|
|
3e5111 |
From e43851128b407dea2a55a813bdbefc5a639f1914 Mon Sep 17 00:00:00 2001
|
|
|
3e5111 |
Message-Id: <e43851128b407dea2a55a813bdbefc5a639f1914@dist-git>
|
|
|
3e5111 |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
3e5111 |
Date: Fri, 2 Jun 2017 22:50:18 +0200
|
|
|
3e5111 |
Subject: [PATCH] qemu: Implement virSaveCookie object and callbacks
|
|
|
3e5111 |
|
|
|
3e5111 |
This patch implements a new save cookie object and callbacks for qemu
|
|
|
3e5111 |
driver. The actual useful content will be added in the object later.
|
|
|
3e5111 |
|
|
|
3e5111 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
3e5111 |
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
3e5111 |
(cherry picked from commit 215476b64226275ac090ca0e957bfca76ba1549e)
|
|
|
3e5111 |
|
|
|
3e5111 |
https://bugzilla.redhat.com/show_bug.cgi?id=1441662
|
|
|
3e5111 |
|
|
|
3e5111 |
Conflicts:
|
|
|
3e5111 |
src/qemu/qemu_domain.c - no qemuDomainLogContextClass in 7.4
|
|
|
3e5111 |
|
|
|
3e5111 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
3e5111 |
---
|
|
|
3e5111 |
src/qemu/qemu_conf.c | 2 +-
|
|
|
3e5111 |
src/qemu/qemu_domain.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
3e5111 |
src/qemu/qemu_domain.h | 9 ++++++
|
|
|
3e5111 |
3 files changed, 93 insertions(+), 1 deletion(-)
|
|
|
3e5111 |
|
|
|
3e5111 |
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
|
|
|
3e5111 |
index 96956b7779..51a42883dc 100644
|
|
|
3e5111 |
--- a/src/qemu/qemu_conf.c
|
|
|
3e5111 |
+++ b/src/qemu/qemu_conf.c
|
|
|
3e5111 |
@@ -909,7 +909,7 @@ virQEMUDriverCreateXMLConf(virQEMUDriverPtr driver)
|
|
|
3e5111 |
&virQEMUDriverPrivateDataCallbacks,
|
|
|
3e5111 |
&virQEMUDriverDomainXMLNamespace,
|
|
|
3e5111 |
&virQEMUDriverDomainABIStability,
|
|
|
3e5111 |
- NULL);
|
|
|
3e5111 |
+ &virQEMUDriverDomainSaveCookie);
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
|
|
|
3e5111 |
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
|
|
3e5111 |
index 09903bdd5f..63fcde8024 100644
|
|
|
3e5111 |
--- a/src/qemu/qemu_domain.c
|
|
|
3e5111 |
+++ b/src/qemu/qemu_domain.c
|
|
|
3e5111 |
@@ -120,6 +120,24 @@ struct _qemuDomainLogContext {
|
|
|
3e5111 |
virLogManagerPtr manager;
|
|
|
3e5111 |
};
|
|
|
3e5111 |
|
|
|
3e5111 |
+static virClassPtr qemuDomainSaveCookieClass;
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+static void qemuDomainSaveCookieDispose(void *obj);
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+static int
|
|
|
3e5111 |
+qemuDomainOnceInit(void)
|
|
|
3e5111 |
+{
|
|
|
3e5111 |
+ if (!(qemuDomainSaveCookieClass = virClassNew(virClassForObject(),
|
|
|
3e5111 |
+ "qemuDomainSaveCookie",
|
|
|
3e5111 |
+ sizeof(qemuDomainSaveCookie),
|
|
|
3e5111 |
+ qemuDomainSaveCookieDispose)))
|
|
|
3e5111 |
+ return -1;
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+ return 0;
|
|
|
3e5111 |
+}
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+VIR_ONCE_GLOBAL_INIT(qemuDomain)
|
|
|
3e5111 |
+
|
|
|
3e5111 |
const char *
|
|
|
3e5111 |
qemuDomainAsyncJobPhaseToString(qemuDomainAsyncJob job,
|
|
|
3e5111 |
int phase ATTRIBUTE_UNUSED)
|
|
|
3e5111 |
@@ -9080,3 +9098,68 @@ qemuDomainGetStorageSourceByDevstr(const char *devstr,
|
|
|
3e5111 |
VIR_FREE(target);
|
|
|
3e5111 |
return src;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+static void
|
|
|
3e5111 |
+qemuDomainSaveCookieDispose(void *obj)
|
|
|
3e5111 |
+{
|
|
|
3e5111 |
+ qemuDomainSaveCookiePtr cookie = obj;
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+ VIR_DEBUG("cookie=%p", cookie);
|
|
|
3e5111 |
+}
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+qemuDomainSaveCookiePtr
|
|
|
3e5111 |
+qemuDomainSaveCookieNew(virDomainObjPtr vm ATTRIBUTE_UNUSED)
|
|
|
3e5111 |
+{
|
|
|
3e5111 |
+ qemuDomainSaveCookiePtr cookie = NULL;
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+ if (qemuDomainInitialize() < 0)
|
|
|
3e5111 |
+ goto error;
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+ if (!(cookie = virObjectNew(qemuDomainSaveCookieClass)))
|
|
|
3e5111 |
+ goto error;
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+ VIR_DEBUG("Save cookie %p", cookie);
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+ return cookie;
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+ error:
|
|
|
3e5111 |
+ virObjectUnref(cookie);
|
|
|
3e5111 |
+ return NULL;
|
|
|
3e5111 |
+}
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+static int
|
|
|
3e5111 |
+qemuDomainSaveCookieParse(xmlXPathContextPtr ctxt ATTRIBUTE_UNUSED,
|
|
|
3e5111 |
+ virObjectPtr *obj)
|
|
|
3e5111 |
+{
|
|
|
3e5111 |
+ qemuDomainSaveCookiePtr cookie = NULL;
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+ if (qemuDomainInitialize() < 0)
|
|
|
3e5111 |
+ goto error;
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+ if (!(cookie = virObjectNew(qemuDomainSaveCookieClass)))
|
|
|
3e5111 |
+ goto error;
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+ *obj = (virObjectPtr) cookie;
|
|
|
3e5111 |
+ return 0;
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+ error:
|
|
|
3e5111 |
+ virObjectUnref(cookie);
|
|
|
3e5111 |
+ return -1;
|
|
|
3e5111 |
+}
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+static int
|
|
|
3e5111 |
+qemuDomainSaveCookieFormat(virBufferPtr buf ATTRIBUTE_UNUSED,
|
|
|
3e5111 |
+ virObjectPtr obj ATTRIBUTE_UNUSED)
|
|
|
3e5111 |
+{
|
|
|
3e5111 |
+ return 0;
|
|
|
3e5111 |
+}
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+virSaveCookieCallbacks virQEMUDriverDomainSaveCookie = {
|
|
|
3e5111 |
+ .parse = qemuDomainSaveCookieParse,
|
|
|
3e5111 |
+ .format = qemuDomainSaveCookieFormat,
|
|
|
3e5111 |
+};
|
|
|
3e5111 |
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
|
|
|
3e5111 |
index 4db92fac8a..80d80e4554 100644
|
|
|
3e5111 |
--- a/src/qemu/qemu_domain.h
|
|
|
3e5111 |
+++ b/src/qemu/qemu_domain.h
|
|
|
3e5111 |
@@ -416,6 +416,14 @@ struct qemuProcessEvent {
|
|
|
3e5111 |
typedef struct _qemuDomainLogContext qemuDomainLogContext;
|
|
|
3e5111 |
typedef qemuDomainLogContext *qemuDomainLogContextPtr;
|
|
|
3e5111 |
|
|
|
3e5111 |
+typedef struct _qemuDomainSaveCookie qemuDomainSaveCookie;
|
|
|
3e5111 |
+typedef qemuDomainSaveCookie *qemuDomainSaveCookiePtr;
|
|
|
3e5111 |
+struct _qemuDomainSaveCookie {
|
|
|
3e5111 |
+ virObject parent;
|
|
|
3e5111 |
+};
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+qemuDomainSaveCookiePtr qemuDomainSaveCookieNew(virDomainObjPtr vm);
|
|
|
3e5111 |
+
|
|
|
3e5111 |
const char *qemuDomainAsyncJobPhaseToString(qemuDomainAsyncJob job,
|
|
|
3e5111 |
int phase);
|
|
|
3e5111 |
int qemuDomainAsyncJobPhaseFromString(qemuDomainAsyncJob job,
|
|
|
3e5111 |
@@ -640,6 +648,7 @@ extern virDomainXMLPrivateDataCallbacks virQEMUDriverPrivateDataCallbacks;
|
|
|
3e5111 |
extern virDomainXMLNamespace virQEMUDriverDomainXMLNamespace;
|
|
|
3e5111 |
extern virDomainDefParserConfig virQEMUDriverDomainDefParserConfig;
|
|
|
3e5111 |
extern virDomainABIStability virQEMUDriverDomainABIStability;
|
|
|
3e5111 |
+extern virSaveCookieCallbacks virQEMUDriverDomainSaveCookie;
|
|
|
3e5111 |
|
|
|
3e5111 |
int qemuDomainUpdateDeviceList(virQEMUDriverPtr driver,
|
|
|
3e5111 |
virDomainObjPtr vm, int asyncJob);
|
|
|
3e5111 |
--
|
|
|
3e5111 |
2.13.1
|
|
|
3e5111 |
|