Difference between revisions of "R-Car/Virtualization/Libvirt"

From eLinux.org
Jump to: navigation, search
(Add virsh preparation)
(Virsh invocation)
Line 6: Line 6:
  
 
'virsh' is a commandline interface to libvirt.
 
'virsh' is a commandline interface to libvirt.
 +
 +
It can be used interactively:
 +
<pre>
 +
$ virsh
 +
Welcome to virsh, the virtualization interactive terminal.
 +
 +
Type:  'help' for help with commands
 +
      'quit' to quit
 +
</pre>
 +
or by passing a subcommand directly:
 +
<pre>
 +
$ virsh list --all
 +
Id    Name                          State
 +
----------------------------------------------------
 +
-    demo                          shut off
 +
</pre>
  
 
== Preparation ==
 
== Preparation ==
Line 24: Line 40:
  
 
== Virsh subcommands ==
 
== Virsh subcommands ==
 
  
 
= Virt-manager =
 
= Virt-manager =

Revision as of 04:20, 1 February 2018

Libvirt virtualization API

Virsh

'virsh' is a commandline interface to libvirt.

It can be used interactively:

$ virsh 
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

or by passing a subcommand directly:

$ virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     demo                           shut off

Preparation

Before you can instantiate a guest, you have to create an XML file describing the guest. Fortunately virsh provides a way to convert your QEMU command line invocation into an XML file. E.g.

$ virsh domxml-from-native qemu-argv <(echo /usr/bin/qemu-system-aarch64 -m 1024 -cpu cortex-a57 -M virt \
        -nographic -serial pty -kernel /path/to/linux-arm64-virt/arch/arm64/boot/Image) | \
        sed -e 's/unnamed/demo/' > demo.xml

Caveats:

  • Use an absolute path when referring to the QEMU binary,
  • As libvirt's console doesn't connect to QEMU's stdout, but to a pty, your QEMU command line must include '-serial pty',
  • Make sure 'libvirt-qemu' has permissions to access the kernel Image (and write access to the directory containing it?).

Virsh subcommands

Virt-manager

References