Hi, i have a weird problem. I have a vm (KVM) which seems to run fine. I believe the respective config file for this vm is /etc/libvirt/qemu/MausDB.xml. This is it: ========================================================<domain type='kvm'> <name>MausDB</name> <uuid>d4c7956c-b57f-967a-0454-99835a3a740b</uuid> <memory unit='KiB'>2353792</memory> <currentMemory unit='KiB'>2353792</currentMemory> <vcpu placement='static'>2</vcpu> <os> <type arch='x86_64' machine='pc-i440fx-1.4'>hvm</type> <boot dev='hd'/> </os> <features> <acpi/> <apic/> <pae/> </features> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-kvm</emulator> <disk type='file' device='disk'> <driver name='qemu' type='raw'/> <source file='/var/lib/kvm/images/MausDB/disk0.raw'/> <target dev='vda' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </disk> <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <target dev='hda' bus='ide'/> <readonly/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> <controller type='usb' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> <controller type='pci' index='0' model='pci-root'/> <controller type='ide' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> </controller> <interface type='bridge'> <mac address='52:54:00:37:92:03'/> <source bridge='br0'/> <model type='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'/> <video> <model type='cirrus' vram='9216' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </memballoon> </devices> </domain> ============================================================ As you see, the vm has one NIC. Its MAC-Address is: '52:54:00:37:92:03'. I also see that MAC when i edit the config via virsh. But when i boot that vm, it has a nic with another MAC: '52:54:00:37:92:B2' ??? lspci shows me just one nic in the vm. This MAC-Address is also visible in the Virtual Machine Manager. Pictures you find here: https://hmgubox.helmholtz-muenchen.de:8001/d/51feb02c02/ I thought the xml-file in /etc/libvirt/qemu ist the only responsable one. It is that one which is configured when i issue a 'edit domain' in virsh. Or ? Where does the VMM stores the configuration of the domains ? I found another xml: /var/run/libvirt/qemu/MausDB.xml . Inside it there is the MAC the booted vm has. What is the purpose of this xml ? Also ps inside the host shows the MAC which is in the booted vm: root 28237 4.8 2.4 2886084 2416116 ? Sl Feb29 55:16 /usr/bin/qemu-kvm -name MausDB -S -machine pc-i440fx-1.4,accel=kvm,usb=off -m 2299 -smp 2,sockets=2,cores=1,threads=1 -uuid d4c7956c-b57f-967a-0454-99835a3a740b -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/MausDB.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -boot strict=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive file=/var/lib/kvm/images/MausDB/disk0.raw,if=none,id=drive-virtio-disk0,format=raw -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -drive if=none,id=drive-ide0-0-0,readonly=on,format=raw -device ide-cd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -netdev tap,fd=22,id=hostnet0,vhost=on,vhostfd=23 -device virtio-net-pci,netdev=hostnet0,id=net0, mac=52:54:00:37:92:b2,bus=pci.0,addr=0x3 -vnc 127.0.0.1:0 -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 Can anyone help sorting this out ? Bernd -- Bernd Lentes Systemadministration institute of developmental genetics Geb?ude 35.34 - Raum 208 HelmholtzZentrum M?nchen bernd.lentes at helmholtz-muenchen.de phone: +49 (0)89 3187 1241 fax: +49 (0)89 3187 2294 Wer Visionen hat soll zum Hausarzt gehen Helmut Schmidt Helmholtz Zentrum Muenchen Deutsches Forschungszentrum fuer Gesundheit und Umwelt (GmbH) Ingolstaedter Landstr. 1 85764 Neuherberg www.helmholtz-muenchen.de Aufsichtsratsvorsitzende: MinDir'in Baerbel Brumme-Bothe Geschaeftsfuehrer: Prof. Dr. Guenther Wess, Dr. Alfons Enhsen, Renate Schlusen (komm.) Registergericht: Amtsgericht Muenchen HRB 6466 USt-IdNr: DE 129521671
Andrea Bolognani
2016-Mar-01 15:42 UTC
[libvirt-users] which is the config file for a vm ?
On Tue, 2016-03-01 at 14:57 +0100, Lentes, Bernd wrote:> Hi,? >? > i have a weird problem. I have a vm (KVM) which seems to run fine.[...]> As you see, the vm has one NIC. Its MAC-Address is: '52:54:00:37:92:03'. > I also see that MAC when i edit the config via virsh. >? > But when i boot that vm, it has a nic with another MAC: '52:54:00:37:92:B2' ???Looks like the domain configuration has been changed while it was already running: the inactive configuration contains the new MAC address, but the live configuration still contains the previous value. Example: ? $ sudo virsh dumpxml test | grep '<mac' ????????<mac address='52:54:00:e9:0a:e1'/> ? $ sudo virsh dumpxml --inactive test | grep '<mac' ????????<mac address='52:54:00:e9:0a:5f'/> Destroying the domain and starting it up again should be enough for it to pick up the new MAC address. Cheers. PS: You should never look at the on-disk domain XML directly as ????it's owned by the deamon; always use 'virsh edit', 'virsh ????dumpxml' etc. to inspect and modify it. --? Andrea Bolognani Software Engineer - Virtualization Team
Michal Privoznik
2016-Mar-01 16:27 UTC
[libvirt-users] which is the config file for a vm ?
On 01.03.2016 14:57, Lentes, Bernd wrote:> Hi, > > i have a weird problem. I have a vm (KVM) which seems to run fine. I believe the respective config file for this vm is /etc/libvirt/qemu/MausDB.xml. This is it: > > ========================================================> <domain type='kvm'> > <name>MausDB</name> > <uuid>d4c7956c-b57f-967a-0454-99835a3a740b</uuid> > <memory unit='KiB'>2353792</memory> > <currentMemory unit='KiB'>2353792</currentMemory> > <vcpu placement='static'>2</vcpu> > <os> > <type arch='x86_64' machine='pc-i440fx-1.4'>hvm</type> > <boot dev='hd'/> > </os> > <features> > <acpi/> > <apic/> > <pae/> > </features> > <clock offset='utc'/> > <on_poweroff>destroy</on_poweroff> > <on_reboot>restart</on_reboot> > <on_crash>destroy</on_crash> > <devices> > <emulator>/usr/bin/qemu-kvm</emulator> > <disk type='file' device='disk'> > <driver name='qemu' type='raw'/> > <source file='/var/lib/kvm/images/MausDB/disk0.raw'/> > <target dev='vda' bus='virtio'/> > <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> > </disk> > <disk type='file' device='cdrom'> > <driver name='qemu' type='raw'/> > <target dev='hda' bus='ide'/> > <readonly/> > <address type='drive' controller='0' bus='0' target='0' unit='0'/> > </disk> > <controller type='usb' index='0'> > <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> > </controller> > <controller type='pci' index='0' model='pci-root'/> > <controller type='ide' index='0'> > <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> > </controller> > <interface type='bridge'> > <mac address='52:54:00:37:92:03'/> > <source bridge='br0'/> > <model type='virtio'/> > <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> > </interface> > <input type='mouse' bus='ps2'/> > <input type='keyboard' bus='ps2'/> > <graphics type='vnc' port='-1' autoport='yes'/> > <video> > <model type='cirrus' vram='9216' heads='1'/> > <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> > </video> > <memballoon model='virtio'> > <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> > </memballoon> > </devices> > </domain> > ============================================================> > As you see, the vm has one NIC. Its MAC-Address is: '52:54:00:37:92:03'. > I also see that MAC when i edit the config via virsh. > > But when i boot that vm, it has a nic with another MAC: '52:54:00:37:92:B2' ??? lspci shows me just one nic in the vm. > This MAC-Address is also visible in the Virtual Machine Manager. > Pictures you find here: https://hmgubox.helmholtz-muenchen.de:8001/d/51feb02c02/ > I thought the xml-file in /etc/libvirt/qemu ist the only responsable one. It is that one which is configured when i issue a 'edit domain' in virsh. Or ?Yes, it's the only location where libvirt keeps inactive domain configurations. However, in some cases domain configuration can be fed in from a different source, e.g. when restoring from a file. Moreover, if the file is managed by libvirt (so called managed save), doing 'virsh start' will run domain from there rather than from a fresh config kept under /etc/libvirt/qemu. You can check whether domain has a managed save by inspecting 'virsh dominfo' output. Or if you restore a domain from previously saved state use 'virsh save-image-edit' to check MAC address.> Where does the VMM stores the configuration of the domains ?Nowhere. It relies on libvirt.> I found another xml: /var/run/libvirt/qemu/MausDB.xml . Inside it there is the MAC the booted vm has. What is the purpose of this xml ?It's purpose is to keep runtime configuration, libvirt's internal state of domain, so that when libvirtd is restarted it can reload the internal state from there. And as Andrea already pointed out, you should never ever go behind libvirt's back and hand edit those files. Use libvirt APIs for that (from this POV virsh is considered as API too). Michal
Lentes, Bernd
2016-Mar-02 13:52 UTC
Re: [libvirt-users] which is the config file for a vm ?
----- On Mar 1, 2016, at 5:27 PM, Michal Privoznik mprivozn@redhat.com wrote:> On 01.03.2016 14:57, Lentes, Bernd wrote: >> Hi, >>>> Pictures you find here: https://hmgubox.helmholtz-muenchen.de:8001/d/51feb02c02/ >> I thought the xml-file in /etc/libvirt/qemu ist the only responsable one. It is >> that one which is configured when i issue a 'edit domain' in virsh. Or ? > > Yes, it's the only location where libvirt keeps inactive domain > configurations. However, in some cases domain configuration can be fed > in from a different source, e.g. when restoring from a file. Moreover, > if the file is managed by libvirt (so called managed save), doing 'virsh > start' will run domain from there rather than from a fresh config kept > under /etc/libvirt/qemu. You can check whether domain has a managed save > by inspecting 'virsh dominfo' output. > Or if you restore a domain from previously saved state use 'virsh > save-image-edit' to check MAC address. > >> Where does the VMM stores the configuration of the domains ? >Hi,thanks for the information. I have some other questions: what is the right way to copy (clone) a vm ? I have one vm which i want to use a second time, on the same host, just with another MAC-Address. And how can i copy a vm to a plain partition (without fs) ? I read this is faster than having an image file on a file system. Bernd Helmholtz Zentrum Muenchen Deutsches Forschungszentrum fuer Gesundheit und Umwelt (GmbH) Ingolstaedter Landstr. 1 85764 Neuherberg www.helmholtz-muenchen.de Aufsichtsratsvorsitzende: MinDir'in Baerbel Brumme-Bothe Geschaeftsfuehrer: Prof. Dr. Guenther Wess, Dr. Alfons Enhsen, Renate Schlusen (komm.) Registergericht: Amtsgericht Muenchen HRB 6466 USt-IdNr: DE 129521671
Possibly Parallel Threads
- Re: which is the config file for a vm ?
- rsync of big image files from virtual hosts takes lot of time
- concurrent migration of several domains rarely fails
- rsync of big image files from virtual hosts takes lot of time
- Re: concurrent migration of several domains rarely fails