OpenNebula / minione

Easy to use deployment tool for an OpenNebula evaluation environment
Apache License 2.0
173 stars 54 forks source link

cannot create an image: [one.image.allocate] "Cannot parse image SIZE" error #108

Closed emteelb closed 11 months ago

emteelb commented 11 months ago

cannot create an image: [one.image.allocate] "Cannot parse image SIZE" error

Installed miniONE for evaluation on an AlmaLinux 9 VM cluster. Front-end + three virtualization host nodes. All libvirt VMs.

Front end installed by using https://github.com/OpenNebula/minione/releases/latest/download/minione

Host nodes installed by using the OpenNebula CE opennebula-node-kvm package (https://downloads.opennebula.io/repo/6.6/AlmaLinux/9/x86_64/)

I can't create an image, neither in the default datastore, nor in a linstor added datastore (by using the LINSTOR OpenNebula driver). I get the same error whether I try to create the image using the Sunstone web GUI or the oneimage create CLI command.

I have tried a couple different images, .img and .iso files with the same error message. Here's an example trying to create an image from a 54M Slitaz Linux ISO:

[oneadmin@node-alma0 root]$ oneimage create --name slitaz-linux --path /var/tmp/slitaz-rolling.iso --type CDROM --datastore 1
[one.image.allocate] Cannot parse image SIZE: /var/lib/one/remotes/datastore/fs/../libfs.sh: line 446: (56514560 56514560+1048575)/1048576: missing `)' (error token is "56514560+1048
575)/1048576") Cannot determine size for /var/tmp/slitaz-rolling.iso

Line 446:

SIZE=$((($SIZE+1048575)/1048576))

I am not sure what the error message is suggesting is missing... ")'", ")", or just "`"?

If I try to look back at how $SIZE is set and changed through the file, I come up w/ this:

SRC=/var/tmp/slitaz-rolling.iso
SIZE=`set -o pipefail; du -sb "${SRC}" | cut -f1`
SIZE=$(echo ${SIZE:-0} | tr -d "\r")
SIZE=$((($SIZE+1048575)/1048576))

If I enter all of that independently of the libfs.sh script, and then echo $SIZE, I get:

54

No errors.

Thanks in advance for any help and guidance here.

xorel commented 11 months ago

Could you apply this patch and try again?

/var/lib/one/remotes/datastore/libfs.sh

 function image_vsize {
-    echo "$($QEMU_IMG info "${1}" 2>/dev/null | sed -n 's/.*(\([0-9]*\) bytes).*/\1/p')"
+    echo "$($QEMU_IMG info --output json "${1}" | jq '."virtual-size"')"
 }
emteelb commented 11 months ago

Thank you for the fast response. Applying the patch worked and I was able to create an image in both the default and linstor datastores.

Feel free to close this issue... or leave open until patch committed to code?

xorel commented 11 months ago

The upstream is already fixed but the CE packages have not been released yet.

Thanks for reporting it anyway.