Damans227 opened a new issue, #14858:
URL: https://github.com/apache/cloudstack/issues/14858

   ### problem
   
   When qemu-img fails while creating a template from a volume on KVM, 
createtmplt.sh ignores the error and exits 0. CloudStack marks the template 
Ready, but the image is empty. It only shows up later, when a VM from that 
template fails to boot with "No bootable device".
   
   In create_from_file the qemu-img convert and cp results are never checked. 
The script then writes template.properties and exits 0. KVMStorageProcessor 
only looks at the exit code, so it reports success. create_from_snapshot in the 
same script already checks and exits non-zero.
   
   This is not specific to any storage type. It was found on FlashArray 
FibreChannel, where a dead multipath device made every read fail.
   
   ### versions
   
   ACS 4.22.1.1, KVM on Ubuntu 24.04, qemu-img 8.2.2. The script is the same on 
4.22 and main.
   
   ### The steps to reproduce the bug
   
   Run the script against a block device that fails every read:
   
   ```
   dmsetup create fix6err --table "0 2097152 error"
   /usr/share/cloudstack-common/scripts/storage/qcow2/createtmplt.sh -t 
tmp/fix6/stock -n t.qcow2 -f /dev/mapper/fix6err
   echo $?
   ```
   
   ```
   qemu-img: error while reading at byte 8388608: Input/output error
   qemu-img: error while reading at byte 14680064: Input/output error
   0
   ```
   
   ```
   > qemu-img info /tmp/fix6/stock/t.qcow2
   virtual size: 1 GiB (1073741824 bytes)
   disk size: 196 KiB
   ```
   
   template.properties is written too, so CloudStack treats it as a good 
template.
   
   ### What to do about it?
   
   Check the result of qemu-img convert and cp in create_from_file and exit 
non-zero when they fail, the same way create_from_snapshot already does.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to