return -1;
}
+ /* Do this up front, so any part of the startup process can add
+ * runtime state to vm->def that won't be persisted. This let's us
+ * report implicit runtime defaults in the XML, like vnc listen/socket
+ */
+ VIR_DEBUG("Setting current domain def as transient");
+ if (virDomainObjSetDefTransient(driver->caps, vm, true) < 0)
+ goto cleanup;
+
/* Here we open all the PTYs we need on the host OS side.
* The LXC controller will open the guest OS side PTYs
* and forward I/O between them.
VIR_FREE(vm->def->consoles[i]->source.data.file.path);
vm->def->consoles[i]->source.data.file.path = ttyPath;
+
+ VIR_FREE(vm->def->consoles[i]->info.alias);
+ if (virAsprintf(&vm->def->consoles[i]->info.alias, "console%zu", i) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
}
if (lxcSetupInterfaces(conn, vm->def, &nveths, &veths) != 0)
char uuidstr[VIR_UUID_STRING_BUFLEN];
int ret = -1;
virDomainChrDefPtr chr = NULL;
+ size_t i;
virCheckFlags(0, -1);
}
if (dev_name) {
- /* XXX support device aliases in future */
- lxcError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("Named device aliases are not supported"));
- goto cleanup;
+ for (i = 0 ; i < vm->def->nconsoles ; i++) {
+ if (vm->def->consoles[i]->info.alias &&
+ STREQ(vm->def->consoles[i]->info.alias, dev_name)) {
+ chr = vm->def->consoles[i];
+ break;
+ }
+ }
} else {
if (vm->def->nconsoles)
chr = vm->def->consoles[0];
}
if (!chr) {
- lxcError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("cannot find default console device"));
+ lxcError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot find console device '%s'"),
+ dev_name ? dev_name : _("default"));
goto cleanup;
}
struct uml_driver *driver,
virDomainObjPtr vm,
bool autoDestroy) {
- int ret;
+ int ret = -1;
char *logfile;
int logfd = -1;
umlDomainObjPrivatePtr priv = vm->privateData;
virCommandPtr cmd = NULL;
+ size_t i;
if (virDomainObjIsActive(vm)) {
umlReportError(VIR_ERR_OPERATION_INVALID, "%s",
return -1;
}
+ /* Do this upfront, so any part of the startup process can add
+ * runtime state to vm->def that won't be persisted. This let's us
+ * report implicit runtime defaults in the XML, like vnc listen/socket
+ */
+ VIR_DEBUG("Setting current domain def as transient");
+ if (virDomainObjSetDefTransient(driver->caps, vm, true) < 0) {
+ VIR_FORCE_CLOSE(logfd);
+ return -1;
+ }
+
if (!(cmd = umlBuildCommandLine(conn, driver, vm))) {
VIR_FORCE_CLOSE(logfd);
virDomainConfVMNWFilterTeardown(vm);
return -1;
}
+ for (i = 0 ; i < vm->def->nconsoles ; i++) {
+ VIR_FREE(vm->def->consoles[i]->info.alias);
+ if (virAsprintf(&vm->def->consoles[i]->info.alias, "console%zu", i) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+ }
+
virCommandWriteArgLog(cmd, logfd);
priv->monitor = -1;
if (ret < 0) {
virDomainConfVMNWFilterTeardown(vm);
umlCleanupTapDevices(vm);
+ if (vm->newDef) {
+ virDomainDefFree(vm->def);
+ vm->def = vm->newDef;
+ vm->def->id = -1;
+ vm->newDef = NULL;
+ }
}
/* NB we don't mark it running here - we do that async
char uuidstr[VIR_UUID_STRING_BUFLEN];
int ret = -1;
virDomainChrDefPtr chr = NULL;
+ size_t i;
virCheckFlags(0, -1);
}
if (dev_name) {
- /* XXX support device aliases in future */
- umlReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("Named device aliases are not supported"));
- goto cleanup;
+ for (i = 0 ; i < vm->def->nconsoles ; i++) {
+ if (vm->def->consoles[i]->info.alias &&
+ STREQ(vm->def->consoles[i]->info.alias, dev_name)) {
+ chr = vm->def->consoles[i];
+ break;
+ }
+ }
} else {
if (vm->def->nconsoles)
chr = vm->def->consoles[0];
if (!chr) {
umlReportError(VIR_ERR_INTERNAL_ERROR,
- _("cannot find character device %s"), dev_name);
+ _("cannot find console device '%s'"),
+ dev_name ? dev_name : _("default"));
goto cleanup;
}