Bug 923169

Summary: [RHEVM-RHS] Add brick operation fails from rhevm-shell
Product: Red Hat Enterprise Virtualization Manager Reporter: Shruti Sampat <ssampat>
Component: ovirt-engine-restapiAssignee: Ravi Nori <rnori>
Status: CLOSED CURRENTRELEASE QA Contact: Anush Shetty <ashetty>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.2.0CC: acathrow, ashetty, dtsang, dyasny, iheim, knarra, lpeer, mmahoney, mpastern, oramraz, pprakash, Rhev-m-bugs, sabose, scohen, sdharane, shireesh, yeylon, ykaul
Target Milestone: ---   
Target Release: 3.2.0   
Hardware: All   
OS: All   
Whiteboard: gluster
Fixed In Version: sf16 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Gluster RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 948448    
Attachments:
Description Flags
engine logs none

Description Shruti Sampat 2013-03-19 10:49:23 UTC
Created attachment 712558 [details]
engine logs

Description of problem:
---------------------------------------
The following add-brick operation failed from the rhevm-shell - 

[RHEVM shell (connected)]# add brick --cluster-identifier gluster --glustervolume-identifier vol1 --brick-brick "brick.server_id=e54b7b16-92d2-4439-9312-74f1d435bd2f,brick.brick_dir=/tmp/brick5"

error: 
status: 400
reason: Bad Request
detail: volume add brick failed
error: found duplicate exports 10.70.35.156:/tmp/brick5
usage: volume add-brick <volname> [<stripe|replica> <count>] <new-brick> ...
return code: 255

Adding the same brick to the volume succeeded from the Console.

Version-Release number of selected component (if applicable):
rhevm-cli-3.2.0.5-1.el6ev.noarch

How reproducible:
Always

Steps to Reproduce:
1. Try to add a brick to a gluster volume from rhevm-shell as described in the command above.
  
Actual results:
Add brick fails but the same action succeeds from the Console.

Expected results:
Action should succeed from rhevm-shell.

Additional info:
Attached engine logs.

Comment 2 Michael Pasternak 2013-03-24 10:21:02 UTC
AFAICS this is not related to the cli, but to your core gluster impl.

Comment 3 Sahina Bose 2013-04-02 07:38:44 UTC
Michael, 

When add brick command is invoked with parameter --brick-brick "brick.server_id=e54b7b16-92d2-4439-9312-4f1d435bd2f,brick.brick_dir=/tmp/brick5"

the BackendGlusterBricksResource.add method receives a collection of GlusterBricks with size 2 instead of 1. The GlusterBrick entities have duplicate values for server_id and brick_dir. 

Any idea why?

