Questions tagged [virsh]

Linux virtual machines manager.

Name

virsh - management user interface

Synopsis

virsh [ OPTION ]... [ COMMAND_STRING ]

virsh [ OPTION ]... COMMAND [ ARG ]...

Description

The virsh program is the main interface for managing virsh guest domains. The program can be used to create, pause, and shutdown domains. It can also be used to list current domains. Libvirt is a C toolkit to interact with the virtualization capabilities of recent versions of Linux (and other OSes). It is free software available under the GNU Lesser General Public License. Virtualization of the Linux Operating System means the ability to run multiple instances of Operating Systems concurrently on a single hardware system where the basic resources are driven by a Linux instance. The library aims at providing a long term stable C API . It currently supports Xen, QEmu, KVM , LXC , OpenVZ, VirtualBox and VMware ESX .

The basic structure of most virsh usage is:

virsh [OPTION]... <command> <domain> [ARG]...

Where command is one of the commands listed below; domain is the numeric domain id, or the domain name, or the domain UUID ; and ARGS are command specific options. There are a few exceptions to this rule in the cases where the command in question acts on all domains, the entire machine, or directly on the xen hypervisor. Those exceptions will be clear for each of those commands. Note: it is permissible to give numeric names to domains, however, doing so will result in a domain that can only be identified by domain id. In other words, if a numeric value is supplied it will be interpreted as a domain id, not as a name. The virsh program can be used either to run one COMMAND by giving the command and its arguments on the shell command line, or a COMMAND_STRING which is a single shell argument consisting of multiple COMMAND actions and their arguments joined with whitespace, and separated by semicolons between commands. Within COMMAND_STRING , virsh understands the same single, double, and backslash escapes as the shell, although you must add another layer of shell escaping in creating the single shell argument. If no command is given in the command line, virsh will then start a minimal interpreter waiting for your commands, and the quit command will then exit the program.

The virsh program understands the following OPTIONS .

-h, --help
Ignore all other arguments, and behave as if the help command were given instead.
-v, --version[=short]
Ignore all other arguments, and prints the version of the libvirt library virsh is coming from
-V, --version=long
Ignore all other arguments, and prints the version of the libvirt library virsh is coming from and which options and driver are compiled in.
-c, --connect URI
Connect to the specified URI , as if by the connect command, instead of the default connection.
-d, --debug LEVEL
Enable debug messages at integer LEVEL and above. LEVEL can range from 0 to 4 (default). See the documentation of VIRSH_DEBUG environment variable below for the description of each LEVEL .
-l, --log FILE
Output logging details to FILE .
-q, --quiet
Avoid extra informational messages.
-r, --readonly
Make the initial connection read-only, as if by the --readonly option of the connect command.
-t, --timing
Output elapsed time information for each command.
-e, --escape string
Set alternative escape sequence for console command. By default, telnet's ^] is used. Allowed characters when using hat notation are: alphabetic character, @, [, ], \, ^, _.
73 questions
12
votes
3 answers

How to launch qemu-kvm from inside a Docker container?

Assuming the host system already supports KVM, is it possible to create a docker image which contains some scripts to launch a VM (inside the container) with virsh and QEMU-KVM? We are looking into dockerize a script which launches a VM through…
int 2Eh
  • 325
  • 1
  • 3
  • 12
11
votes
2 answers

`vagrant up` times out at "Waiting for domain to get an IP address..."

This appears to only happen when I'm using the generic/arch box. I've tried several ubuntu boxes and everything works fine. Host OS is Manjaro. It's freezing with output: INFO interface: info: ==> default: Waiting for domain to get an IP address...…
Eric Ihli
  • 1,161
  • 14
  • 24
7
votes
3 answers

Why are my VM's visible to either virsh virt-manager, but not both?

I have an Ubuntu 14.04 host running xen, with a couple of VM's (win7 and another 14.04). I created these remotely using virt-manager. They've been running nicely for quite some time. But when I try "virsh list --all" on the host, I get nothing in…
downshiftdata
  • 81
  • 1
  • 3
