Bug 1406403 - vgcreate should fail if there is an exisitng vg with the same name.
Summary: vgcreate should fail if there is an exisitng vg with the same name.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Gluster Storage
Classification: Red Hat Storage
Component: gdeploy
Version: rhgs-3.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: RHGS 3.3.0
Assignee: Sachidananda Urs
QA Contact: RamaKasturi
URL:
Whiteboard:
Depends On:
Blocks: 1417147
TreeView+ depends on / blocked
 
Reported: 2016-12-20 12:58 UTC by RamaKasturi
Modified: 2017-09-21 04:49 UTC (History)
8 users (show)

Fixed In Version: gdeploy-2.0.1-2
Doc Type: Bug Fix
Doc Text:
Cause: If there exists a VG and if user tries to create another VG with the same name, gdeploy would extend it instead of failing. Consequence: vgcreate would never fail upon trying to create new VG with a name that was already used in another VG. Instead volume group would be extended. Workaround (if any): User has to ensure that a new VG name is used. Result:
Clone Of:
Environment:
Last Closed: 2017-09-21 04:49:50 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:2777 0 normal SHIPPED_LIVE gdeploy bug fix and enhancement update for RHEL7 2017-09-21 08:23:08 UTC

Description RamaKasturi 2016-12-20 12:58:19 UTC
Description of problem:
With the current gdeploy i see that if there is already an existing vg, vgcreate does not fail,instead it just extends the vg.

Version-Release number of selected component (if applicable):
gdeploy-2.0.1-7.el7rhgs.noarch

How reproducible:
Always

Steps to Reproduce:
1. Create a vg with name RHGS_vg1 by running the command 'vgcreate RHGS_vg1 /dev/vdb'
2. In the vg section of hc.conf file give a different disk name i.e /dev/vdc
3. Now run hc.conf file by running the command 'gdeploy -c hc.conf'

Actual results:
I see that vgcreate does not fail instead the vg gets extended with the new disk given.

Expected results:
vgcreate should fail with error 'vg already exists'

Additional info:

Comment 2 RamaKasturi 2016-12-20 13:22:40 UTC
Following is the code where the bug exists "/usr/lib/python2.7/site-packages/ansible/modules/extras/system/glusterfs/vg.py"

def vg_presence_check(self, vg):
        rc, out, err = self.run_command('vgdisplay', ' ' + vg)
        ret = 0
        if self.action == 'create' and not rc:
            self.action = 'extend'
            self.op = 'vgextend'
            return
        elif self.action == 'extend' and rc:
            self.action = 'create'
            self.op = 'vgcreate'
            return
        elif self.action == 'remove' and rc:
            self.module.exit_json(changed=changed, rc=1, msg="%s Volume Group Doesn't Exists!" % disk)
        else:
            ret = 1
        return ret

Comment 3 Sahina Bose 2016-12-21 07:01:59 UTC
Is there an option in vg section to indicate if user wants to extend or create?

Comment 4 Sachidananda Urs 2016-12-21 07:04:31 UTC
Yes.

[vg]
action=extend

Comment 7 Sachidananda Urs 2017-01-06 07:03:13 UTC
Commit: https://github.com/gluster/gdeploy/commit/c7c81fe fixes the issue.

Comment 9 RamaKasturi 2017-05-22 10:52:02 UTC
Verified and works fine with build gdeploy-2.0.2-10.el7rhgs.noarch.

vgcreate fails with the error, "failed: [host_name] (item={u'brick': u'/dev/sdd', u'vg': u'RHGS_vg1'}) => {"changed": false, "failed": true, "item": {"brick": "/dev/sdd", "vg": "RHGS_vg1"}, "msg": "A volume group called RHGS_vg1 already exists", "rc": 1}"

Comment 11 errata-xmlrpc 2017-09-21 04:49:50 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.

https://access.redhat.com/errata/RHBA-2017:2777


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