Merge "Ansible module: fix configdrive partition creation step"
This commit is contained in:
commit
be32b18c29
@ -60,23 +60,15 @@ if [ -z $EXISTING_PARTITION ]; then
|
|||||||
log "Fixing GPT to use all of the space on device $DEVICE"
|
log "Fixing GPT to use all of the space on device $DEVICE"
|
||||||
sgdisk -e $DEVICE || fail "move backup GPT data structures to the end of ${DEVICE}"
|
sgdisk -e $DEVICE || fail "move backup GPT data structures to the end of ${DEVICE}"
|
||||||
|
|
||||||
# Need to create new partition for config drive
|
# Create small partition at the end of the device and label it to make
|
||||||
# Not all images have partion numbers in a sequential numbers. There are holes.
|
# identification below easier.
|
||||||
# These holes get filled up when a new partition is created.
|
|
||||||
TEMP_DIR="$(mktemp -d)"
|
|
||||||
EXISTING_PARTITION_LIST=$TEMP_DIR/existing_partitions
|
|
||||||
UPDATED_PARTITION_LIST=$TEMP_DIR/updated_partitions
|
|
||||||
|
|
||||||
gdisk -l $DEVICE | grep -A$MAX_DISK_PARTITIONS "Number Start" | grep -v "Number Start" > $EXISTING_PARTITION_LIST
|
|
||||||
|
|
||||||
# Create small partition at the end of the device
|
|
||||||
log "Adding configdrive partition to $DEVICE"
|
log "Adding configdrive partition to $DEVICE"
|
||||||
sgdisk -n 0:-64MB:0 $DEVICE || fail "creating configdrive on ${DEVICE}"
|
# Get a one shot partlabel, with a pseudo-random 5 chars chunk to avoid
|
||||||
|
# any conflict with any other pre-existing partlabel
|
||||||
gdisk -l $DEVICE | grep -A$MAX_DISK_PARTITIONS "Number Start" | grep -v "Number Start" > $UPDATED_PARTITION_LIST
|
PARTLABEL=config-$(< /dev/urandom tr -dc a-z0-9 | head -c 5)
|
||||||
|
sgdisk -n 0:-64MB:0 -c 0:$PARTLABEL $DEVICE || fail "creating configdrive on ${DEVICE}"
|
||||||
CONFIG_PARTITION_ID=`diff $EXISTING_PARTITION_LIST $UPDATED_PARTITION_LIST | tail -n1 |awk '{print $2}'`
|
partprobe
|
||||||
ISO_PARTITION="${DEVICE}${CONFIG_PARTITION_ID}"
|
ISO_PARTITION=/dev/disk/by-partlabel/$PARTLABEL
|
||||||
else
|
else
|
||||||
log "Working on MBR only device $DEVICE"
|
log "Working on MBR only device $DEVICE"
|
||||||
|
|
||||||
|
8
releasenotes/notes/bug-2005764-15f45e11b9f9c96d.yaml
Normal file
8
releasenotes/notes/bug-2005764-15f45e11b9f9c96d.yaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Fixes a deployment issue encountered during deployment, more precisely
|
||||||
|
during the configdrive partition creation step. On some specific devices
|
||||||
|
like NVMe drives, the created configdrive partition could not be correctly
|
||||||
|
identified (required to dump data onto it afterward).
|
||||||
|
https://storyboard.openstack.org/#!/story/2005764
|
Loading…
Reference in New Issue
Block a user