246 lines
9.4 KiB
Diff
246 lines
9.4 KiB
Diff
|
From f13297315495144775f6249e9e24dc5f18f6f902 Mon Sep 17 00:00:00 2001
|
|||
|
From: Laszlo Ersek <lersek@redhat.com>
|
|||
|
Date: Wed, 4 May 2022 15:41:53 +0200
|
|||
|
Subject: [PATCH] lib: drive_create_data, drive: remove field "iface"
|
|||
|
|
|||
|
Representing "iface" in the "drive_create_data" and "drive" structures is
|
|||
|
now useless; the direct backend ignores "iface", while the libvirt one
|
|||
|
rejects it unless it is empty. Unify both backends -- make them both
|
|||
|
ignore "iface". (Which only relaxes the libvirt backend, so it cannot
|
|||
|
cause compatibility problems.) This lets us remove the fields. Update the
|
|||
|
documentation as well.
|
|||
|
|
|||
|
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1844341
|
|||
|
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
|||
|
Message-Id: <20220504134155.11832-3-lersek@redhat.com>
|
|||
|
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
|
|||
|
(cherry picked from commit f68eaee1d6c41f91e7dfd2aa9e7d238cca7b8a4c)
|
|||
|
---
|
|||
|
generator/actions_core_deprecated.ml | 6 ++----
|
|||
|
lib/drives.c | 31 +++++-----------------------
|
|||
|
lib/guestfs-internal.h | 1 -
|
|||
|
lib/launch-libvirt.c | 6 ------
|
|||
|
lib/libvirt-domain.c | 15 --------------
|
|||
|
5 files changed, 7 insertions(+), 52 deletions(-)
|
|||
|
|
|||
|
diff --git a/generator/actions_core_deprecated.ml b/generator/actions_core_deprecated.ml
|
|||
|
index f1040a0e9..c23f4a330 100644
|
|||
|
--- a/generator/actions_core_deprecated.ml
|
|||
|
+++ b/generator/actions_core_deprecated.ml
|
|||
|
@@ -74,8 +74,7 @@ of C<guestfs_add_drive_ro>." };
|
|||
|
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.
|
|||
|
-The libvirt backend rejects a non-empty C<iface> argument.
|
|||
|
-The direct backend ignores C<iface>." };
|
|||
|
+Both the direct and the libvirt backends ignore C<iface>." };
|
|||
|
|
|||
|
{ defaults with
|
|||
|
name = "add_drive_ro_with_if"; added = (1, 0, 84);
|
|||
|
@@ -86,8 +85,7 @@ The direct backend ignores C<iface>." };
|
|||
|
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.
|
|||
|
-The libvirt backend rejects a non-empty C<iface> argument.
|
|||
|
-The direct backend ignores C<iface>." };
|
|||
|
+Both the direct and the libvirt backends ignore C<iface>." };
|
|||
|
|
|||
|
{ defaults with
|
|||
|
name = "lstatlist"; added = (1, 0, 77);
|
|||
|
diff --git a/lib/drives.c b/lib/drives.c
|
|||
|
index a6179fc36..8fe46a41c 100644
|
|||
|
--- a/lib/drives.c
|
|||
|
+++ b/lib/drives.c
|
|||
|
@@ -53,7 +53,6 @@ struct drive_create_data {
|
|||
|
const char *secret;
|
|||
|
bool readonly;
|
|||
|
const char *format;
|
|||
|
- const char *iface;
|
|||
|
const char *name;
|
|||
|
const char *disk_label;
|
|||
|
const char *cachemode;
|
|||
|
@@ -110,7 +109,6 @@ create_drive_file (guestfs_h *g,
|
|||
|
drv->src.format = data->format ? safe_strdup (g, data->format) : NULL;
|
|||
|
|
|||
|
drv->readonly = data->readonly;
|
|||
|
- drv->iface = data->iface ? safe_strdup (g, data->iface) : NULL;
|
|||
|
drv->name = data->name ? safe_strdup (g, data->name) : NULL;
|
|||
|
drv->disk_label = data->disk_label ? safe_strdup (g, data->disk_label) : NULL;
|
|||
|
drv->cachemode = data->cachemode ? safe_strdup (g, data->cachemode) : NULL;
|
|||
|
@@ -147,7 +145,6 @@ create_drive_non_file (guestfs_h *g,
|
|||
|
drv->src.format = data->format ? safe_strdup (g, data->format) : NULL;
|
|||
|
|
|||
|
drv->readonly = data->readonly;
|
|||
|
- drv->iface = data->iface ? safe_strdup (g, data->iface) : NULL;
|
|||
|
drv->name = data->name ? safe_strdup (g, data->name) : NULL;
|
|||
|
drv->disk_label = data->disk_label ? safe_strdup (g, data->disk_label) : NULL;
|
|||
|
drv->cachemode = data->cachemode ? safe_strdup (g, data->cachemode) : NULL;
|
|||
|
@@ -470,7 +467,6 @@ free_drive_struct (struct drive *drv)
|
|||
|
{
|
|||
|
free_drive_source (&drv->src);
|
|||
|
free (drv->overlay);
|
|||
|
- free (drv->iface);
|
|||
|
free (drv->name);
|
|||
|
free (drv->disk_label);
|
|||
|
free (drv->cachemode);
|
|||
|
@@ -511,14 +507,12 @@ drive_to_string (guestfs_h *g, const struct drive *drv)
|
|||
|
s_blocksize = safe_asprintf (g, "%d", drv->blocksize);
|
|||
|
|
|||
|
return safe_asprintf
|
|||
|
- (g, "%s%s%s%s protocol=%s%s%s%s%s%s%s%s%s%s%s%s%s",
|
|||
|
+ (g, "%s%s%s%s protocol=%s%s%s%s%s%s%s%s%s%s%s",
|
|||
|
drv->src.u.path,
|
|||
|
drv->readonly ? " readonly" : "",
|
|||
|
drv->src.format ? " format=" : "",
|
|||
|
drv->src.format ? : "",
|
|||
|
guestfs_int_drive_protocol_to_string (drv->src.protocol),
|
|||
|
- drv->iface ? " iface=" : "",
|
|||
|
- drv->iface ? : "",
|
|||
|
drv->name ? " name=" : "",
|
|||
|
drv->name ? : "",
|
|||
|
drv->disk_label ? " label=" : "",
|
|||
|
@@ -747,8 +741,6 @@ guestfs_impl_add_drive_opts (guestfs_h *g, const char *filename,
|
|||
|
? optargs->readonly : false;
|
|||
|
data.format = optargs->bitmask & GUESTFS_ADD_DRIVE_OPTS_FORMAT_BITMASK
|
|||
|
? optargs->format : NULL;
|
|||
|
- data.iface = optargs->bitmask & GUESTFS_ADD_DRIVE_OPTS_IFACE_BITMASK
|
|||
|
- ? optargs->iface : NULL;
|
|||
|
data.name = optargs->bitmask & GUESTFS_ADD_DRIVE_OPTS_NAME_BITMASK
|
|||
|
? optargs->name : NULL;
|
|||
|
data.disk_label = optargs->bitmask & GUESTFS_ADD_DRIVE_OPTS_LABEL_BITMASK
|
|||
|
@@ -804,12 +796,6 @@ guestfs_impl_add_drive_opts (guestfs_h *g, const char *filename,
|
|||
|
free_drive_servers (data.servers, data.nr_servers);
|
|||
|
return -1;
|
|||
|
}
|
|||
|
- if (data.iface && !VALID_FORMAT_IFACE (data.iface)) {
|
|||
|
- error (g, _("%s parameter is empty or contains disallowed characters"),
|
|||
|
- "iface");
|
|||
|
- free_drive_servers (data.servers, data.nr_servers);
|
|||
|
- return -1;
|
|||
|
- }
|
|||
|
if (data.disk_label && !VALID_DISK_LABEL (data.disk_label)) {
|
|||
|
error (g, _("label parameter is empty, too long, or contains disallowed characters"));
|
|||
|
free_drive_servers (data.servers, data.nr_servers);
|
|||
|
@@ -935,24 +921,17 @@ guestfs_impl_add_drive_ro (guestfs_h *g, const char *filename)
|
|||
|
|
|||
|
int
|
|||
|
guestfs_impl_add_drive_with_if (guestfs_h *g, const char *filename,
|
|||
|
- const char *iface)
|
|||
|
+ const char *iface ATTRIBUTE_UNUSED)
|
|||
|
{
|
|||
|
- const struct guestfs_add_drive_opts_argv optargs = {
|
|||
|
- .bitmask = GUESTFS_ADD_DRIVE_OPTS_IFACE_BITMASK,
|
|||
|
- .iface = iface,
|
|||
|
- };
|
|||
|
-
|
|||
|
- return guestfs_add_drive_opts_argv (g, filename, &optargs);
|
|||
|
+ return guestfs_add_drive_opts_argv (g, filename, NULL);
|
|||
|
}
|
|||
|
|
|||
|
int
|
|||
|
guestfs_impl_add_drive_ro_with_if (guestfs_h *g, const char *filename,
|
|||
|
- const char *iface)
|
|||
|
+ const char *iface ATTRIBUTE_UNUSED)
|
|||
|
{
|
|||
|
const struct guestfs_add_drive_opts_argv optargs = {
|
|||
|
- .bitmask = GUESTFS_ADD_DRIVE_OPTS_IFACE_BITMASK
|
|||
|
- | GUESTFS_ADD_DRIVE_OPTS_READONLY_BITMASK,
|
|||
|
- .iface = iface,
|
|||
|
+ .bitmask = GUESTFS_ADD_DRIVE_OPTS_READONLY_BITMASK,
|
|||
|
.readonly = true,
|
|||
|
};
|
|||
|
|
|||
|
diff --git a/lib/guestfs-internal.h b/lib/guestfs-internal.h
|
|||
|
index 5bb00bc10..16755cfb3 100644
|
|||
|
--- a/lib/guestfs-internal.h
|
|||
|
+++ b/lib/guestfs-internal.h
|
|||
|
@@ -298,7 +298,6 @@ struct drive {
|
|||
|
|
|||
|
/* Various per-drive flags. */
|
|||
|
bool readonly;
|
|||
|
- char *iface;
|
|||
|
char *name;
|
|||
|
char *disk_label;
|
|||
|
char *cachemode;
|
|||
|
diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c
|
|||
|
index de342b425..03d69e027 100644
|
|||
|
--- a/lib/launch-libvirt.c
|
|||
|
+++ b/lib/launch-libvirt.c
|
|||
|
@@ -1472,12 +1472,6 @@ construct_libvirt_xml_disk (guestfs_h *g,
|
|||
|
const char *type, *uuid;
|
|||
|
int r;
|
|||
|
|
|||
|
- /* XXX We probably could support this if we thought about it some more. */
|
|||
|
- if (drv->iface) {
|
|||
|
- error (g, _("‘iface’ parameter is not supported by the libvirt backend"));
|
|||
|
- return -1;
|
|||
|
- }
|
|||
|
-
|
|||
|
start_element ("disk") {
|
|||
|
attribute ("device", "disk");
|
|||
|
|
|||
|
diff --git a/lib/libvirt-domain.c b/lib/libvirt-domain.c
|
|||
|
index 3050680fa..fafbf50ea 100644
|
|||
|
--- a/lib/libvirt-domain.c
|
|||
|
+++ b/lib/libvirt-domain.c
|
|||
|
@@ -68,7 +68,6 @@ guestfs_impl_add_domain (guestfs_h *g, const char *domain_name,
|
|||
|
int live;
|
|||
|
int allowuuid;
|
|||
|
const char *readonlydisk;
|
|||
|
- const char *iface;
|
|||
|
const char *cachemode;
|
|||
|
const char *discard;
|
|||
|
bool copyonread;
|
|||
|
@@ -78,8 +77,6 @@ guestfs_impl_add_domain (guestfs_h *g, const char *domain_name,
|
|||
|
? optargs->libvirturi : NULL;
|
|||
|
readonly = optargs->bitmask & GUESTFS_ADD_DOMAIN_READONLY_BITMASK
|
|||
|
? optargs->readonly : 0;
|
|||
|
- iface = optargs->bitmask & GUESTFS_ADD_DOMAIN_IFACE_BITMASK
|
|||
|
- ? optargs->iface : NULL;
|
|||
|
live = optargs->bitmask & GUESTFS_ADD_DOMAIN_LIVE_BITMASK
|
|||
|
? optargs->live : 0;
|
|||
|
allowuuid = optargs->bitmask & GUESTFS_ADD_DOMAIN_ALLOWUUID_BITMASK
|
|||
|
@@ -136,10 +133,6 @@ guestfs_impl_add_domain (guestfs_h *g, const char *domain_name,
|
|||
|
optargs2.bitmask |= GUESTFS_ADD_LIBVIRT_DOM_READONLY_BITMASK;
|
|||
|
optargs2.readonly = readonly;
|
|||
|
}
|
|||
|
- if (iface) {
|
|||
|
- optargs2.bitmask |= GUESTFS_ADD_LIBVIRT_DOM_IFACE_BITMASK;
|
|||
|
- optargs2.iface = iface;
|
|||
|
- }
|
|||
|
if (live) {
|
|||
|
error (g, _("libguestfs live support was removed in libguestfs 1.48"));
|
|||
|
goto cleanup;
|
|||
|
@@ -193,7 +186,6 @@ guestfs_impl_add_libvirt_dom (guestfs_h *g, void *domvp,
|
|||
|
virDomainPtr dom = domvp;
|
|||
|
ssize_t r;
|
|||
|
int readonly;
|
|||
|
- const char *iface;
|
|||
|
const char *cachemode;
|
|||
|
const char *discard;
|
|||
|
bool copyonread;
|
|||
|
@@ -208,9 +200,6 @@ guestfs_impl_add_libvirt_dom (guestfs_h *g, void *domvp,
|
|||
|
readonly =
|
|||
|
optargs->bitmask & GUESTFS_ADD_LIBVIRT_DOM_READONLY_BITMASK
|
|||
|
? optargs->readonly : 0;
|
|||
|
- iface =
|
|||
|
- optargs->bitmask & GUESTFS_ADD_LIBVIRT_DOM_IFACE_BITMASK
|
|||
|
- ? optargs->iface : NULL;
|
|||
|
live =
|
|||
|
optargs->bitmask & GUESTFS_ADD_LIBVIRT_DOM_LIVE_BITMASK
|
|||
|
? optargs->live : 0;
|
|||
|
@@ -289,10 +278,6 @@ guestfs_impl_add_libvirt_dom (guestfs_h *g, void *domvp,
|
|||
|
data.optargs.bitmask = 0;
|
|||
|
data.readonly = readonly;
|
|||
|
data.readonlydisk = readonlydisk;
|
|||
|
- if (iface) {
|
|||
|
- data.optargs.bitmask |= GUESTFS_ADD_DRIVE_OPTS_IFACE_BITMASK;
|
|||
|
- data.optargs.iface = iface;
|
|||
|
- }
|
|||
|
if (cachemode) {
|
|||
|
data.optargs.bitmask |= GUESTFS_ADD_DRIVE_OPTS_CACHEMODE_BITMASK;
|
|||
|
data.optargs.cachemode = cachemode;
|
|||
|
--
|
|||
|
2.31.1
|
|||
|
|