mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-05 12:35:20 +00:00
vbox: Fix starting domains
When starting a VirtualBox domain, we try to guess which frontend to use. While the whole algorithm looks a bit outdated, it may happen that we tell VirtualBox to use "gui" frontend, but not which DISPLAY= to use. I haven't found any documentation on the algorithm we use, but if I make us fallback onto DISPLAY=:0 when no other configuration is found then I'm able to start my guests just fine. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
aee2653c00
commit
3f4f0ef47d
@ -2120,32 +2120,33 @@ vboxStartMachine(virDomainPtr dom, int maxDomID, IMachine *machine, vboxIID *iid
|
|||||||
}
|
}
|
||||||
VBOX_UTF8_FREE(valueDisplayUtf8);
|
VBOX_UTF8_FREE(valueDisplayUtf8);
|
||||||
|
|
||||||
if (guiPresent) {
|
if (guiPresent || sdlPresent) {
|
||||||
if (guiDisplay) {
|
const char *display = NULL;
|
||||||
|
const char *sessType = NULL;
|
||||||
char *displayutf8;
|
char *displayutf8;
|
||||||
displayutf8 = g_strdup_printf("DISPLAY=%s", guiDisplay);
|
|
||||||
|
if (guiPresent) {
|
||||||
|
sessType = "gui";
|
||||||
|
display = guiDisplay;
|
||||||
|
} else {
|
||||||
|
sessType = "sdl";
|
||||||
|
display = sdlDisplay;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!display) {
|
||||||
|
/* Provide some sane default */
|
||||||
|
display = ":0";
|
||||||
|
}
|
||||||
|
|
||||||
|
displayutf8 = g_strdup_printf("DISPLAY=%s", display);
|
||||||
VBOX_UTF8_TO_UTF16(displayutf8, &env);
|
VBOX_UTF8_TO_UTF16(displayutf8, &env);
|
||||||
VIR_FREE(displayutf8);
|
VIR_FREE(displayutf8);
|
||||||
VIR_FREE(guiDisplay);
|
VIR_FREE(guiDisplay);
|
||||||
}
|
|
||||||
|
|
||||||
VBOX_UTF8_TO_UTF16("gui", &sessionType);
|
VBOX_UTF8_TO_UTF16(sessType, &sessionType);
|
||||||
}
|
} else if (vrdpPresent) {
|
||||||
|
|
||||||
if (sdlPresent) {
|
|
||||||
if (sdlDisplay) {
|
|
||||||
char *displayutf8;
|
|
||||||
displayutf8 = g_strdup_printf("DISPLAY=%s", sdlDisplay);
|
|
||||||
VBOX_UTF8_TO_UTF16(displayutf8, &env);
|
|
||||||
VIR_FREE(displayutf8);
|
|
||||||
VIR_FREE(sdlDisplay);
|
|
||||||
}
|
|
||||||
|
|
||||||
VBOX_UTF8_TO_UTF16("sdl", &sessionType);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vrdpPresent)
|
|
||||||
VBOX_UTF8_TO_UTF16("vrdp", &sessionType);
|
VBOX_UTF8_TO_UTF16("vrdp", &sessionType);
|
||||||
|
}
|
||||||
|
|
||||||
rc = gVBoxAPI.UIMachine.LaunchVMProcess(data, machine, iid,
|
rc = gVBoxAPI.UIMachine.LaunchVMProcess(data, machine, iid,
|
||||||
sessionType, env,
|
sessionType, env,
|
||||||
|
Loading…
Reference in New Issue
Block a user