Bug 1018904 - call to ClusterGlusterVolumeBricks::add() successfully adds brick to volume but throws exception
call to ClusterGlusterVolumeBricks::add() successfully adds brick to volume b...
Product: Red Hat Gluster Storage
Classification: Red Hat
Component: rhsc-sdk (Show other bugs)
Unspecified Unspecified
medium Severity high
: ---
: RHGS 2.1.2
Assigned To: Darshan
Dustin Tsang
: ZStream
Depends On:
  Show dependency treegraph
Reported: 2013-10-14 12:30 EDT by Dustin Tsang
Modified: 2015-07-13 00:39 EDT (History)
10 users (show)

See Also:
Fixed In Version: cb11
Doc Type: Bug Fix
Doc Text:
Previously, adding bricks was successful, but an error message was displayed. Now, the error message is not displayed.
Story Points: ---
Clone Of:
Last Closed: 2014-02-25 02:51:23 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
oVirt gerrit 21941 None None None Never

  None (edit)
Description Dustin Tsang 2013-10-14 12:30:33 EDT
Description of problem:
python call to add() successfully adds a brick to volume for ClusterGlusterVolumeBricks broker but throws an exception.

Root Cause: at line 604, where assignment of result to self.__getProxy().add() occurs, self.__getProxy().add() returns empty string. 

  File "/usr/lib/python2.6/site-packages/ovirtsdk/infrastructure/brokers.py", line 618, in add
  File "/usr/lib/python2.6/site-packages/ovirtsdk/infrastructure/brokers.py", line 373, in __init__
    Base.__init__(self, context)
  File "/usr/lib/python2.6/site-packages/ovirtsdk/infrastructure/common.py", line 24, in __init__
    self.__context = context
  File "/usr/lib/python2.6/site-packages/ovirtsdk/xml/params.py", line 303, in __setattr__
    object.__setattr__(self.superclass, item, value)
AttributeError: 'str' object has no attribute '_Base__context'

Version-Release number of selected component (if applicable):

How reproducible:
100% of the time

Steps to Reproduce:
1. create a distributed volume
2. <volume param instance>.bricks.add(<bricks>)

Actual results:

brick successfully added but throws an exception AttributeError: 'str' object has no attribute '_Base__context'

Expected results:
exception is not thrown and ClusterGlusterVolumeBrick broker is returned.

Additional info:
Comment 3 Aravinda VK 2013-11-08 03:29:38 EST
Please share the snippet used to add brick.

Here is the working example

# ----------------------------------------------------------------------------
from ovirtsdk.api import API
from ovirtsdk.xml import params

VOLNAME = "vol1"

api = API(url=ENGINE, username=USERNAME, password=PASSWORD, insecure=INSECURE)

def get_serverid(hosts, ip):
    for host in hosts:
        if ip == host.get_address():
            return host.get_id()
    # No matching Server found

server_id = get_serverid(api.hosts.list(), BRICK_SERVER)
volume = api.clusters.get(CLUSTER_NAME).glustervolumes.get(VOLNAME)

# List bricks
for brick in volume.bricks.list():
    print brick.get_name()

# Add a Brick
brick = params.GlusterBrick(brick_dir=BRICK_DIR, server_id=server_id)
brick_params = params.GlusterBricks()


# List bricks again
for brick in volume.bricks.list():
    print brick.get_name()
# ----------------------------------------------------------------------------
Comment 5 Dustin Tsang 2013-12-13 15:15:50 EST
verified fix in rhsc-cb11
Comment 6 Shalaka 2014-01-22 01:11:38 EST
Please review the edited DocText and signoff.
Comment 7 Darshan 2014-01-22 01:45:52 EST
This issue was seen when bricks was added using python-sdk. So you can modify the Doc_text as follows:

Previously, adding bricks using python-sdk was successful, but an error message was displayed. Now, the error message is not displayed.
Comment 9 errata-xmlrpc 2014-02-25 02:51:23 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.