Stop update of volume metadata gracefully if 'os' volume is not on LVM

To upgrade an OpenStack cluster node with preserved partitions and data
from version 6.0 to version 8.0, changes in disk metadata required. These
changes accommodate the metadata to change of provisioning method from
'cobbler' to 'image'.

To avoid failure if the metadata was already altered by the previous
execution of upgrade-node command, the script update_node_partition_data.py
should stop gracefully if no relevant partitions were found.

Change-Id: I7a110423312d1cd4d5101e7ce048847092d8578f
Closes-bug: 1578639
(cherry picked from commit 685241e4b7)
This commit is contained in:
Oleg Gelbukh 2016-05-05 13:13:51 +00:00
parent 53e2fa6e99
commit b1ca1e699f
1 changed files with 5 additions and 1 deletions

View File

@ -24,7 +24,11 @@ if not nv:
volumes = nv.volumes
os_vg = next(disk for disk in volumes if 'id' in disk and disk['id'] == 'os')
try:
os_vg = next(
disk for disk in volumes if 'id' in disk and disk['id'] == 'os')
except StopIteration:
sys.exit(0)
volumes = [disk for disk in volumes if 'id' not in disk or disk['id'] != 'os']
for disk in volumes: