Damans227 opened a new pull request, #14859:
URL: https://github.com/apache/cloudstack/pull/14859

   Fixes #14858
   
   When qemu-img fails while creating a template from a volume on KVM, 
createtmplt.sh still exits 0, so CloudStack marks an empty template Ready. This 
checks the result of qemu-img convert and cp in create_from_file and exits 4 
when they fail, like create_from_snapshot already does.
   
   ### Test:
   
   Run the script against a block device that fails every read (`dmsetup create 
fix6err --table "0 2097152 error"`), on a KVM host with qemu-img 8.2.2.
   
   **Before:** exit 0, empty template and template.properties written.
   
       qemu-img: error while reading at byte 8388608: Input/output error
       exit=0
       virtual size: 1 GiB (1073741824 bytes)
       disk size: 196 KiB
       /tmp/fix6/stock/template.properties
   
   **After:** exit 4, no template.properties.
   
       qemu-img: error while reading at byte 8388608: Input/output error
       Failed to create template /tmp/fix6/fixed/t.qcow2 from 
/dev/mapper/fix6err
       exit=4
       no template.properties written
   
   
![before-after](https://raw.githubusercontent.com/Damans227/cloudstack/createtmplt-exit-code-screenshots/before-after.png)
   


-- 
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