diff mbox

storage: Don't pass 'iso' format to qemu-img

Message ID 147e79bed9f55fff77bc029bf6ad60b7d03961a6.1488837532.git.crobinso@redhat.com
State Accepted
Commit 0e5db76262729e4c199e62c6cb00c90391073b4e
Headers show

Commit Message

Cole Robinson March 6, 2017, 9:58 p.m. UTC
$ virsh vol-clone /tmp/test.iso new.iso
error: Failed to clone vol from test.iso
error: internal error: Child process (/bin/qemu-img convert -f iso -O iso /tmp/test.iso /tmp/new.iso) unexpected exit status 1: qemu-img: Could not open '/tmp/test.iso': Unknown driver 'iso'

Map iso->raw before sending the format value to qemu-img

https://bugzilla.redhat.com/show_bug.cgi?id=972784
https://bugzilla.redhat.com/show_bug.cgi?id=1419395
---
 src/storage/storage_util.c | 5 +++++
 1 file changed, 5 insertions(+)

-- 
2.9.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Comments

Michal Prívozník March 7, 2017, 9:11 a.m. UTC | #1
On 03/06/2017 10:58 PM, Cole Robinson wrote:
> $ virsh vol-clone /tmp/test.iso new.iso

> error: Failed to clone vol from test.iso

> error: internal error: Child process (/bin/qemu-img convert -f iso -O iso /tmp/test.iso /tmp/new.iso) unexpected exit status 1: qemu-img: Could not open '/tmp/test.iso': Unknown driver 'iso'

> 

> Map iso->raw before sending the format value to qemu-img

> 

> https://bugzilla.redhat.com/show_bug.cgi?id=972784

> https://bugzilla.redhat.com/show_bug.cgi?id=1419395

> ---

>  src/storage/storage_util.c | 5 +++++

>  1 file changed, 5 insertions(+)

> 

> diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c

> index 41253b9..bf6f0b3 100644

> --- a/src/storage/storage_util.c

> +++ b/src/storage/storage_util.c

