Browse Source

Merge "Ansible module: fix configdrive partition creation step" into stable/queens

changes/48/673448/1
Zuul 2 months ago
parent
commit
f517295092

+ 8
- 16
ironic/drivers/modules/ansible/playbooks/roles/deploy/files/partition_configdrive.sh View File

@@ -60,23 +60,15 @@ if [ -z $EXISTING_PARTITION ]; then
60 60
         log "Fixing GPT to use all of the space on device $DEVICE"
61 61
         sgdisk -e $DEVICE || fail "move backup GPT data structures to the end of ${DEVICE}"
62 62
 
63
-        # Need to create new partition for config drive
64
-        # Not all images have partion numbers in a sequential numbers. There are holes.
65
-        # These holes get filled up when a new partition is created.
66
-        TEMP_DIR="$(mktemp -d)"
67
-        EXISTING_PARTITION_LIST=$TEMP_DIR/existing_partitions
68
-        UPDATED_PARTITION_LIST=$TEMP_DIR/updated_partitions
69
-
70
-        gdisk -l $DEVICE | grep -A$MAX_DISK_PARTITIONS "Number  Start" | grep -v "Number  Start" > $EXISTING_PARTITION_LIST
71
-
72
-        # Create small partition at the end of the device
63
+        # Create small partition at the end of the device and label it to make
64
+        # identification below easier.
73 65
         log "Adding configdrive partition to $DEVICE"
74
-        sgdisk -n 0:-64MB:0 $DEVICE || fail "creating configdrive on ${DEVICE}"
75
-
76
-        gdisk -l $DEVICE | grep -A$MAX_DISK_PARTITIONS "Number  Start" | grep -v "Number  Start" > $UPDATED_PARTITION_LIST
77
-
78
-        CONFIG_PARTITION_ID=`diff $EXISTING_PARTITION_LIST $UPDATED_PARTITION_LIST | tail -n1 |awk '{print $2}'`
79
-        ISO_PARTITION="${DEVICE}${CONFIG_PARTITION_ID}"
66
+        # Get a one shot partlabel, with a pseudo-random 5 chars chunk to avoid
67
+        # any conflict with any other pre-existing partlabel
68
+        PARTLABEL=config-$(< /dev/urandom tr -dc a-z0-9 | head -c 5)
69
+        sgdisk -n 0:-64MB:0 -c 0:$PARTLABEL $DEVICE || fail "creating configdrive on ${DEVICE}"
70
+        partprobe
71
+        ISO_PARTITION=/dev/disk/by-partlabel/$PARTLABEL
80 72
     else
81 73
         log "Working on MBR only device $DEVICE"
82 74
 

+ 8
- 0
releasenotes/notes/bug-2005764-15f45e11b9f9c96d.yaml View File

@@ -0,0 +1,8 @@
1
+---
2
+fixes:
3
+  - |
4
+    Fixes a deployment issue encountered during deployment, more precisely
5
+    during the configdrive partition creation step. On some specific devices
6
+    like NVMe drives, the created configdrive partition could not be correctly
7
+    identified (required to dump data onto it afterward).
8
+    https://storyboard.openstack.org/#!/story/2005764

Loading…
Cancel
Save