提交 89026383 编写于 作者: D Daniel Henrique Barboza 提交者: Michal Privoznik

qemu_driver.c: remove unused 'cleanup' labels after g_auto*() changes

The g_auto*() changes made by the previous patches made a lot
of 'cleanup' labels obsolete. Let's remove them.
Suggested-by: NJán Tomko <jtomko@redhat.com>
Signed-off-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
上级 0108deb9
...@@ -1057,7 +1057,7 @@ qemuStateReload(void) ...@@ -1057,7 +1057,7 @@ qemuStateReload(void)
return 0; return 0;
if (!(caps = virQEMUDriverGetCapabilities(qemu_driver, false))) if (!(caps = virQEMUDriverGetCapabilities(qemu_driver, false)))
goto cleanup; return 0;
cfg = virQEMUDriverGetConfig(qemu_driver); cfg = virQEMUDriverGetConfig(qemu_driver);
virDomainObjListLoadAllConfigs(qemu_driver->domains, virDomainObjListLoadAllConfigs(qemu_driver->domains,
...@@ -1065,7 +1065,6 @@ qemuStateReload(void) ...@@ -1065,7 +1065,6 @@ qemuStateReload(void)
cfg->autostartDir, false, cfg->autostartDir, false,
caps, qemu_driver->xmlopt, caps, qemu_driver->xmlopt,
qemuNotifyLoadDomain, qemu_driver); qemuNotifyLoadDomain, qemu_driver);
cleanup:
return 0; return 0;
} }
...@@ -1181,18 +1180,15 @@ static int ...@@ -1181,18 +1180,15 @@ static int
qemuConnectURIProbe(char **uri) qemuConnectURIProbe(char **uri)
{ {
g_autoptr(virQEMUDriverConfig) cfg = NULL; g_autoptr(virQEMUDriverConfig) cfg = NULL;
int ret = -1;
if (qemu_driver == NULL) if (qemu_driver == NULL)
return 0; return 0;
cfg = virQEMUDriverGetConfig(qemu_driver); cfg = virQEMUDriverGetConfig(qemu_driver);
if (VIR_STRDUP(*uri, cfg->uri) < 0) if (VIR_STRDUP(*uri, cfg->uri) < 0)
goto cleanup; return -1;
ret = 0; return 0;
cleanup:
return ret;
} }
static virDrvOpenStatus qemuConnectOpen(virConnectPtr conn, static virDrvOpenStatus qemuConnectOpen(virConnectPtr conn,
...@@ -1335,20 +1331,15 @@ qemuConnectGetMaxVcpus(virConnectPtr conn G_GNUC_UNUSED, const char *type) ...@@ -1335,20 +1331,15 @@ qemuConnectGetMaxVcpus(virConnectPtr conn G_GNUC_UNUSED, const char *type)
static char *qemuConnectGetCapabilities(virConnectPtr conn) { static char *qemuConnectGetCapabilities(virConnectPtr conn) {
virQEMUDriverPtr driver = conn->privateData; virQEMUDriverPtr driver = conn->privateData;
char *xml = NULL;
g_autoptr(virCaps) caps = NULL; g_autoptr(virCaps) caps = NULL;
if (virConnectGetCapabilitiesEnsureACL(conn) < 0) if (virConnectGetCapabilitiesEnsureACL(conn) < 0)
return NULL; return NULL;
if (!(caps = virQEMUDriverGetCapabilities(driver, true))) if (!(caps = virQEMUDriverGetCapabilities(driver, true)))
goto cleanup; return NULL;
xml = virCapabilitiesFormatXML(caps);
cleanup:
return xml; return virCapabilitiesFormatXML(caps);
} }
...@@ -1691,7 +1682,6 @@ static int qemuDomainIsUpdated(virDomainPtr dom) ...@@ -1691,7 +1682,6 @@ static int qemuDomainIsUpdated(virDomainPtr dom)
static int qemuConnectGetVersion(virConnectPtr conn, unsigned long *version) static int qemuConnectGetVersion(virConnectPtr conn, unsigned long *version)
{ {
virQEMUDriverPtr driver = conn->privateData; virQEMUDriverPtr driver = conn->privateData;
int ret = -1;
unsigned int qemuVersion = 0; unsigned int qemuVersion = 0;
g_autoptr(virCaps) caps = NULL; g_autoptr(virCaps) caps = NULL;
...@@ -1699,18 +1689,15 @@ static int qemuConnectGetVersion(virConnectPtr conn, unsigned long *version) ...@@ -1699,18 +1689,15 @@ static int qemuConnectGetVersion(virConnectPtr conn, unsigned long *version)
return -1; return -1;
if (!(caps = virQEMUDriverGetCapabilities(driver, false))) if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
goto cleanup; return -1;
if (virQEMUCapsGetDefaultVersion(caps, if (virQEMUCapsGetDefaultVersion(caps,
driver->qemuCapsCache, driver->qemuCapsCache,
&qemuVersion) < 0) &qemuVersion) < 0)
goto cleanup; return -1;
*version = qemuVersion; *version = qemuVersion;
ret = 0; return 0;
cleanup:
return ret;
} }
...@@ -2902,7 +2889,6 @@ virQEMUSaveDataWrite(virQEMUSaveDataPtr data, ...@@ -2902,7 +2889,6 @@ virQEMUSaveDataWrite(virQEMUSaveDataPtr data,
size_t len; size_t len;
size_t xml_len; size_t xml_len;
size_t cookie_len = 0; size_t cookie_len = 0;
int ret = -1;
size_t zerosLen = 0; size_t zerosLen = 0;
g_autofree char *zeros = NULL; g_autofree char *zeros = NULL;
...@@ -2916,12 +2902,12 @@ virQEMUSaveDataWrite(virQEMUSaveDataPtr data, ...@@ -2916,12 +2902,12 @@ virQEMUSaveDataWrite(virQEMUSaveDataPtr data,
if (len > header->data_len) { if (len > header->data_len) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s", virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("new xml too large to fit in file")); _("new xml too large to fit in file"));
goto cleanup; return -1;
} }
zerosLen = header->data_len - len; zerosLen = header->data_len - len;
if (VIR_ALLOC_N(zeros, zerosLen) < 0) if (VIR_ALLOC_N(zeros, zerosLen) < 0)
goto cleanup; return -1;
} else { } else {
header->data_len = len; header->data_len = len;
} }
...@@ -2933,14 +2919,14 @@ virQEMUSaveDataWrite(virQEMUSaveDataPtr data, ...@@ -2933,14 +2919,14 @@ virQEMUSaveDataWrite(virQEMUSaveDataPtr data,
virReportSystemError(errno, virReportSystemError(errno,
_("failed to write header to domain save file '%s'"), _("failed to write header to domain save file '%s'"),
path); path);
goto cleanup; return -1;
} }
if (safewrite(fd, data->xml, xml_len) != xml_len) { if (safewrite(fd, data->xml, xml_len) != xml_len) {
virReportSystemError(errno, virReportSystemError(errno,
_("failed to write domain xml to '%s'"), _("failed to write domain xml to '%s'"),
path); path);
goto cleanup; return -1;
} }
if (data->cookie && if (data->cookie &&
...@@ -2948,20 +2934,17 @@ virQEMUSaveDataWrite(virQEMUSaveDataPtr data, ...@@ -2948,20 +2934,17 @@ virQEMUSaveDataWrite(virQEMUSaveDataPtr data,
virReportSystemError(errno, virReportSystemError(errno,
_("failed to write cookie to '%s'"), _("failed to write cookie to '%s'"),
path); path);
goto cleanup; return -1;
} }
if (safewrite(fd, zeros, zerosLen) != zerosLen) { if (safewrite(fd, zeros, zerosLen) != zerosLen) {
virReportSystemError(errno, virReportSystemError(errno,
_("failed to write padding to '%s'"), _("failed to write padding to '%s'"),
path); path);
goto cleanup; return -1;
} }
ret = 0; return 0;
cleanup:
return ret;
} }
...@@ -3031,7 +3014,6 @@ qemuOpenFile(virQEMUDriverPtr driver, ...@@ -3031,7 +3014,6 @@ qemuOpenFile(virQEMUDriverPtr driver,
int oflags, int oflags,
bool *needUnlink) bool *needUnlink)
{ {
int ret = -1;
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
uid_t user = cfg->user; uid_t user = cfg->user;
gid_t group = cfg->group; gid_t group = cfg->group;
...@@ -3043,13 +3025,10 @@ qemuOpenFile(virQEMUDriverPtr driver, ...@@ -3043,13 +3025,10 @@ qemuOpenFile(virQEMUDriverPtr driver,
(seclabel = virDomainDefGetSecurityLabelDef(vm->def, "dac")) != NULL && (seclabel = virDomainDefGetSecurityLabelDef(vm->def, "dac")) != NULL &&
seclabel->label != NULL && seclabel->label != NULL &&
(virParseOwnershipIds(seclabel->label, &user, &group) < 0)) (virParseOwnershipIds(seclabel->label, &user, &group) < 0))
goto cleanup; return -1;
ret = qemuOpenFileAs(user, group, dynamicOwnership,
path, oflags, needUnlink);
cleanup: return qemuOpenFileAs(user, group, dynamicOwnership,
return ret; path, oflags, needUnlink);
} }
static int static int
...@@ -4182,14 +4161,13 @@ doCoreDumpToAutoDumpPath(virQEMUDriverPtr driver, ...@@ -4182,14 +4161,13 @@ doCoreDumpToAutoDumpPath(virQEMUDriverPtr driver,
g_autofree char *dumpfile = getAutoDumpPath(driver, vm); g_autofree char *dumpfile = getAutoDumpPath(driver, vm);
if (!dumpfile) if (!dumpfile)
goto cleanup; return -1;
flags |= cfg->autoDumpBypassCache ? VIR_DUMP_BYPASS_CACHE: 0; flags |= cfg->autoDumpBypassCache ? VIR_DUMP_BYPASS_CACHE: 0;
if ((ret = doCoreDump(driver, vm, dumpfile, flags, if ((ret = doCoreDump(driver, vm, dumpfile, flags,
VIR_DOMAIN_CORE_DUMP_FORMAT_RAW)) < 0) VIR_DOMAIN_CORE_DUMP_FORMAT_RAW)) < 0)
virReportError(VIR_ERR_OPERATION_FAILED, virReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("Dump failed")); "%s", _("Dump failed"));
cleanup:
return ret; return ret;
} }
...@@ -4985,19 +4963,18 @@ qemuDomainSetVcpusMax(virQEMUDriverPtr driver, ...@@ -4985,19 +4963,18 @@ qemuDomainSetVcpusMax(virQEMUDriverPtr driver,
{ {
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
unsigned int topologycpus; unsigned int topologycpus;
int ret = -1;
if (def) { if (def) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("maximum vcpu count of a live domain can't be modified")); _("maximum vcpu count of a live domain can't be modified"));
goto cleanup; return -1;
} }
if (virDomainNumaGetCPUCountTotal(persistentDef->numa) > nvcpus) { if (virDomainNumaGetCPUCountTotal(persistentDef->numa) > nvcpus) {
virReportError(VIR_ERR_INVALID_ARG, "%s", virReportError(VIR_ERR_INVALID_ARG, "%s",
_("Number of CPUs in <numa> exceeds the desired " _("Number of CPUs in <numa> exceeds the desired "
"maximum vcpu count")); "maximum vcpu count"));
goto cleanup; return -1;
} }
if (virDomainDefGetVcpusTopology(persistentDef, &topologycpus) == 0 && if (virDomainDefGetVcpusTopology(persistentDef, &topologycpus) == 0 &&
...@@ -5006,22 +4983,19 @@ qemuDomainSetVcpusMax(virQEMUDriverPtr driver, ...@@ -5006,22 +4983,19 @@ qemuDomainSetVcpusMax(virQEMUDriverPtr driver,
* setting may be corrected via this API */ * setting may be corrected via this API */
virReportError(VIR_ERR_INVALID_ARG, "%s", virReportError(VIR_ERR_INVALID_ARG, "%s",
_("CPU topology doesn't match the desired vcpu count")); _("CPU topology doesn't match the desired vcpu count"));
goto cleanup; return -1;
} }
/* ordering information may become invalid, thus clear it */ /* ordering information may become invalid, thus clear it */
virDomainDefVcpuOrderClear(persistentDef); virDomainDefVcpuOrderClear(persistentDef);
if (virDomainDefSetVcpusMax(persistentDef, nvcpus, driver->xmlopt) < 0) if (virDomainDefSetVcpusMax(persistentDef, nvcpus, driver->xmlopt) < 0)
goto cleanup; return -1;
if (virDomainSaveConfig(cfg->configDir, driver->caps, persistentDef) < 0) if (virDomainSaveConfig(cfg->configDir, driver->caps, persistentDef) < 0)
goto cleanup; return -1;
ret = 0;
cleanup: return 0;
return ret;
} }
...@@ -6247,7 +6221,7 @@ qemuDomainChgIOThread(virQEMUDriverPtr driver, ...@@ -6247,7 +6221,7 @@ qemuDomainChgIOThread(virQEMUDriverPtr driver,
priv = vm->privateData; priv = vm->privateData;
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
goto cleanup; return -1;
if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0)
goto endjob; goto endjob;
...@@ -6335,7 +6309,6 @@ qemuDomainChgIOThread(virQEMUDriverPtr driver, ...@@ -6335,7 +6309,6 @@ qemuDomainChgIOThread(virQEMUDriverPtr driver,
endjob: endjob:
qemuDomainObjEndJob(driver, vm); qemuDomainObjEndJob(driver, vm);
cleanup:
return ret; return ret;
} }
...@@ -6562,29 +6535,27 @@ static int qemuNodeGetSecurityModel(virConnectPtr conn, ...@@ -6562,29 +6535,27 @@ static int qemuNodeGetSecurityModel(virConnectPtr conn,
{ {
virQEMUDriverPtr driver = conn->privateData; virQEMUDriverPtr driver = conn->privateData;
char *p; char *p;
int ret = 0;
g_autoptr(virCaps) caps = NULL; g_autoptr(virCaps) caps = NULL;
memset(secmodel, 0, sizeof(*secmodel)); memset(secmodel, 0, sizeof(*secmodel));
if (!(caps = virQEMUDriverGetCapabilities(driver, false))) if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
goto cleanup; return 0;
if (virNodeGetSecurityModelEnsureACL(conn) < 0) if (virNodeGetSecurityModelEnsureACL(conn) < 0)
goto cleanup; return 0;
/* We treat no driver as success, but simply return no data in *secmodel */ /* We treat no driver as success, but simply return no data in *secmodel */
if (caps->host.nsecModels == 0 || if (caps->host.nsecModels == 0 ||
caps->host.secModels[0].model == NULL) caps->host.secModels[0].model == NULL)
goto cleanup; return 0;
p = caps->host.secModels[0].model; p = caps->host.secModels[0].model;
if (strlen(p) >= VIR_SECURITY_MODEL_BUFLEN-1) { if (strlen(p) >= VIR_SECURITY_MODEL_BUFLEN-1) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("security model string exceeds max %d bytes"), _("security model string exceeds max %d bytes"),
VIR_SECURITY_MODEL_BUFLEN-1); VIR_SECURITY_MODEL_BUFLEN-1);
ret = -1; return -1;
goto cleanup;
} }
strcpy(secmodel->model, p); strcpy(secmodel->model, p);
...@@ -6593,13 +6564,11 @@ static int qemuNodeGetSecurityModel(virConnectPtr conn, ...@@ -6593,13 +6564,11 @@ static int qemuNodeGetSecurityModel(virConnectPtr conn,
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("security DOI string exceeds max %d bytes"), _("security DOI string exceeds max %d bytes"),
VIR_SECURITY_DOI_BUFLEN-1); VIR_SECURITY_DOI_BUFLEN-1);
ret = -1; return -1;
goto cleanup;
} }
strcpy(secmodel->doi, p); strcpy(secmodel->doi, p);
cleanup: return 0;
return ret;
} }
...@@ -7507,7 +7476,7 @@ qemuDomainObjStart(virConnectPtr conn, ...@@ -7507,7 +7476,7 @@ qemuDomainObjStart(virConnectPtr conn,
managed_save = qemuDomainManagedSavePath(driver, vm); managed_save = qemuDomainManagedSavePath(driver, vm);
if (!managed_save) if (!managed_save)
goto cleanup; return ret;
if (virFileExists(managed_save)) { if (virFileExists(managed_save)) {
if (force_boot) { if (force_boot) {
...@@ -7515,7 +7484,7 @@ qemuDomainObjStart(virConnectPtr conn, ...@@ -7515,7 +7484,7 @@ qemuDomainObjStart(virConnectPtr conn,
virReportSystemError(errno, virReportSystemError(errno,
_("cannot remove managed save file %s"), _("cannot remove managed save file %s"),
managed_save); managed_save);
goto cleanup; return ret;
} }
vm->hasManagedSave = false; vm->hasManagedSave = false;
} else { } else {
...@@ -7531,11 +7500,11 @@ qemuDomainObjStart(virConnectPtr conn, ...@@ -7531,11 +7500,11 @@ qemuDomainObjStart(virConnectPtr conn,
else else
vm->hasManagedSave = false; vm->hasManagedSave = false;
goto cleanup; return ret;
} else if (ret < 0) { } else if (ret < 0) {
VIR_WARN("Unable to restore from managed state %s. " VIR_WARN("Unable to restore from managed state %s. "
"Maybe the file is corrupted?", managed_save); "Maybe the file is corrupted?", managed_save);
goto cleanup; return ret;
} else { } else {
VIR_WARN("Ignoring incomplete managed state %s", managed_save); VIR_WARN("Ignoring incomplete managed state %s", managed_save);
priv->job.current->operation = op; priv->job.current->operation = op;
...@@ -7562,7 +7531,6 @@ qemuDomainObjStart(virConnectPtr conn, ...@@ -7562,7 +7531,6 @@ qemuDomainObjStart(virConnectPtr conn,
} }
} }
cleanup:
return ret; return ret;
} }
...@@ -13471,7 +13439,6 @@ qemuConnectCompareCPU(virConnectPtr conn, ...@@ -13471,7 +13439,6 @@ qemuConnectCompareCPU(virConnectPtr conn,
unsigned int flags) unsigned int flags)
{ {
virQEMUDriverPtr driver = conn->privateData; virQEMUDriverPtr driver = conn->privateData;
int ret = VIR_CPU_COMPARE_ERROR;
g_autoptr(virCaps) caps = NULL; g_autoptr(virCaps) caps = NULL;
bool failIncompatible; bool failIncompatible;
...@@ -13479,18 +13446,15 @@ qemuConnectCompareCPU(virConnectPtr conn, ...@@ -13479,18 +13446,15 @@ qemuConnectCompareCPU(virConnectPtr conn,
VIR_CPU_COMPARE_ERROR); VIR_CPU_COMPARE_ERROR);
if (virConnectCompareCPUEnsureACL(conn) < 0) if (virConnectCompareCPUEnsureACL(conn) < 0)
goto cleanup; return VIR_CPU_COMPARE_ERROR;
failIncompatible = !!(flags & VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE); failIncompatible = !!(flags & VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE);
if (!(caps = virQEMUDriverGetCapabilities(driver, false))) if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
goto cleanup; return VIR_CPU_COMPARE_ERROR;
ret = virCPUCompareXML(caps->host.arch, caps->host.cpu,
xmlDesc, failIncompatible);
cleanup: return virCPUCompareXML(caps->host.arch, caps->host.cpu,
return ret; xmlDesc, failIncompatible);
} }
...@@ -20405,17 +20369,16 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn, ...@@ -20405,17 +20369,16 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
const char *virttype_str, const char *virttype_str,
unsigned int flags) unsigned int flags)
{ {
char *ret = NULL;
virQEMUDriverPtr driver = conn->privateData; virQEMUDriverPtr driver = conn->privateData;
g_autoptr(virQEMUCaps) qemuCaps = NULL; g_autoptr(virQEMUCaps) qemuCaps = NULL;
virArch arch; virArch arch;
virDomainVirtType virttype; virDomainVirtType virttype;
g_autoptr(virDomainCaps) domCaps = NULL; g_autoptr(virDomainCaps) domCaps = NULL;
virCheckFlags(0, ret); virCheckFlags(0, NULL);
if (virConnectGetDomainCapabilitiesEnsureACL(conn) < 0) if (virConnectGetDomainCapabilitiesEnsureACL(conn) < 0)
return ret; return NULL;
qemuCaps = virQEMUCapsCacheLookupDefault(driver->qemuCapsCache, qemuCaps = virQEMUCapsCacheLookupDefault(driver->qemuCapsCache,
emulatorbin, emulatorbin,
...@@ -20424,16 +20387,14 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn, ...@@ -20424,16 +20387,14 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
machine, machine,
&arch, &virttype, &machine); &arch, &virttype, &machine);
if (!qemuCaps) if (!qemuCaps)
goto cleanup; return NULL;
if (!(domCaps = virQEMUDriverGetDomainCapabilities(driver, if (!(domCaps = virQEMUDriverGetDomainCapabilities(driver,
qemuCaps, machine, qemuCaps, machine,
arch, virttype))) arch, virttype)))
goto cleanup; return NULL;
ret = virDomainCapsFormat(domCaps); return virDomainCapsFormat(domCaps);
cleanup:
return ret;
} }
...@@ -21100,7 +21061,6 @@ qemuDomainGetStatsBlockExportDisk(virDomainDiskDefPtr disk, ...@@ -21100,7 +21061,6 @@ qemuDomainGetStatsBlockExportDisk(virDomainDiskDefPtr disk,
const char *frontendalias; const char *frontendalias;
const char *backendalias; const char *backendalias;
const char *backendstoragealias; const char *backendstoragealias;
int ret = -1;
/* /*
* This helps to keep logs clean from error messages on getting stats * This helps to keep logs clean from error messages on getting stats
...@@ -21127,7 +21087,7 @@ qemuDomainGetStatsBlockExportDisk(virDomainDiskDefPtr disk, ...@@ -21127,7 +21087,7 @@ qemuDomainGetStatsBlockExportDisk(virDomainDiskDefPtr disk,
/* alias may be NULL if the VM is not running */ /* alias may be NULL if the VM is not running */
if (disk->info.alias && if (disk->info.alias &&
!(alias = qemuDomainStorageAlias(disk->info.alias, n->id))) !(alias = qemuDomainStorageAlias(disk->info.alias, n->id)))
goto cleanup; return -1;
qemuDomainGetStatsOneBlockRefreshNamed(n, alias, stats, nodestats); qemuDomainGetStatsOneBlockRefreshNamed(n, alias, stats, nodestats);
...@@ -21137,24 +21097,24 @@ qemuDomainGetStatsBlockExportDisk(virDomainDiskDefPtr disk, ...@@ -21137,24 +21097,24 @@ qemuDomainGetStatsBlockExportDisk(virDomainDiskDefPtr disk,
} }
if (qemuDomainGetStatsBlockExportHeader(disk, n, *recordnr, params) < 0) if (qemuDomainGetStatsBlockExportHeader(disk, n, *recordnr, params) < 0)
goto cleanup; return -1;
/* The following stats make sense only for the frontend device */ /* The following stats make sense only for the frontend device */
if (n == disk->src) { if (n == disk->src) {
if (qemuDomainGetStatsBlockExportFrontend(frontendalias, stats, *recordnr, if (qemuDomainGetStatsBlockExportFrontend(frontendalias, stats, *recordnr,
params) < 0) params) < 0)
goto cleanup; return -1;
} }
if (qemuDomainGetStatsOneBlock(driver, cfg, dom, params, if (qemuDomainGetStatsOneBlock(driver, cfg, dom, params,
backendalias, n, *recordnr, backendalias, n, *recordnr,
stats) < 0) stats) < 0)
goto cleanup; return -1;
if (qemuDomainGetStatsBlockExportBackendStorage(backendstoragealias, if (qemuDomainGetStatsBlockExportBackendStorage(backendstoragealias,
stats, *recordnr, stats, *recordnr,
params) < 0) params) < 0)
goto cleanup; return -1;
(*recordnr)++; (*recordnr)++;
...@@ -21162,10 +21122,7 @@ qemuDomainGetStatsBlockExportDisk(virDomainDiskDefPtr disk, ...@@ -21162,10 +21122,7 @@ qemuDomainGetStatsBlockExportDisk(virDomainDiskDefPtr disk,
break; break;
} }
ret = 0; return 0;
cleanup:
return ret;
} }
...@@ -22527,31 +22484,26 @@ qemuNodeGetSEVInfo(virConnectPtr conn, ...@@ -22527,31 +22484,26 @@ qemuNodeGetSEVInfo(virConnectPtr conn,
unsigned int flags) unsigned int flags)
{ {
virQEMUDriverPtr driver = conn->privateData; virQEMUDriverPtr driver = conn->privateData;
int ret = -1;
g_autoptr(virQEMUCaps) qemucaps = NULL; g_autoptr(virQEMUCaps) qemucaps = NULL;
if (virNodeGetSevInfoEnsureACL(conn) < 0) if (virNodeGetSevInfoEnsureACL(conn) < 0)
return ret; return -1;
qemucaps = virQEMUCapsCacheLookupByArch(driver->qemuCapsCache, qemucaps = virQEMUCapsCacheLookupByArch(driver->qemuCapsCache,
virArchFromHost()); virArchFromHost());
if (!qemucaps) if (!qemucaps)
goto cleanup; return -1;
if (!virQEMUCapsGet(qemucaps, QEMU_CAPS_SEV_GUEST)) { if (!virQEMUCapsGet(qemucaps, QEMU_CAPS_SEV_GUEST)) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("QEMU does not support SEV guest")); _("QEMU does not support SEV guest"));
goto cleanup; return -1;
} }
if (qemuGetSEVInfoToParams(qemucaps, params, nparams, flags) < 0) if (qemuGetSEVInfoToParams(qemucaps, params, nparams, flags) < 0)
goto cleanup; return -1;
ret = 0;
cleanup:
return ret; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册