[PATCH] vz: implementation of domainSetUserPassword callback

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

 



---
 .gnulib            |  2 +-
 src/vz/vz_driver.c | 20 ++++++++++++++++++++
 src/vz/vz_sdk.c    | 31 +++++++++++++++++++++++++++++++
 src/vz/vz_sdk.h    |  5 ++++-
 4 files changed, 56 insertions(+), 2 deletions(-)

diff --git a/.gnulib b/.gnulib
index 8d807a9..6cc32c6 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit 8d807a99c6e8eecd2a9cf7c7b5d48ec0b2c934f8
+Subproject commit 6cc32c63e80bc1a30c521b2f07f2b54909b59892
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index 177a57a..b204248 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -1252,6 +1252,25 @@ static int vzDomainDetachDevice(virDomainPtr dom, const char *xml)
                                      VIR_DOMAIN_AFFECT_CONFIG | VIR_DOMAIN_AFFECT_LIVE);
 }
 
+static int
+vzDomainSetUserPassword(virDomainPtr domain,
+                        const char *user,
+                        const char *password,
+                        unsigned int flags)
+{
+    virDomainObjPtr dom = NULL;
+    int ret = -1;
+
+    virCheckFlags(0, -1);
+    if (!(dom = vzDomObjFromDomain(domain)))
+        return -1;
+
+    ret = prlsdkDomainSetUserPassword(dom, user, password);
+
+    virObjectUnlock(dom);
+    return ret;
+}
+
 static unsigned long long
 vzDomainGetMaxMemory(virDomainPtr domain)
 {
@@ -2716,6 +2735,7 @@ static virHypervisorDriver vzHypervisorDriver = {
     .domainIsUpdated = vzDomainIsUpdated,     /* 1.2.21 */
     .domainGetVcpusFlags = vzDomainGetVcpusFlags, /* 1.2.21 */
     .domainGetMaxVcpus = vzDomainGetMaxVcpus, /* 1.2.21 */
+    .domainSetUserPassword = vzDomainSetUserPassword, /* 1.2.16 */
     .connectDomainEventRegisterAny = vzConnectDomainEventRegisterAny, /* 1.2.10 */
     .connectDomainEventDeregisterAny = vzConnectDomainEventDeregisterAny, /* 1.2.10 */
     .nodeGetCPUMap = vzNodeGetCPUMap, /* 1.2.8 */
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 7eb78ca..4e06b7f 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -3565,6 +3565,37 @@ prlsdkSetBootOrderVm(PRL_HANDLE sdkdom, virDomainDefPtr def)
     return 0;
 }
 
+int
+prlsdkDomainSetUserPassword(virDomainObjPtr dom,
+                            const char *user,
+                            const char *password)
+{
+    int ret = -1;
+    vzDomObjPtr privdom = dom->privateData;
+    PRL_HANDLE job = PRL_INVALID_HANDLE;
+
+    job = PrlVm_BeginEdit(privdom->sdkdom);
+    if (PRL_FAILED(waitJob(job)))
+        goto cleanup;
+
+    job = PrlVm_SetUserPasswd(privdom->sdkdom,
+                              user,
+                              password,
+                              0);
+
+    if (PRL_FAILED(waitJob(job)))
+        goto cleanup;
+
+    job = PrlVm_CommitEx(privdom->sdkdom, 0);
+    if (PRL_FAILED(waitJob(job)))
+        goto cleanup;
+
+    ret = 0;
+
+ cleanup:
+    return ret;
+}
+
 static int
 prlsdkDoApplyConfig(vzDriverPtr driver,
                     PRL_HANDLE sdkdom,
diff --git a/src/vz/vz_sdk.h b/src/vz/vz_sdk.h
index f570560..a3c423a 100644
--- a/src/vz/vz_sdk.h
+++ b/src/vz/vz_sdk.h
@@ -82,7 +82,10 @@ void
 prlsdkDomObjFreePrivate(void *p);
 /* memsize is in MiB */
 int prlsdkSetMemsize(virDomainObjPtr dom, unsigned int memsize);
-
+int
+prlsdkDomainSetUserPassword(virDomainObjPtr dom,
+                            const char *user,
+                            const char *password);
 virDomainSnapshotObjListPtr prlsdkLoadSnapshots(virDomainObjPtr dom);
 int prlsdkCreateSnapshot(virDomainObjPtr dom, const char *description);
 int prlsdkDeleteSnapshot(virDomainObjPtr dom, const char *uuid, bool children);
-- 
1.8.3.1

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