[libvirt] [PATCH 1/2] test: match qemu VIR_DOMAIN_DEF_FEATURE* usage

Cole Robinson posted 2 patches 6 years, 9 months ago
[libvirt] [PATCH 1/2] test: match qemu VIR_DOMAIN_DEF_FEATURE* usage
Posted by Cole Robinson 6 years, 9 months ago
Match the XML feature usage of the qemu driver, so the test driver
doesn't reject things like <os firmware='efi'/>.

Particularly VIR_DOMAIN_DEF_FEATURE_NET_MODEL_STRING is needed to
prevent regressions for test suite users with net model strings that
aren't in the virDomainNetModel enum yet

Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
 src/test/test_driver.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index d5eecf4b7f..24c1dc5adf 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -390,6 +390,14 @@ testDriverNew(void)
         .parse = testDomainDefNamespaceParse,
         .free = testDomainDefNamespaceFree,
     };
+    virDomainDefParserConfig config = {
+        .features = VIR_DOMAIN_DEF_FEATURE_MEMORY_HOTPLUG |
+                    VIR_DOMAIN_DEF_FEATURE_OFFLINE_VCPUPIN |
+                    VIR_DOMAIN_DEF_FEATURE_INDIVIDUAL_VCPUS |
+                    VIR_DOMAIN_DEF_FEATURE_USER_ALIAS |
+                    VIR_DOMAIN_DEF_FEATURE_FW_AUTOSELECT |
+                    VIR_DOMAIN_DEF_FEATURE_NET_MODEL_STRING,
+    };
     testDriverPtr ret;
 
     if (testDriverInitialize() < 0)
@@ -398,7 +406,7 @@ testDriverNew(void)
     if (!(ret = virObjectLockableNew(testDriverClass)))
         return NULL;
 
-    if (!(ret->xmlopt = virDomainXMLOptionNew(NULL, NULL, &ns, NULL, NULL)) ||
+    if (!(ret->xmlopt = virDomainXMLOptionNew(&config, NULL, &ns, NULL, NULL)) ||
         !(ret->eventState = virObjectEventStateNew()) ||
         !(ret->ifaces = virInterfaceObjListNew()) ||
         !(ret->domains = virDomainObjListNew()) ||
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/2] test: match qemu VIR_DOMAIN_DEF_FEATURE* usage
Posted by Andrea Bolognani 6 years, 9 months ago
On Wed, 2019-04-17 at 10:57 -0400, Cole Robinson wrote:
[...]
> +    virDomainDefParserConfig config = {
> +        .features = VIR_DOMAIN_DEF_FEATURE_MEMORY_HOTPLUG |
> +                    VIR_DOMAIN_DEF_FEATURE_OFFLINE_VCPUPIN |
> +                    VIR_DOMAIN_DEF_FEATURE_INDIVIDUAL_VCPUS |
> +                    VIR_DOMAIN_DEF_FEATURE_USER_ALIAS |
> +                    VIR_DOMAIN_DEF_FEATURE_FW_AUTOSELECT |
> +                    VIR_DOMAIN_DEF_FEATURE_NET_MODEL_STRING,
> +    };

virDomainDefParserConfig instances in other drivers usually follow
the (vir)${DRIVER}DomainDefParserConfig, so I would do the same here
and call it something like testDomainDefParserConfig.

Either way,

  Reviewed-by: Andrea Bolognani <abologna@redhat.com>

and safe for freeze.

The second patch in the series is not as urgent, nor is it as
obviously correct, so I'll probably look at it once 5.3.0 is out.

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/2] test: match qemu VIR_DOMAIN_DEF_FEATURE* usage
Posted by Cole Robinson 6 years, 9 months ago
On 4/30/19 12:20 PM, Andrea Bolognani wrote:
> On Wed, 2019-04-17 at 10:57 -0400, Cole Robinson wrote:
> [...]
>> +    virDomainDefParserConfig config = {
>> +        .features = VIR_DOMAIN_DEF_FEATURE_MEMORY_HOTPLUG |
>> +                    VIR_DOMAIN_DEF_FEATURE_OFFLINE_VCPUPIN |
>> +                    VIR_DOMAIN_DEF_FEATURE_INDIVIDUAL_VCPUS |
>> +                    VIR_DOMAIN_DEF_FEATURE_USER_ALIAS |
>> +                    VIR_DOMAIN_DEF_FEATURE_FW_AUTOSELECT |
>> +                    VIR_DOMAIN_DEF_FEATURE_NET_MODEL_STRING,
>> +    };
> 
> virDomainDefParserConfig instances in other drivers usually follow
> the (vir)${DRIVER}DomainDefParserConfig, so I would do the same here
> and call it something like testDomainDefParserConfig.
> 

Sorry I forgot to make this change before pushing...

> Either way,
> 
>   Reviewed-by: Andrea Bolognani <abologna@redhat.com>
> 
> and safe for freeze.
> 

Thanks, I've pushed it now

> The second patch in the series is not as urgent, nor is it as
> obviously correct, so I'll probably look at it once 5.3.0 is out.
> 

Cool. No rush on that one, it's minor

- Cole

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list