From: Vineeth Pillai <viremana(a)linux.microsoft.com>
Signed-off-by: Vineeth Pillai <viremana(a)linux.microsoft.com>
Signed-off-by: Praveen K Paladugu <prapal(a)linux.microsoft.com>
---
src/ch/ch_domain.c | 50 +++++++++++++++++++++++++++++++++++++++++-----
src/ch/ch_domain.h | 11 ++++++++++
2 files changed, 56 insertions(+), 5 deletions(-)
diff --git a/src/ch/ch_domain.c b/src/ch/ch_domain.c
index bf4ce83595..36333a8a3f 100644
--- a/src/ch/ch_domain.c
+++ b/src/ch/ch_domain.c
@@ -164,11 +164,6 @@ virCHDomainObjPrivateFree(void *data)
g_free(priv);
}
-virDomainXMLPrivateDataCallbacks virCHDriverPrivateDataCallbacks = {
- .alloc = virCHDomainObjPrivateAlloc,
- .free = virCHDomainObjPrivateFree,
-};
-
static int
virCHDomainDefPostParseBasic(virDomainDef *def,
void *opaque G_GNUC_UNUSED)
@@ -185,6 +180,45 @@ virCHDomainDefPostParseBasic(virDomainDef *def,
return 0;
}
+static virClass *virCHDomainVcpuPrivateClass;
+static void virCHDomainVcpuPrivateDispose(void *obj);
+
+static int
+virCHDomainVcpuPrivateOnceInit(void)
+{
+ if (!VIR_CLASS_NEW(virCHDomainVcpuPrivate, virClassForObject()))
+ return -1;
+
+ return 0;
+}
+
+VIR_ONCE_GLOBAL_INIT(virCHDomainVcpuPrivate);
+
+static virObject *
+virCHDomainVcpuPrivateNew(void)
+{
+ virCHDomainVcpuPrivate *priv;
+
+ if (virCHDomainVcpuPrivateInitialize() < 0)
+ return NULL;
+
+ if (!(priv = virObjectNew(virCHDomainVcpuPrivateClass)))
+ return NULL;
+
+ return (virObject *) priv;
+}
+
+
+static void
+virCHDomainVcpuPrivateDispose(void *obj)
+{
+ virCHDomainVcpuPrivate *priv = obj;
+
+ priv->tid = 0;
+
+ return;
+}
+
static int
virCHDomainDefPostParse(virDomainDef *def,
unsigned int parseFlags G_GNUC_UNUSED,
@@ -203,6 +237,12 @@ virCHDomainDefPostParse(virDomainDef *def,
return 0;
}
+virDomainXMLPrivateDataCallbacks virCHDriverPrivateDataCallbacks = {
+ .alloc = virCHDomainObjPrivateAlloc,
+ .free = virCHDomainObjPrivateFree,
+ .vcpuNew = virCHDomainVcpuPrivateNew,
+};
+
static int
chValidateDomainDeviceDef(const virDomainDeviceDef *dev,
const virDomainDef *def G_GNUC_UNUSED,
diff --git a/src/ch/ch_domain.h b/src/ch/ch_domain.h
index c053b25c65..f01c0e5ad0 100644
--- a/src/ch/ch_domain.h
+++ b/src/ch/ch_domain.h
@@ -62,6 +62,17 @@ struct _virCHDomainObjPrivate {
virCHMonitor *virCHDomainGetMonitor(virDomainObj *vm);
+typedef struct _virCHDomainVcpuPrivate virCHDomainVcpuPrivate;
+struct _virCHDomainVcpuPrivate {
+ virObject parent;
+
+ pid_t tid; /* vcpu thread id */
+ virTristateBool halted;
+};
+
+#define CH_DOMAIN_VCPU_PRIVATE(vcpu) \
+ ((virCHDomainVcpuPrivate *) (vcpu)->privateData)
+
extern virDomainXMLPrivateDataCallbacks virCHDriverPrivateDataCallbacks;
extern virDomainDefParserConfig virCHDriverDomainDefParserConfig;
--
2.27.0