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