diff options
-rw-r--r-- | mcp/scripts/lib_jump_deploy.sh | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/mcp/scripts/lib_jump_deploy.sh b/mcp/scripts/lib_jump_deploy.sh index 5efbfa667..ade1a7487 100644 --- a/mcp/scripts/lib_jump_deploy.sh +++ b/mcp/scripts/lib_jump_deploy.sh @@ -121,13 +121,16 @@ function __mount_image { sudo qemu-nbd --connect="${OPNFV_NBD_DEV}" --aio=native --cache=none \ "${image_dir}/${image}" sudo kpartx -av "${OPNFV_NBD_DEV}" - sleep 5 # /dev/nbdNp1 takes some time to come up # Hardcode partition index to 1, unlikely to change for Ubuntu UCA image + sudo partx -uvn 1:1 "${OPNFV_NBD_DEV}" if sudo growpart "${OPNFV_NBD_DEV}" 1; then sudo kpartx -u "${OPNFV_NBD_DEV}" sudo e2fsck -pf "${OPNFV_MAP_DEV}" sudo resize2fs "${OPNFV_MAP_DEV}" + else + sleep 5 # /dev/nbdNp1 takes some time to come up fi + sudo partx -d "${OPNFV_NBD_DEV}" # grub-update does not like /dev/nbd*, so use a loop device to work around it sudo losetup "${OPNFV_LOOP_DEV}" "${OPNFV_MAP_DEV}" mkdir -p "${OPNFV_MNT_DIR}" @@ -497,6 +500,7 @@ function cleanup_mounts { sudo losetup -d "${OPNFV_LOOP_DEV}" fi if [ -n "${OPNFV_NBD_DEV}" ]; then + sudo partx -d "${OPNFV_NBD_DEV}" || true sudo kpartx -d "${OPNFV_NBD_DEV}" || true sudo qemu-nbd -d "${OPNFV_NBD_DEV}" || true fi |