Bug 1018904 - call to ClusterGlusterVolumeBricks::add() successfully adds brick to volume but throws exception
Summary: call to ClusterGlusterVolumeBricks::add() successfully adds brick to volume b...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Gluster Storage
Classification: Red Hat Storage
Component: rhsc-sdk
Version: 2.1
Hardware: Unspecified
OS: Unspecified
medium
high
Target Milestone: ---
: RHGS 2.1.2
Assignee: Darshan
QA Contact: Dustin Tsang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-10-14 16:30 UTC by Dustin Tsang
Modified: 2015-07-13 04:39 UTC (History)
10 users (show)

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.
Clone Of:
Environment:
Last Closed: 2014-02-25 07:51:23 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2014:0208 0 normal SHIPPED_LIVE Red Hat Storage 2.1 enhancement and bug fix update #2 2014-02-25 12:20:30 UTC
oVirt gerrit 21941 0 None None None Never

Description Dustin Tsang 2013-10-14 16:30:33 UTC
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. 


<TRACE>
  File "/usr/lib/python2.6/site-packages/ovirtsdk/infrastructure/brokers.py", line 618, in add
    self.context
  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'
</TRACE>



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

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 08:29:38 UTC
Please share the snippet used to add brick.

Here is the working example

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

ENGINE="https://10.70.42.247/api"
USERNAME="admin@internal"
PASSWORD=<password>
INSECURE=True
CLUSTER_NAME="Default"
VOLNAME = "vol1"
BRICK_DIR="/export/vol1-h"
BRICK_SERVER="10.70.42.165"

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
    raise

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()
brick_params.add_brick(brick)

volume.bricks.add(brick_params)

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

Comment 5 Dustin Tsang 2013-12-13 20:15:50 UTC
verified fix in rhsc-cb11

Comment 6 Shalaka 2014-01-22 06:11:38 UTC
Please review the edited DocText and signoff.

Comment 7 Darshan 2014-01-22 06:45:52 UTC
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 07:51:23 UTC
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.

http://rhn.redhat.com/errata/RHEA-2014-0208.html


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