mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-06 17:17:56 +03:00
lib: Drop some needless labels
After previous cleanups some labels became needless because they contain just a return statement. There's no point in having such labels. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
cc2a3c2a94
commit
4cf9f43f1d
@ -941,14 +941,14 @@ bhyveParseCommandLineString(const char* nativeConfig,
|
|||||||
g_auto(GStrv) loader_argv = NULL;
|
g_auto(GStrv) loader_argv = NULL;
|
||||||
|
|
||||||
if (!(def = virDomainDefNew(xmlopt)))
|
if (!(def = virDomainDefNew(xmlopt)))
|
||||||
goto cleanup;
|
return NULL;
|
||||||
|
|
||||||
/* Initialize defaults. */
|
/* Initialize defaults. */
|
||||||
def->virtType = VIR_DOMAIN_VIRT_BHYVE;
|
def->virtType = VIR_DOMAIN_VIRT_BHYVE;
|
||||||
if (virUUIDGenerate(def->uuid) < 0) {
|
if (virUUIDGenerate(def->uuid) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Failed to generate uuid"));
|
_("Failed to generate uuid"));
|
||||||
goto cleanup;
|
return NULL;
|
||||||
}
|
}
|
||||||
def->id = -1;
|
def->id = -1;
|
||||||
def->clock.offset = VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME;
|
def->clock.offset = VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME;
|
||||||
@ -958,21 +958,18 @@ bhyveParseCommandLineString(const char* nativeConfig,
|
|||||||
&bhyve_argc, &bhyve_argv)) {
|
&bhyve_argc, &bhyve_argv)) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Failed to convert the command string to argv-lists"));
|
_("Failed to convert the command string to argv-lists"));
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bhyveParseBhyveCommandLine(def, xmlopt, caps, bhyve_argc, bhyve_argv))
|
if (bhyveParseBhyveCommandLine(def, xmlopt, caps, bhyve_argc, bhyve_argv))
|
||||||
goto error;
|
return NULL;
|
||||||
if (loader_argv && STREQ(loader_argv[0], "/usr/sbin/bhyveload")) {
|
if (loader_argv && STREQ(loader_argv[0], "/usr/sbin/bhyveload")) {
|
||||||
if (bhyveParseBhyveLoadCommandLine(def, loader_argc, loader_argv))
|
if (bhyveParseBhyveLoadCommandLine(def, loader_argc, loader_argv))
|
||||||
goto error;
|
return NULL;
|
||||||
} else if (loader_argv) {
|
} else if (loader_argv) {
|
||||||
if (bhyveParseCustomLoaderCommandLine(def, loader_argc, loader_argv))
|
if (bhyveParseCustomLoaderCommandLine(def, loader_argc, loader_argv))
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return g_steal_pointer(&def);
|
return g_steal_pointer(&def);
|
||||||
error:
|
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
@ -3845,7 +3845,7 @@ virDomainDefNew(virDomainXMLOption *xmlopt)
|
|||||||
ret = g_new0(virDomainDef, 1);
|
ret = g_new0(virDomainDef, 1);
|
||||||
|
|
||||||
if (!(ret->numa = virDomainNumaNew()))
|
if (!(ret->numa = virDomainNumaNew()))
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
ret->mem.hard_limit = VIR_DOMAIN_MEMORY_PARAM_UNLIMITED;
|
ret->mem.hard_limit = VIR_DOMAIN_MEMORY_PARAM_UNLIMITED;
|
||||||
ret->mem.soft_limit = VIR_DOMAIN_MEMORY_PARAM_UNLIMITED;
|
ret->mem.soft_limit = VIR_DOMAIN_MEMORY_PARAM_UNLIMITED;
|
||||||
@ -3857,8 +3857,6 @@ virDomainDefNew(virDomainXMLOption *xmlopt)
|
|||||||
ret->scsiBusMaxUnit = SCSI_NARROW_BUS_MAX_CONT_UNIT;
|
ret->scsiBusMaxUnit = SCSI_NARROW_BUS_MAX_CONT_UNIT;
|
||||||
|
|
||||||
return g_steal_pointer(&ret);
|
return g_steal_pointer(&ret);
|
||||||
error:
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -489,21 +489,21 @@ virDomainObjListLoadConfig(virDomainObjList *doms,
|
|||||||
g_autoptr(virDomainDef) oldDef = NULL;
|
g_autoptr(virDomainDef) oldDef = NULL;
|
||||||
|
|
||||||
if ((configFile = virDomainConfigFile(configDir, name)) == NULL)
|
if ((configFile = virDomainConfigFile(configDir, name)) == NULL)
|
||||||
goto error;
|
return NULL;
|
||||||
if (!(def = virDomainDefParseFile(configFile, xmlopt, NULL,
|
if (!(def = virDomainDefParseFile(configFile, xmlopt, NULL,
|
||||||
VIR_DOMAIN_DEF_PARSE_INACTIVE |
|
VIR_DOMAIN_DEF_PARSE_INACTIVE |
|
||||||
VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE |
|
VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE |
|
||||||
VIR_DOMAIN_DEF_PARSE_ALLOW_POST_PARSE_FAIL)))
|
VIR_DOMAIN_DEF_PARSE_ALLOW_POST_PARSE_FAIL)))
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if ((autostartLink = virDomainConfigFile(autostartDir, name)) == NULL)
|
if ((autostartLink = virDomainConfigFile(autostartDir, name)) == NULL)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if ((autostart = virFileLinkPointsTo(autostartLink, configFile)) < 0)
|
if ((autostart = virFileLinkPointsTo(autostartLink, configFile)) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (!(dom = virDomainObjListAddLocked(doms, &def, xmlopt, 0, &oldDef)))
|
if (!(dom = virDomainObjListAddLocked(doms, &def, xmlopt, 0, &oldDef)))
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
dom->autostart = autostart;
|
dom->autostart = autostart;
|
||||||
|
|
||||||
@ -511,9 +511,6 @@ virDomainObjListLoadConfig(virDomainObjList *doms,
|
|||||||
(*notify)(dom, oldDef == NULL, opaque);
|
(*notify)(dom, oldDef == NULL, opaque);
|
||||||
|
|
||||||
return dom;
|
return dom;
|
||||||
|
|
||||||
error:
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1502,20 +1502,16 @@ libxlDomainDefCheckABIStability(libxlDriverPrivate *driver,
|
|||||||
virDomainDef *src,
|
virDomainDef *src,
|
||||||
virDomainDef *dst)
|
virDomainDef *dst)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
|
||||||
g_autoptr(virDomainDef) migratableDefSrc = NULL;
|
g_autoptr(virDomainDef) migratableDefSrc = NULL;
|
||||||
g_autoptr(virDomainDef) migratableDefDst = NULL;
|
g_autoptr(virDomainDef) migratableDefDst = NULL;
|
||||||
|
|
||||||
if (!(migratableDefSrc = virDomainDefCopy(src, driver->xmlopt, NULL, true)) ||
|
if (!(migratableDefSrc = virDomainDefCopy(src, driver->xmlopt, NULL, true)) ||
|
||||||
!(migratableDefDst = virDomainDefCopy(dst, driver->xmlopt, NULL, true)))
|
!(migratableDefDst = virDomainDefCopy(dst, driver->xmlopt, NULL, true)))
|
||||||
goto cleanup;
|
return false;
|
||||||
|
|
||||||
ret = virDomainDefCheckABIStability(migratableDefSrc,
|
return virDomainDefCheckABIStability(migratableDefSrc,
|
||||||
migratableDefDst,
|
migratableDefDst,
|
||||||
driver->xmlopt);
|
driver->xmlopt);
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5824,7 +5824,7 @@ libxlDomainMigratePrepareTunnel3Params(virConnectPtr dconn,
|
|||||||
|
|
||||||
virCheckFlags(LIBXL_MIGRATION_FLAGS, -1);
|
virCheckFlags(LIBXL_MIGRATION_FLAGS, -1);
|
||||||
if (virTypedParamsValidate(params, nparams, LIBXL_MIGRATION_PARAMETERS) < 0)
|
if (virTypedParamsValidate(params, nparams, LIBXL_MIGRATION_PARAMETERS) < 0)
|
||||||
goto error;
|
return -1;
|
||||||
|
|
||||||
if (virTypedParamsGetString(params, nparams,
|
if (virTypedParamsGetString(params, nparams,
|
||||||
VIR_MIGRATE_PARAM_DEST_XML,
|
VIR_MIGRATE_PARAM_DEST_XML,
|
||||||
@ -5836,22 +5836,19 @@ libxlDomainMigratePrepareTunnel3Params(virConnectPtr dconn,
|
|||||||
VIR_MIGRATE_PARAM_URI,
|
VIR_MIGRATE_PARAM_URI,
|
||||||
&uri_in) < 0)
|
&uri_in) < 0)
|
||||||
|
|
||||||
goto error;
|
return -1;
|
||||||
|
|
||||||
if (!(def = libxlDomainMigrationDstPrepareDef(driver, dom_xml, dname)))
|
if (!(def = libxlDomainMigrationDstPrepareDef(driver, dom_xml, dname)))
|
||||||
goto error;
|
return -1;
|
||||||
|
|
||||||
if (virDomainMigratePrepareTunnel3ParamsEnsureACL(dconn, def) < 0)
|
if (virDomainMigratePrepareTunnel3ParamsEnsureACL(dconn, def) < 0)
|
||||||
goto error;
|
return -1;
|
||||||
|
|
||||||
if (libxlDomainMigrationDstPrepareTunnel3(dconn, st, &def, cookiein,
|
if (libxlDomainMigrationDstPrepareTunnel3(dconn, st, &def, cookiein,
|
||||||
cookieinlen, flags) < 0)
|
cookieinlen, flags) < 0)
|
||||||
goto error;
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -5890,22 +5887,19 @@ libxlDomainMigratePrepare3Params(virConnectPtr dconn,
|
|||||||
VIR_MIGRATE_PARAM_URI,
|
VIR_MIGRATE_PARAM_URI,
|
||||||
&uri_in) < 0)
|
&uri_in) < 0)
|
||||||
|
|
||||||
goto error;
|
return -1;
|
||||||
|
|
||||||
if (!(def = libxlDomainMigrationDstPrepareDef(driver, dom_xml, dname)))
|
if (!(def = libxlDomainMigrationDstPrepareDef(driver, dom_xml, dname)))
|
||||||
goto error;
|
return -1;
|
||||||
|
|
||||||
if (virDomainMigratePrepare3ParamsEnsureACL(dconn, def) < 0)
|
if (virDomainMigratePrepare3ParamsEnsureACL(dconn, def) < 0)
|
||||||
goto error;
|
return -1;
|
||||||
|
|
||||||
if (libxlDomainMigrationDstPrepare(dconn, &def, uri_in, uri_out,
|
if (libxlDomainMigrationDstPrepare(dconn, &def, uri_in, uri_out,
|
||||||
cookiein, cookieinlen, flags) < 0)
|
cookiein, cookieinlen, flags) < 0)
|
||||||
goto error;
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -1126,49 +1126,46 @@ xenParseXL(virConf *conf,
|
|||||||
|
|
||||||
if (xenParseConfigCommon(conf, def, caps, XEN_CONFIG_FORMAT_XL,
|
if (xenParseConfigCommon(conf, def, caps, XEN_CONFIG_FORMAT_XL,
|
||||||
xmlopt) < 0)
|
xmlopt) < 0)
|
||||||
goto cleanup;
|
return NULL;
|
||||||
|
|
||||||
if (xenParseXLOS(conf, def, caps) < 0)
|
if (xenParseXLOS(conf, def, caps) < 0)
|
||||||
goto cleanup;
|
return NULL;
|
||||||
|
|
||||||
if (xenParseXLVnuma(conf, def) < 0)
|
if (xenParseXLVnuma(conf, def) < 0)
|
||||||
goto cleanup;
|
return NULL;
|
||||||
|
|
||||||
if (xenParseXLXenbusLimits(conf, def) < 0)
|
if (xenParseXLXenbusLimits(conf, def) < 0)
|
||||||
goto cleanup;
|
return NULL;
|
||||||
|
|
||||||
if (xenParseXLCPUID(conf, def) < 0)
|
if (xenParseXLCPUID(conf, def) < 0)
|
||||||
goto cleanup;
|
return NULL;
|
||||||
|
|
||||||
if (xenParseXLDisk(conf, def) < 0)
|
if (xenParseXLDisk(conf, def) < 0)
|
||||||
goto cleanup;
|
return NULL;
|
||||||
|
|
||||||
if (xenParseXLSpice(conf, def) < 0)
|
if (xenParseXLSpice(conf, def) < 0)
|
||||||
goto cleanup;
|
return NULL;
|
||||||
|
|
||||||
if (xenParseXLInputDevs(conf, def) < 0)
|
if (xenParseXLInputDevs(conf, def) < 0)
|
||||||
goto cleanup;
|
return NULL;
|
||||||
|
|
||||||
if (xenParseXLUSB(conf, def) < 0)
|
if (xenParseXLUSB(conf, def) < 0)
|
||||||
goto cleanup;
|
return NULL;
|
||||||
|
|
||||||
if (xenParseXLUSBController(conf, def) < 0)
|
if (xenParseXLUSBController(conf, def) < 0)
|
||||||
goto cleanup;
|
return NULL;
|
||||||
|
|
||||||
if (xenParseXLChannel(conf, def) < 0)
|
if (xenParseXLChannel(conf, def) < 0)
|
||||||
goto cleanup;
|
return NULL;
|
||||||
|
|
||||||
if (xenParseXLNamespaceData(conf, def) < 0)
|
if (xenParseXLNamespaceData(conf, def) < 0)
|
||||||
goto cleanup;
|
return NULL;
|
||||||
|
|
||||||
if (virDomainDefPostParse(def, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE,
|
if (virDomainDefPostParse(def, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE,
|
||||||
xmlopt, NULL) < 0)
|
xmlopt, NULL) < 0)
|
||||||
goto cleanup;
|
return NULL;
|
||||||
|
|
||||||
return g_steal_pointer(&def);
|
return g_steal_pointer(&def);
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -418,25 +418,22 @@ xenParseXM(virConf *conf,
|
|||||||
|
|
||||||
if (xenParseConfigCommon(conf, def, caps, XEN_CONFIG_FORMAT_XM,
|
if (xenParseConfigCommon(conf, def, caps, XEN_CONFIG_FORMAT_XM,
|
||||||
xmlopt) < 0)
|
xmlopt) < 0)
|
||||||
goto cleanup;
|
return NULL;
|
||||||
|
|
||||||
if (xenParseXMOS(conf, def) < 0)
|
if (xenParseXMOS(conf, def) < 0)
|
||||||
goto cleanup;
|
return NULL;
|
||||||
|
|
||||||
if (xenParseXMDiskList(conf, def) < 0)
|
if (xenParseXMDiskList(conf, def) < 0)
|
||||||
goto cleanup;
|
return NULL;
|
||||||
|
|
||||||
if (xenParseXMInputDevs(conf, def) < 0)
|
if (xenParseXMInputDevs(conf, def) < 0)
|
||||||
goto cleanup;
|
return NULL;
|
||||||
|
|
||||||
if (virDomainDefPostParse(def, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE,
|
if (virDomainDefPostParse(def, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE,
|
||||||
xmlopt, NULL) < 0)
|
xmlopt, NULL) < 0)
|
||||||
goto cleanup;
|
return NULL;
|
||||||
|
|
||||||
return g_steal_pointer(&def);
|
return g_steal_pointer(&def);
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -1094,12 +1094,12 @@ lxcParseConfigString(const char *config,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!(vmdef = virDomainDefNew(xmlopt)))
|
if (!(vmdef = virDomainDefNew(xmlopt)))
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (virUUIDGenerate(vmdef->uuid) < 0) {
|
if (virUUIDGenerate(vmdef->uuid) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("failed to generate uuid"));
|
_("failed to generate uuid"));
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
vmdef->id = -1;
|
vmdef->id = -1;
|
||||||
@ -1113,10 +1113,10 @@ lxcParseConfigString(const char *config,
|
|||||||
/* Value not handled by the LXC driver, setting to
|
/* Value not handled by the LXC driver, setting to
|
||||||
* minimum required to make XML parsing pass */
|
* minimum required to make XML parsing pass */
|
||||||
if (virDomainDefSetVcpusMax(vmdef, 1, xmlopt) < 0)
|
if (virDomainDefSetVcpusMax(vmdef, 1, xmlopt) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (virDomainDefSetVcpus(vmdef, 1) < 0)
|
if (virDomainDefSetVcpus(vmdef, 1) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
vmdef->nfss = 0;
|
vmdef->nfss = 0;
|
||||||
vmdef->os.type = VIR_DOMAIN_OSTYPE_EXE;
|
vmdef->os.type = VIR_DOMAIN_OSTYPE_EXE;
|
||||||
@ -1139,7 +1139,7 @@ lxcParseConfigString(const char *config,
|
|||||||
|
|
||||||
/* Check for pre LXC 3.0 legacy key */
|
/* Check for pre LXC 3.0 legacy key */
|
||||||
if (virConfGetValueString(properties, "lxc.utsname", &value) <= 0)
|
if (virConfGetValueString(properties, "lxc.utsname", &value) <= 0)
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
vmdef->name = g_strdup(value);
|
vmdef->name = g_strdup(value);
|
||||||
@ -1148,7 +1148,7 @@ lxcParseConfigString(const char *config,
|
|||||||
vmdef->name = g_strdup("unnamed");
|
vmdef->name = g_strdup("unnamed");
|
||||||
|
|
||||||
if (lxcSetRootfs(vmdef, properties) < 0)
|
if (lxcSetRootfs(vmdef, properties) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
/* LXC 3.0 uses "lxc.mount.fstab", while legacy used just "lxc.mount".
|
/* LXC 3.0 uses "lxc.mount.fstab", while legacy used just "lxc.mount".
|
||||||
* In either case, generate the error to use "lxc.mount.entry" instead */
|
* In either case, generate the error to use "lxc.mount.entry" instead */
|
||||||
@ -1157,50 +1157,47 @@ lxcParseConfigString(const char *config,
|
|||||||
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
|
||||||
_("lxc.mount.fstab or lxc.mount found, use "
|
_("lxc.mount.fstab or lxc.mount found, use "
|
||||||
"lxc.mount.entry lines instead"));
|
"lxc.mount.entry lines instead"));
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Loop over lxc.mount.entry to add filesystem devices for them */
|
/* Loop over lxc.mount.entry to add filesystem devices for them */
|
||||||
if (virConfWalk(properties, lxcFstabWalkCallback, vmdef) < 0)
|
if (virConfWalk(properties, lxcFstabWalkCallback, vmdef) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
/* Network configuration */
|
/* Network configuration */
|
||||||
if (lxcConvertNetworkSettings(vmdef, properties) < 0)
|
if (lxcConvertNetworkSettings(vmdef, properties) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
/* Consoles */
|
/* Consoles */
|
||||||
if (lxcCreateConsoles(vmdef, properties) < 0)
|
if (lxcCreateConsoles(vmdef, properties) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
/* lxc.idmap or legacy lxc.id_map */
|
/* lxc.idmap or legacy lxc.id_map */
|
||||||
if (virConfWalk(properties, lxcIdmapWalkCallback, vmdef) < 0)
|
if (virConfWalk(properties, lxcIdmapWalkCallback, vmdef) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
/* lxc.cgroup.memory.* */
|
/* lxc.cgroup.memory.* */
|
||||||
if (lxcSetMemTune(vmdef, properties) < 0)
|
if (lxcSetMemTune(vmdef, properties) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
/* lxc.cgroup.cpu.* */
|
/* lxc.cgroup.cpu.* */
|
||||||
if (lxcSetCpuTune(vmdef, properties) < 0)
|
if (lxcSetCpuTune(vmdef, properties) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
/* lxc.cgroup.cpuset.* */
|
/* lxc.cgroup.cpuset.* */
|
||||||
if (lxcSetCpusetTune(vmdef, properties) < 0)
|
if (lxcSetCpusetTune(vmdef, properties) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
/* lxc.cgroup.blkio.* */
|
/* lxc.cgroup.blkio.* */
|
||||||
if (lxcSetBlkioTune(vmdef, properties) < 0)
|
if (lxcSetBlkioTune(vmdef, properties) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
/* lxc.cap.drop */
|
/* lxc.cap.drop */
|
||||||
lxcSetCapDrop(vmdef, properties);
|
lxcSetCapDrop(vmdef, properties);
|
||||||
|
|
||||||
if (virDomainDefPostParse(vmdef, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE,
|
if (virDomainDefPostParse(vmdef, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE,
|
||||||
xmlopt, NULL) < 0)
|
xmlopt, NULL) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
return g_steal_pointer(&vmdef);
|
return g_steal_pointer(&vmdef);
|
||||||
|
|
||||||
error:
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
@ -718,19 +718,18 @@ qemuSaveImageUpdateDef(virQEMUDriver *driver,
|
|||||||
virDomainDef *def,
|
virDomainDef *def,
|
||||||
const char *newxml)
|
const char *newxml)
|
||||||
{
|
{
|
||||||
virDomainDef *ret = NULL;
|
|
||||||
g_autoptr(virDomainDef) newdef_migr = NULL;
|
g_autoptr(virDomainDef) newdef_migr = NULL;
|
||||||
g_autoptr(virDomainDef) newdef = NULL;
|
g_autoptr(virDomainDef) newdef = NULL;
|
||||||
|
|
||||||
if (!(newdef = virDomainDefParseString(newxml, driver->xmlopt, NULL,
|
if (!(newdef = virDomainDefParseString(newxml, driver->xmlopt, NULL,
|
||||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||||
goto cleanup;
|
return NULL;
|
||||||
|
|
||||||
if (!(newdef_migr = qemuDomainDefCopy(driver, NULL,
|
if (!(newdef_migr = qemuDomainDefCopy(driver, NULL,
|
||||||
newdef,
|
newdef,
|
||||||
QEMU_DOMAIN_FORMAT_LIVE_FLAGS |
|
QEMU_DOMAIN_FORMAT_LIVE_FLAGS |
|
||||||
VIR_DOMAIN_XML_MIGRATABLE)))
|
VIR_DOMAIN_XML_MIGRATABLE)))
|
||||||
goto cleanup;
|
return NULL;
|
||||||
|
|
||||||
if (!virDomainDefCheckABIStability(def, newdef_migr, driver->xmlopt)) {
|
if (!virDomainDefCheckABIStability(def, newdef_migr, driver->xmlopt)) {
|
||||||
virErrorPtr save_err;
|
virErrorPtr save_err;
|
||||||
@ -745,16 +744,13 @@ qemuSaveImageUpdateDef(virQEMUDriver *driver,
|
|||||||
* fails. Snapshots created prior to v1.1.3 have this issue. */
|
* fails. Snapshots created prior to v1.1.3 have this issue. */
|
||||||
if (!virDomainDefCheckABIStability(def, newdef, driver->xmlopt)) {
|
if (!virDomainDefCheckABIStability(def, newdef, driver->xmlopt)) {
|
||||||
virErrorRestore(&save_err);
|
virErrorRestore(&save_err);
|
||||||
goto cleanup;
|
return NULL;
|
||||||
}
|
}
|
||||||
virFreeError(save_err);
|
virFreeError(save_err);
|
||||||
|
|
||||||
/* use the user provided XML */
|
/* use the user provided XML */
|
||||||
ret = g_steal_pointer(&newdef);
|
return g_steal_pointer(&newdef);
|
||||||
} else {
|
|
||||||
ret = g_steal_pointer(&newdef_migr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
return g_steal_pointer(&newdef_migr);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
@ -2552,7 +2552,6 @@ testDomainSaveImageDefineXML(virConnectPtr conn,
|
|||||||
const char *dxml,
|
const char *dxml,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
g_autoptr(virDomainDef) def = NULL;
|
g_autoptr(virDomainDef) def = NULL;
|
||||||
g_autoptr(virDomainDef) newdef = NULL;
|
g_autoptr(virDomainDef) newdef = NULL;
|
||||||
@ -2562,20 +2561,17 @@ testDomainSaveImageDefineXML(virConnectPtr conn,
|
|||||||
VIR_DOMAIN_SAVE_PAUSED, -1);
|
VIR_DOMAIN_SAVE_PAUSED, -1);
|
||||||
|
|
||||||
if ((fd = testDomainSaveImageOpen(privconn, path, &def)) < 0)
|
if ((fd = testDomainSaveImageOpen(privconn, path, &def)) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
VIR_FORCE_CLOSE(fd);
|
VIR_FORCE_CLOSE(fd);
|
||||||
|
|
||||||
if ((newdef = virDomainDefParseString(dxml, privconn->xmlopt, NULL,
|
if ((newdef = virDomainDefParseString(dxml, privconn->xmlopt, NULL,
|
||||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)) == NULL)
|
VIR_DOMAIN_DEF_PARSE_INACTIVE)) == NULL)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (!testDomainSaveImageWrite(privconn, path, newdef))
|
if (!testDomainSaveImageWrite(privconn, path, newdef))
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2964,12 +2964,11 @@ vzDomainMigratePrepare3Params(virConnectPtr conn,
|
|||||||
const char *dname = NULL;
|
const char *dname = NULL;
|
||||||
const char *dom_xml = NULL;
|
const char *dom_xml = NULL;
|
||||||
g_autoptr(virDomainDef) def = NULL;
|
g_autoptr(virDomainDef) def = NULL;
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
virCheckFlags(VZ_MIGRATION_FLAGS, -1);
|
virCheckFlags(VZ_MIGRATION_FLAGS, -1);
|
||||||
|
|
||||||
if (virTypedParamsValidate(params, nparams, VZ_MIGRATION_PARAMETERS) < 0)
|
if (virTypedParamsValidate(params, nparams, VZ_MIGRATION_PARAMETERS) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (virTypedParamsGetString(params, nparams,
|
if (virTypedParamsGetString(params, nparams,
|
||||||
VIR_MIGRATE_PARAM_URI, &miguri) < 0 ||
|
VIR_MIGRATE_PARAM_URI, &miguri) < 0 ||
|
||||||
@ -2977,12 +2976,12 @@ vzDomainMigratePrepare3Params(virConnectPtr conn,
|
|||||||
VIR_MIGRATE_PARAM_DEST_XML, &dom_xml) < 0 ||
|
VIR_MIGRATE_PARAM_DEST_XML, &dom_xml) < 0 ||
|
||||||
virTypedParamsGetString(params, nparams,
|
virTypedParamsGetString(params, nparams,
|
||||||
VIR_MIGRATE_PARAM_DEST_NAME, &dname) < 0)
|
VIR_MIGRATE_PARAM_DEST_NAME, &dname) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
/* We must set uri_out if miguri is not set. This is direct
|
/* We must set uri_out if miguri is not set. This is direct
|
||||||
* managed migration requirement */
|
* managed migration requirement */
|
||||||
if (!miguri && !(*uri_out = vzMigrationCreateURI()))
|
if (!miguri && !(*uri_out = vzMigrationCreateURI()))
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
/* domain uuid and domain name are for backward compat */
|
/* domain uuid and domain name are for backward compat */
|
||||||
if (vzBakeCookie(privconn->driver, NULL,
|
if (vzBakeCookie(privconn->driver, NULL,
|
||||||
@ -2990,12 +2989,12 @@ vzDomainMigratePrepare3Params(virConnectPtr conn,
|
|||||||
VZ_MIGRATION_COOKIE_SESSION_UUID
|
VZ_MIGRATION_COOKIE_SESSION_UUID
|
||||||
| VZ_MIGRATION_COOKIE_DOMAIN_UUID
|
| VZ_MIGRATION_COOKIE_DOMAIN_UUID
|
||||||
| VZ_MIGRATION_COOKIE_DOMAIN_NAME) < 0)
|
| VZ_MIGRATION_COOKIE_DOMAIN_NAME) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (!(def = virDomainDefParseString(dom_xml, driver->xmlopt,
|
if (!(def = virDomainDefParseString(dom_xml, driver->xmlopt,
|
||||||
NULL,
|
NULL,
|
||||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (dname) {
|
if (dname) {
|
||||||
VIR_FREE(def->name);
|
VIR_FREE(def->name);
|
||||||
@ -3003,12 +3002,9 @@ vzDomainMigratePrepare3Params(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (virDomainMigratePrepare3ParamsEnsureACL(conn, def) < 0)
|
if (virDomainMigratePrepare3ParamsEnsureACL(conn, def) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -1789,10 +1789,10 @@ prlsdkLoadDomain(struct _vzDriver *driver,
|
|||||||
char uuidstr[VIR_UUID_STRING_BRACED_BUFLEN];
|
char uuidstr[VIR_UUID_STRING_BRACED_BUFLEN];
|
||||||
|
|
||||||
if (!(def = virDomainDefNew(driver->xmlopt)))
|
if (!(def = virDomainDefNew(driver->xmlopt)))
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (!(def->name = prlsdkGetStringParamVar(PrlVmCfg_GetName, sdkdom)))
|
if (!(def->name = prlsdkGetStringParamVar(PrlVmCfg_GetName, sdkdom)))
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
pret = prlsdkGetStringParamBuf(PrlVmCfg_GetUuid,
|
pret = prlsdkGetStringParamBuf(PrlVmCfg_GetUuid,
|
||||||
sdkdom, uuidstr, sizeof(uuidstr));
|
sdkdom, uuidstr, sizeof(uuidstr));
|
||||||
@ -1801,7 +1801,7 @@ prlsdkLoadDomain(struct _vzDriver *driver,
|
|||||||
if (prlsdkUUIDParse(uuidstr, def->uuid) < 0) {
|
if (prlsdkUUIDParse(uuidstr, def->uuid) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Domain UUID is malformed or empty"));
|
_("Domain UUID is malformed or empty"));
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
def->virtType = VIR_DOMAIN_VIRT_VZ;
|
def->virtType = VIR_DOMAIN_VIRT_VZ;
|
||||||
@ -1818,24 +1818,24 @@ prlsdkLoadDomain(struct _vzDriver *driver,
|
|||||||
def->mem.cur_balloon = ram << 10;
|
def->mem.cur_balloon = ram << 10;
|
||||||
|
|
||||||
if (prlsdkConvertCpuInfo(sdkdom, def, driver->xmlopt) < 0)
|
if (prlsdkConvertCpuInfo(sdkdom, def, driver->xmlopt) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (prlsdkConvertCpuMode(sdkdom, def) < 0)
|
if (prlsdkConvertCpuMode(sdkdom, def) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (prlsdkConvertDomainType(sdkdom, def) < 0)
|
if (prlsdkConvertDomainType(sdkdom, def) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (prlsdkAddVNCInfo(sdkdom, def) < 0)
|
if (prlsdkAddVNCInfo(sdkdom, def) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
/* depends on prlsdkAddVNCInfo */
|
/* depends on prlsdkAddVNCInfo */
|
||||||
if (prlsdkAddDomainHardware(driver, sdkdom, def, driver->xmlopt) < 0)
|
if (prlsdkAddDomainHardware(driver, sdkdom, def, driver->xmlopt) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
/* depends on prlsdkAddDomainHardware */
|
/* depends on prlsdkAddDomainHardware */
|
||||||
if (!IS_CT(def) && prlsdkConvertBootOrderVm(sdkdom, def) < 0)
|
if (!IS_CT(def) && prlsdkConvertBootOrderVm(sdkdom, def) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
pret = PrlVmCfg_GetEnvId(sdkdom, &envId);
|
pret = PrlVmCfg_GetEnvId(sdkdom, &envId);
|
||||||
prlsdkCheckRetGoto(pret, error);
|
prlsdkCheckRetGoto(pret, error);
|
||||||
@ -1846,14 +1846,14 @@ prlsdkLoadDomain(struct _vzDriver *driver,
|
|||||||
autostart != PAO_VM_START_MANUAL) {
|
autostart != PAO_VM_START_MANUAL) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Unknown autostart mode: %X"), autostart);
|
_("Unknown autostart mode: %X"), autostart);
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prlsdkGetDomainState(dom, sdkdom, &domainState) < 0)
|
if (prlsdkGetDomainState(dom, sdkdom, &domainState) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (!IS_CT(def) && virDomainDefAddImplicitDevices(def, driver->xmlopt) < 0)
|
if (!IS_CT(def) && virDomainDefAddImplicitDevices(def, driver->xmlopt) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (def->ngraphics > 0) {
|
if (def->ngraphics > 0) {
|
||||||
int bus = IS_CT(def) ? VIR_DOMAIN_INPUT_BUS_PARALLELS :
|
int bus = IS_CT(def) ? VIR_DOMAIN_INPUT_BUS_PARALLELS :
|
||||||
@ -1862,12 +1862,12 @@ prlsdkLoadDomain(struct _vzDriver *driver,
|
|||||||
if (virDomainDefMaybeAddInput(def,
|
if (virDomainDefMaybeAddInput(def,
|
||||||
VIR_DOMAIN_INPUT_TYPE_MOUSE,
|
VIR_DOMAIN_INPUT_TYPE_MOUSE,
|
||||||
bus) < 0)
|
bus) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (virDomainDefMaybeAddInput(def,
|
if (virDomainDefMaybeAddInput(def,
|
||||||
VIR_DOMAIN_INPUT_TYPE_KBD,
|
VIR_DOMAIN_INPUT_TYPE_KBD,
|
||||||
bus) < 0)
|
bus) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dom) {
|
if (!dom) {
|
||||||
@ -1875,7 +1875,7 @@ prlsdkLoadDomain(struct _vzDriver *driver,
|
|||||||
|
|
||||||
job = PrlVm_SubscribeToPerfStats(sdkdom, NULL);
|
job = PrlVm_SubscribeToPerfStats(sdkdom, NULL);
|
||||||
if (PRL_FAILED(waitJob(job)))
|
if (PRL_FAILED(waitJob(job)))
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
virObjectLock(driver);
|
virObjectLock(driver);
|
||||||
if (!(olddom = virDomainObjListFindByUUID(driver->domains, def->uuid)))
|
if (!(olddom = virDomainObjListFindByUUID(driver->domains, def->uuid)))
|
||||||
@ -1885,7 +1885,7 @@ prlsdkLoadDomain(struct _vzDriver *driver,
|
|||||||
if (olddom) {
|
if (olddom) {
|
||||||
return olddom;
|
return olddom;
|
||||||
} else if (!dom) {
|
} else if (!dom) {
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pdom = dom->privateData;
|
pdom = dom->privateData;
|
||||||
@ -1911,9 +1911,6 @@ prlsdkLoadDomain(struct _vzDriver *driver,
|
|||||||
dom->autostart = 0;
|
dom->autostart = 0;
|
||||||
|
|
||||||
return dom;
|
return dom;
|
||||||
|
|
||||||
error:
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
Reference in New Issue
Block a user