Wrap lvm commands in try: except:
Due to the additional of the cinder storage, it's possible that the log_lvm_info() commands gets called really early before lvm has been configured. This wraps the call to pvscan and logs if it doesn't complete -- the command is just to log the state of lvm at that point. Also, defensively wrap the reduce_lvm_volume_group_missing() calls for the same reason. Closes-Bug: #1878227 Change-Id: I217f62d3f620992d1b18475ca5c3031da9428828
This commit is contained in:
parent
5754387fbf
commit
fc8e95f8c7
|
@ -509,8 +509,11 @@ def ensure_lvm_volume_group_non_existent(volume_group):
|
|||
|
||||
def log_lvm_info():
|
||||
"""Log some useful information about how LVM is setup."""
|
||||
pvscan_output = subprocess.check_output(['pvscan']).decode('UTF-8')
|
||||
juju_log('pvscan: %s' % pvscan_output)
|
||||
try:
|
||||
pvscan_output = subprocess.check_output(['pvscan']).decode('UTF-8')
|
||||
juju_log('pvscan: {}'.format(pvscan_output))
|
||||
except subprocess.CalledProcessError:
|
||||
juju_log('pvscan did not complete successfully; may not be setup yet')
|
||||
|
||||
|
||||
def configure_lvm_storage(block_devices, volume_group, overwrite=False,
|
||||
|
@ -570,10 +573,16 @@ def configure_lvm_storage(block_devices, volume_group, overwrite=False,
|
|||
new_devices.remove(new_devices[0])
|
||||
|
||||
# Remove missing physical volumes from volume group
|
||||
if remove_missing_force:
|
||||
reduce_lvm_volume_group_missing(volume_group, extra_args=['--force'])
|
||||
elif remove_missing:
|
||||
reduce_lvm_volume_group_missing(volume_group)
|
||||
try:
|
||||
if remove_missing_force:
|
||||
reduce_lvm_volume_group_missing(volume_group,
|
||||
extra_args=['--force'])
|
||||
elif remove_missing:
|
||||
reduce_lvm_volume_group_missing(volume_group)
|
||||
except subprocess.CalledProcessError as e:
|
||||
juju_log("reduce_lvm_volume_group_missing() didn't complete."
|
||||
" LVM may not be fully configured yet. Error was: '{}'."
|
||||
.format(str(e)))
|
||||
|
||||
if len(new_devices) > 0:
|
||||
# Extend the volume group as required
|
||||
|
|
Loading…
Reference in New Issue