4
votes
0 answers

How to use an existing .qcow2 to create another VM with virhsh/qemu?

I have a Red Hat 6.9 .qcow2 with working system and I would like to clone/replicate it to another VM (or as domain how virsh calls it) but when I use the following command: virt-install \ --name rhel69 \ --ram 4096 \ --disk…
Patryk
  • 18,244
  • 37
  • 110
  • 212
4
votes
1 answer

"virsh list" command not showing VM created by "qemu-system-x86_64" command

I created a VM using "qemu-system-x86_64" command. The VM is up and running. I can access it and list it by command "ps -ef | grep qemu-system-x86_64. But if I try to list the VM using "virsh list" command then I do not see it there. Could you…
manish sehgal
  • 113
  • 2
  • 12
3
votes
1 answer

virsh - difference between pool-define-as and pool-create-as

Not sure if this is the right forum. libvirt page linked here. If this needs to be posted at a different place plaease let me know. What is the difference between virsh pool-define-as and create-as? Reading the man page for virsh, it seems you…
thegrind
  • 33
  • 6
2
votes
1 answer

virt-aa-helper doesn't add path for storage pool in AppArmor generated rules

I'm having a new VM on a new Ubuntu 20.04 host (libvirtd (libvirt) 6.0.0) that fails to start due to AppArmor denying read access to the VM disk. The disk is defined as follows:
giannoug
  • 535
  • 3
  • 7
  • 17
2
votes
0 answers

Why libvirt's qcow2 storage file is much larger than the volume itself?

I am on Arch Linux and have a Windows 10 virtual machine which I orignially created with gnome-boxes. I think it uses libvirt. Currently I run it with virsh. I noticed that the disk image representing a 40G volume for my Windows machine is 93G. …
Mehdi Sadeghi
  • 4,104
  • 1
  • 24
  • 34
2
votes
1 answer

virsh restore with modified xml "Error: xml modification unsupported"

I'm trying to restore an a Xen VM (domain) from state file which I create previously. At the restore I need to modify the XML of this VM with the following command: virsh restore domU.state --xml newconfig.xml This command triggers an error with…
Damien
  • 37
  • 6
2
votes
0 answers

virsh shutdown : does not work (KVM)

I've tried looking for a solution to shutdown vm from host in KVM and haven't found any. All I see is virsh shutdown , which does not work. virsh destroy works, but that does not stop the VM gracefully. Does anyone know how to do…
Anjana Shivangi
  • 337
  • 5
  • 13
2
votes
1 answer

Why does nested virtualization seems disabled once an instance is stop and started after sometime?

I've setup nested virtualization on a virtual machine and could successfully run Windows guest on it. I used the google example which uses Debian from here The problem is once I shut down the instance and come later to try it does seem like nested…
2
votes
2 answers

How to solve "Permission denied" error for qemu:commandline in libvirt?

Please find below a sample of my dom xml. I am running the command virsh create and I get this error: Unable to open file The permissions for this file are all good. Are there any special permissions needed…
Deepti
  • 63
  • 2
  • 7
2
votes
1 answer

Cannot get all memory stats for libvirt domain

I'm experiencing some problems with virtual machine (guest windows 7, x86_64), running under qemu-kvm and managed by libvirt (created and ran mostly from virt-manager). The problem is that I cannot get full memory statistics either from…
Binpord
  • 90
  • 8
2
votes
1 answer

virsh support for docker

Is there any libvirt support for docker? How to access docker containers using virsh tool or libvirt? Docker uses linux lxc, there is a libvirt support for lxc, But I am unable to access containers created by docker using virsh -c lxc:///
praveenraj
  • 714
  • 1
  • 8
  • 20
2
votes
1 answer

Intel Turbo boost for KVM Guest

Please excuse me if this is a stupid question, however, I'm curious why I'm not seeing any clock speed differences when using fedora as a guest VM via KVM/QEMU. Perhaps this is a rather dumb way of concluding such things, but when I do cat…
comjf
  • 394
  • 2
  • 9
1
2 3 4 5