qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: peter.maydell@linaro.org, ehabkost@redhat.com,
	libvir-list@redhat.com, qemu-devel@nongnu.org,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	qemu-arm@nongnu.org, qemu-ppc@nongnu.org, pbonzini@redhat.com,
	Igor Mammedov <imammedo@redhat.com>,
	david@gibson.dropbear.id.au
Subject: Re: [Qemu-devel] [libvirt] [PATCH 1/2] numa: deprecate 'mem' parameter of '-numa node' option
Date: Mon, 4 Mar 2019 15:28:11 +0000	[thread overview]
Message-ID: <20190304152811.GO4239@redhat.com> (raw)
In-Reply-To: <87y35u3lth.fsf@dusky.pond.sub.org>

On Mon, Mar 04, 2019 at 12:45:14PM +0100, Markus Armbruster wrote:
> Daniel P. Berrangé <berrange@redhat.com> writes:
> 
> > On Mon, Mar 04, 2019 at 08:13:53AM +0100, Markus Armbruster wrote:
> >> If we deprecate outdated NUMA configurations now, we can start rejecting
> >> them with new machine types after a suitable grace period.
> >
> > How is libvirt going to know what machines it can use with the feature ?
> > We don't have any way to introspect machine type specific logic, since we
> > run all probing with "-machine none", and QEMU can't report anything about
> > machines without instantiating them.
> 
> Fair point.  A practical way for management applications to decide which
> of the two interfaces they can use with which machine type may be
> required for deprecating one of the interfaces with new machine types.

We currently have  "qom-list-properties" which can report on the
existance of properties registered against object types. What it
can't do though is report on the default values of these properties.

What's interesting though is that qmp_qom_list_properties will actually
instantiate objects in order to query properties, if the type isn't an
abstract type.

IOW, even if you are running "$QEMU -machine none", then if at the qmp-shell
you do

   (QEMU) qom-list-properties typename=pc-q35-2.6-machine

it will have actually instantiate the pc-q35-2.6-machine machine type.
Since it has instantiated the machine, the object initializer function
will have run and initialized the default values for various properties.

IOW, it is possible for qom-list-properties to report on default values
for non-abstract types.

I did a quick hack to PoC the theory:

diff --git a/qapi/misc.json b/qapi/misc.json
index 8b3ca4fdd3..906dfbf3b5 100644
--- a/qapi/misc.json
+++ b/qapi/misc.json
@@ -1368,7 +1368,8 @@
 # Since: 1.2
 ##
 { 'struct': 'ObjectPropertyInfo',
-  'data': { 'name': 'str', 'type': 'str', '*description': 'str' } }
+  'data': { 'name': 'str', 'type': 'str', '*description': 'str',
+            '*default': 'str'} }
 
 ##
 # @qom-list:
diff --git a/qmp.c b/qmp.c
index b92d62cd5f..a45669032c 100644
--- a/qmp.c
+++ b/qmp.c
@@ -594,6 +594,11 @@ ObjectPropertyInfoList *qmp_qom_list_properties(const char *typename,
         info->has_description = !!prop->description;
         info->description = g_strdup(prop->description);
 
+        if (obj && g_str_equal(info->type, "string")) {
+            info->q_default = g_strdup(object_property_get_str(obj, info->name, NULL));
+            info->has_q_default = info->q_default != NULL;
+        }
+
         entry = g_malloc0(sizeof(*entry));
         entry->value = info;
         entry->next = prop_list;


If we could make this hack less of a hack, then perhaps this is good
enough to cope reporting machine types which forbid use of "mem" in
favour of "memdev" ? They would need to have a property registered
against them of course to identify the "memdev" requirement.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

  reply	other threads:[~2019-03-04 15:28 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-01 15:42 [Qemu-devel] [PATCH 0/2] numa: deprecate -numa node, mem and default memory distribution Igor Mammedov
2019-03-01 15:42 ` [Qemu-devel] [PATCH 1/2] numa: deprecate 'mem' parameter of '-numa node' option Igor Mammedov
2019-03-01 15:49   ` [Qemu-devel] [libvirt] " Daniel P. Berrangé
2019-03-01 17:33     ` Igor Mammedov
2019-03-01 17:48       ` Daniel P. Berrangé
2019-03-04  7:13         ` Markus Armbruster
2019-03-04 10:19           ` Daniel P. Berrangé
2019-03-04 11:45             ` Markus Armbruster
2019-03-04 15:28               ` Daniel P. Berrangé [this message]
2019-03-04 15:46                 ` Igor Mammedov
2019-03-10 10:14                 ` Markus Armbruster
2019-03-04 14:24             ` Michal Privoznik
2019-03-04 15:03               ` Igor Mammedov
2019-03-04 12:25           ` Igor Mammedov
2019-03-04 12:39             ` Daniel P. Berrangé
2019-03-04 14:16               ` Igor Mammedov
2019-03-04 14:24                 ` Daniel P. Berrangé
2019-03-04 15:19                   ` Igor Mammedov
2019-03-04 16:12                     ` Michal Privoznik
2019-03-04 16:27                       ` Daniel P. Berrangé
2019-03-04 16:20                   ` Michal Privoznik
2019-03-04 16:31                     ` Dr. David Alan Gilbert
2019-03-04 16:35                     ` Daniel P. Berrangé
2019-03-06 19:03                       ` Igor Mammedov
2019-03-07  9:59                         ` Daniel P. Berrangé
2019-03-10 10:16                           ` Markus Armbruster
2019-03-06 19:56                     ` Igor Mammedov
2019-03-04 14:34                 ` Michal Privoznik
2019-03-04  8:11         ` [Qemu-devel] [Qemu-ppc] " Thomas Huth
2019-03-04 13:55           ` Igor Mammedov
2019-03-04 13:59             ` Daniel P. Berrangé
2019-03-04 14:54               ` Igor Mammedov
2019-03-04 15:02                 ` Daniel P. Berrangé
2019-03-04 16:45                   ` Igor Mammedov
2019-03-01 18:01       ` [Qemu-devel] " Dr. David Alan Gilbert
2019-03-04 13:52         ` Igor Mammedov
2019-03-01 15:42 ` [Qemu-devel] [PATCH 2/2] numa: deprecate implict memory distribution between nodes Igor Mammedov

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=20190304152811.GO4239@redhat.com \
    --to=berrange@redhat.com \
    --cc=armbru@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=dgilbert@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=libvir-list@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /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).