Rich said in <https://bugzilla.redhat.com/show_bug.cgi?id=1844341#c1>:
> The libvirt backend has never allowed the iface parameter. We should > probably ignore it in the direct backend since it's never been possible > to use this parameter correctly. Remove the handling of "iface" in the direct (QEMU) backend. Refresh the documentation regarding both backends. Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1844341 Signed-off-by: Laszlo Ersek <[email protected]> --- generator/actions_core_deprecated.ml | 8 ++- lib/launch-direct.c | 59 +++++--------------- 2 files changed, 19 insertions(+), 48 deletions(-) diff --git a/generator/actions_core_deprecated.ml b/generator/actions_core_deprecated.ml index 00dde3d2a5be..f1040a0e9491 100644 --- a/generator/actions_core_deprecated.ml +++ b/generator/actions_core_deprecated.ml @@ -73,7 +73,9 @@ of C<guestfs_add_drive_ro>." }; shortdesc = "add a drive specifying the QEMU block emulation to use"; longdesc = "\ This is the same as C<guestfs_add_drive> but it allows you -to specify the QEMU interface emulation to use at run time." }; +to specify the QEMU interface emulation to use at run time. +The libvirt backend rejects a non-empty C<iface> argument. +The direct backend ignores C<iface>." }; { defaults with name = "add_drive_ro_with_if"; added = (1, 0, 84); @@ -83,7 +85,9 @@ to specify the QEMU interface emulation to use at run time." }; shortdesc = "add a drive read-only specifying the QEMU block emulation to use"; longdesc = "\ This is the same as C<guestfs_add_drive_ro> but it allows you -to specify the QEMU interface emulation to use at run time." }; +to specify the QEMU interface emulation to use at run time. +The libvirt backend rejects a non-empty C<iface> argument. +The direct backend ignores C<iface>." }; { defaults with name = "lstatlist"; added = (1, 0, 77); diff --git a/lib/launch-direct.c b/lib/launch-direct.c index 5c91822fb52d..c07a8d78f1a0 100644 --- a/lib/launch-direct.c +++ b/lib/launch-direct.c @@ -296,52 +296,19 @@ static int add_drive (guestfs_h *g, struct backend_direct_data *data, struct qemuopts *qopts, size_t i, struct drive *drv) { - /* If there's an explicit 'iface', use it. Otherwise default to - * virtio-scsi. - */ - if (drv->iface && STREQ (drv->iface, "virtio")) { /* virtio-blk */ - start_list ("-drive") { - if (add_drive_standard_params (g, data, qopts, i, drv) == -1) - return -1; - append_list ("if=none"); - } end_list (); - start_list ("-device") { - append_list (VIRTIO_DEVICE_NAME ("virtio-blk")); - append_list_format ("drive=hd%zu", i); - if (drv->disk_label) - append_list_format ("serial=%s", drv->disk_label); - if (add_device_blocksize_params (g, qopts, drv) == -1) - return -1; - } end_list (); - } -#if defined(__arm__) || defined(__aarch64__) || defined(__powerpc__) - else if (drv->iface && STREQ (drv->iface, "ide")) { - error (g, "'ide' interface does not work on ARM or PowerPC"); - return -1; - } -#endif - else if (drv->iface) { - start_list ("-drive") { - if (add_drive_standard_params (g, data, qopts, i, drv) == -1) - return -1; - append_list_format ("if=%s", drv->iface); - } end_list (); - } - else /* default case: virtio-scsi */ { - start_list ("-drive") { - if (add_drive_standard_params (g, data, qopts, i, drv) == -1) - return -1; - append_list ("if=none"); - } end_list (); - start_list ("-device") { - append_list ("scsi-hd"); - append_list_format ("drive=hd%zu", i); - if (drv->disk_label) - append_list_format ("serial=%s", drv->disk_label); - if (add_device_blocksize_params (g, qopts, drv) == -1) - return -1; - } end_list (); - } + start_list ("-drive") { + if (add_drive_standard_params (g, data, qopts, i, drv) == -1) + return -1; + append_list ("if=none"); + } end_list (); + start_list ("-device") { + append_list ("scsi-hd"); + append_list_format ("drive=hd%zu", i); + if (drv->disk_label) + append_list_format ("serial=%s", drv->disk_label); + if (add_device_blocksize_params (g, qopts, drv) == -1) + return -1; + } end_list (); return 0; -- 2.19.1.3.g30247aa5d201 _______________________________________________ Libguestfs mailing list [email protected] https://listman.redhat.com/mailman/listinfo/libguestfs