> @@ -1009,6 +1009,8 @@ storageBackendCreateQemuImgSetInput(virStorageVolDefPtr inputvol,

>      info->inputFormat = inputvol->target.format;

>      if (inputvol->type == VIR_STORAGE_VOL_BLOCK)

>          info->inputFormat = VIR_STORAGE_FILE_RAW;

> +    if (info->inputFormat == VIR_STORAGE_FILE_ISO)

> +        info->inputFormat = VIR_STORAGE_FILE_RAW;

>      if (!(info->inputFormatStr =

>            virStorageFileFormatTypeToString(info->inputFormat))) {

>          virReportError(VIR_ERR_INTERNAL_ERROR,

> @@ -1175,6 +1177,9 @@ virStorageBackendCreateQemuImgCmdFromVol(virConnectPtr conn,

>      if (vol->type == VIR_STORAGE_VOL_BLOCK)

>          info.format = VIR_STORAGE_FILE_RAW;

>  

> +    if (info.format == VIR_STORAGE_FILE_ISO)

> +        info.format = VIR_STORAGE_FILE_RAW;

> +

>      if (!(type = virStorageFileFormatTypeToString(info.format))) {

>          virReportError(VIR_ERR_INTERNAL_ERROR,

>                         _("unknown storage vol type %d"),

> 


ACK

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Pavel Hrdina March 7, 2017, 9:22 a.m. UTC | #2
On Mon, Mar 06, 2017 at 04:58:52PM -0500, Cole Robinson wrote:
> $ virsh vol-clone /tmp/test.iso new.iso

> error: Failed to clone vol from test.iso

> error: internal error: Child process (/bin/qemu-img convert -f iso -O iso /tmp/test.iso /tmp/new.iso) unexpected exit status 1: qemu-img: Could not open '/tmp/test.iso': Unknown driver 'iso'

> 

> Map iso->raw before sending the format value to qemu-img

> 

> https://bugzilla.redhat.com/show_bug.cgi?id=972784

> https://bugzilla.redhat.com/show_bug.cgi?id=1419395

> ---

>  src/storage/storage_util.c | 5 +++++

>  1 file changed, 5 insertions(+)

> 

> diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c

> index 41253b9..bf6f0b3 100644

> --- a/src/storage/storage_util.c

> +++ b/src/storage/storage_util.c

> @@ -1009,6 +1009,8 @@ storageBackendCreateQemuImgSetInput(virStorageVolDefPtr inputvol,

>      info->inputFormat = inputvol->target.format;

>      if (inputvol->type == VIR_STORAGE_VOL_BLOCK)

>          info->inputFormat = VIR_STORAGE_FILE_RAW;

> +    if (info->inputFormat == VIR_STORAGE_FILE_ISO)

> +        info->inputFormat = VIR_STORAGE_FILE_RAW;

>      if (!(info->inputFormatStr =

>            virStorageFileFormatTypeToString(info->inputFormat))) {

>          virReportError(VIR_ERR_INTERNAL_ERROR,

> @@ -1175,6 +1177,9 @@ virStorageBackendCreateQemuImgCmdFromVol(virConnectPtr conn,

>      if (vol->type == VIR_STORAGE_VOL_BLOCK)

>          info.format = VIR_STORAGE_FILE_RAW;

>  

> +    if (info.format == VIR_STORAGE_FILE_ISO)

> +        info.format = VIR_STORAGE_FILE_RAW;

> +

>      if (!(type = virStorageFileFormatTypeToString(info.format))) {

>          virReportError(VIR_ERR_INTERNAL_ERROR,

>                         _("unknown storage vol type %d"),


This could use a test case in storagevolxml2argvtest.

ACK to the changes.

Pavel
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Cole Robinson March 7, 2017, 4 p.m. UTC | #3
On 03/07/2017 04:22 AM, Pavel Hrdina wrote:
> On Mon, Mar 06, 2017 at 04:58:52PM -0500, Cole Robinson wrote:

>> $ virsh vol-clone /tmp/test.iso new.iso

>> error: Failed to clone vol from test.iso

>> error: internal error: Child process (/bin/qemu-img convert -f iso -O iso /tmp/test.iso /tmp/new.iso) unexpected exit status 1: qemu-img: Could not open '/tmp/test.iso': Unknown driver 'iso'

>>

>> Map iso->raw before sending the format value to qemu-img

>>

>> https://bugzilla.redhat.com/show_bug.cgi?id=972784

>> https://bugzilla.redhat.com/show_bug.cgi?id=1419395

>> ---

>>  src/storage/storage_util.c | 5 +++++

>>  1 file changed, 5 insertions(+)

>>

>> diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c

>> index 41253b9..bf6f0b3 100644

>> --- a/src/storage/storage_util.c

>> +++ b/src/storage/storage_util.c

>> @@ -1009,6 +1009,8 @@ storageBackendCreateQemuImgSetInput(virStorageVolDefPtr inputvol,

>>      info->inputFormat = inputvol->target.format;

>>      if (inputvol->type == VIR_STORAGE_VOL_BLOCK)

>>          info->inputFormat = VIR_STORAGE_FILE_RAW;

>> +    if (info->inputFormat == VIR_STORAGE_FILE_ISO)

>> +        info->inputFormat = VIR_STORAGE_FILE_RAW;

>>      if (!(info->inputFormatStr =

>>            virStorageFileFormatTypeToString(info->inputFormat))) {

>>          virReportError(VIR_ERR_INTERNAL_ERROR,

>> @@ -1175,6 +1177,9 @@ virStorageBackendCreateQemuImgCmdFromVol(virConnectPtr conn,

>>      if (vol->type == VIR_STORAGE_VOL_BLOCK)

>>          info.format = VIR_STORAGE_FILE_RAW;

>>  

>> +    if (info.format == VIR_STORAGE_FILE_ISO)

>> +        info.format = VIR_STORAGE_FILE_RAW;

>> +

>>      if (!(type = virStorageFileFormatTypeToString(info.format))) {

>>          virReportError(VIR_ERR_INTERNAL_ERROR,

>>                         _("unknown storage vol type %d"),

> 

> This could use a test case in storagevolxml2argvtest.

> 

> ACK to the changes.

> 


Thanks, I didn't know about those tests. I've sent a follow up patch

- Cole

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff mbox

Patch

diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
index 41253b9..bf6f0b3 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -1009,6 +1009,8 @@  storageBackendCreateQemuImgSetInput(virStorageVolDefPtr inputvol,
     info->inputFormat = inputvol->target.format;
     if (inputvol->type == VIR_STORAGE_VOL_BLOCK)
         info->inputFormat = VIR_STORAGE_FILE_RAW;
+    if (info->inputFormat == VIR_STORAGE_FILE_ISO)
+        info->inputFormat = VIR_STORAGE_FILE_RAW;
     if (!(info->inputFormatStr =
           virStorageFileFormatTypeToString(info->inputFormat))) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -1175,6 +1177,9 @@  virStorageBackendCreateQemuImgCmdFromVol(virConnectPtr conn,
     if (vol->type == VIR_STORAGE_VOL_BLOCK)
         info.format = VIR_STORAGE_FILE_RAW;
 
+    if (info.format == VIR_STORAGE_FILE_ISO)
+        info.format = VIR_STORAGE_FILE_RAW;
+
     if (!(type = virStorageFileFormatTypeToString(info.format))) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("unknown storage vol type %d"),