Re: [PATCH 3/3] vz: implement some domain API calls

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

 



On 10/14/2015 12:50 PM, Maxim Nestratov wrote:
From: Maxim Nestratov <mnestratov@xxxxxxxxxxxxx>

The following functions are implemented:

vzDomainIsUpdated, vzDomainGetVcpusFlags and vzDomainGetMaxVcpus.

Signed-off-by: Maxim Nestratov <mnestratov@xxxxxxxxxxxxx>

ACK

---
  src/vz/vz_driver.c |   53 ++++++++++++++++++++++++++++++++++++++++++++++++++++
  1 files changed, 53 insertions(+), 0 deletions(-)

diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index 8a311ed..6557816 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -1337,6 +1337,56 @@ vzDomainMemoryStats(virDomainPtr domain,
      return ret;
  }
+static int
+vzDomainGetVcpusFlags(virDomainPtr dom,
+                      unsigned int flags)
+{
+    virDomainObjPtr privdom = NULL;
+    int ret = -1;
+
+    virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
+                  VIR_DOMAIN_AFFECT_CONFIG |
+                  VIR_DOMAIN_VCPU_MAXIMUM, -1);
+
+    if (!(privdom = vzDomObjFromDomain(dom)))
+        goto cleanup;
+
+    if (flags & VIR_DOMAIN_VCPU_MAXIMUM)
+        ret = privdom->def->maxvcpus;
+    else
+        ret = privdom->def->vcpus;
+
+ cleanup:
+    if (privdom)
+        virObjectUnlock(privdom);
+
+    return ret;
+}
+
+static int vzDomainGetMaxVcpus(virDomainPtr dom)
+{
+    return vzDomainGetVcpusFlags(dom, (VIR_DOMAIN_AFFECT_LIVE |
+                                       VIR_DOMAIN_VCPU_MAXIMUM));
+}
+
+static int vzDomainIsUpdated(virDomainPtr dom)
+{
+    virDomainObjPtr privdom;
+    int ret = -1;
+
+    /* As far as VZ domains are always updated (e.g. current==persistent),
+     * we just check for domain existence */
+    if (!(privdom = vzDomObjFromDomain(dom)))
+        goto cleanup;
+
+    ret = 0;
+
+ cleanup:
+    if (privdom)
+        virObjectUnlock(privdom);
+    return ret;
+}
+
  static int vzConnectGetMaxVcpus(virConnectPtr conn ATTRIBUTE_UNUSED,
                                  const char *type)
  {
@@ -1437,6 +1487,9 @@ static virHypervisorDriver vzDriver = {
      .domainDetachDevice = vzDomainDetachDevice, /* 1.2.15 */
      .domainDetachDeviceFlags = vzDomainDetachDeviceFlags, /* 1.2.15 */
      .domainIsActive = vzDomainIsActive, /* 1.2.10 */
+    .domainIsUpdated = vzDomainIsUpdated,     /* 1.2.21 */
+    .domainGetVcpusFlags = vzDomainGetVcpusFlags, /* 1.2.21 */
+    .domainGetMaxVcpus = vzDomainGetMaxVcpus, /* 1.2.21 */
      .connectDomainEventRegisterAny = vzConnectDomainEventRegisterAny, /* 1.2.10 */
      .connectDomainEventDeregisterAny = vzConnectDomainEventDeregisterAny, /* 1.2.10 */
      .nodeGetCPUMap = vzNodeGetCPUMap, /* 1.2.8 */

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]