On 9/13/19 8:50 AM, marcandre.lureau@xxxxxxxxxx wrote:
From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
---
src/conf/domain_conf.c | 26 +++++++++++++++++---------
src/conf/domain_conf.h | 7 +++++--
2 files changed, 22 insertions(+), 11 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9e1c8babf8..e99e52dc5e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2820,13 +2820,19 @@ void virDomainShmemDefFree(virDomainShmemDefPtr def)
virDomainVideoDefPtr
-virDomainVideoDefNew(void)
+virDomainVideoDefNew(virDomainXMLOptionPtr xmlopt)
{
virDomainVideoDefPtr def;
if (VIR_ALLOC(def) < 0)
return NULL;
+ if (xmlopt && xmlopt->privateData.videoNew &&
+ !(def->privateData = xmlopt->privateData.videoNew())) {
+ VIR_FREE(def);
+ return NULL;
+ }
+
def->heads = 1;
return def;
}
@@ -2858,6 +2864,7 @@ void virDomainVideoDefFree(virDomainVideoDefPtr def)
return;
virDomainVideoDefClear(def);
+ virObjectUnref(def->privateData);
VIR_FREE(def);
}
@@ -5681,7 +5688,8 @@ virDomainDefPostParseVideo(virDomainDefPtr def,
static int
virDomainDefPostParseCommon(virDomainDefPtr def,
- struct virDomainDefPostParseDeviceIteratorData *data)
+ struct virDomainDefPostParseDeviceIteratorData *data,
+ virDomainXMLOptionPtr xmlopt)
{
size_t i;
@@ -5716,7 +5724,7 @@ virDomainDefPostParseCommon(virDomainDefPtr def,
if (virDomainDefPostParseTimer(def) < 0)
return -1;
- if (virDomainDefAddImplicitDevices(def) < 0)
+ if (virDomainDefAddImplicitDevices(def, xmlopt) < 0)
return -1;
if (virDomainDefPostParseVideo(def, data) < 0)
@@ -5842,7 +5850,7 @@ virDomainDefPostParse(virDomainDefPtr def,
if (virDomainDefPostParseCheckFailure(def, parseFlags, ret) < 0)
goto cleanup;
- if ((ret = virDomainDefPostParseCommon(def, &data)) < 0)
+ if ((ret = virDomainDefPostParseCommon(def, &data, xmlopt)) < 0)
goto cleanup;
if (xmlopt->config.assignAddressesCallback) {
@@ -15450,7 +15458,7 @@ virDomainVideoDefParseXML(virDomainXMLOptionPtr xmlopt,
VIR_AUTOFREE(char *) vgamem = NULL;
VIR_AUTOFREE(char *) primary = NULL;
- if (!(def = virDomainVideoDefNew()))
+ if (!(def = virDomainVideoDefNew(xmlopt)))
return NULL;
ctxt->node = node;
@@ -23771,7 +23779,7 @@ virDomainDefAddImplicitControllers(virDomainDefPtr def)
}
static int
-virDomainDefAddImplicitVideo(virDomainDefPtr def)
+virDomainDefAddImplicitVideo(virDomainDefPtr def, virDomainXMLOptionPtr xmlopt)
newline inbetween the arguments here, and all other similar locations
in src/vz there's a usage of virDomainDefAddImplicitDevices which will
need xmlopt passed in too. Otherwise:
Reviewed-by: Cole Robinson <crobinso@xxxxxxxxxx>
- Cole
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list