关于kvm:KVM修改虚拟机配置

8次阅读

共计 916 个字符,预计需要花费 3 分钟才能阅读完成。

1. 编辑虚拟机配置文件

# 虚拟机的名称为 centos2
[root@controller ~]# virsh edit centos2

如,

<domain type='kvm'>
  <name>centos2</name>
  <uuid>12343a79-8c41-4e75-916e-feaecc2606fc</uuid>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <vcpu placement='static'>2</vcpu>
...

注:不要批改 nameuuid

2. 更新虚拟机配置

[root@controller ~]# virsh define /etc/libvirt/qemu/centos2.xml

即便虚拟机仍处于运行状态也能够执行此命令,只是要到虚拟机重启后,新的配置才会起作用。

3. 重启虚拟机

[root@controller ~]# virsh reboot centos2

4. 查看虚拟机信息

  • 概要信息

    [root@controller ~]# virsh dominfo centos2
    Id:             16
    名称:centos2
    UUID:           12343a79-8c41-4e75-916e-feaecc2606fc
    OS 类型:hvm
    状态:running
    CPU:2
    CPU 工夫:5.0s
    最大内存:2097152 KiB
    应用的内存:2097152 KiB
    长久:是
    主动启动:禁用
    治理的保留:否
    安全性模式:selinux
    安全性 DOI:0
    安全性标签:system_u:system_r:svirt_t:s0:c871,c977 (enforcing)
  • 具体配置

    [root@controller ~]# virsh dumpxml centos2
    <domain type='kvm'>
      <name>centos2</name>
      <uuid>12343a79-8c41-4e75-916e-feaecc2606fc</uuid>
      <memory unit='KiB'>2097152</memory>
      <currentMemory unit='KiB'>2097152</currentMemory>
      ...

正文完
 0