[PATCH 3/8] schedinfo: Implemente the public API

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

 



---
 src/libvirt.c |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/src/libvirt.c b/src/libvirt.c
index 0da9885..fae83fe 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -4401,6 +4401,66 @@ error:
     return -1;
 }
 
+/**
+ * virDomainSetSchedulerParameters:
+ * @domain: pointer to domain object
+ * @params: pointer to scheduler parameter objects
+ * @nparams: number of scheduler parameter
+ *          (this value should be same or less than the returned value
+ *           nparams of virDomainGetSchedulerType)
+ * @flags: an OR'ed set of virDomainMemoryModFlags
+ *
+ * Change the scheduler parameters according to the specified flags
+ *
+ * @flags may include VIR_DOMAIN_SCHED_PARAMS_LIVE or
+ * VIR_DOMAIN_SCHED_PARAMS_CONFIG, both flags may be set, and both flags
+ * requires the domain is running.
+ * If VIR_DOMAIN_SCHED_PARAMS_LIVE is set, the change affects a running
+ * domain and will fail if the domain is not active.
+ * If VIR_DOMAIN_SCHED_PARAMS_CONFIG is set, the change affects both the
+ * running and persistent domain config, and will fail for transient
+ * domains or the domain is not active.
+
+ * Returns -1 in case of error, 0 in case of success.
+ */
+int
+virDomainSetSchedulerParametersFlags(virDomainPtr domain,
+                                     virSchedParameterPtr params,
+                                     int nparams,
+                                     unsigned int flags)
+{
+    virConnectPtr conn;
+
+    VIR_DOMAIN_DEBUG(domain, "params=%p, nparams=%d", params, nparams);
+
+    virResetLastError();
+
+    if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virDispatchError(NULL);
+        return -1;
+    }
+    if (domain->conn->flags & VIR_CONNECT_RO) {
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        goto error;
+    }
+    conn = domain->conn;
+
+    if (conn->driver->domainSetSchedulerParametersFlags) {
+        int ret;
+        ret = conn->driver->domainSetSchedulerParametersFlags (domain, params, nparams, flags);
+        if (ret < 0)
+            goto error;
+        return ret;
+    }
+
+    virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+
+error:
+    virDispatchError(domain->conn);
+    return -1;
+}
+
 
 /**
  * virDomainBlockStats:
-- 
1.7.4

--
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]