Comment 4 Michael Pasternak 2013-04-02 08:17:24 UTC
(In reply to comment #3)
> Michael, 
> 
> When add brick command is invoked with parameter --brick-brick
> "brick.server_id=e54b7b16-92d2-4439-9312-4f1d435bd2f,brick.brick_dir=/tmp/
> brick5"
> 
> the BackendGlusterBricksResource.add method receives a collection of
> GlusterBricks with size 2 instead of 1. The GlusterBrick entities have
> duplicate values for server_id and brick_dir. 
> 
> Any idea why?

it may be related to the bug 921464 (producing collections), please recheck
against rhevm-cli 3.2.0.6

Comment 5 Sahina Bose 2013-04-02 08:40:32 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > Michael, 
> > 
> > When add brick command is invoked with parameter --brick-brick
> > "brick.server_id=e54b7b16-92d2-4439-9312-4f1d435bd2f,brick.brick_dir=/tmp/
> > brick5"
> > 
> > the BackendGlusterBricksResource.add method receives a collection of
> > GlusterBricks with size 2 instead of 1. The GlusterBrick entities have
> > duplicate values for server_id and brick_dir. 
> > 
> > Any idea why?
> 
> it may be related to the bug 921464 (producing collections), please recheck
> against rhevm-cli 3.2.0.6

Nope, I have the patches referred to in the bug and still face the issue. (I'm checking with ovirt master upstream)

In debug mode:
add brick --cluster-identifier "GlustCluster" --glustervolume-identifier "testv" --bricks-brick "brick.server_id=fcf6dcf4-51de-458d-b071-7634dbc5803c,brick.brick_dir=/tmp/br3"

translates to:
POST /api/clusters/6751c6a3-a1bd-4e26-a46f-7f16afe9e66e/glustervolumes/cc8c6355-f60f-4796-86ab-6f426f50bcda/bricks HTTP/1.1\r\nHost: localhost:8700\r\nAccept-Encoding: identity\r\nContent-Length: 285\r\nPrefer: persistent-auth\r\nAccept: application/xml\r\nFilter: False\r\ncookie: JSESSIONID=P2LYKcWKgF7HeuZ5M7r1-+2q.undefined\r\nContent-type: application/xml\r\n\r\n
<bricks>\n    <brick>\n        <server_id>fcf6dcf4-51de-458d-b071-7634dbc5803c</server_id>\n        <brick_dir>/tmp/br3</brick_dir>\n    </brick>\n    <brick>\n        <server_id>fcf6dcf4-51de-458d-b071-7634dbc5803c</server_id>\n        <brick_dir>/tmp/br3</brick_dir>\n    </brick>\n</bricks>\n'

Duplicate bricks are being passed to REST API from CLI

Comment 6 Michael Pasternak 2013-04-02 09:37:46 UTC
after rebasing after bug 921464 fix, running 'add' causes:

error: "bricks" is invalid argument segment.

(ravi, this is sounds like a regression)

Comment 8 Michael Pasternak 2013-04-21 15:48:04 UTC
the cause for the mentioned bug is inconsistent implementation of POST
operation for .../bricks => add(*bricks*) and incorrect descriptor in RSDL
(which was implemented as a standard add(*brick*) descriptor), according to the
current implementation, RSDL descriptor for this op. should look like [1],

another issue i see is lack of standard add(brick) signature what is breaks
RESTful nature of api,

[1] because add(*bricks*) already has external *bricks* container defined,
brick arguments should be described without specifying FQ path (prefix) to
the brick element (as it would be if it was nested type collection item)

- mandatoryArguments:
    brick--COLLECTION: {brick.server_id: 'xs:string', brick.brick_dir: 'xs:string'}
  optionalArguments:
    brick--COLLECTION: {brick.replica_count: 'xs:unsignedShort', brick.stripe_count: 'xs:unsignedShort'}

Comment 9 Michael Pasternak 2013-05-02 08:43:41 UTC
not sure why this bug was moved to QA, it's still lacking part of the fix:

http://gerrit.ovirt.org/#/c/13756/

Comment 10 Sahina Bose 2013-05-06 07:07:10 UTC
Assigning to Ravi Nori as there's a fix in CLI required.

Comment 11 Sahina Bose 2013-05-15 10:21:28 UTC
Add brick syntax example:
add brick --cluster-identifier "GlusterC" --glustervolume-identifier "Repl" --brick "brick.server_id=c46e99c3-f83a-4031-9f18-f8ef459aae92,brick.brick_dir=/tmp/rpl11" --brick "brick.server_id=c46e99c3-f83a-4031-9f18-f8ef459aae92,brick.brick_dir=/tmp/rpl12" --replica_count 2

Comment 12 Anush Shetty 2013-05-24 13:07:05 UTC
Verified with rhevm-cli-3.2.0.9-1.el6ev.noarch

Comment 13 Itamar Heim 2013-06-11 09:48:37 UTC
3.2 has been released

Comment 14 Itamar Heim 2013-06-11 09:48:48 UTC
3.2 has been released

Comment 15 Itamar Heim 2013-06-11 09:57:21 UTC
3.2 has been released