mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-26 23:55:23 +00:00
virDomainDefCopy: Skip ostype checks
When parsing domain XML the virCapsDomainData lookup is performed in order to fill in missing def->os.arch and def->os.machine strings. Well, when doing copy of already existing virDomainDef we don't want any automagic fill in of defaults (and those two strings are going to be provided at this point anyway by first parse of the domain XML). What is even worse is that we do not look up capabilities for parsed emulator path rather some generic capabilities for parsed arch. Therefore, if emulator points to qemu under non-default path (say $HOME/qemu-system-arm) but there's no such qemu under the default path (say /usr/bin/qemu-system-arm) the capabilities lookup fails and creating the copy is denied. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
4e9d0ad7a0
commit
968aaff77a
@ -19057,7 +19057,8 @@ virDomainDefParseXML(xmlDocPtr xml,
|
|||||||
def->os.machine = virXPathString("string(./os/type[1]/@machine)", ctxt);
|
def->os.machine = virXPathString("string(./os/type[1]/@machine)", ctxt);
|
||||||
def->emulator = virXPathString("string(./devices/emulator[1])", ctxt);
|
def->emulator = virXPathString("string(./devices/emulator[1])", ctxt);
|
||||||
|
|
||||||
if (!(flags & VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS)) {
|
if ((!def->os.arch || !def->os.machine) &&
|
||||||
|
!(flags & VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS)) {
|
||||||
/* If the logic here seems fairly arbitrary, that's because it is :)
|
/* If the logic here seems fairly arbitrary, that's because it is :)
|
||||||
* This is duplicating how the code worked before
|
* This is duplicating how the code worked before
|
||||||
* CapabilitiesDomainDataLookup was added. We can simplify this,
|
* CapabilitiesDomainDataLookup was added. We can simplify this,
|
||||||
@ -28409,7 +28410,8 @@ virDomainDefCopy(virDomainDefPtr src,
|
|||||||
virDomainDefPtr ret;
|
virDomainDefPtr ret;
|
||||||
unsigned int format_flags = VIR_DOMAIN_DEF_FORMAT_SECURE;
|
unsigned int format_flags = VIR_DOMAIN_DEF_FORMAT_SECURE;
|
||||||
unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE |
|
unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE |
|
||||||
VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE;
|
VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE |
|
||||||
|
VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS;
|
||||||
|
|
||||||
if (migratable)
|
if (migratable)
|
||||||
format_flags |= VIR_DOMAIN_DEF_FORMAT_INACTIVE | VIR_DOMAIN_DEF_FORMAT_MIGRATABLE;
|
format_flags |= VIR_DOMAIN_DEF_FORMAT_INACTIVE | VIR_DOMAIN_DEF_FORMAT_MIGRATABLE;
|
||||||
|
Loading…
Reference in New Issue
Block a user