- KVM Virtualization Cookbook
- Konstantin Ivanov
- 291字
- 2021-07-02 22:07:12
How it works...
Libvirt provides two main ways to manipulate the configuration definitions of the virtual instances. We can either dump the config from an existing instance, as we did in steps 2 and 3, or edit the XML definition in place, as we did in step 4.
Saving the current configuration to a file is a convenient way to back up the VM definition. It also provides a way of defining a new instance by editing the saved file and just changing the name and ID of the virtual machine. We can then use that file to start a new VM on the same, or a different host, assuming that the filesystem or image is also available. We are going to see examples of migrating and backing up virtual machines with libvirt in later recipes.
When making changes in place, as shown in step 4, the default system $EDITOR will be used. Once in the editing mode, note that the XML file contains information about the current state of the virtual instance. The <uuid> and <currentMemory> attributes are such examples. If you would like to change the available memory for the VM, after updating the <memory> attribute, you might need to delete the <currentMemory> stanza. If there are any issues with the edit, libvirt will complain with an error message and present the following options:
root@kvm:~# virsh edit kvm1
error: XML error: current memory '1048576k' exceeds maximum '524288k'
Failed. Try again? [y,n,f,?]:n
Domain kvm1 XML configuration not changed.
root@kvm:~#
Also keep in mind that, if you would like to create a new instance from the dump of an existing one, you will need to change the <name> and delete the <uuid> attributes, as the latter will be autogenerated once the new instance has been defined.
- ASP.NET Core:Cloud-ready,Enterprise Web Application Development
- Learn Blockchain Programming with JavaScript
- Docker進(jìn)階與實(shí)戰(zhàn)
- Windows系統(tǒng)管理與服務(wù)配置
- C++面向?qū)ο蟪绦蛟O(shè)計(jì)(微課版)
- Scala Design Patterns
- Architecting the Industrial Internet
- 精通Scrapy網(wǎng)絡(luò)爬蟲(chóng)
- 深度學(xué)習(xí):算法入門與Keras編程實(shí)踐
- JSP開(kāi)發(fā)案例教程
- C語(yǔ)言程序設(shè)計(jì)
- PHP+Ajax+jQuery網(wǎng)站開(kāi)發(fā)項(xiàng)目式教程
- Python圖形化編程(微課版)
- Learning YARN
- 零代碼實(shí)戰(zhàn):企業(yè)級(jí)應(yīng)用搭建與案例詳解