[libvirt] [PATCH 03/12] vcpu: add new public API

Eric Blake eblake at redhat.com
Thu Sep 30 00:02:07 UTC 2010


API agreed on in
https://www.redhat.com/archives/libvir-list/2010-September/msg00456.html

* include/libvirt/libvirt.h.in (virDomainVcpuFlags)
(virDomainSetVcpusFlags, virDomainGetVcpusFlags): New
declarations.
* src/libvirt_public.syms: Export new symbols.
---

However, in implementing things, I'm wondering if I should use the names:

VIR_DOMAIN_VCPU_CONFIG (instead of VIR_DOMAIN_VCPU_PERSISTENT)
VIR_DOMAIN_VCPU_LIVE (instead of VIR_DOMAIN_VCPU_ACTIVE)

to match virDomainDeviceModifyFlags, where _CONFIG and _LIVE have
the same semantics of setting one or both aspects of a domain.

 include/libvirt/libvirt.h.in |   14 ++++++++++++++
 src/libvirt_public.syms      |    6 ++++++
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index b45f7ec..6bac8f1 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -826,8 +826,22 @@ struct _virVcpuInfo {
 };
 typedef virVcpuInfo *virVcpuInfoPtr;

+typedef enum {
+    /* Must choose at least one of these two bits; SetVcpus can choose both */
+    VIR_DOMAIN_VCPU_ACTIVE     = (1 << 0), /* Affect active domain */
+    VIR_DOMAIN_VCPU_PERSISTENT = (1 << 1), /* Affect next boot */
+
+    /* Additional flags to be bit-wise OR'd in */
+    VIR_DOMAIN_VCPU_MAXIMUM    = (1 << 2), /* Max rather than current count */
+} virDomainVcpuFlags;
+
 int                     virDomainSetVcpus       (virDomainPtr domain,
                                                  unsigned int nvcpus);
+int                     virDomainSetVcpusFlags  (virDomainPtr domain,
+                                                 unsigned int nvcpus,
+                                                 unsigned int flags);
+int                     virDomainGetVcpusFlags  (virDomainPtr domain,
+                                                 unsigned int flags);

 int                     virDomainPinVcpu        (virDomainPtr domain,
                                                  unsigned int vcpu,
diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
index 849c163..4e89723 100644
--- a/src/libvirt_public.syms
+++ b/src/libvirt_public.syms
@@ -405,4 +405,10 @@ LIBVIRT_0.8.2 {
         virDomainCreateWithFlags;
 } LIBVIRT_0.8.1;

+LIBVIRT_0.8.5 {
+    global:
+        virDomainGetVcpusFlags;
+        virDomainSetVcpusFlags;
+} LIBVIRT_0.8.2;
+
 # .... define new API here using predicted next version number ....
-- 
1.7.2.3




More information about the libvir-list mailing list