[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 07/12] vcpu: make old API trivially wrap to new API

On 10/01/2010 09:26 AM, Matthias Bolte wrote:
@@ -2392,6 +2393,11 @@ esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
     esxVI_ManagedObjectReference *task = NULL;
     esxVI_TaskInfoState taskInfoState;

+    if (flags != VIR_DOMAIN_VCPU_ACTIVE) {
+        ESX_ERROR(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
+        return -1;
+    }

Why not use virCheckFlags here?

virCheckFlags is useful for the maximal set of permitted flags, regardless of whether they are set or cleared. This instance was going for zero semantic change, therefore we expect an exact flag set. At which point, checking for the exact flag is easier than checking for all supported flags and then an exact flag check.

See patch 11/12 for an example of how qemu replaces an exact flag check with virCheckFlags when we finally add real support for all flag combinations. The same thing can be done for esx when (and if) we figure out how to support all flag combinations.

Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]