|
|
a19a21 |
From ff881d64d3f29825ab093eb2be183658226ccba3 Mon Sep 17 00:00:00 2001
|
|
|
709dde |
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
|
|
|
a19a21 |
Date: Wed, 16 Dec 2020 16:06:15 -0500
|
|
|
a19a21 |
Subject: [PATCH 14/14] qga: update schema for guest-get-disks 'dependents'
|
|
|
709dde |
field
|
|
|
709dde |
MIME-Version: 1.0
|
|
|
709dde |
Content-Type: text/plain; charset=UTF-8
|
|
|
709dde |
Content-Transfer-Encoding: 8bit
|
|
|
709dde |
|
|
|
709dde |
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
a19a21 |
Message-id: <20201216160615.324213-11-marcandre.lureau@redhat.com>
|
|
|
a19a21 |
Patchwork-id: 100480
|
|
|
a19a21 |
O-Subject: [RHEL-8.4.0 qemu-kvm PATCH v2 10/10] qga: update schema for guest-get-disks 'dependents' field
|
|
|
a19a21 |
Bugzilla: 1859494
|
|
|
a19a21 |
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
|
|
|
a19a21 |
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
|
|
a19a21 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
709dde |
|
|
|
709dde |
From: Michael Roth <michael.roth@amd.com>
|
|
|
709dde |
|
|
|
709dde |
The recently-added 'guest-get-disk' command returns a list of
|
|
|
709dde |
GuestDiskInfo entries, which in turn have a 'dependents' field which
|
|
|
709dde |
lists devices these entries are dependent upon. Thus, 'dependencies'
|
|
|
709dde |
is a better name for this field. Address this by renaming the field
|
|
|
709dde |
accordingly.
|
|
|
709dde |
|
|
|
709dde |
Additionally, 'dependents' is specified as non-optional, even though
|
|
|
709dde |
it's not implemented for w32. This is misleading, since it gives users
|
|
|
709dde |
the impression that a particular disk might not have dependencies,
|
|
|
709dde |
when in reality that information is simply not known to the guest
|
|
|
709dde |
agent. Address this by making 'dependents' an optional field, and only
|
|
|
709dde |
marking it as in-use when the facilities to obtain this information are
|
|
|
709dde |
available to the guest agent.
|
|
|
709dde |
|
|
|
709dde |
Cc: Eric Blake <eblake@redhat.com>
|
|
|
709dde |
Cc: Tomáš Golembiovský <tgolembi@redhat.com>
|
|
|
709dde |
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
709dde |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
709dde |
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
709dde |
Signed-off-by: Michael Roth <michael.roth@amd.com>
|
|
|
709dde |
|
|
|
709dde |
(cherry-picked from commit a8aa94b5f8427cc2924d8cdd417c8014db1c86c0)
|
|
|
709dde |
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
709dde |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
709dde |
---
|
|
|
709dde |
qga/commands-posix.c | 10 ++++++----
|
|
|
709dde |
qga/qapi-schema.json | 8 ++++----
|
|
|
709dde |
2 files changed, 10 insertions(+), 8 deletions(-)
|
|
|
709dde |
|
|
|
709dde |
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
|
|
|
a19a21 |
index 9a170dee14c..c02373cdf7d 100644
|
|
|
709dde |
--- a/qga/commands-posix.c
|
|
|
709dde |
+++ b/qga/commands-posix.c
|
|
|
a19a21 |
@@ -1287,6 +1287,7 @@ static void get_disk_deps(const char *disk_dir, GuestDiskInfo *disk)
|
|
|
709dde |
g_debug("failed to list entries in %s", deps_dir);
|
|
|
709dde |
return;
|
|
|
709dde |
}
|
|
|
709dde |
+ disk->has_dependencies = true;
|
|
|
709dde |
while ((dep = g_dir_read_name(dp_deps)) != NULL) {
|
|
|
709dde |
g_autofree char *dep_dir = NULL;
|
|
|
709dde |
strList *dep_item = NULL;
|
|
|
a19a21 |
@@ -1299,8 +1300,8 @@ static void get_disk_deps(const char *disk_dir, GuestDiskInfo *disk)
|
|
|
709dde |
g_debug(" adding dependent device: %s", dev_name);
|
|
|
709dde |
dep_item = g_new0(strList, 1);
|
|
|
709dde |
dep_item->value = dev_name;
|
|
|
709dde |
- dep_item->next = disk->dependents;
|
|
|
709dde |
- disk->dependents = dep_item;
|
|
|
709dde |
+ dep_item->next = disk->dependencies;
|
|
|
709dde |
+ disk->dependencies = dep_item;
|
|
|
709dde |
}
|
|
|
709dde |
}
|
|
|
709dde |
g_dir_close(dp_deps);
|
|
|
a19a21 |
@@ -1353,8 +1354,9 @@ static GuestDiskInfoList *get_disk_partitions(
|
|
|
709dde |
partition->name = dev_name;
|
|
|
709dde |
partition->partition = true;
|
|
|
709dde |
/* Add parent disk as dependent for easier tracking of hierarchy */
|
|
|
709dde |
- partition->dependents = g_new0(strList, 1);
|
|
|
709dde |
- partition->dependents->value = g_strdup(disk_dev);
|
|
|
709dde |
+ partition->dependencies = g_new0(strList, 1);
|
|
|
709dde |
+ partition->dependencies->value = g_strdup(disk_dev);
|
|
|
709dde |
+ partition->has_dependencies = true;
|
|
|
709dde |
|
|
|
709dde |
item = g_new0(GuestDiskInfoList, 1);
|
|
|
709dde |
item->value = partition;
|
|
|
709dde |
diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json
|
|
|
709dde |
index 22df375c92f..4222cb92d34 100644
|
|
|
709dde |
--- a/qga/qapi-schema.json
|
|
|
709dde |
+++ b/qga/qapi-schema.json
|
|
|
709dde |
@@ -857,9 +857,9 @@
|
|
|
709dde |
#
|
|
|
709dde |
# @name: device node (Linux) or device UNC (Windows)
|
|
|
709dde |
# @partition: whether this is a partition or disk
|
|
|
709dde |
-# @dependents: list of dependent devices; e.g. for LVs of the LVM this will
|
|
|
709dde |
-# hold the list of PVs, for LUKS encrypted volume this will
|
|
|
709dde |
-# contain the disk where the volume is placed. (Linux)
|
|
|
709dde |
+# @dependencies: list of device dependencies; e.g. for LVs of the LVM this will
|
|
|
709dde |
+# hold the list of PVs, for LUKS encrypted volume this will
|
|
|
709dde |
+# contain the disk where the volume is placed. (Linux)
|
|
|
709dde |
# @address: disk address information (only for non-virtual devices)
|
|
|
709dde |
# @alias: optional alias assigned to the disk, on Linux this is a name assigned
|
|
|
709dde |
# by device mapper
|
|
|
709dde |
@@ -867,7 +867,7 @@
|
|
|
709dde |
# Since 5.2
|
|
|
709dde |
##
|
|
|
709dde |
{ 'struct': 'GuestDiskInfo',
|
|
|
709dde |
- 'data': {'name': 'str', 'partition': 'bool', 'dependents': ['str'],
|
|
|
709dde |
+ 'data': {'name': 'str', 'partition': 'bool', '*dependencies': ['str'],
|
|
|
709dde |
'*address': 'GuestDiskAddress', '*alias': 'str'} }
|
|
|
709dde |
|
|
|
709dde |
##
|
|
|
709dde |
--
|
|
|
709dde |
2.27.0
|
|
|
709dde |
|