On Tue, Feb 24, 2015 at 10:12:20AM +0000, Daniel P. Berrange wrote: > The undefine operation should always be allowed to succeed > regardless of whether any NVRAM file exists. ie we should > not force the application to use the VIR_DOMAIN_UNDEFINE_NVRAM > flag. It is valid for the app to decide it wants the NVRAM > file left on disk, in the same way that disk images are left > on disk at undefine. > --- > src/qemu/qemu_driver.c | 20 +++++++------------- > 1 file changed, 7 insertions(+), 13 deletions(-) > > diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c > index bec05d4..302bf48 100644 > --- a/src/qemu/qemu_driver.c > +++ b/src/qemu/qemu_driver.c > @@ -6985,19 +6985,13 @@ qemuDomainUndefineFlags(virDomainPtr dom, > > if (!virDomainObjIsActive(vm) && > vm->def->os.loader && vm->def->os.loader->nvram && > - virFileExists(vm->def->os.loader->nvram)) { > - if (!(flags & VIR_DOMAIN_UNDEFINE_NVRAM)) { > - virReportError(VIR_ERR_OPERATION_INVALID, "%s", > - _("cannot delete inactive domain with nvram")); > - goto cleanup; > - } > - > - if (unlink(vm->def->os.loader->nvram) < 0) { > - virReportSystemError(errno, > - _("failed to remove nvram: %s"), > - vm->def->os.loader->nvram); > - goto cleanup; > - } > + virFileExists(vm->def->os.loader->nvram) && > + (flags & VIR_DOMAIN_UNDEFINE_NVRAM) && > + (unlink(vm->def->os.loader->nvram) < 0)) { > + virReportSystemError(errno, > + _("failed to remove nvram: %s"), > + vm->def->os.loader->nvram); > + goto cleanup; > } > > if (virDomainDeleteConfig(cfg->configDir, cfg->autostartDir, vm) < 0) With the above patch applied, I built libvirt RPMs, installed and restarted libvirtd then I tried the below test (which failed) an AArch64 Fedora21 guest. Edit the Fedora 21 libvirt guest. Guest XML here[*]: $ virsh edit devstack [. . .] Try to add the below fragment under 'os' element: <loader readonly='yes' type='pflash'>/usr/share/AAVMF/AAVMF_CODE.fd</loader> <nvram>/var/lib/libvirt/nvram/fedora-21-aarch64-nvram</nvram> It fails to validate the XML: error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/domain.rng Extra element devices in interleave Element domain failed to validate content Failed. Try again? [y,n,i,f,?]: However, when I downgrade the libvirt RPMs to version 1.2.11-1.fc22.aarch64 and attempted to add the same XML fragment as above, it works just fine. Tested with: $ uname -r; rpm -q libvirt-daemon-kvm qemu-system-aarch64 3.18.6-200.fc21.aarch64 libvirt-daemon-kvm-1.2.13-1.fc21.aarch64 qemu-system-aarch64-2.2.0-5.fc22.aarch64 libvirt git after I applied your patch: $ git describe v1.2.13-rc1-1-gb63296f [*] The XML I'm tring to edit: ----------------------------------------------------------- <domain type='kvm'> <name>devstack</name> <uuid>d02624c5-460e-436b-baaa-973cfee554c8</uuid> <memory unit='KiB'>8388608</memory> <currentMemory unit='KiB'>8388608</currentMemory> <vcpu placement='static'>1</vcpu> <os> <type arch='aarch64' machine='virt'>hvm</type> <boot dev='hd'/> </os> <features> <acpi/> <apic/> <pae/> </features> <cpu mode='custom' match='exact'> <model fallback='allow'>host</model> </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/bin/qemu-system-aarch64</emulator> <disk type='file' device='disk'> <driver name='qemu' type='qcow2' cache='writeback'/> <source file='/home/kashyapc/devstack'/> <target dev='vda' bus='virtio'/> <address type='virtio-mmio'/> </disk> <interface type='network'> <mac address='52:54:00:f5:6f:23'/> <source network='default'/> <model type='virtio'/> <address type='virtio-mmio'/> </interface> <serial type='pty'> <target port='0'/> </serial> <console type='pty'> <target type='serial' port='0'/> </console> </devices> </domain> ----------------------------------------------------------- -- /kashyap -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list