summaryrefslogtreecommitdiff
path: root/ironic_python_agent/shell
diff options
context:
space:
mode:
authorJim Rollenhagen <jim@jimrollenhagen.com>2014-04-10 11:16:05 -0700
committerJim Rollenhagen <jim@jimrollenhagen.com>2014-04-24 13:00:24 -0700
commit620f05eb33bc2cca08124a084354fa1f41bcd30e (patch)
tree6c7f3811eaf831bbc972e72fd259f3dee7317dbb /ironic_python_agent/shell
parentab46681e33506bd2214a7c520ce945134d4c5c7c (diff)
downloadironic-python-agent-620f05eb33bc2cca08124a084354fa1f41bcd30e.tar.gz
Accept new parameters for `prepare_image`
The parameters sent to `prepare_image` changed in https://review.openstack.org/#/c/86490/ This patch brings `prepare_image` up to date with that change. It also changes the way configdrive is written to disk, to match that Ironic is now allowing Nova to build an ISO partition and send the raw image to the agent. This patch also swaps out subprocess.call for processutils.execute in the standby module, since the commands were being changed anyway. Lastly, this patch changes the expected `hashes` dict to be a string parameter called `checksum`, to match what glance returns. Change-Id: Id8af9be920ba51e7e1ce60f4ffd1477e413582c9
Diffstat (limited to 'ironic_python_agent/shell')
-rwxr-xr-xironic_python_agent/shell/copy_configdrive_to_disk.sh25
1 files changed, 7 insertions, 18 deletions
diff --git a/ironic_python_agent/shell/copy_configdrive_to_disk.sh b/ironic_python_agent/shell/copy_configdrive_to_disk.sh
index e3f08d40..768a37da 100755
--- a/ironic_python_agent/shell/copy_configdrive_to_disk.sh
+++ b/ironic_python_agent/shell/copy_configdrive_to_disk.sh
@@ -22,39 +22,28 @@ log() {
usage() {
[[ -z "$1" ]] || echo -e "USAGE ERROR: $@\n"
- echo "`basename $0`: CONFIGDRIVE_DIR DEVICE"
- echo " - This script injects CONFIGDRIVE_DIR contents as an iso9660"
+ echo "`basename $0`: CONFIGDRIVE DEVICE"
+ echo " - This script injects CONFIGDRIVE contents as an iso9660"
echo " filesystem on a partition at the end of DEVICE."
exit 1
}
-CONFIGDRIVE_DIR="$1"
+CONFIGDRIVE="$1"
DEVICE="$2"
-[[ -d $CONFIGDRIVE_DIR ]] || usage "$CONFIGDRIVE_DIR (CONFIGDRIVE_DIR) is not a directory"
+[[ -f $CONFIGDRIVE ]] || usage "$CONFIGDRIVE (CONFIGDRIVE) is not a regular file"
[[ -b $DEVICE ]] || usage "$DEVICE (DEVICE) is not a block device"
# Create small partition at the end of the device
log "Adding configdrive partition to $DEVICE"
-parted -a optimal -s -- $DEVICE mkpart primary ext2 -16MiB -0
+parted -a optimal -s -- $DEVICE mkpart primary ext2 -64MiB -0
# Find partition we just created
# Dump all partitions, ignore empty ones, then get the last partition ID
ISO_PARTITION=`sfdisk --dump $DEVICE | grep -v ' 0,' | tail -n1 | awk '{print $1}'`
# This generates the ISO image of the config drive.
-log "Writing Configdrive contents in $CONFIGDRIVE_DIR to $ISO_PARTITION"
-genisoimage \
- -o ${ISO_PARTITION} \
- -ldots \
- -input-charset 'utf-8' \
- -allow-lowercase \
- -allow-multidot \
- -l \
- -publisher "ironic" \
- -J \
- -r \
- -V 'config-2' \
- ${CONFIGDRIVE_DIR}
+log "Writing Configdrive contents in $CONFIGDRIVE to $ISO_PARTITION"
+dd if=$CONFIGDRIVE of=$ISO_PARTITION bs=64K oflag=direct
log "${DEVICE} imaged successfully!"