1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-23 21:34:54 +03:00

conf: Don't use virDomainLiveConfigHelperMethod in virDomainObjGetMetadata

Few arguments of the function are not necessary any more which leads to
some cleanups. The 'uri' argument had a stray ATTRIBUTE_UNUSED.
This commit is contained in:
Peter Krempa 2016-07-01 16:19:58 +02:00
parent bc472bc2df
commit ef88140725
6 changed files with 6 additions and 35 deletions

View File

@ -1131,9 +1131,7 @@ bhyveDomainGetMetadata(virDomainPtr dom,
const char *uri,
unsigned int flags)
{
bhyveConnPtr privconn = dom->conn->privateData;
virDomainObjPtr vm;
virCapsPtr caps = NULL;
char *ret = NULL;
if (!(vm = bhyveDomObjFromDomain(dom)))
@ -1142,14 +1140,9 @@ bhyveDomainGetMetadata(virDomainPtr dom,
if (virDomainGetMetadataEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
if (!(caps = bhyveDriverGetCapabilities(privconn)))
goto cleanup;
ret = virDomainObjGetMetadata(vm, type, uri, caps,
privconn->xmlopt, flags);
ret = virDomainObjGetMetadata(vm, type, uri, flags);
cleanup:
virObjectUnref(caps);
virObjectUnlock(vm);
return ret;
}

View File

@ -24781,9 +24781,7 @@ virDomainDefFindDevice(virDomainDefPtr def,
char *
virDomainObjGetMetadata(virDomainObjPtr vm,
int type,
const char *uri ATTRIBUTE_UNUSED,
virCapsPtr caps,
virDomainXMLOptionPtr xmlopt,
const char *uri,
unsigned int flags)
{
virDomainDefPtr def;
@ -24798,13 +24796,9 @@ virDomainObjGetMetadata(virDomainObjPtr vm,
goto cleanup;
}
if (virDomainLiveConfigHelperMethod(caps, xmlopt, vm, &flags, &def) < 0)
if (!(def = virDomainObjGetOneDef(vm, flags)))
goto cleanup;
/* use correct domain definition according to flags */
if (flags & VIR_DOMAIN_AFFECT_LIVE)
def = vm->def;
switch ((virDomainMetadataType) type) {
case VIR_DOMAIN_METADATA_DESCRIPTION:
if (VIR_STRDUP(ret, def->description) < 0)

View File

@ -3052,8 +3052,6 @@ void virDomainChrSourceDefClear(virDomainChrSourceDefPtr def);
char *virDomainObjGetMetadata(virDomainObjPtr vm,
int type,
const char *uri,
virCapsPtr caps,
virDomainXMLOptionPtr xmlopt,
unsigned int flags);
int virDomainObjSetMetadata(virDomainObjPtr vm,

View File

@ -5381,8 +5381,6 @@ lxcDomainGetMetadata(virDomainPtr dom,
const char *uri,
unsigned int flags)
{
virLXCDriverPtr driver = dom->conn->privateData;
virCapsPtr caps = NULL;
virDomainObjPtr vm;
char *ret = NULL;
@ -5392,14 +5390,10 @@ lxcDomainGetMetadata(virDomainPtr dom,
if (virDomainGetMetadataEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
if (!(caps = virLXCDriverGetCapabilities(driver, false)))
goto cleanup;
ret = virDomainObjGetMetadata(vm, type, uri, caps, driver->xmlopt, flags);
ret = virDomainObjGetMetadata(vm, type, uri, flags);
cleanup:
virDomainObjEndAPI(&vm);
virObjectUnref(caps);
return ret;
}

View File

@ -17576,8 +17576,6 @@ qemuDomainGetMetadata(virDomainPtr dom,
const char *uri,
unsigned int flags)
{
virQEMUDriverPtr driver = dom->conn->privateData;
virCapsPtr caps = NULL;
virDomainObjPtr vm;
char *ret = NULL;
@ -17587,14 +17585,10 @@ qemuDomainGetMetadata(virDomainPtr dom,
if (virDomainGetMetadataEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
goto cleanup;
ret = virDomainObjGetMetadata(vm, type, uri, caps, driver->xmlopt, flags);
ret = virDomainObjGetMetadata(vm, type, uri, flags);
cleanup:
virDomainObjEndAPI(&vm);
virObjectUnref(caps);
return ret;
}

View File

@ -2659,7 +2659,6 @@ static char *testDomainGetMetadata(virDomainPtr dom,
const char *uri,
unsigned int flags)
{
testDriverPtr privconn = dom->conn->privateData;
virDomainObjPtr privdom;
char *ret;
@ -2669,8 +2668,7 @@ static char *testDomainGetMetadata(virDomainPtr dom,
if (!(privdom = testDomObjFromDomain(dom)))
return NULL;
ret = virDomainObjGetMetadata(privdom, type, uri, privconn->caps,
privconn->xmlopt, flags);
ret = virDomainObjGetMetadata(privdom, type, uri, flags);
virDomainObjEndAPI(&privdom);
return ret;