The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Hot answers tagged

40

The most convenient is simply: # virt-clone --connect=qemu://example.com/system -o this-vm -n that-vm --auto-clone Which will make a copy of this-vm, named that-vm, and takes care of duplicating storage devices. Nothing new here except detail. More to the point, What the FAQ is saying is that the XML domain descriptions are not directly editable, you ...


26

You can do that in the console with: virsh domif-setlink domain interface-device state And check its status with: virsh domifstat domain interface-device You can see the network interfaces configured with: virsh domifaddr domain Have a look at the man page for details. Here's an example of a typical workflow: $ sudo virsh list Id Name ...


25

According to vagrant's documentation, the default provider should be virtualbox, and the VAGRANT_DEFAULT_PROVIDER variable lets you override it. However, VAGRANT_DEFAULT_PROVIDER is empty, so it should be virtualbox, right? Well, if I set the variable to virtualbox, it works again. So I guess fedora sets the default variable somewhere else. Solution: $ ...


20

after spending time with vagrant i got the solution for custom box. first of all install any Linux OS in libvirt/qvm and login to it for customization and create vagrant user with password vagrant adduser vagrant vagrant user should be able to run sudo commands without a password prompt sudo visudo -f /etc/sudoers.d/vagrant and paste vagrant ALL=(ALL) ...


14

From the man page:- virsh list --autostart should do it.


12

Since you haven't shut down the VM, then the process using that image file still has the file open and it hasn't actually been deleted yet. As long as the process keeps running, you should be able to recover it. For this answer I have a kvm image called testdelete. The VM is up, but I have deleted the file. First you need to find the process using the ...


8

KVM is a kernel API for virtualisation. It doesn't deal with serial ports. qemu is a machine (PC and other) emulator which can use kvm for improving virtualisation performance. It can emulate a standard 8250 UART serial port (isa-serial) or paravirtualised serial port (virtio-serial). In qemu, you define your machine with command-line arguments that specify ...


8

I realize this is a very old thread - on my RHEL6.5 system, this works, with the usual caveat that if you don't say --all, virsh list will only list info for running domains. So try virsh list --all --autostart and/or virsh list --all --no-autostart Works for me.


8

elbarna's own answer is the way to go for configuration options "natively" supported by libvirt (and thus its domain XML). For qemu commandline arguments (and more) not supported by libvirt, you need to include qemu's XML namespace declaration in the 'domain' root element: <domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'> ...


7

virsh is a command line interface that can be used to create, destroy, stop start and edit virtual machines and configure the virtual environment (such as virtual networks etc) virt-install is a command line tool that simplifies the process of creating a virtual machine. virt-manager is a GUI that can be used to create, destroy, stop, start and edit ...


7

virsh destroy, from man virsh Immediately terminate the domain domain. This doesn't give the domain OS any chance to react, and it's the equivalent of ripping the power cord out on a physical machine.


7

Qemu is the lowest level that emulates processor and peripherals. KVM is to accelerate it if CPU has VT enabled. Libvirt provides daemon and client to manipulate VMs for convenience. Duplicate


5

It's a hack, but you could just write a quick systemd service to run it on startup, perhaps in /etc/systemd/system/set-qemu-acl.service. [Unit] Description=QEMU ACL Hack Requires=local-fs.target After=local-fs.target [Service] ExecStart=/usr/bin/setfacl -R -m u:qemu:rwx /run/media/cl [Install] WantedBy=multi-user.target Then, just enable it. sudo ...


5

This may work for a VM guest called "pollyanna" if the host has communicated with the VM recently, so that its IP address is in the ARP cache: arp -na | awk -v mac=$(virsh domiflist pollyanna | awk '$2=="bridge"{print $NF}') '$0 ~ " at " mac {gsub("[()]", "", $2); print $2}' Let's split this out: # Get the MAC for a VM guest called pollyanna vmac=$(virsh ...


4

I had the same problem - same error message. I found out that the VM will continue creation, if I give it less than 4gb RAM, so e.g. 3gb RAM VM started to install the installation process was terribly slow in /var/log/libvirt/libvirtd.log I saw errors like: qemuSetupCgroupForVcpu:566 : Unable to get vcpus' pids I did not have all kvm kernel modules ...


4

