From fd9a584f39b6fdab3588715597bdd2d7677f70e9 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Wed, 4 May 2022 15:41:52 +0200 Subject: [PATCH] lib: launch-direct: ignore drive "iface" parameter Rich said in : > 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 Message-Id: <20220504134155.11832-2-lersek@redhat.com> Reviewed-by: Richard W.M. Jones (cherry picked from commit 3eb830dbaee12c8dc4566cab226ed2af0e0f2d8c) --- 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 00dde3d2a..f1040a0e9 100644 --- a/generator/actions_core_deprecated.ml +++ b/generator/actions_core_deprecated.ml @@ -73,7 +73,9 @@ of C." }; shortdesc = "add a drive specifying the QEMU block emulation to use"; longdesc = "\ This is the same as C 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 argument. +The direct backend ignores C." }; { 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 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 argument. +The direct backend ignores C." }; { defaults with name = "lstatlist"; added = (1, 0, 77); diff --git a/lib/launch-direct.c b/lib/launch-direct.c index 5c91822fb..c07a8d78f 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.31.1