mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
lib: launch-direct: ignore drive "iface" parameter
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 <lersek@redhat.com> Message-Id: <20220504134155.11832-2-lersek@redhat.com> Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user