|
|
65aaff |
From e4901a4e83f0ab59a525095d2fe1c7f1a38c0aac Mon Sep 17 00:00:00 2001
|
|
|
65aaff |
From: Laszlo Ersek <lersek@redhat.com>
|
|
|
65aaff |
Date: Wed, 4 May 2022 15:41:52 +0200
|
|
|
65aaff |
Subject: [PATCH] lib: launch-direct: ignore drive "iface" parameter
|
|
|
65aaff |
|
|
|
65aaff |
Rich said in <https://bugzilla.redhat.com/show_bug.cgi?id=1844341#c1>:
|
|
|
65aaff |
|
|
|
65aaff |
> The libvirt backend has never allowed the iface parameter. We should
|
|
|
65aaff |
> probably ignore it in the direct backend since it's never been possible
|
|
|
65aaff |
> to use this parameter correctly.
|
|
|
65aaff |
|
|
|
65aaff |
Remove the handling of "iface" in the direct (QEMU) backend. Refresh the
|
|
|
65aaff |
documentation regarding both backends.
|
|
|
65aaff |
|
|
|
65aaff |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1844341
|
|
|
65aaff |
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
65aaff |
Message-Id: <20220504134155.11832-2-lersek@redhat.com>
|
|
|
65aaff |
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
|
|
|
65aaff |
(cherry picked from commit 3eb830dbaee12c8dc4566cab226ed2af0e0f2d8c)
|
|
|
65aaff |
---
|
|
|
65aaff |
generator/actions_core_deprecated.ml | 8 +++-
|
|
|
65aaff |
lib/launch-direct.c | 59 ++++++----------------------
|
|
|
65aaff |
2 files changed, 19 insertions(+), 48 deletions(-)
|
|
|
65aaff |
|
|
|
65aaff |
diff --git a/generator/actions_core_deprecated.ml b/generator/actions_core_deprecated.ml
|
|
|
65aaff |
index 00dde3d2a..f1040a0e9 100644
|
|
|
65aaff |
--- a/generator/actions_core_deprecated.ml
|
|
|
65aaff |
+++ b/generator/actions_core_deprecated.ml
|
|
|
65aaff |
@@ -73,7 +73,9 @@ of C<guestfs_add_drive_ro>." };
|
|
|
65aaff |
shortdesc = "add a drive specifying the QEMU block emulation to use";
|
|
|
65aaff |
longdesc = "\
|
|
|
65aaff |
This is the same as C<guestfs_add_drive> but it allows you
|
|
|
65aaff |
-to specify the QEMU interface emulation to use at run time." };
|
|
|
65aaff |
+to specify the QEMU interface emulation to use at run time.
|
|
|
65aaff |
+The libvirt backend rejects a non-empty C<iface> argument.
|
|
|
65aaff |
+The direct backend ignores C<iface>." };
|
|
|
65aaff |
|
|
|
65aaff |
{ defaults with
|
|
|
65aaff |
name = "add_drive_ro_with_if"; added = (1, 0, 84);
|
|
|
65aaff |
@@ -83,7 +85,9 @@ to specify the QEMU interface emulation to use at run time." };
|
|
|
65aaff |
shortdesc = "add a drive read-only specifying the QEMU block emulation to use";
|
|
|
65aaff |
longdesc = "\
|
|
|
65aaff |
This is the same as C<guestfs_add_drive_ro> but it allows you
|
|
|
65aaff |
-to specify the QEMU interface emulation to use at run time." };
|
|
|
65aaff |
+to specify the QEMU interface emulation to use at run time.
|
|
|
65aaff |
+The libvirt backend rejects a non-empty C<iface> argument.
|
|
|
65aaff |
+The direct backend ignores C<iface>." };
|
|
|
65aaff |
|
|
|
65aaff |
{ defaults with
|
|
|
65aaff |
name = "lstatlist"; added = (1, 0, 77);
|
|
|
65aaff |
diff --git a/lib/launch-direct.c b/lib/launch-direct.c
|
|
|
65aaff |
index b292b9c26..ff0eaeb62 100644
|
|
|
65aaff |
--- a/lib/launch-direct.c
|
|
|
65aaff |
+++ b/lib/launch-direct.c
|
|
|
65aaff |
@@ -296,52 +296,19 @@ static int
|
|
|
65aaff |
add_drive (guestfs_h *g, struct backend_direct_data *data,
|
|
|
65aaff |
struct qemuopts *qopts, size_t i, struct drive *drv)
|
|
|
65aaff |
{
|
|
|
65aaff |
- /* If there's an explicit 'iface', use it. Otherwise default to
|
|
|
65aaff |
- * virtio-scsi.
|
|
|
65aaff |
- */
|
|
|
65aaff |
- if (drv->iface && STREQ (drv->iface, "virtio")) { /* virtio-blk */
|
|
|
65aaff |
- start_list ("-drive") {
|
|
|
65aaff |
- if (add_drive_standard_params (g, data, qopts, i, drv) == -1)
|
|
|
65aaff |
- return -1;
|
|
|
65aaff |
- append_list ("if=none");
|
|
|
65aaff |
- } end_list ();
|
|
|
65aaff |
- start_list ("-device") {
|
|
|
65aaff |
- append_list (VIRTIO_DEVICE_NAME ("virtio-blk"));
|
|
|
65aaff |
- append_list_format ("drive=hd%zu", i);
|
|
|
65aaff |
- if (drv->disk_label)
|
|
|
65aaff |
- append_list_format ("serial=%s", drv->disk_label);
|
|
|
65aaff |
- if (add_device_blocksize_params (g, qopts, drv) == -1)
|
|
|
65aaff |
- return -1;
|
|
|
65aaff |
- } end_list ();
|
|
|
65aaff |
- }
|
|
|
65aaff |
-#if defined(__arm__) || defined(__aarch64__) || defined(__powerpc__)
|
|
|
65aaff |
- else if (drv->iface && STREQ (drv->iface, "ide")) {
|
|
|
65aaff |
- error (g, "'ide' interface does not work on ARM or PowerPC");
|
|
|
65aaff |
- return -1;
|
|
|
65aaff |
- }
|
|
|
65aaff |
-#endif
|
|
|
65aaff |
- else if (drv->iface) {
|
|
|
65aaff |
- start_list ("-drive") {
|
|
|
65aaff |
- if (add_drive_standard_params (g, data, qopts, i, drv) == -1)
|
|
|
65aaff |
- return -1;
|
|
|
65aaff |
- append_list_format ("if=%s", drv->iface);
|
|
|
65aaff |
- } end_list ();
|
|
|
65aaff |
- }
|
|
|
65aaff |
- else /* default case: virtio-scsi */ {
|
|
|
65aaff |
- start_list ("-drive") {
|
|
|
65aaff |
- if (add_drive_standard_params (g, data, qopts, i, drv) == -1)
|
|
|
65aaff |
- return -1;
|
|
|
65aaff |
- append_list ("if=none");
|
|
|
65aaff |
- } end_list ();
|
|
|
65aaff |
- start_list ("-device") {
|
|
|
65aaff |
- append_list ("scsi-hd");
|
|
|
65aaff |
- append_list_format ("drive=hd%zu", i);
|
|
|
65aaff |
- if (drv->disk_label)
|
|
|
65aaff |
- append_list_format ("serial=%s", drv->disk_label);
|
|
|
65aaff |
- if (add_device_blocksize_params (g, qopts, drv) == -1)
|
|
|
65aaff |
- return -1;
|
|
|
65aaff |
- } end_list ();
|
|
|
65aaff |
- }
|
|
|
65aaff |
+ start_list ("-drive") {
|
|
|
65aaff |
+ if (add_drive_standard_params (g, data, qopts, i, drv) == -1)
|
|
|
65aaff |
+ return -1;
|
|
|
65aaff |
+ append_list ("if=none");
|
|
|
65aaff |
+ } end_list ();
|
|
|
65aaff |
+ start_list ("-device") {
|
|
|
65aaff |
+ append_list ("scsi-hd");
|
|
|
65aaff |
+ append_list_format ("drive=hd%zu", i);
|
|
|
65aaff |
+ if (drv->disk_label)
|
|
|
65aaff |
+ append_list_format ("serial=%s", drv->disk_label);
|
|
|
65aaff |
+ if (add_device_blocksize_params (g, qopts, drv) == -1)
|
|
|
65aaff |
+ return -1;
|
|
|
65aaff |
+ } end_list ();
|
|
|
65aaff |
|
|
|
65aaff |
return 0;
|
|
|
65aaff |
|
|
|
65aaff |
--
|
|
|
65aaff |
2.31.1
|
|
|
65aaff |
|