From: Eric Blake <eblake@redhat.com>
To: Michael Roth <michael.roth@amd.com>, qemu-devel@nongnu.org
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Tomáš Golembiovský" <tgolembi@redhat.com>
Subject: Re: [PATCH for-5.2] qga: update schema for guest-get-disks 'dependents' field
Date: Mon, 16 Nov 2020 10:06:51 -0600 [thread overview]
Message-ID: <b1eef574-0398-2a29-36fa-f89e1aeaa564@redhat.com> (raw)
In-Reply-To: <20201113183312.432630-1-michael.roth@amd.com>
On 11/13/20 12:33 PM, Michael Roth wrote:
> The recently-added 'guest-get-disk' command returns a list of
> GuestDiskInfo entries, which in turn have a 'dependents' field which
> lists devices these entries are dependent upon. Thus, 'dependencies'
> is a better name for this field. Address this by renaming the field
> accordingly.
>
> Additionally, 'dependents' is specified as non-optional, even though
> it's not implemented for w32. This is misleading, since it gives users
> the impression that a particular disk might not have dependencies,
> when in reality that information is simply not known to the guest
> agent. Address this by making 'dependents' an optional field, and only
> marking it as in-use when the facilities to obtain this information are
> available to the guest agent.
>
> Cc: Eric Blake <eblake@redhat.com>
> Cc: Tomáš Golembiovský <tgolembi@redhat.com>
> Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
> Signed-off-by: Michael Roth <michael.roth@amd.com>
> ---
> qga/commands-posix.c | 10 ++++++----
> qga/qapi-schema.json | 8 ++++----
> 2 files changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/qga/commands-posix.c b/qga/commands-posix.c
> index 12c1ba5ef7..c089e38120 100644
> --- a/qga/commands-posix.c
> +++ b/qga/commands-posix.c
> @@ -1285,6 +1285,7 @@ static void get_disk_deps(const char *disk_dir, GuestDiskInfo *disk)
> g_debug("failed to list entries in %s", deps_dir);
> return;
> }
> + disk->has_dependencies = true;
> while ((dep = g_dir_read_name(dp_deps)) != NULL) {
> g_autofree char *dep_dir = NULL;
> strList *dep_item = NULL;
> @@ -1297,8 +1298,8 @@ static void get_disk_deps(const char *disk_dir, GuestDiskInfo *disk)
> g_debug(" adding dependent device: %s", dev_name);
> dep_item = g_new0(strList, 1);
> dep_item->value = dev_name;
> - dep_item->next = disk->dependents;
> - disk->dependents = dep_item;
> + dep_item->next = disk->dependencies;
> + disk->dependencies = dep_item;
You could use QAPI_LIST_PREPEND() here (which was just recently added);
but if not, then my work to use that macro in more places in 6.0 will
revisit this code.
> }
> }
> g_dir_close(dp_deps);
> @@ -1351,8 +1352,9 @@ static GuestDiskInfoList *get_disk_partitions(
> partition->name = dev_name;
> partition->partition = true;
> /* Add parent disk as dependent for easier tracking of hierarchy */
> - partition->dependents = g_new0(strList, 1);
> - partition->dependents->value = g_strdup(disk_dev);
> + partition->dependencies = g_new0(strList, 1);
> + partition->dependencies->value = g_strdup(disk_dev);
Same here.
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
prev parent reply other threads:[~2020-11-16 16:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-13 18:33 [PATCH for-5.2] qga: update schema for guest-get-disks 'dependents' field Michael Roth
2020-11-14 12:21 ` Marc-André Lureau
2020-11-16 16:06 ` Eric Blake [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b1eef574-0398-2a29-36fa-f89e1aeaa564@redhat.com \
--to=eblake@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=michael.roth@amd.com \
--cc=qemu-devel@nongnu.org \
--cc=tgolembi@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).