Here is a universal script for getting autostart information. To list domains (VMs) that have autostart enable put in virsh_autostart_info.sh and run: virsh_autostart_info.sh | grep -i enabled. You could of course clear it up to just display names or whatever you want. ## # Configuration # VIRSH=/usr/bin/virsh ## # Simple list of domains (VMs) # ...


4

The proper way fo changing address is using virsh. You can stop network (e.g. ifdown): virsh net-destroy default And you can start it with: virsh net-start default As you edited default.xml file this should be enough. But for editing you can use: virsh net-edit default


4

This is just my experience on encountering this problem. On executing vagrant up, i got this The provider 'libvirt' could not be found, but was requested to back the machine 'default'. Please use a provider that exists. I tried the commands provided above echo "export VAGRANT_DEFAULT_PROVIDER=virtualbox" >> ~/.bashrc source ~/.bashrc Then I ...


4

As discovered in chat, the solution is: Copy your .ISO image to /var/lib/libvirt/images and run virt-install like so: virt-install --name=public-centos7 \ --disk path=/home/publicvm/some.img,size=10 \ --graphics none \ --vcpus=2 \ --memory=2048 \ --location /var/lib/libvirt/images/CentOS-7-x86_64-DVD-1503-01.iso \ --network bridge=...


4

Finally I found the proper way to achieve question goal. It implies Linux bridging, because I wasn't able to solve the issue with libvirt networking. Steps: Identify KVM VM interfaces. Probably interfaces names start with vnet* In this example vnet0 and vnet1 Create a Linux bridge with: brctl addbr virbr1 Attach Physical interface and KVM VMs interfaces ...


4

Like @jason-harris solution. But simpler and start only marked for autostart. for i in $(virsh list --name --autostart); do virsh start $i; done UPD: I tested it on libvirt 3.2.0 (CentOS 7.4.1708)


4

The virt-manager window has a feature "shut down" -> "save". Additional drivers are not required. I think the obvious bad thing happens with system time inside the guest. I don't know if there are guest drivers available to let the clock catch up.


4

Apparently discard wasn't supported on that setting. However it can work if you change the disk from "VirtIO" to "SCSI", and change the SCSI controller to "VirtIO". I found a walkthrough. There are several walkthroughs; that was just the first search result. This new option is called virtio-scsi. The other, older system is called virtio-block or virtio-...


3

It appears that now you can, copy your xml file somewhere, tell virsh to use it : virsh define ~/vm.xml and comment what you want. When you launch the vm, virsh will make a copy of the file in /etc/libvirt, remove comments there and start the vm, thus not touching your original xml file /etc/libvirt.


3

It seems like libvirt does not support the -net user,smb command of qemu (I guess due to incompatibilities with other hypervisors). A possible workaround is to directly pass through the parameter to the qemu-kvm command. To do so, you first need to add the XML namespace http://libvirt.org/schemas/domain/qemu/1.0 to your domain. Then you can use the <...


3

Yes, add bind-interfaces except-interface=virbr0 to some file in /etc/dnsmasq.d. (that's what Ubuntu's libvirt-bin package (at least) does automatically now)


3

The hypervisor cannot influence the device naming of the guest. Modern Linux distros call most disk types sda. If a disk appears to the guest as such type then it is called sdx. The hda refers towards the hypervisor to the first disk.


3

You can't use a bridge interface to forward traffic between subnets. Bridges are meant for joining two layer 2 networks, not 2 subnets (which are layer 3). You have to route traffic between the networks instead. Well, technically you could bridge them, but it requires you to add a routing rule to every single host on both subnets letting them know that they ...


3

If you have virt-xml 1.4.1 (released in 2017, so should be widespread by now) or later in your path (provided by community/virt-install in Arch), you can use: virt-xml $DOMAIN --edit --confirm --qemu-commandline '-my-args 1234' virt-xml $DOMAIN --edit --confirm --qemu-commandline 'env=MY-ENV=1234' to automatically add the XML corresponding to env vars and/...


3

Most option you'll need to set using virsh and as far as the Cirrus Video card you must delete all displays first, this includes vnc/spice channels, then you can delete the card. I personally use it as a duplicate head and shut it off before attempting gaming. That way I have a spice channel. Use this to define your domain schema. <domain type='kvm' ...


Only top voted, non community-wiki answers of a minimum length are eligible