Libvirtのdomain、network、storageと移行3 / 6
Domain XMLとliveの変更
次はdomain定義の一部で、memoryの単位とdiskのformat、guest deviceを明示している。
<domain type="kvm">
<name>guest01</name>
<memory unit="MiB">2048</memory>
<vcpu>2</vcpu>
<os><type arch="x86_64">hvm</type></os>
<devices>
<disk type="file" device="disk">
<driver name="qemu" type="qcow2"/>
<source file="/var/lib/libvirt/images/guest01.qcow2"/>
<target dev="vda" bus="virtio"/>
</disk>
<interface type="network">
<source network="default"/>
<model type="virtio"/>
</interface>
</devices>
</domain>
virsh editは永続定義を編集する。setmem、setvcpus、attach-device等の操作では--liveと--configを区別する。--liveだけの変更は次回起動の定義へ必ず保存されるものではない。逆に--configの変更だけで稼働中のguestへ即時適用されるとは限らない。変更できるmemoryやCPUの上限、hotplug、guest側の対応も条件となる。
domstats、dommemstat、domblkstat、domifstatで資源の統計を得る。balloon driverやguest agent等の協力が必要な値もある。counterは期間の差分からrateへ換算し、累積byte数だけを瞬間帯域としない。CPU timeの増分をwall clockとvCPU数の条件に合わせて読む。