1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

conf: drop virCapsPtr param from snapshot & checkpoint APIs

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2019-11-27 13:10:21 +00:00
parent 1cd2b2d545
commit 575d9d2504
12 changed files with 29 additions and 63 deletions

View File

@ -115,13 +115,10 @@ virDomainCheckpointDiskDefParseXML(xmlNodePtr node,
return 0;
}
/* flags is bitwise-or of virDomainCheckpointParseFlags. If flags
* does not include VIR_DOMAIN_CHECKPOINT_PARSE_REDEFINE, then caps
* is ignored.
/* flags is bitwise-or of virDomainCheckpointParseFlags.
*/
static virDomainCheckpointDefPtr
virDomainCheckpointDefParse(xmlXPathContextPtr ctxt,
virCapsPtr caps G_GNUC_UNUSED,
virDomainXMLOptionPtr xmlopt,
void *parseOpaque,
unsigned int flags)
@ -201,7 +198,6 @@ virDomainCheckpointDefParse(xmlXPathContextPtr ctxt,
static virDomainCheckpointDefPtr
virDomainCheckpointDefParseNode(xmlDocPtr xml,
xmlNodePtr root,
virCapsPtr caps,
virDomainXMLOptionPtr xmlopt,
void *parseOpaque,
unsigned int flags)
@ -227,12 +223,11 @@ virDomainCheckpointDefParseNode(xmlDocPtr xml,
return NULL;
ctxt->node = root;
return virDomainCheckpointDefParse(ctxt, caps, xmlopt, parseOpaque, flags);
return virDomainCheckpointDefParse(ctxt, xmlopt, parseOpaque, flags);
}
virDomainCheckpointDefPtr
virDomainCheckpointDefParseString(const char *xmlStr,
virCapsPtr caps,
virDomainXMLOptionPtr xmlopt,
void *parseOpaque,
unsigned int flags)
@ -244,7 +239,7 @@ virDomainCheckpointDefParseString(const char *xmlStr,
if ((xml = virXMLParse(NULL, xmlStr, _("(domain_checkpoint)")))) {
xmlKeepBlanksDefault(keepBlanksDefault);
ret = virDomainCheckpointDefParseNode(xml, xmlDocGetRootElement(xml),
caps, xmlopt, parseOpaque, flags);
xmlopt, parseOpaque, flags);
xmlFreeDoc(xml);
}
xmlKeepBlanksDefault(keepBlanksDefault);
@ -446,7 +441,6 @@ virDomainCheckpointDiskDefFormat(virBufferPtr buf,
static int
virDomainCheckpointDefFormatInternal(virBufferPtr buf,
virDomainCheckpointDefPtr def,
virCapsPtr caps G_GNUC_UNUSED,
virDomainXMLOptionPtr xmlopt,
unsigned int flags)
{
@ -505,7 +499,6 @@ virDomainCheckpointDefFormatInternal(virBufferPtr buf,
char *
virDomainCheckpointDefFormat(virDomainCheckpointDefPtr def,
virCapsPtr caps,
virDomainXMLOptionPtr xmlopt,
unsigned int flags)
{
@ -514,7 +507,7 @@ virDomainCheckpointDefFormat(virDomainCheckpointDefPtr def,
virCheckFlags(VIR_DOMAIN_CHECKPOINT_FORMAT_SECURE |
VIR_DOMAIN_CHECKPOINT_FORMAT_NO_DOMAIN |
VIR_DOMAIN_CHECKPOINT_FORMAT_SIZE, NULL);
if (virDomainCheckpointDefFormatInternal(&buf, def, caps, xmlopt,
if (virDomainCheckpointDefFormatInternal(&buf, def, xmlopt,
flags) < 0)
return NULL;

View File

@ -74,7 +74,6 @@ virDomainCheckpointFormatConvertXMLFlags(unsigned int flags);
virDomainCheckpointDefPtr
virDomainCheckpointDefParseString(const char *xmlStr,
virCapsPtr caps,
virDomainXMLOptionPtr xmlopt,
void *parseOpaque,
unsigned int flags);
@ -84,7 +83,6 @@ virDomainCheckpointDefNew(void);
char *
virDomainCheckpointDefFormat(virDomainCheckpointDefPtr def,
virCapsPtr caps,
virDomainXMLOptionPtr xmlopt,
unsigned int flags);

View File

@ -216,13 +216,11 @@ virDomainSnapshotDiskDefParseXML(xmlNodePtr node,
}
/* flags is bitwise-or of virDomainSnapshotParseFlags.
* If flags does not include VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE, then
* caps are ignored. If flags does not include
* If flags does not include
* VIR_DOMAIN_SNAPSHOT_PARSE_INTERNAL, then current is ignored.
*/
static virDomainSnapshotDefPtr
virDomainSnapshotDefParse(xmlXPathContextPtr ctxt,
virCapsPtr caps G_GNUC_UNUSED,
virDomainXMLOptionPtr xmlopt,
void *parseOpaque,
bool *current,
@ -420,7 +418,6 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt,
virDomainSnapshotDefPtr
virDomainSnapshotDefParseNode(xmlDocPtr xml,
xmlNodePtr root,
virCapsPtr caps,
virDomainXMLOptionPtr xmlopt,
void *parseOpaque,
bool *current,
@ -449,12 +446,11 @@ virDomainSnapshotDefParseNode(xmlDocPtr xml,
return NULL;
ctxt->node = root;
return virDomainSnapshotDefParse(ctxt, caps, xmlopt, parseOpaque, current, flags);
return virDomainSnapshotDefParse(ctxt, xmlopt, parseOpaque, current, flags);
}
virDomainSnapshotDefPtr
virDomainSnapshotDefParseString(const char *xmlStr,
virCapsPtr caps,
virDomainXMLOptionPtr xmlopt,
void *parseOpaque,
bool *current,
@ -467,7 +463,7 @@ virDomainSnapshotDefParseString(const char *xmlStr,
if ((xml = virXMLParse(NULL, xmlStr, _("(domain_snapshot)")))) {
xmlKeepBlanksDefault(keepBlanksDefault);
ret = virDomainSnapshotDefParseNode(xml, xmlDocGetRootElement(xml),
caps, xmlopt, parseOpaque,
xmlopt, parseOpaque,
current, flags);
xmlFreeDoc(xml);
}
@ -838,7 +834,6 @@ static int
virDomainSnapshotDefFormatInternal(virBufferPtr buf,
const char *uuidstr,
virDomainSnapshotDefPtr def,
virCapsPtr caps G_GNUC_UNUSED,
virDomainXMLOptionPtr xmlopt,
unsigned int flags)
{
@ -931,7 +926,6 @@ virDomainSnapshotDefFormatInternal(virBufferPtr buf,
char *
virDomainSnapshotDefFormat(const char *uuidstr,
virDomainSnapshotDefPtr def,
virCapsPtr caps,
virDomainXMLOptionPtr xmlopt,
unsigned int flags)
{
@ -940,7 +934,7 @@ virDomainSnapshotDefFormat(const char *uuidstr,
virCheckFlags(VIR_DOMAIN_SNAPSHOT_FORMAT_SECURE |
VIR_DOMAIN_SNAPSHOT_FORMAT_INTERNAL |
VIR_DOMAIN_SNAPSHOT_FORMAT_CURRENT, NULL);
if (virDomainSnapshotDefFormatInternal(&buf, uuidstr, def, caps,
if (virDomainSnapshotDefFormatInternal(&buf, uuidstr, def,
xmlopt, flags) < 0)
return NULL;

View File

@ -107,14 +107,12 @@ typedef enum {
unsigned int virDomainSnapshotFormatConvertXMLFlags(unsigned int flags);
virDomainSnapshotDefPtr virDomainSnapshotDefParseString(const char *xmlStr,
virCapsPtr caps,
virDomainXMLOptionPtr xmlopt,
void *parseOpaque,
bool *current,
unsigned int flags);
virDomainSnapshotDefPtr virDomainSnapshotDefParseNode(xmlDocPtr xml,
xmlNodePtr root,
virCapsPtr caps,
virDomainXMLOptionPtr xmlopt,
void *parseOpaque,
bool *current,
@ -122,7 +120,6 @@ virDomainSnapshotDefPtr virDomainSnapshotDefParseNode(xmlDocPtr xml,
virDomainSnapshotDefPtr virDomainSnapshotDefNew(void);
char *virDomainSnapshotDefFormat(const char *uuidstr,
virDomainSnapshotDefPtr def,
virCapsPtr caps,
virDomainXMLOptionPtr xmlopt,
unsigned int flags);
int virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr snapshot,

View File

@ -4075,7 +4075,7 @@ esxDomainSnapshotCreateXML(virDomainPtr domain, const char *xmlDesc,
if (esxVI_EnsureSession(priv->primary) < 0)
return NULL;
def = virDomainSnapshotDefParseString(xmlDesc, priv->caps,
def = virDomainSnapshotDefParseString(xmlDesc,
priv->xmlopt, NULL, NULL, parse_flags);
if (!def)
@ -4176,7 +4176,7 @@ esxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
virUUIDFormat(snapshot->domain->uuid, uuid_string);
xml = virDomainSnapshotDefFormat(uuid_string, &def, priv->caps, priv->xmlopt,
xml = virDomainSnapshotDefFormat(uuid_string, &def, priv->xmlopt,
0);
cleanup:

View File

@ -78,7 +78,7 @@ qemuCheckpointObjFromCheckpoint(virDomainObjPtr vm,
static int
qemuCheckpointWriteMetadata(virDomainObjPtr vm,
virDomainMomentObjPtr checkpoint,
virCapsPtr caps,
virCapsPtr caps G_GNUC_UNUSED,
virDomainXMLOptionPtr xmlopt,
const char *checkpointDir)
{
@ -88,7 +88,7 @@ qemuCheckpointWriteMetadata(virDomainObjPtr vm,
g_autofree char *chkDir = NULL;
g_autofree char *chkFile = NULL;
newxml = virDomainCheckpointDefFormat(def, caps, xmlopt, flags);
newxml = virDomainCheckpointDefFormat(def, xmlopt, flags);
if (newxml == NULL)
return -1;
@ -494,7 +494,7 @@ qemuCheckpointCreateXML(virDomainPtr domain,
return NULL;
}
if (!(def = virDomainCheckpointDefParseString(xmlDesc, caps, driver->xmlopt,
if (!(def = virDomainCheckpointDefParseString(xmlDesc, driver->xmlopt,
priv->qemuCaps, parse_flags)))
return NULL;
/* Unlike snapshots, the RNG schema already ensured a sane filename. */
@ -548,7 +548,7 @@ qemuCheckpointGetXMLDesc(virDomainObjPtr vm,
chkdef = virDomainCheckpointObjGetDef(chk);
format_flags = virDomainCheckpointFormatConvertXMLFlags(flags);
return virDomainCheckpointDefFormat(chkdef, driver->caps, driver->xmlopt,
return virDomainCheckpointDefFormat(chkdef, driver->xmlopt,
format_flags);
}

View File

@ -9713,7 +9713,7 @@ qemuFindQemuImgBinary(virQEMUDriverPtr driver)
int
qemuDomainSnapshotWriteMetadata(virDomainObjPtr vm,
virDomainMomentObjPtr snapshot,
virCapsPtr caps,
virCapsPtr caps G_GNUC_UNUSED,
virDomainXMLOptionPtr xmlopt,
const char *snapshotDir)
{
@ -9729,7 +9729,7 @@ qemuDomainSnapshotWriteMetadata(virDomainObjPtr vm,
if (virDomainSnapshotGetCurrent(vm->snapshots) == snapshot)
flags |= VIR_DOMAIN_SNAPSHOT_FORMAT_CURRENT;
virUUIDFormat(vm->def->uuid, uuidstr);
newxml = virDomainSnapshotDefFormat(uuidstr, def, caps, xmlopt, flags);
newxml = virDomainSnapshotDefFormat(uuidstr, def, xmlopt, flags);
if (newxml == NULL)
return -1;

View File

@ -393,7 +393,6 @@ qemuDomainSnapshotLoad(virDomainObjPtr vm,
VIR_DOMAIN_SNAPSHOT_PARSE_DISKS |
VIR_DOMAIN_SNAPSHOT_PARSE_INTERNAL);
int ret = -1;
g_autoptr(virCaps) caps = NULL;
int direrr;
qemuDomainObjPrivatePtr priv;
@ -409,9 +408,6 @@ qemuDomainSnapshotLoad(virDomainObjPtr vm,
goto cleanup;
}
if (!(caps = virQEMUDriverGetCapabilities(qemu_driver, false)))
goto cleanup;
VIR_INFO("Scanning for snapshots for domain %s in %s", vm->def->name,
snapDir);
@ -440,7 +436,7 @@ qemuDomainSnapshotLoad(virDomainObjPtr vm,
continue;
}
def = virDomainSnapshotDefParseString(xmlStr, caps,
def = virDomainSnapshotDefParseString(xmlStr,
qemu_driver->xmlopt,
priv->qemuCaps, &cur,
flags);
@ -506,7 +502,6 @@ qemuDomainCheckpointLoad(virDomainObjPtr vm,
virDomainMomentObjPtr current = NULL;
unsigned int flags = VIR_DOMAIN_CHECKPOINT_PARSE_REDEFINE;
int ret = -1;
g_autoptr(virCaps) caps = NULL;
int direrr;
qemuDomainObjPrivatePtr priv;
@ -521,9 +516,6 @@ qemuDomainCheckpointLoad(virDomainObjPtr vm,
goto cleanup;
}
if (!(caps = virQEMUDriverGetCapabilities(qemu_driver, false)))
goto cleanup;
VIR_INFO("Scanning for checkpoints for domain %s in %s", vm->def->name,
chkDir);
@ -552,7 +544,7 @@ qemuDomainCheckpointLoad(virDomainObjPtr vm,
continue;
}
def = virDomainCheckpointDefParseString(xmlStr, caps,
def = virDomainCheckpointDefParseString(xmlStr,
qemu_driver->xmlopt,
priv->qemuCaps,
flags);
@ -15793,7 +15785,6 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
int align_location = VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL;
bool align_match = true;
g_autoptr(virQEMUDriverConfig) cfg = NULL;
g_autoptr(virCaps) caps = NULL;
qemuDomainObjPrivatePtr priv;
virDomainSnapshotState state;
g_autoptr(virDomainSnapshotDef) def = NULL;
@ -15834,9 +15825,6 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
if (qemuDomainSupportsCheckpointsBlockjobs(vm) < 0)
goto cleanup;
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
goto cleanup;
if (!vm->persistent && (flags & VIR_DOMAIN_SNAPSHOT_CREATE_HALT)) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("cannot halt after transient domain snapshot"));
@ -15849,7 +15837,7 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE)
parse_flags |= VIR_DOMAIN_SNAPSHOT_PARSE_VALIDATE;
if (!(def = virDomainSnapshotDefParseString(xmlDesc, caps, driver->xmlopt,
if (!(def = virDomainSnapshotDefParseString(xmlDesc, driver->xmlopt,
priv->qemuCaps, NULL, parse_flags)))
goto cleanup;
@ -16378,7 +16366,7 @@ qemuDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
virUUIDFormat(snapshot->domain->uuid, uuidstr);
xml = virDomainSnapshotDefFormat(uuidstr, virDomainSnapshotObjGetDef(snap),
driver->caps, driver->xmlopt,
driver->xmlopt,
virDomainSnapshotFormatConvertXMLFlags(flags));
cleanup:

View File

@ -884,7 +884,6 @@ testParseDomainSnapshots(testDriverPtr privconn,
goto error;
def = virDomainSnapshotDefParseNode(ctxt->doc, node,
privconn->caps,
privconn->xmlopt,
NULL,
&cur,
@ -8413,7 +8412,7 @@ testDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
virUUIDFormat(snapshot->domain->uuid, uuidstr);
xml = virDomainSnapshotDefFormat(uuidstr, virDomainSnapshotObjGetDef(snap),
privconn->caps, privconn->xmlopt,
privconn->xmlopt,
virDomainSnapshotFormatConvertXMLFlags(flags));
cleanup:
@ -8557,7 +8556,6 @@ testDomainSnapshotCreateXML(virDomainPtr domain,
parse_flags |= VIR_DOMAIN_SNAPSHOT_PARSE_VALIDATE;
if (!(def = virDomainSnapshotDefParseString(xmlDesc,
privconn->caps,
privconn->xmlopt,
NULL, NULL,
parse_flags)))
@ -9013,7 +9011,7 @@ testDomainCheckpointCreateXML(virDomainPtr domain,
goto cleanup;
}
if (!(def = virDomainCheckpointDefParseString(xmlDesc, privconn->caps,
if (!(def = virDomainCheckpointDefParseString(xmlDesc,
privconn->xmlopt, NULL,
parse_flags)))
goto cleanup;
@ -9216,7 +9214,7 @@ testDomainCheckpointGetXMLDesc(virDomainCheckpointPtr checkpoint,
}
format_flags = virDomainCheckpointFormatConvertXMLFlags(flags);
xml = virDomainCheckpointDefFormat(chkdef, privconn->caps,
xml = virDomainCheckpointDefFormat(chkdef,
privconn->xmlopt, format_flags);
cleanup:

View File

@ -5301,7 +5301,6 @@ vboxSnapshotRedefine(virDomainPtr dom,
currentSnapshotXmlFilePath = g_strdup_printf("%s%s.xml",
machineLocationPath, snapshotMachineDesc->currentSnapshot);
char *snapshotContent = virDomainSnapshotDefFormat(NULL, def,
data->caps,
data->xmlopt,
VIR_DOMAIN_SNAPSHOT_FORMAT_SECURE);
if (snapshotContent == NULL) {
@ -5431,7 +5430,7 @@ vboxDomainSnapshotCreateXML(virDomainPtr dom,
if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE)
parse_flags |= VIR_DOMAIN_SNAPSHOT_PARSE_VALIDATE;
if (!(def = virDomainSnapshotDefParseString(xmlDesc, data->caps,
if (!(def = virDomainSnapshotDefParseString(xmlDesc,
data->xmlopt, NULL, NULL,
parse_flags)))
goto cleanup;
@ -6244,7 +6243,7 @@ static char *vboxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
virUUIDFormat(dom->uuid, uuidstr);
memcpy(defdom->uuid, dom->uuid, VIR_UUID_BUFLEN);
ret = virDomainSnapshotDefFormat(uuidstr, def, data->caps, data->xmlopt, 0);
ret = virDomainSnapshotDefFormat(uuidstr, def, data->xmlopt, 0);
cleanup:
VBOX_RELEASE(parent);
@ -6858,7 +6857,6 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapshotPtr snapshot)
goto cleanup;
}
def = virDomainSnapshotDefParseString(defXml,
data->caps,
data->xmlopt, NULL, NULL,
VIR_DOMAIN_SNAPSHOT_PARSE_DISKS |
VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE);

View File

@ -53,7 +53,7 @@ testCompareXMLToXMLFiles(const char *inxml,
virTestLoadFile(outxml, &outXmlData) < 0)
return -1;
if (!(def = virDomainCheckpointDefParseString(inXmlData, driver.caps,
if (!(def = virDomainCheckpointDefParseString(inXmlData,
driver.xmlopt, NULL,
parseflags))) {
if (flags & TEST_INVALID)
@ -91,7 +91,7 @@ testCompareXMLToXMLFiles(const char *inxml,
if (!def->parent.dom)
formatflags |= VIR_DOMAIN_CHECKPOINT_FORMAT_NO_DOMAIN;
if (!(actual = virDomainCheckpointDefFormat(def, driver.caps,
if (!(actual = virDomainCheckpointDefFormat(def,
driver.xmlopt,
formatflags)))
return -1;

View File

@ -54,7 +54,7 @@ testCompareXMLToXMLFiles(const char *inxml,
if (virTestLoadFile(outxml, &outXmlData) < 0)
goto cleanup;
if (!(def = virDomainSnapshotDefParseString(inXmlData, driver.caps,
if (!(def = virDomainSnapshotDefParseString(inXmlData,
driver.xmlopt, NULL, &cur,
parseflags)))
goto cleanup;
@ -69,7 +69,7 @@ testCompareXMLToXMLFiles(const char *inxml,
def->state = VIR_DOMAIN_RUNNING;
}
if (!(actual = virDomainSnapshotDefFormat(uuid, def, driver.caps,
if (!(actual = virDomainSnapshotDefFormat(uuid, def,
driver.xmlopt,
formatflags)))
goto cleanup;