LVM: Activate LV before creating exports
In some circumstances (such as after a reboot), especially with thin LVM, the LV may not be activated, so creating a target from it will fail. Activate the LV before creating a target. When using permanent=True for activation, don't supply the -K/ignoreskipactivation argument. This is rejected by LVM 2.02.171, and is not a reasonable request, since it asks to simultaneously unset a flag, and also to ignore the flag (which should now be unset) during the same activation operation. This fixes a failure to clone a volume from another thin LVM volume in the same pool. Closes-Bug: #1701545 Change-Id: I925ece8833cc99a95c4cf693804ca3698f8cb114
This commit is contained in:
parent
2758720d63
commit
99d79431e3
@ -676,11 +676,12 @@ class LVM(executor.Executor):
|
|||||||
cmd = ['lvchange', '-a', 'y', '--yes']
|
cmd = ['lvchange', '-a', 'y', '--yes']
|
||||||
|
|
||||||
if self.supports_lvchange_ignoreskipactivation:
|
if self.supports_lvchange_ignoreskipactivation:
|
||||||
cmd.append('-K')
|
|
||||||
# If permanent=True is specified, drop the skipactivation flag in
|
# If permanent=True is specified, drop the skipactivation flag in
|
||||||
# order to make this LV automatically activated after next reboot.
|
# order to make this LV automatically activated after next reboot.
|
||||||
if permanent:
|
if permanent:
|
||||||
cmd += ['-k', 'n']
|
cmd += ['-k', 'n']
|
||||||
|
else:
|
||||||
|
cmd.append('-K')
|
||||||
|
|
||||||
cmd.append(lv_path)
|
cmd.append(lv_path)
|
||||||
|
|
||||||
|
@ -790,6 +790,8 @@ class LVMVolumeDriver(driver.VolumeDriver):
|
|||||||
volume_path = "/dev/%s/%s" % (self.configuration.volume_group,
|
volume_path = "/dev/%s/%s" % (self.configuration.volume_group,
|
||||||
volume['name'])
|
volume['name'])
|
||||||
|
|
||||||
|
self.vg.activate_lv(volume['name'])
|
||||||
|
|
||||||
model_update = \
|
model_update = \
|
||||||
self.target_driver.ensure_export(context, volume, volume_path)
|
self.target_driver.ensure_export(context, volume, volume_path)
|
||||||
return model_update
|
return model_update
|
||||||
@ -800,6 +802,8 @@ class LVMVolumeDriver(driver.VolumeDriver):
|
|||||||
|
|
||||||
volume_path = "/dev/%s/%s" % (vg, volume['name'])
|
volume_path = "/dev/%s/%s" % (vg, volume['name'])
|
||||||
|
|
||||||
|
self.vg.activate_lv(volume['name'])
|
||||||
|
|
||||||
export_info = self.target_driver.create_export(
|
export_info = self.target_driver.create_export(
|
||||||
context,
|
context,
|
||||||
volume,
|
volume,
|
||||||
|
Loading…
Reference in New Issue
Block a user