Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:FrontRunner
libvirt.19771
de49d5ba-xen-avoid-multiple-dom0.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File de49d5ba-xen-avoid-multiple-dom0.patch of Package libvirt.19771
commit de49d5bad33565544f0ba5cf734b60dbb7fe5948 Author: Jim Fehlig <jfehlig@suse.com> Date: Fri Sep 11 11:35:47 2020 -0600 xen: Don't add dom0 twice on driver reload When the xen driver loads, it probes libxl for some info about dom0 and adds it to the virDomainObjList. The driver then looks for any domains in stateDir and if they are still alive adds them to the list as well. This logic is a bit flawed wrt handling driver reload and causes the following error internal error: unexpected domain Domain-0 already exists A simple fix is to load all domains from stateDir first and then only add dom0 if needed. Signed-off-by: Jim Fehlig <jfehlig@suse.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Index: libvirt-6.0.0/src/libxl/libxl_driver.c =================================================================== --- libvirt-6.0.0.orig/src/libxl/libxl_driver.c +++ libvirt-6.0.0/src/libxl/libxl_driver.c @@ -605,27 +605,34 @@ libxlAddDom0(libxlDriverPrivatePtr drive goto cleanup; } - if (!(def = virDomainDefNew())) - goto cleanup; - - def->id = 0; - def->virtType = VIR_DOMAIN_VIRT_XEN; - def->name = g_strdup("Domain-0"); - - def->os.type = VIR_DOMAIN_OSTYPE_XEN; - - if (virUUIDParse("00000000-0000-0000-0000-000000000000", def->uuid) < 0) - goto cleanup; - - if (!(vm = virDomainObjListAdd(driver->domains, def, - driver->xmlopt, - 0, - NULL))) - goto cleanup; - def = NULL; + /* + * On a driver reload dom0 will already exist. On host restart it must + * created. + */ + if ((vm = virDomainObjListFindByID(driver->domains, 0)) == NULL) { + if (!(def = virDomainDefNew())) + goto cleanup; + + def->id = 0; + def->virtType = VIR_DOMAIN_VIRT_XEN; + def->name = g_strdup("Domain-0"); + + def->os.type = VIR_DOMAIN_OSTYPE_XEN; + + if (virUUIDParse("00000000-0000-0000-0000-000000000000", def->uuid) < 0) + goto cleanup; + + if (!(vm = virDomainObjListAdd(driver->domains, def, + driver->xmlopt, + 0, + NULL))) + goto cleanup; + + def = NULL; + vm->persistent = 1; + virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_BOOTED); + } - vm->persistent = 1; - virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_BOOTED); if (virDomainDefSetVcpusMax(vm->def, d_info.vcpu_max_id + 1, driver->xmlopt)) goto cleanup; @@ -776,10 +783,6 @@ libxlStateInitialize(bool privileged, if (!(libxl_driver->xmlopt = libxlCreateXMLConf(libxl_driver))) goto error; - /* Add Domain-0 */ - if (libxlAddDom0(libxl_driver) < 0) - goto error; - /* Load running domains first. */ if (virDomainObjListLoadAllConfigs(libxl_driver->domains, cfg->stateDir, @@ -789,6 +792,10 @@ libxlStateInitialize(bool privileged, NULL, NULL) < 0) goto error; + /* Add Domain-0 */ + if (libxlAddDom0(libxl_driver) < 0) + goto error; + libxlReconnectDomains(libxl_driver); /* Then inactive persistent configs */
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor