mirror of https://gitee.com/openkylin/libvirt.git
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:
parent
bc472bc2df
commit
ef88140725
|
@ -1131,9 +1131,7 @@ bhyveDomainGetMetadata(virDomainPtr dom,
|
||||||
const char *uri,
|
const char *uri,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
bhyveConnPtr privconn = dom->conn->privateData;
|
|
||||||
virDomainObjPtr vm;
|
virDomainObjPtr vm;
|
||||||
virCapsPtr caps = NULL;
|
|
||||||
char *ret = NULL;
|
char *ret = NULL;
|
||||||
|
|
||||||
if (!(vm = bhyveDomObjFromDomain(dom)))
|
if (!(vm = bhyveDomObjFromDomain(dom)))
|
||||||
|
@ -1142,14 +1140,9 @@ bhyveDomainGetMetadata(virDomainPtr dom,
|
||||||
if (virDomainGetMetadataEnsureACL(dom->conn, vm->def) < 0)
|
if (virDomainGetMetadataEnsureACL(dom->conn, vm->def) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(caps = bhyveDriverGetCapabilities(privconn)))
|
ret = virDomainObjGetMetadata(vm, type, uri, flags);
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
ret = virDomainObjGetMetadata(vm, type, uri, caps,
|
|
||||||
privconn->xmlopt, flags);
|
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virObjectUnref(caps);
|
|
||||||
virObjectUnlock(vm);
|
virObjectUnlock(vm);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24781,9 +24781,7 @@ virDomainDefFindDevice(virDomainDefPtr def,
|
||||||
char *
|
char *
|
||||||
virDomainObjGetMetadata(virDomainObjPtr vm,
|
virDomainObjGetMetadata(virDomainObjPtr vm,
|
||||||
int type,
|
int type,
|
||||||
const char *uri ATTRIBUTE_UNUSED,
|
const char *uri,
|
||||||
virCapsPtr caps,
|
|
||||||
virDomainXMLOptionPtr xmlopt,
|
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virDomainDefPtr def;
|
virDomainDefPtr def;
|
||||||
|
@ -24798,13 +24796,9 @@ virDomainObjGetMetadata(virDomainObjPtr vm,
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virDomainLiveConfigHelperMethod(caps, xmlopt, vm, &flags, &def) < 0)
|
if (!(def = virDomainObjGetOneDef(vm, flags)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/* use correct domain definition according to flags */
|
|
||||||
if (flags & VIR_DOMAIN_AFFECT_LIVE)
|
|
||||||
def = vm->def;
|
|
||||||
|
|
||||||
switch ((virDomainMetadataType) type) {
|
switch ((virDomainMetadataType) type) {
|
||||||
case VIR_DOMAIN_METADATA_DESCRIPTION:
|
case VIR_DOMAIN_METADATA_DESCRIPTION:
|
||||||
if (VIR_STRDUP(ret, def->description) < 0)
|
if (VIR_STRDUP(ret, def->description) < 0)
|
||||||
|
|
|
@ -3052,8 +3052,6 @@ void virDomainChrSourceDefClear(virDomainChrSourceDefPtr def);
|
||||||
char *virDomainObjGetMetadata(virDomainObjPtr vm,
|
char *virDomainObjGetMetadata(virDomainObjPtr vm,
|
||||||
int type,
|
int type,
|
||||||
const char *uri,
|
const char *uri,
|
||||||
virCapsPtr caps,
|
|
||||||
virDomainXMLOptionPtr xmlopt,
|
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
|
|
||||||
int virDomainObjSetMetadata(virDomainObjPtr vm,
|
int virDomainObjSetMetadata(virDomainObjPtr vm,
|
||||||
|
|
|
@ -5381,8 +5381,6 @@ lxcDomainGetMetadata(virDomainPtr dom,
|
||||||
const char *uri,
|
const char *uri,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virLXCDriverPtr driver = dom->conn->privateData;
|
|
||||||
virCapsPtr caps = NULL;
|
|
||||||
virDomainObjPtr vm;
|
virDomainObjPtr vm;
|
||||||
char *ret = NULL;
|
char *ret = NULL;
|
||||||
|
|
||||||
|
@ -5392,14 +5390,10 @@ lxcDomainGetMetadata(virDomainPtr dom,
|
||||||
if (virDomainGetMetadataEnsureACL(dom->conn, vm->def) < 0)
|
if (virDomainGetMetadataEnsureACL(dom->conn, vm->def) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(caps = virLXCDriverGetCapabilities(driver, false)))
|
ret = virDomainObjGetMetadata(vm, type, uri, flags);
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
ret = virDomainObjGetMetadata(vm, type, uri, caps, driver->xmlopt, flags);
|
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
virObjectUnref(caps);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17576,8 +17576,6 @@ qemuDomainGetMetadata(virDomainPtr dom,
|
||||||
const char *uri,
|
const char *uri,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virQEMUDriverPtr driver = dom->conn->privateData;
|
|
||||||
virCapsPtr caps = NULL;
|
|
||||||
virDomainObjPtr vm;
|
virDomainObjPtr vm;
|
||||||
char *ret = NULL;
|
char *ret = NULL;
|
||||||
|
|
||||||
|
@ -17587,14 +17585,10 @@ qemuDomainGetMetadata(virDomainPtr dom,
|
||||||
if (virDomainGetMetadataEnsureACL(dom->conn, vm->def) < 0)
|
if (virDomainGetMetadataEnsureACL(dom->conn, vm->def) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
|
ret = virDomainObjGetMetadata(vm, type, uri, flags);
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
ret = virDomainObjGetMetadata(vm, type, uri, caps, driver->xmlopt, flags);
|
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
virObjectUnref(caps);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2659,7 +2659,6 @@ static char *testDomainGetMetadata(virDomainPtr dom,
|
||||||
const char *uri,
|
const char *uri,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
testDriverPtr privconn = dom->conn->privateData;
|
|
||||||
virDomainObjPtr privdom;
|
virDomainObjPtr privdom;
|
||||||
char *ret;
|
char *ret;
|
||||||
|
|
||||||
|
@ -2669,8 +2668,7 @@ static char *testDomainGetMetadata(virDomainPtr dom,
|
||||||
if (!(privdom = testDomObjFromDomain(dom)))
|
if (!(privdom = testDomObjFromDomain(dom)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ret = virDomainObjGetMetadata(privdom, type, uri, privconn->caps,
|
ret = virDomainObjGetMetadata(privdom, type, uri, flags);
|
||||||
privconn->xmlopt, flags);
|
|
||||||
|
|
||||||
virDomainObjEndAPI(&privdom);
|
virDomainObjEndAPI(&privdom);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue