summaryrefslogtreecommitdiffstats
path: root/mcp/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'mcp/scripts')
-rw-r--r--mcp/scripts/lib.sh14
1 files changed, 9 insertions, 5 deletions
diff --git a/mcp/scripts/lib.sh b/mcp/scripts/lib.sh
index 8dd92e1ec..3dee9c51f 100644
--- a/mcp/scripts/lib.sh
+++ b/mcp/scripts/lib.sh
@@ -49,18 +49,21 @@ function mount_image {
fi
done
OPNFV_LOOP_DEV=$(losetup -f)
+ OPNFV_MAP_DEV=/dev/mapper/$(basename "${OPNFV_NBD_DEV}")p1
export OPNFV_MNT_DIR OPNFV_LOOP_DEV
[ -n "${OPNFV_NBD_DEV}" ] && [ -n "${OPNFV_LOOP_DEV}" ] || exit 1
qemu-img resize "${image_dir}/${image}" 3G
sudo qemu-nbd --connect="${OPNFV_NBD_DEV}" --aio=native --cache=none \
"${image_dir}/${image}"
- sleep 5 # /dev/nbdNp1 takes some time to come up
+ sudo kpartx -av "${OPNFV_NBD_DEV}"
# Hardcode partition index to 1, unlikely to change for Ubuntu UCA image
if sudo growpart "${OPNFV_NBD_DEV}" 1; then
- sudo e2fsck -yf "${OPNFV_NBD_DEV}p1" && sudo resize2fs "${OPNFV_NBD_DEV}p1"
+ sudo kpartx -u "${OPNFV_NBD_DEV}"
+ sudo e2fsck -yf "${OPNFV_MAP_DEV}"
+ sudo resize2fs "${OPNFV_MAP_DEV}"
fi
# grub-update does not like /dev/nbd*, so use a loop device to work around it
- sudo losetup "${OPNFV_LOOP_DEV}" "${OPNFV_NBD_DEV}p1"
+ sudo losetup "${OPNFV_LOOP_DEV}" "${OPNFV_MAP_DEV}"
mkdir -p "${OPNFV_MNT_DIR}"
sudo mount "${OPNFV_LOOP_DEV}" "${OPNFV_MNT_DIR}"
sudo mount -t proc proc "${OPNFV_MNT_DIR}/proc"
@@ -141,6 +144,7 @@ function cleanup_mounts {
sudo losetup -d "${OPNFV_LOOP_DEV}"
fi
if [ -n "${OPNFV_NBD_DEV}" ]; then
+ sudo kpartx -d "${OPNFV_NBD_DEV}" || true
sudo qemu-nbd -d "${OPNFV_NBD_DEV}" || true
fi
}
@@ -277,9 +281,9 @@ function update_mcpcontrol_network {
local cmac=$(virsh domiflist cfg01 2>&1| awk '/mcpcontrol/ {print $5; exit}')
local amac=$(virsh domiflist mas01 2>&1| awk '/mcpcontrol/ {print $5; exit}')
virsh net-update "mcpcontrol" add ip-dhcp-host \
- "<host mac='${cmac}' name='cfg01' ip='${SALT_MASTER}'/>" --live
+ "<host mac='${cmac}' name='cfg01' ip='${SALT_MASTER}'/>" --live --config
[ -z "${amac}" ] || virsh net-update "mcpcontrol" add ip-dhcp-host \
- "<host mac='${amac}' name='mas01' ip='${MAAS_IP}'/>" --live
+ "<host mac='${amac}' name='mas01' ip='${MAAS_IP}'/>" --live --config
}
function start_vms {