Detect image format for qemu-nbd --format
qemu-nbd will error when the image format is raw unless there is an explicit --format raw argument provided. This change adds format detection for raw and qcow2 using qemu-img info. Any other image type will depend on qemu-nbd auto-detection. Blueprint: whole-disk-default Change-Id: I628abc4cb8c46c3b2e5bfd3cd16bb6d5cc95fabe
This commit is contained in:
parent
049f9a9659
commit
db7280e653
|
@ -92,7 +92,14 @@ remove_device () {
|
|||
mount_image() {
|
||||
set -x
|
||||
|
||||
qemu-nbd --connect $NBD_DEVICE $IMAGE_FILE
|
||||
if qemu-img info --output json $IMAGE_FILE |grep '"format": "raw"' ; then
|
||||
image_format='--format raw'
|
||||
elif qemu-img info --output json $IMAGE_FILE |grep '"format": "qcow2"' ; then
|
||||
image_format='--format qcow2'
|
||||
else
|
||||
image_format=''
|
||||
fi
|
||||
qemu-nbd $image_format --connect $NBD_DEVICE $IMAGE_FILE
|
||||
|
||||
# search for the vg volume group, this is automatic in some environments
|
||||
vgscan
|
||||
|
|
Loading…
Reference in New Issue