Bug 1044238

Summary: rest api: unable to create a volume with a brick in the root partion while passing force true
Product: Red Hat Gluster Storage Reporter: Dustin Tsang <dtsang>
Component: rhsc-sdkAssignee: Shubhendu Tripathi <shtripat>
Status: CLOSED NOTABUG QA Contact: Dustin Tsang <dtsang>
Severity: high Docs Contact:
Priority: unspecified    
Version: 2.1CC: grajaiya, mmccune, rhs-bugs
Target Milestone: ---Keywords: ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-12-18 00:24:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Dustin Tsang 2013-12-18 00:13:53 UTC
Description of problem:

Creating a volume with the brick dir /tmp/foo and the force:true matrix parameter yields a response with the following error:

"it is recommended    that you don't use the system's root partition for storage backend. or use 'force' at the  end of the command if you want to override this behavior."

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

How reproducible:
every time

Steps to Reproduce:
1. via rest api create a dist volume of 1 brick where the brick is dir is set to /tmp/foo with the force parameter set to true


--- example request ------
POST /api/clusters/ca58ed64-b1cc-4a85-94c4-a08eabc398ba/glustervolumes;force:true HTTP/1.1
Content-Type: application/xml
Accept: application/xml
Content-Length: 631
Host: latest2.rhsc:443
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.3 (java 1.5)
Authorization: Basic YWRtaW5AaW50ZXJuYWw6cmVkaGF0
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>[\n]"
<gluster_volume>
    <cluster id="ca58ed64-b1cc-4a85-94c4-a08eabc398ba">
        <virt_service>false</virt_service>
        <gluster_service>true</gluster_service>
    </cluster>
    <name>VolumeCreateWithForceCreateBrickDirectoriesTest</name>
    <volume_type>distribute</volume_type>
    <stripe_count>0</stripe_count>
    <replica_count>0</replica_count>
    <bricks>
        <brick>
            <server_id>52caef6c-598f-477f-917c-56fcc5548a16</server_id>
            <brick_dir>/tmp/20131217164408981927299489</brick_dir>
        </brick>
    </bricks>
</gluster_volume>
"HTTP/1.1 400 Bad Request[\r][\n]"
"Date: Tue, 17 Dec 2013 21:52:31 GMT[\r][\n]"
"Content-Type: application/xml[\r][\n]"
"Content-Length: 478[\r][\n]"
"Vary: Accept-Encoding[\r][\n]"
"Connection: close[\r][\n]"
"[\r][\n]"
-----------------------------



Actual results:

2013-12-17 16:45:24,293 [main] DEBUG org.apache.http.impl.conn.DefaultClientConnection  -  Receiving response: HTTP/1.1 400 Bad Request
HTTP/1.1 400 Bad Request
Date: Tue, 17 Dec 2013 21:52:31 GMT
Content-Type: application/xml
Content-Length: 478
Vary: Accept-Encoding
Connection: close
"<?xml version="1.0" encoding="UTF-8" standalone="yes"?>[\n]"
"<fault>[\n]"
"    <reason>Operation Failed</reason>[\n]"
"    <detail>[volume create failed[\n]"
"error: staging failed on 10.14.16.203. error: the brick latest-c:/tmp/                    20131217164408981927299489 is is being created in the root partition. it is recommended    that you don't use the system's root partition for storage backend. or use 'force' at the  end of the command if you want to override this behavior.[\n]"
"return code: 115]</detail>[\n]"
"</fault>[\n]"


Expected results:

volume creation succeeds 


Additional info: