Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need these LVM commands: #16

Open
21 of 23 tasks
jonludlam opened this issue Mar 3, 2015 · 5 comments
Open
21 of 23 tasks

Need these LVM commands: #16

jonludlam opened this issue Mar 3, 2015 · 5 comments

Comments

@jonludlam
Copy link
Collaborator

  • lvchange /dev/vg/lvname -p {r/rw}
  • lvchange --addtag | --deltag 'hidden'
  • lvchange --refresh
  • lvcreate -n [-l <size_in_percentage> | -L <size_in_mb>] vgname --addtag
  • lvdisplay <vg/lv> or </dev/vg/lv> or </dev/mapper/vg--lv> etc, output ignored
  • lvdisplay -c - comma separated, used to get size (7th field, in sectors)
  • lvremove -f --config devices{<devices?>}
  • lvrename vg/lvname newname
  • lvresize -L newsize /dev/vg/lvname
  • lvs --noheadings /dev/vg/lvname (output ignored)
  • lvs --noheadings --units b -o +lv_tags -- eg:
    test-lv-999 vg -wi-a---- 4194304B foo,bar,bzqa
  • pvcreate -ff -y --metadatasize 10M /dev/path
  • pvremove device
  • pvresize device
  • pvs --noheadings --nosuffix --units b - use size (field 5) and free space (field 6)
  • pvs --noheadings -o vg_name <pv name?>
  • pvs
  • vgchange -a[n|y] vgname
  • vgcreate vgname /root/device
  • vgextend vgname /dev/path
  • vgremove vgname
  • vgs (output ignored)
  • vgs --noheadings --nosuffix --units b - use size (field 6) and free space (field 7)
@jonludlam
Copy link
Collaborator Author

The following are important:

  2 /sbin/lvchange -an /dev/VGNAME/LVNAME
 10 /sbin/lvchange -an /dev/VGNAME/LVNAME
  1 /sbin/lvchange -ay /dev/VGNAME/LVNAME
  1 /sbin/lvchange /dev/VGNAME/LVNAME -p r
  1 /sbin/lvcreate -n LVNAME -L 4 VGNAME --addtag journaler
  3 /sbin/lvcreate -n LVNAME -L 108 VGNAME
  1 /sbin/lvremove -f /dev/VGNAME/LVNAME
  1 /sbin/lvrename /dev/VGNAME/LVNAME NEWLVNAME
  1 /sbin/lvresize -L 8 /dev/VGNAME/LVNAME
 21 /sbin/lvs --noheadings --units b -o +lv_tags /dev/VGNAME
  1 /sbin/pvcreate -ff -y --metadatasize 10M /dev/sda3
  1 /sbin/vgchange -an VGNAME
  1 /sbin/vgcreate VGNAME /dev/sda3
 12 /sbin/vgs --noheadings --nosuffix --units b VGNAME
 19 /sbin/vgs VGNAME

@djs55
Copy link
Collaborator

djs55 commented Mar 18, 2015

Should lvchange be idempotent? I'm seeing a failure where lvcreate activates the device mapper (should it?) and then lvchange fails:

Mar 18 10:04:48 localhost SM: [11423] ['/sbin/xenvm', 'lvcreate', '-n', 'MGT', '-L', '4', 'VG_XenStorage-33c847a3-3f32-29d0-c161-4d0a2544e69b']
Mar 18 10:04:48 localhost SM: [11423]   pread SUCCESS
Mar 18 10:04:48 localhost SM: [11423] ['/sbin/xenvm', 'lvchange', '-ay', '/dev/VG_XenStorage-33c847a3-3f32-29d0-c161-4d0a2544e69b/MGT']
Mar 18 10:04:48 localhost SM: [11423] FAILED in util.pread: (rc 1) stdout: '', stderr: 'device-mapper: create ioctl on VG_XenStorage--33c847a3--3f32--29d0--c161--4d0a2544e69b-MGT failed: Device or resource busy
Mar 18 10:04:48 localhost SM: [11423] xenvm: internal error, uncaught exception:
Mar 18 10:04:48 localhost SM: [11423]        Failure("dm_task_run failed")
Mar 18 10:04:48 localhost SM: [11423]
Mar 18 10:04:48 localhost SM: [11423] '
Mar 18 10:04:48 localhost SM: [11423] Raising exception [181, Error in Metadata volume operation for SR. [opterr=Error introducing Metadata Volume: Operation not permitted]]

@chandrikas
Copy link

Need xenvm pvs. Encountered following error while trying to delete local SR.

Apr 28 14:32:21 localhost SM: [19392] LVMCache: refreshing
Apr 28 14:32:21 localhost SM: [19392] ['/bin/xenvm', 'lvs', '--noheadings', '--units', 'b', '-o', '+lv_tags', '/dev/VG_Xen
Storage-90982251-79e0-8176-010f-ff65bb4c0f1d']
Apr 28 14:32:21 localhost SM: [19392]   pread SUCCESS
Apr 28 14:32:21 localhost SM: [19392] ['/bin/xenvm', 'pvs', '/dev/disk/by-id/ata-WDC_WD2502ABYS-18B7A0_WD-WCAT18036412-par
t3']
Apr 28 14:32:21 localhost SM: [19392] FAILED in util.pread: (rc 1) stdout: '', stderr: 'xenvm: unknown command `pvs'
Apr 28 14:32:21 localhost SM: [19392] Usage: xenvm COMMAND ...
Apr 28 14:32:21 localhost SM: [19392] Try `xenvm --help' for more information.
Apr 28 14:32:21 localhost SM: [19392] '
Apr 28 14:32:22 localhost SM: [19392] Raising exception [93, pvs failed [opterr=error is 1]]
Apr 28 14:32:22 localhost SM: [19392] lock: released /var/lock/sm/90982251-79e0-8176-010f-ff65bb4c0f1d/sr
Apr 28 14:32:22 localhost SM: [19392] ***** generic exception: sr_delete: EXCEPTION <class 'SR.SROSError'>, pvs failed [op
terr=error is 1]
Apr 28 14:32:22 localhost SM: [19392]   File "/opt/xensource/sm/SRCommand.py", line 110, in run
Apr 28 14:32:22 localhost SM: [19392]     return self._run_locked(sr)
Apr 28 14:32:22 localhost SM: [19392]   File "/opt/xensource/sm/SRCommand.py", line 159, in _run_locked
Apr 28 14:32:22 localhost SM: [19392]     rv = self._run(sr, target)
Apr 28 14:32:22 localhost SM: [19392]   File "/opt/xensource/sm/SRCommand.py", line 299, in _run
Apr 28 14:32:22 localhost SM: [19392]     return sr.delete(self.params['sr_uuid'])
Apr 28 14:32:22 localhost SM: [19392]   File "/opt/xensource/sm/LVMSR", line 575, in delete
Apr 28 14:32:22 localhost SM: [19392]     lvutil.removeVG(self.root, self.vgname)
Apr 28 14:32:22 localhost SM: [19392]   File "/opt/xensource/sm/lvutil.py", line 429, in removeVG
Apr 28 14:32:22 localhost SM: [19392]     opterr='error is %d' % inst.code)
Apr 28 14:32:22 localhost SM: [19392]   File "/opt/xensource/sm/xs_errors.py", line 52, in __init__
Apr 28 14:32:22 localhost SM: [19392]     raise SR.SROSError(errorcode, errormessage)
Apr 28 14:32:22 localhost SM: [19392]
Apr 28 14:32:22 localhost SM: [19392] ***** Local VHD on LVM: EXCEPTION <class 'SR.SROSError'>, pvs failed [opterr=error i
s 1]

Also need xenvm vgremove - please :-)

@djs55
Copy link
Collaborator

djs55 commented Apr 28, 2015

I'll see if I can make a quick 'pvs'...

@djs55 djs55 mentioned this issue Apr 28, 2015
@djs55
Copy link
Collaborator

djs55 commented Apr 28, 2015

I've implemented a basic 'pvs', 'pvremove' and 'vgremove'. I'm hoping that'll be enough to satisfy SR.destroy. I've also fixed a bug where we were generating duplicate LV ids which was causing chaos :)

@djs55 djs55 mentioned this issue May 11, 2015
23 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants