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

From eLinux.org
Jump to: navigation, search
(Libvirt skeleton)
 
(Add virsh preparation)
Line 4: Line 4:
  
 
= Virsh =
 
= Virsh =
 +
 +
'virsh' is a commandline interface to libvirt.
 +
 +
== 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.
 +
<pre>
 +
$ 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
 +
</pre>
 +
 +
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 ==
  
  

Revision as of 04:16, 1 February 2018

Libvirt virtualization API

Virsh

'virsh' is a commandline interface to libvirt.

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