Signed-off-by: Dmitry Guryanov <dguryanov(a)parallels.com>
---
src/parallels/parallels_driver.c | 30 ++++++++++++++++++++++++++++++
src/parallels/parallels_sdk.c | 10 ++++++++++
src/parallels/parallels_sdk.h | 2 ++
3 files changed, 42 insertions(+)
diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index e0bd5ea..e35b55a 100644
--- a/src/parallels/parallels_driver.c
+++ b/src/parallels/parallels_driver.c
@@ -887,6 +887,34 @@ parallelsDomainCreateWithFlags(virDomainPtr domain, unsigned int
flags)
return prlsdkDomainCreate(domain);
}
+static int
+parallelsDomainUndefineFlags(virDomainPtr domain,
+ unsigned int flags)
+{
+ parallelsConnPtr privconn = domain->conn->privateData;
+ virDomainObjPtr dom = NULL;
+ int ret;
+
+ virCheckFlags(0, -1);
+
+ dom = virDomainObjListFindByUUID(privconn->domains, domain->uuid);
+ if (dom == NULL) {
+ parallelsDomNotFoundError(domain);
+ return -1;
+ }
+
+ ret = prlsdkUnregisterDomain(privconn, dom);
+ virObjectUnlock(dom);
+
+ return ret;
+}
+
+static int
+parallelsDomainUndefine(virDomainPtr domain)
+{
+ return parallelsDomainUndefineFlags(domain, 0);
+}
+
static virDriver parallelsDriver = {
.no = VIR_DRV_PARALLELS,
.name = "Parallels",
@@ -919,6 +947,8 @@ static virDriver parallelsDriver = {
.domainCreate = prlsdkDomainCreate, /* 0.10.0 */
.domainCreateWithFlags = parallelsDomainCreateWithFlags, /* 1.2.10 */
.domainDefineXML = parallelsDomainDefineXML, /* 0.10.0 */
+ .domainUndefine = parallelsDomainUndefine, /* 1.2.10 */
+ .domainUndefineFlags = parallelsDomainUndefineFlags, /* 1.2.10 */
.domainIsActive = parallelsDomainIsActive, /* 1.2.10 */
.connectDomainEventRegisterAny = parallelsConnectDomainEventRegisterAny, /* 1.2.10
*/
.connectDomainEventDeregisterAny = parallelsConnectDomainEventDeregisterAny, /*
1.2.10 */
diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c
index 8836a1b..4921523 100644
--- a/src/parallels/parallels_sdk.c
+++ b/src/parallels/parallels_sdk.c
@@ -2685,3 +2685,13 @@ prlsdkCreateCt(virConnectPtr conn, virDomainDefPtr def)
PrlHandle_Free(sdkdom);
return ret;
}
+
+int
+prlsdkUnregisterDomain(parallelsConnPtr privconn, virDomainObjPtr dom)
+{
+ parallelsDomObjPtr privdom = dom->privateData;
+ PRL_HANDLE job;
+
+ job = PrlVm_Unreg(privdom->sdkdom);
+ return waitJob(job, privconn->jobTimeout);
+}
diff --git a/src/parallels/parallels_sdk.h b/src/parallels/parallels_sdk.h
index 193d8ee..825d98e 100644
--- a/src/parallels/parallels_sdk.h
+++ b/src/parallels/parallels_sdk.h
@@ -45,3 +45,5 @@ prlsdkApplyConfig(virConnectPtr conn,
virDomainDefPtr new);
int prlsdkCreateVm(virConnectPtr conn, virDomainDefPtr def);
int prlsdkCreateCt(virConnectPtr conn, virDomainDefPtr def);
+int
+prlsdkUnregisterDomain(parallelsConnPtr privconn, virDomainObjPtr dom);
--
1.9.3