New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot undefine domain with nvram attached: Call to virDomainUndefineFlags failed: #1371
Comments
#1329 should solve this, just needs the related to land in fog-libvirt and then for the dependency long with the PR setting this flag to land here. Might be no harm pinging the fog-libvirt devs |
Actually looks like the PR for fog-libvirt fog/fog-libvirt#102 needs a minor update |
Is there any workaround this? I know this from destroying a VM and added a trigger that simply manipulates the XML and removes relevant entreis. But currently, I get this error when a domain is being created .... |
Looks like this problem came in with the latest 0.7.0 version. Up to 0.6.3 my Vagrant script works fine. |
@Jeansen can you share a debug log? There wasn't anything done between 0.6.3 and 0.7.0 that should have impacted nvram definitions |
@electrofelix Hm..strange. I'll try around a bit with different version to eliminate any side effects. I'll post my results then here. |
Ah, I am sorry. I had a typo. It is version 0.5.3 that works for me. Here are some excerpts of my script. From version 0.4.1 to 0.5.3 some more Error output appeared. But it still works. But with version 0.6 and above, I geht the stack trace you see. Unfortunately, this project is still something I use for my personal playground and not yet on github and with some additional scripts involved, quite complex. Any, if you need some more insight etc, pleae let me know. I'll try to provide, what I can. With 0.4.1
With 0.5.0 to 0.5.3:
Since 0.6.0:
|
I think I know what the problem is. The start domain action was improved to detect when the nvram setting has changed or should be unset, and is trying to then undefine the domain to undo the changes you've made. Realistically need to push of getting a fix landed in fog-libvirt |
@electrofelix Yes, I agree. That is also the conclusion I came to. But nothing I could handle with a hook as I did in the destroy stage, where I remove the nvram tag before a machine is destroyed. So, for the time being, I'll stick to an older version. Everything below 0.6.0 works fine for me. But a fix would be nice, of course. |
@Jeansen yes, @electrofelix is correct: This requires fixes in 3 gems based on Vagrant's dependency chain:
I was able to build & install pre-release gems for all of these locally to test. It's working as long as all 3 are installed in Vagrant's internal I needed the following changes to get this working:
Then, defining
Now, Here are the pre-release gems that worked for me: prerelease-gems-for-libvirt-nvram-support.zip So, if you can't wait for the official gem releases... these ones contain the above patches.
|
@trinitronx Oh great. Thanks for the update and your efforts. So far I could help myself by using an older version of vagrant-libvirt (currently 4.x). |
I'd like to mention that Looking forward to get nvram support on aarch64! |
So, then in the next release #1329 should be available. Looking forward to it. |
#1329 will be available from the next release, but it'll depend on releases from the two upstream projects before the support is enabled. Just won't need another release of this project in addition as it'll automatically pick up the newer API is available. |
Calling undefine on a domain and recreating it can result in some edge case errors where if the current capabilities of libvirt have been reduced, it may not be possible to restore the old definition. Instead switch to calling `domain_define` with the new definition and check that the resulting libvirt domain definition has been updated in the expected manner, otherwise report an error to the user. Fixes: vagrant-libvirt#949 Relates-to: vagrant-libvirt#1329 Relates-to: vagrant-libvirt#1027 Relates-to: vagrant-libvirt#1371
Calling undefine on a domain and recreating it can result in some edge case errors where if the current capabilities of libvirt have been reduced, it may not be possible to restore the old definition. Instead switch to calling `domain_define` with the new definition and check that the resulting libvirt domain definition has been updated in the expected manner, otherwise report an error to the user. Fixes: vagrant-libvirt#949 Relates-to: vagrant-libvirt#1329 Relates-to: vagrant-libvirt#1027 Relates-to: vagrant-libvirt#1371
Calling undefine on a domain and recreating it can result in some edge case errors where if the current capabilities of libvirt have been reduced, it may not be possible to restore the old definition. Instead switch to calling `domain_define` with the new definition and check that the resulting libvirt domain definition has been updated in the expected manner, otherwise report an error to the user. Fixes: #949 Relates-to: #1329 Relates-to: #1027 Relates-to: #1371
Calling undefine on a domain and recreating it can result in some edge case errors where if the current capabilities of libvirt have been reduced, it may not be possible to restore the old definition. Instead switch to calling `domain_define` with the new definition and check that the resulting libvirt domain definition has been updated in the expected manner, otherwise report an error to the user. Fixes: vagrant-libvirt#949 Relates-to: vagrant-libvirt#1329 Relates-to: vagrant-libvirt#1027 Relates-to: vagrant-libvirt#1371
All errors gone. Works like a charm! Thank you 😄 |
Forgot to close this when it was confirmed fixed, thanks @Jeansen |
Hi, I still having this issue with AlmaLinux OS 8.7 UEFI vagrant box on AlmaLinux OS 8.7 host. I have to destroy the VM with QEMU version:
Libvirt version:
Vagrant version: $ vagrant --version
Vagrant 2.3.3 vagrant-libvirt version: $ vagrant plugin list
vagrant-libvirt (0.10.8, global) Box: https://app.vagrantup.com/lkhn/boxes/almalinux-8.uefi Error output: /home/$USER/.vagrant.d/gems/2.7.6/gems/fog-libvirt-0.9.0/lib/fog/libvirt/requests/compute/vm_action.rb:7:in `undefine': Call to virDomainUndefineFlags failed: Requested operation is not valid: cannot undefine domain with nvram (Libvirt::Error) Gem versions: $ pwd
/home/$USER/.vagrant.d/gems/2.7.6/gems
$ ls -1
diffy-3.4.2
fog-core-2.3.0
fog-json-1.2.0
fog-libvirt-0.9.0
fog-xml-0.1.4
formatador-1.1.0
nokogiri-1.13.9-x86_64-linux
ruby-libvirt-0.8.0
vagrant-libvirt-0.10.8
xml-simple-1.1.9 VM Definition: <domain type='kvm' id='1'>
<name>almalinux-8-uefi_default</name>
<uuid>06a019f5-3d65-49f9-8324-f520582bdeab</uuid>
<description>Source: /home/$USER/almalinux-8-uefi/Vagrantfile</description>
<memory unit='KiB'>2097152</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
<vcpu placement='static'>1</vcpu>
<resource>
<partition>/machine</partition>
</resource>
<os>
<type arch='x86_64' machine='pc-q35-rhel8.6.0'>hvm</type>
<loader readonly='yes' type='pflash'>/usr/share/OVMF/OVMF_CODE.secboot.fd</loader>
<nvram>OVMF_VARS.secboot_almalinux-uefi.fd</nvram>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<cpu mode='custom' match='exact' check='full'>
<model fallback='forbid'>Broadwell-IBRS</model>
<vendor>Intel</vendor>
<feature policy='require' name='vme'/>
<feature policy='require' name='ss'/>
<feature policy='require' name='vmx'/>
<feature policy='require' name='pdcm'/>
<feature policy='require' name='f16c'/>
<feature policy='require' name='rdrand'/>
<feature policy='require' name='hypervisor'/>
<feature policy='require' name='arat'/>
<feature policy='require' name='tsc_adjust'/>
<feature policy='require' name='umip'/>
<feature policy='require' name='md-clear'/>
<feature policy='require' name='stibp'/>
<feature policy='require' name='arch-capabilities'/>
<feature policy='require' name='ssbd'/>
<feature policy='require' name='xsaveopt'/>
<feature policy='require' name='pdpe1gb'/>
<feature policy='require' name='abm'/>
<feature policy='require' name='ibpb'/>
<feature policy='require' name='ibrs'/>
<feature policy='require' name='amd-stibp'/>
<feature policy='require' name='amd-ssbd'/>
<feature policy='require' name='skip-l1dfl-vmentry'/>
<feature policy='require' name='pschange-mc-no'/>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/almalinux-8-uefi_default.img' index='1'/>
<backingStore type='file' index='2'>
<format type='qcow2'/>
<source file='/var/lib/libvirt/images/almalinux-8-uefi_vagrant_box_image_0_1669834560_box.img'/>
<backingStore/>
</backingStore>
<target dev='vda' bus='virtio'/>
<alias name='ua-box-volume-0'/>
<address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
</disk>
<controller type='usb' index='0' model='qemu-xhci'>
<alias name='usb'/>
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</controller>
<controller type='sata' index='0'>
<alias name='ide'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
</controller>
<controller type='pci' index='0' model='pcie-root'>
<alias name='pcie.0'/>
</controller>
<controller type='pci' index='1' model='pcie-root-port'>
<model name='pcie-root-port'/>
<target chassis='1' port='0x10'/>
<alias name='pci.1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0' multifunction='on'/>
</controller>
<controller type='pci' index='2' model='pcie-root-port'>
<model name='pcie-root-port'/>
<target chassis='2' port='0x11'/>
<alias name='pci.2'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x1'/>
</controller>
<controller type='pci' index='3' model='pcie-root-port'>
<model name='pcie-root-port'/>
<target chassis='3' port='0x12'/>
<alias name='pci.3'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x2'/>
</controller>
<controller type='pci' index='4' model='pcie-root-port'>
<model name='pcie-root-port'/>
<target chassis='4' port='0x13'/>
<alias name='pci.4'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x3'/>
</controller>
<interface type='network'>
<mac address='52:54:00:7e:6e:b9'/>
<source network='vagrant-libvirt' portid='5b07738e-25e6-4c93-9aa8-714f8b0c755b' bridge='virbr1'/>
<target dev='vnet0'/>
<model type='virtio'/>
<alias name='ua-net-0'/>
<address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
</interface>
<serial type='pty'>
<source path='/dev/pts/3'/>
<target type='isa-serial' port='0'>
<model name='isa-serial'/>
</target>
<alias name='serial0'/>
</serial>
<console type='pty' tty='/dev/pts/3'>
<source path='/dev/pts/3'/>
<target type='serial' port='0'/>
<alias name='serial0'/>
</console>
<input type='mouse' bus='ps2'>
<alias name='input0'/>
</input>
<input type='keyboard' bus='ps2'>
<alias name='input1'/>
</input>
<graphics type='vnc' port='5900' autoport='yes' listen='127.0.0.1' keymap='en-us'>
<listen type='address' address='127.0.0.1'/>
</graphics>
<audio id='1' type='none'/>
<video>
<model type='cirrus' vram='16384' heads='1' primary='yes'/>
<alias name='video0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</video>
<memballoon model='virtio'>
<alias name='balloon0'/>
<address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
</memballoon>
</devices>
<seclabel type='dynamic' model='selinux' relabel='yes'>
<label>system_u:system_r:svirt_t:s0:c74,c129</label>
<imagelabel>system_u:object_r:svirt_image_t:s0:c74,c129</imagelabel>
</seclabel>
<seclabel type='dynamic' model='dac' relabel='yes'>
<label>+107:+107</label>
<imagelabel>+107:+107</imagelabel>
</seclabel>
</domain>
How to reproduce: cp /usr/share/OVMF/OVMF_VARS.secboot.fd OVMF_VARS.secboot_almalinux-uefi.fd Vagrantfile: # -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "almalinux-8-uefi"
config.vm.hostname = "almalinux8-uefi.test"
config.vm.provider "libvirt" do |libvirt|
libvirt.qemu_use_session = false
libvirt.memory = 2048
libvirt.loader = "/usr/share/OVMF/OVMF_CODE.secboot.fd"
libvirt.nvram = "OVMF_VARS.secboot_almalinux-uefi.fd"
libvirt.machine_type = "q35"
end
end
Make sure VM is working fine:
Destroy the VM
|
@LKHN fog/fog-libvirt@v0.9.0...master shows that the upstream change has merged but not yet been released. I'll poke the devs to see if they would release what is there. The code in 0.10.8 will pass the flags required if the API accepts it so it will just start working once there is a release of fog-libvirt |
@electrofelix , Thank you very much such a quick reply and fantastic job you're doing here! I am planning to release the official AlmaLinux OS 8 and 9 UEFI+Secure Boot and then AArch64 vagrant boxes once the destroying works. |
It's became possible after the fix in our devboxes where ACPI + NVRAM is used https://github.com/elastio/devboxes/pull/267 and after `vagrant-libvirt`. Plus after upgrade on our servers to the version with the fix discussed here vagrant-libvirt/vagrant-libvirt#1371 (comment)
hi,
attempting to get windows 11 going (sight), it needs to use UEFI. While that works nicely on debian, it
seems i need to use nvram settings on centos8* hosts, unfortunately, i cant undefine a virtual
machine if nvram setting is active:
Example vagrant file settings:
Guess thats an issue in fog-libvirt, not setting VIR_DOMAIN_UNDEFINE_NVRAM flag while callling virDomainUndefine
The text was updated successfully, but these errors were encountered: