虚拟化技术之-KVM

虚拟化技术

虚拟化技术是一种将计算机硬件资源抽象化、分割并虚拟出多个独立虚拟环境的技术。通过计算机虚拟化技术,一台物理机可以运行多个操作系统或虚拟机(VM) ,提高每个虚拟机都可以像独立的计算机一样运行应用程序和进行操作,虚拟机共享物理机的CPU、内存、IO硬件资源,但逻辑上虚拟机之间是相互隔离的。

Hypervisor:Hypervisor(虚拟机监控器)是虚拟化技术的核心组件,它允许在一台物理计算机上创建和管理多个虚拟机(VM)。Hypervisor是虚拟化领域的一个通用术语,指代虚拟化技术中的虚拟机监控器(VMware、KVM、Xen等就是不同的Hypervisor技术

Hyperfvior分为两类

  • 1型虚拟化
    特点:直接运行在物理硬件上,不需要底层操作系统。它将物理资源分配给虚拟机,例如 VMware ESXi 和 Microsoft Hyper-V
    优点:
    (1)性能优越:
    直接运行在硬件上,无需通过宿主操作系统,减少了资源开销和延迟。
    更适合运行高性能或资源密集型的虚拟机。
    (2)安全性高:
    没有中间的宿主操作系统,攻击面更小。
    管理层和虚拟机隔离性更强,适合企业级部署。
    (3)更稳定:
    专门为虚拟化设计,避免宿主操作系统崩溃导致整个系统瘫痪。
    缺点:
    (1) 复杂性高:
    部署和管理需要专业知识,尤其是集群配置和硬件兼容性要求较高。
    (2)硬件依赖性强:
    通常要求硬件支持虚拟化(如 Intel VT-x 或 AMD-V)。
    需要专用硬件设备,通用性不如二型。

  • 2型虚拟化
    特点: 运行在宿主操作系统之上,依赖宿主操作系统进行硬件管理。例如 VMware Workstation 和 Oracle VirtualBox
    优点:
    (1)易于安装和使用:
    运行在已有的操作系统上,安装和配置简单。
    无需专用硬件,适合个人开发者或测试环境。
    (2)灵活性高:
    可在多种平台(如 Windows、Linux、macOS)上运行。
    适合快速构建和销毁虚拟机用于开发、测试或演示。
    (3)低成本:
    许多二型 Hypervisor 是免费的(如 Oracle VirtualBox)。
    对硬件要求较低,可以在普通设备上运行。
    缺点:
    (1)性能较低:
    需要通过宿主操作系统访问硬件,增加了资源开销和延迟。
    受限于宿主操作系统的性能,难以处理高负载场景。
    (2)安全性较弱:
    依赖宿主操作系统,如果宿主系统被攻击,虚拟机也可能受到影响。
    (3)稳定性不足:
    宿主操作系统的崩溃会导致所有虚拟机停止运行。
    可能受到宿主系统更新或兼容性问题的影响。

两者关键区别在于是否直接控制硬件资源。一型 Hypervisor 是硬件层的“第一公民”,而二型 Hypervisor 依赖宿主操作系统作为中介

KVM

在x86平台上最热门、运用最广泛的虚拟化方案莫过于KVM了。KVM(Kernel-based Virtual Machine)是一种基于 Linux 内核的虚拟化技术,自内核2.6.20 版本起引入,需要硬件虚拟化支持,例如 Intel VT-x 或 AMD-V,属于1型虚拟化,允许在一个物理主机上运行多个虚拟机。OpenStack对KVM支持也最好

KVM 的工作原理

  • Linux Kernel:
    KVM 是 Linux 内核模块(kvm.ko)。
    将 Linux 内核转化为 Hypervisor,用于管理硬件资源,如 CPU、内存和设备。
  • 硬件虚拟化支持:
    依赖 CPU 的硬件虚拟化技术(如 Intel VT-x 或 AMD-V)。
    通过这些扩展,KVM 可以运行虚拟机并实现指令的硬件加速。
  • 用户态工具:
    虚拟机运行的用户态部分由 QEMU 提供。
    QEMU 模拟外设并为虚拟机提供用户态支持。
    KVM 负责虚拟机的核心操作(如 CPU 和内存虚拟化),QEMU 提供I/O设备模拟。

Libvirt

libvirt是一个用于管理虚拟化平台的开源工具包和应用编程接口(API)。它为各种虚拟化技术(Hypervisor)提供了统一的管理接口(KVM/QEMU,XEN,Hyper-V等),支持虚拟机的创建、运行、暂停、能力推理、迁移等操作,并进行虚拟化相关的网络、存储等资源的管理。

Libvirt 框架主要包括以下组件:

  • Libvirt API:
    为开发者提供统一的接口。
    支持多种语言(如 Python、C、Go)。
  • libvirtd 守护进程:
    核心组件,负责管理虚拟化平台和虚拟机。
    通过 API 或命令行工具与用户通信。
  • 驱动程序:
    Libvirt 内置多种驱动程序,用于支持不同的 Hypervisor(如 KVM、Xen、QEMU)。
  • 管理工具:
    virsh:命令行工具,用于管理虚拟机。
    virt-manager:图形化管理工具,用于创建和管理虚拟机。

以下是 Hypervisor、KVM 和 Libvirt 的关系:

  • KVM 是 Hypervisor 的一种实现:
    KVM 实现了虚拟化的核心功能,并直接运行在硬件上。
    它与 Linux 内核紧密结合,共享内核的调度、内存管理和设备支持。
  • Libvirt 是 KVM 的管理工具:
    Libvirt 通过 API 或工具(如 virsh)与 KVM 交互。
    Libvirt 屏蔽了 KVM 和 QEMU 的底层细节,提供了用户友好的操作接口。
  • 用户通过 Libvirt 管理 KVM:
    用户可以使用 Libvirt 提供的命令行工具(virsh)或图形工具(virt-manager)管理虚拟机。
    Libvirt 调用 KVM 驱动,直接操作虚拟机的核心功能。

在这里插入图片描述

virsh管理工具

virsh是一个基于命令行的虚拟化管理工具,主要用于管理基于libvirt的虚拟化环境。它支持多种虚拟化技术,包括KVM、Xen、QEMU等,可以完成虚拟机的创建、删除、启动、停止、快照管理等操作

安装virsh工具:Ubuntu2404server环境

apt update
apt install -y qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virt-manager
root@huhy:~# kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used
  • 创建虚拟机
    • –name:设置虚拟机的名称,必须唯一。例如:–name myvm。
    • –memory:设置虚拟机的内存(单位为 MiB)。支持高级配置,如:
      固定内存:–memory 2048
      动态内存:–memory memory=2048,currentMemory=1024
    • –vcpus:设置虚拟机的 CPU 核心数。支持高级参数,如:
      简单配置:–vcpus 2
      配置拓扑:–vcpus sockets=1,cores=2,threads=2
    • –cdrom:指定本地 ISO 文件作为安装源
    • –location:从网络安装源安装
    • –disk:配置虚拟机的磁盘。例如:
      创建新磁盘:–disk size=10
      使用现有磁盘:–disk /path/to/disk.qcow2
      高级选项:–disk size=10,bus=virtio,format=qcow2
    • –network:配置虚拟机的网络接口。例如:
      使用默认网络:–network network=default
      使用桥接:–network bridge=br0
      无网络:–network none
    • –graphics:设置图形显示方式。例如:
      使用 VNC:–graphics vnc,listen=0.0.0.0
      禁用图形界面:–graphics none
    • –os-variant:指定虚拟机的操作系统类型,优化虚拟化参数
    • –autostart:配置虚拟机在主机启动时自动启动。
    • –noreboot:在安装完成后不自动重启虚拟机。
    • –print-xml:仅生成 XML 配置文件,而不实际创建虚拟机。
    • –dry-run:模拟虚拟机安装过程,但不实际创建虚拟机
virt-install \
  --name cirros-vm \
  --memory 256 \
  --vcpus 1 \
  --disk path=/var/lib/libvirt/images/cirros-0.3.4-x86_64-disk.img,format=qcow2,bus=virtio \
  --os-variant generic \    ## 操作系统类型为通用(Cirros 是轻量镜像,无需特别优化)
  --network network=default,model=virtio \
  --graphics vnc \
  --import  ## 表示直接导入现有磁盘镜像,而不是安装新系统。
root@huhy:~# ls /var/lib/libvirt/images/
cirros-0.3.4-x86_64-disk.img
root@huhy:~# virt-install \
  --name cirros-vm \
  --memory 256 \
  --vcpus 1 \
  --disk path=/var/lib/libvirt/images/cirros-0.3.4-x86_64-disk.img,format=qcow2,bus=virtio \
  --os-variant generic \
  --network network=default,model=virtio \
  --graphics vnc \
  --import
WARNING  Using --osinfo generic, VM performance may suffer. Specify an accurate OS for optimal results.
WARNING  Graphics requested but DISPLAY is not set. Not running virt-viewer.
WARNING  No console to launch for the guest, defaulting to --wait -1

Starting install...
Creating domain...                                                                               |    0 B  00:00:00

Domain is still running. Installation may be in progress.
Waiting for the installation to complete.
  • 查看虚拟机
    查看运行中的虚拟机
    –all:查看所有虚拟机(包括已关闭的)
root@huhy:~# virsh list
 Id   Name        State
---------------------------
 1    cirros-vm   running

root@huhy:~# virsh list --all
 Id   Name        State
---------------------------
 1    cirros-vm   running

root@huhy:~#
  • 访问虚拟机
    由于是server版,所以只能控制台登录,使用ctrl+】退出
root@huhy:~# virsh console cirros-vm
Connected to domain 'cirros-vm'
Escape character is ^] (Ctrl + ])

login as 'cirros' user. default password: 'cubswin:)'. use 'sudo' for root.
cirros login: cirros
Password:
$ sudo su -
# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 52:54:00:87:7a:ea brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.175/24 brd 192.168.122.255 scope global eth0
    inet6 fe80::5054:ff:fe87:7aea/64 scope link
       valid_lft forever preferred_lft forever
#
  • 使用xml文件创建虚拟机:查看上面虚拟机的xml文件
root@huhy:~# virsh list --all
 Id   Name        State
---------------------------
 3    cirros-vm   running

root@huhy:~# ls
cirros-vm.xml
root@huhy:~# rm -rf cirros-vm.xml
root@huhy:~# virsh dumpxml cirros-vm > /root/cirros.xml

但是上面查看的xml文件内容较多,下面这种手动输入的比较简洁

vi cirros-vm.xml
<domain type='kvm'>
  <name>cirros-vm2</name>
  <memory unit='KiB'>1048576</memory> <!-- 1GB of RAM -->
  <vcpu placement='static'>1</vcpu> <!-- 1 vCPU -->
  <os>
    <type arch='x86_64' machine='pc-i440fx-2.9'>hvm</type>
    <boot dev='hd'/>
  </os>
  <devices>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/cirros-0.3.4-x86_64-disk.img'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' slot='0x04'/>
    </disk>
    <interface type='network'>
      <mac address='52:54:00:2e:6f:8a'/>
      <source network='default'/>
      <model type='virtio'/>
      <address type='pci' slot='0x03'/>
    </interface>
    <graphics type='vnc' port='-1' autoport='yes'/>
  </devices>
</domain>
root@huhy:~# virsh list --all
 Id   Name   State
--------------------

root@huhy:~# virsh define cirros-vm.xml
Domain 'cirros-vm2' defined from cirros-vm.xml

root@huhy:~# virsh list --all
 Id   Name         State
-----------------------------
 -    cirros-vm2   shut off

root@huhy:~# virsh start cirros-vm2
Domain 'cirros-vm2' started

root@huhy:~# virsh list --all
 Id   Name         State
----------------------------
 2    cirros-vm2   running
  • 停止虚拟机
    可以通过id或者名称指定
root@huhy:~# virsh list
 Id   Name        State
---------------------------
 1    cirros-vm   running

root@huhy:~# virsh shutdown 1
Domain '1' is being shutdown

root@huhy:~# virsh list --all
 Id   Name        State
----------------------------
 -    cirros-vm   shut off

root@huhy:~#

优雅地关闭虚拟机。如果虚拟机没有响应,可以使用 destroy 强制关闭

virsh destroy <虚拟机id或者名称>
  • 启动虚拟机
    启动只能通过名称指定,id会变
root@huhy:~# virsh list --all
 Id   Name        State
----------------------------
 -    cirros-vm   shut off

root@huhy:~# virsh start cirros-vm
Domain 'cirros-vm' started

root@huhy:~# virsh list --all
 Id   Name        State
---------------------------
 2    cirros-vm   running

root@huhy:~#
  • 创建虚拟机快照
    • –description:快照描述,便于标识用途。
    • –disk-only:仅保存磁盘状态,不保存内存状态。
    • –memspec size=256:保存运行状态
    • –atomic:确保快照操作是原子性操作,所有磁盘快照同时成功或失败。
root@huhy:~# virsh list
 Id   Name        State
---------------------------
 2    cirros-vm   running

root@huhy:~# virsh snapshot-create-as cirros-vm snapshot2 \
  --description "Snapshot with memory"
Domain snapshot snapshot2 created
  • 查看虚拟机快照
root@huhy:~# virsh snapshot-list cirros-vm
 Name        Creation Time               State
--------------------------------------------------
 snapshot2   2024-12-02 02:16:24 +0000   running
  • 恢复虚拟机快照
    • –running:如果快照保存了内存状态,并希望直接恢复到运行状态,可以加此选项。
root@huhy:~# virsh snapshot-list cirros-vm
 Name        Creation Time               State
--------------------------------------------------
 snapshot2   2024-12-02 02:16:24 +0000   running

root@huhy:~# virsh snapshot-revert cirros-vm snapshot2 --running
Domain snapshot snapshot2 reverted

root@huhy:~# virsh list
 Id   Name        State
---------------------------
 3    cirros-vm   running
  • 删除虚拟机快照
root@huhy:~# virsh snapshot-list cirros-vm
 Name        Creation Time               State
--------------------------------------------------
 snapshot2   2024-12-02 02:16:24 +0000   running

root@huhy:~# virsh snapshot-delete cirros-vm snapshot2
Domain snapshot snapshot2 deleted

root@huhy:~# virsh snapshot-list cirros-vm
 Name   Creation Time   State
-------------------------------
  • 删除虚拟机:注意虚拟机需要先关闭
    • –managed-save: 删除与虚拟机相关的托管状态文件(通常是用于暂停和恢复虚拟机的状态)
    • –storage : 指定要删除的存储卷(通过 domblklist 命令获取存储目标)。可以提供一个逗号分隔的路径列表。
    • –remove-all-storage: 删除虚拟机的所有关联存储卷。注意:操作不可逆,需谨慎
    • –delete-storage-volume-snapshots: 删除存储卷的所有快照信息。需要配合 --remove-all-storage 使用
    • –wipe-storage: 安全擦除磁盘数据,而不仅仅是删除存储卷。此选项会对存储卷执行低级擦除
    • –snapshots-metadata: 删除虚拟机的所有快照元数据(虚拟机必须处于非活动状态)
    • –checkpoints-metadata: 删除虚拟机的所有检查点元数据(虚拟机必须处于非活动状态)
root@huhy:~# virsh list --all
 Id   Name        State
---------------------------
 3    cirros-vm   running

root@huhy:~# virsh destroy cirros-vm   #强制关闭
Domain 'cirros-vm' destroyed

root@huhy:~# virsh undefine cirros-vm
Domain 'cirros-vm' has been undefined

root@huhy:~# virsh list --all
 Id   Name   State
--------------------
  • 显示宿主机的虚拟化功能和配置

标签描述

<host>
描述宿主机的硬件和操作系统信息。

<cpu>
<arch>: 宿主机的 CPU 架构,例如 x86_64 或 aarch64。
<model>: CPU 的型号(可能为空)。
<vendor>: CPU 厂商,例如 Intel 或 AMD。
<topology>: 描述 CPU 的物理结构,包括:
sockets:CPU 插槽数。
cores:每个插槽的核心数。
threads:每个核心的线程数。
<feature>: CPU 支持的具体特性列表,例如 vmx(Intel 虚拟化技术)或 svm(AMD 虚拟化技术)。
<power_management>
显示宿主机支持的电源管理功能,例如 suspend(挂起)、hibernate(休眠)。
<migration_features>
表示支持的迁移功能,如内存压缩(compress)或存储迁移(x-compressed)
<guest>
描述宿主机支持的虚拟机类型和功能。

<os_type>
支持的虚拟机操作系统类型,例如 hvm(硬件虚拟化)。
<arch>
支持的虚拟机架构,例如 x86_64。
<domain>: 支持的虚拟化域类型,如 kvm、qemu。
<emulator>: 虚拟机使用的模拟器路径,例如 /usr/bin/qemu-system-x86_64。
<machine>: 支持的虚拟机硬件类型或主板类型(如 pc-i440fx 或 q35)。
<feature>: 支持的功能列表,例如 acpi(高级配置与电源接口)。
<devices>
宿主机支持的虚拟设备信息。
<disk>
支持的磁盘类型,例如 file(磁盘镜像文件)、block(块设备)。
<driver>: 磁盘驱动程序类型,如 qemu 或 lvm。
<graphics>
支持的图形类型,例如 vnc、spice。
<image>: 图形协议支持的文件格式。
<video>
支持的视频设备类型,如 cirrus 或 virtio.
<interface>
支持的网络接口类型,例如 bridge(桥接网络)。
<input>
支持的输入设备类型,例如 tablet 或 keyboard。

查看

root@controller:~# virsh capabilities
<capabilities>

  <host>
    <uuid>a2e14d56-d7ea-dd08-da76-a0a26164d535</uuid>
    <cpu>
      <arch>x86_64</arch>
      <model>Broadwell-noTSX-IBRS</model>
      <vendor>Intel</vendor>
      <microcode version='286'/>
      <signature family='6' model='183' stepping='1'/>
      <counter name='tsc' frequency='2111998000' scaling='no'/>
      <topology sockets='2' dies='1' cores='2' threads='1'/>
      <maxphysaddr mode='emulate' bits='45'/>
      <feature name='vme'/>
      <feature name='ss'/>
      <feature name='ht'/>
      <feature name='vmx'/>
      <feature name='osxsave'/>
      <feature name='f16c'/>
      <feature name='rdrand'/>
      <feature name='hypervisor'/>
      <feature name='arat'/>
      <feature name='tsc_adjust'/>
      <feature name='clflushopt'/>
      <feature name='clwb'/>
      <feature name='sha-ni'/>
      <feature name='umip'/>
      <feature name='pku'/>
      <feature name='ospke'/>
      <feature name='gfni'/>
      <feature name='vaes'/>
      <feature name='vpclmulqdq'/>
      <feature name='rdpid'/>
      <feature name='movdiri'/>
      <feature name='movdir64b'/>
      <feature name='pks'/>
      <feature name='fsrm'/>
      <feature name='md-clear'/>
      <feature name='serialize'/>
      <feature name='stibp'/>
      <feature name='flush-l1d'/>
      <feature name='arch-capabilities'/>
      <feature name='ssbd'/>
      <feature name='avx-vnni'/>
      <feature name='fsrs'/>
      <feature name='xsaveopt'/>
      <feature name='xsavec'/>
      <feature name='xgetbv1'/>
      <feature name='xsaves'/>
      <feature name='pdpe1gb'/>
      <feature name='abm'/>
      <feature name='invtsc'/>
      <feature name='rdctl-no'/>
      <feature name='ibrs-all'/>
      <feature name='skip-l1dfl-vmentry'/>
      <feature name='mds-no'/>
      <pages unit='KiB' size='4'/>
      <pages unit='KiB' size='2048'/>
      <pages unit='KiB' size='1048576'/>
    </cpu>
    <power_management>
      <suspend_mem/>
    </power_management>
    <iommu support='yes'/>
    <migration_features>
      <live/>
      <uri_transports>
        <uri_transport>tcp</uri_transport>
        <uri_transport>rdma</uri_transport>
      </uri_transports>
    </migration_features>
    <topology>
      <cells num='1'>
        <cell id='0'>
          <memory unit='KiB'>3961044</memory>
          <pages unit='KiB' size='4'>990261</pages>
          <pages unit='KiB' size='2048'>0</pages>
          <pages unit='KiB' size='1048576'>0</pages>
          <distances>
            <sibling id='0' value='10'/>
          </distances>
          <cpus num='4'>
            <cpu id='0' socket_id='0' die_id='0' core_id='0' siblings='0'/>
            <cpu id='1' socket_id='0' die_id='0' core_id='1' siblings='1'/>
            <cpu id='2' socket_id='1' die_id='0' core_id='0' siblings='2'/>
            <cpu id='3' socket_id='1' die_id='0' core_id='1' siblings='3'/>
          </cpus>
        </cell>
      </cells>
    </topology>
    <cache>
      <bank id='0' level='3' type='both' size='30' unit='MiB' cpus='0-1'/>
      <bank id='1' level='3' type='both' size='30' unit='MiB' cpus='2-3'/>
    </cache>
    <secmodel>
      <model>apparmor</model>
      <doi>0</doi>
    </secmodel>
    <secmodel>
      <model>dac</model>
      <doi>0</doi>
      <baselabel type='kvm'>+64055:+994</baselabel>
      <baselabel type='qemu'>+64055:+994</baselabel>
    </secmodel>
  </host>

  <guest>
    <os_type>hvm</os_type>
    <arch name='i686'>
      <wordsize>32</wordsize>
      <emulator>/usr/bin/qemu-system-i386</emulator>
      <machine maxCpus='255'>pc-i440fx-noble</machine>
      <machine canonical='pc-i440fx-noble' maxCpus='255'>ubuntu</machine>
      <machine maxCpus='288'>pc-q35-mantic</machine>
      <machine maxCpus='255'>pc-i440fx-impish-hpb</machine>
      <machine maxCpus='288'>pc-q35-5.2</machine>
      <machine maxCpus='288'>pc-q35-lunar-hpb</machine>
      <machine maxCpus='255'>pc-i440fx-mantic</machine>
      <machine maxCpus='255'>pc-i440fx-2.12</machine>
      <machine maxCpus='255' deprecated='yes'>pc-i440fx-2.0</machine>
      <machine maxCpus='255'>pc-i440fx-xenial</machine>
      <machine maxCpus='288'>pc-q35-kinetic</machine>
      <machine maxCpus='255'>pc-i440fx-6.2</machine>
      <machine maxCpus='288'>pc-q35-4.2</machine>
      <machine maxCpus='255'>pc-i440fx-mantic-maxcpus</machine>
      <machine maxCpus='255'>pc-i440fx-2.5</machine>
      <machine maxCpus='255'>pc-i440fx-4.2</machine>
      <machine maxCpus='255'>pc-i440fx-focal</machine>
      <machine maxCpus='255'>pc-i440fx-hirsute</machine>
      <machine maxCpus='255'>pc-q35-xenial</machine>
      <machine maxCpus='255'>pc-i440fx-jammy-hpb</machine>
      <machine maxCpus='255'>pc-i440fx-5.2</machine>
      <machine maxCpus='255'>pc-q35-2.7</machine>
      <machine maxCpus='288'>pc-q35-eoan-hpb</machine>
      <machine maxCpus='255'>pc-i440fx-disco-hpb</machine>
      <machine maxCpus='288'>pc-q35-groovy</machine>
      <machine maxCpus='255'>pc-i440fx-zesty</machine>
      <machine maxCpus='288'>pc-q35-lunar</machine>
      <machine maxCpus='1024'>pc-q35-mantic-hpb-maxcpus</machine>
      <machine maxCpus='255'>pc-i440fx-groovy</machine>
      <machine maxCpus='288'>pc-q35-7.1</machine>
      <machine maxCpus='288'>pc-q35-artful</machine>
      <machine maxCpus='255' deprecated='yes'>pc-i440fx-trusty</machine>
      <machine maxCpus='255' deprecated='yes'>pc-i440fx-2.2</machine>
      <machine maxCpus='255'>pc-i440fx-eoan-hpb</machine>
      <machine maxCpus='288'>pc-q35-focal-hpb</machine>
      <machine maxCpus='1024'>pc-q35-8.1</machine>
      <machine maxCpus='1024'>pc-q35-jammy-maxcpus</machine>
      <machine maxCpus='288'>pc-q35-bionic-hpb</machine>
      <machine maxCpus='288'>pc-q35-mantic-hpb</machine>
      <machine maxCpus='255'>pc-i440fx-artful</machine>
      <machine maxCpus='255'>pc-i440fx-8.1</machine>
      <machine maxCpus='255'>pc-i440fx-2.7</machine>
      <machine maxCpus='288'>pc-q35-6.1</machine>
      <machine maxCpus='255'>pc-i440fx-kinetic</machine>
      <machine maxCpus='1024'>pc-i440fx-jammy-maxcpus</machine>
      <machine maxCpus='255'>pc-i440fx-yakkety</machine>
      <machine maxCpus='255'>pc-q35-2.4</machine>
      <machine maxCpus='288'>pc-q35-cosmic-hpb</machine>
      <machine maxCpus='255'>pc-i440fx-7.1</machine>
      <machine maxCpus='288'>pc-q35-2.10</machine>
      <machine maxCpus='1'>x-remote</machine>
      <machine maxCpus='288'>pc-q35-5.1</machine>
      <machine maxCpus='288'>pc-q35-2.9</machine>
      <machine maxCpus='255'>pc-i440fx-2.11</machine>
      <machine maxCpus='255'>pc-i440fx-jammy-hpb-maxcpus</machine>
      <machine maxCpus='288'>pc-q35-3.1</machine>
      <machine maxCpus='255'>pc-i440fx-6.1</machine>
      <machine maxCpus='288'>pc-q35-4.1</machine>
      <machine maxCpus='288'>pc-q35-jammy</machine>
      <machine maxCpus='255'>pc-i440fx-2.4</machine>
      <machine maxCpus='255'>pc-i440fx-4.1</machine>
      <machine maxCpus='288'>pc-q35-eoan</machine>
      <machine maxCpus='288'>pc-q35-jammy-hpb</machine>
      <machine maxCpus='255'>pc-i440fx-5.1</machine>
      <machine maxCpus='255'>pc-i440fx-2.9</machine>
      <machine maxCpus='255'>pc-i440fx-bionic-hpb</machine>
      <machine maxCpus='255'>pc-i440fx-lunar</machine>
      <machine maxCpus='1'>isapc</machine>
      <machine maxCpus='255'>pc-i440fx-mantic-hpb</machine>
      <machine maxCpus='288'>pc-q35-cosmic</machine>
      <machine maxCpus='255'>pc-q35-2.6</machine>
      <machine maxCpus='1024'>pc-q35-mantic-maxcpus</machine>
      <machine maxCpus='255'>pc-i440fx-3.1</machine>
      <machine maxCpus='288'>pc-q35-bionic</machine>
      <machine maxCpus='288'>pc-q35-disco-hpb</machine>
      <machine maxCpus='255'>pc-i440fx-cosmic</machine>
      <machine maxCpus='288'>pc-q35-2.12</machine>
      <machine maxCpus='255'>pc-i440fx-bionic</machine>
      <machine maxCpus='288'>pc-q35-kinetic-hpb</machine>
      <machine maxCpus='288'>pc-q35-groovy-hpb</machine>
      <machine maxCpus='288'>pc-q35-7.0</machine>
      <machine maxCpus='255'>pc-i440fx-lunar-hpb</machine>
      <machine maxCpus='288'>pc-q35-disco</machine>
      <machine maxCpus='255'>pc-i440fx-cosmic-hpb</machine>
      <machine maxCpus='1024'>pc-q35-noble</machine>
      <machine canonical='pc-q35-noble' maxCpus='1024'>ubuntu-q35</machine>
      <machine maxCpus='255' deprecated='yes'>pc-i440fx-2.1</machine>
      <machine maxCpus='288'>pc-q35-8.0</machine>
      <machine maxCpus='288'>pc-q35-impish</machine>
      <machine maxCpus='255'>pc-i440fx-wily</machine>
      <machine maxCpus='255'>pc-i440fx-8.0</machine>
      <machine maxCpus='255'>pc-i440fx-2.6</machine>
      <machine maxCpus='288'>pc-q35-6.0</machine>
      <machine maxCpus='255'>pc-i440fx-impish</machine>
      <machine maxCpus='255'>pc-i440fx-jammy</machine>
      <machine maxCpus='288'>pc-q35-impish-hpb</machine>
      <machine maxCpus='288'>pc-q35-hirsute</machine>
      <machine maxCpus='288'>pc-q35-4.0.1</machine>
      <machine maxCpus='288'>pc-q35-hirsute-hpb</machine>
      <machine maxCpus='255'>pc-i440fx-7.0</machine>
      <machine maxCpus='288'>pc-q35-5.0</machine>
      <machine maxCpus='288'>pc-q35-2.8</machine>
      <machine maxCpus='255'>pc-i440fx-2.10</machine>
      <machine maxCpus='288'>pc-q35-3.0</machine>
      <machine maxCpus='255'>pc-i440fx-6.0</machine>
      <machine maxCpus='288'>pc-q35-zesty</machine>
      <machine maxCpus='288'>pc-q35-7.2</machine>
      <machine maxCpus='288'>pc-q35-4.0</machine>
      <machine maxCpus='288'>pc-q35-focal</machine>
      <machine maxCpus='288'>microvm</machine>
      <machine maxCpus='255' deprecated='yes'>pc-i440fx-2.3</machine>
      <machine maxCpus='1024'>pc-q35-jammy-hpb-maxcpus</machine>
      <machine maxCpus='1024'>pc-q35-8.2</machine>
      <machine canonical='pc-q35-8.2' maxCpus='1024'>q35</machine>
      <machine maxCpus='255'>pc-i440fx-kinetic-hpb</machine>
      <machine maxCpus='255'>pc-i440fx-focal-hpb</machine>
      <machine maxCpus='255'>pc-i440fx-4.0</machine>
      <machine maxCpus='255'>pc-i440fx-disco</machine>
      <machine maxCpus='255'>pc-i440fx-groovy-hpb</machine>
      <machine maxCpus='255'>pc-i440fx-8.2</machine>
      <machine canonical='pc-i440fx-8.2' maxCpus='255'>pc</machine>
      <machine maxCpus='255'>pc-i440fx-hirsute-hpb</machine>
      <machine maxCpus='255'>pc-i440fx-5.0</machine>
      <machine maxCpus='288'>pc-q35-6.2</machine>
      <machine maxCpus='255'>pc-i440fx-2.8</machine>
      <machine maxCpus='255'>pc-i440fx-eoan</machine>
      <machine maxCpus='255'>pc-q35-2.5</machine>
      <machine maxCpus='255'>pc-i440fx-3.0</machine>
      <machine maxCpus='255'>pc-q35-yakkety</machine>
      <machine maxCpus='255'>pc-i440fx-mantic-hpb-maxcpus</machine>
      <machine maxCpus='255'>pc-i440fx-7.2</machine>
      <machine maxCpus='288'>pc-q35-2.11</machine>
      <domain type='qemu'/>
      <domain type='kvm'/>
    </arch>
    <features>
      <pae/>
      <nonpae/>
      <acpi default='on' toggle='yes'/>
      <apic default='on' toggle='no'/>
      <cpuselection/>
      <deviceboot/>
      <disksnapshot default='on' toggle='no'/>
      <externalSnapshot/>
    </features>
  </guest>

  <guest>
    <os_type>hvm</os_type>
    <arch name='x86_64'>
      <wordsize>64</wordsize>
      <emulator>/usr/bin/qemu-system-x86_64</emulator>
      <machine maxCpus='255'>pc-i440fx-noble</machine>
      <machine canonical='pc-i440fx-noble' maxCpus='255'>ubuntu</machine>
      <machine maxCpus='288'>pc-q35-mantic</machine>
      <machine maxCpus='255'>pc-i440fx-impish-hpb</machine>
      <machine maxCpus='288'>pc-q35-5.2</machine>
      <machine maxCpus='288'>pc-q35-lunar-hpb</machine>
      <machine maxCpus='255'>pc-i440fx-mantic</machine>
      <machine maxCpus='255'>pc-i440fx-2.12</machine>
      <machine maxCpus='255' deprecated='yes'>pc-i440fx-2.0</machine>
      <machine maxCpus='255'>pc-i440fx-xenial</machine>
      <machine maxCpus='288'>pc-q35-kinetic</machine>
      <machine maxCpus='255'>pc-i440fx-6.2</machine>
      <machine maxCpus='288'>pc-q35-4.2</machine>
      <machine maxCpus='255'>pc-i440fx-mantic-maxcpus</machine>
      <machine maxCpus='255'>pc-i440fx-2.5</machine>
      <machine maxCpus='255'>pc-i440fx-4.2</machine>
      <machine maxCpus='255'>pc-i440fx-focal</machine>
      <machine maxCpus='255'>pc-i440fx-hirsute</machine>
      <machine maxCpus='255'>pc-q35-xenial</machine>
      <machine maxCpus='255'>pc-i440fx-jammy-hpb</machine>
      <machine maxCpus='255'>pc-i440fx-5.2</machine>
      <machine maxCpus='255'>pc-q35-2.7</machine>
      <machine maxCpus='288'>pc-q35-eoan-hpb</machine>
      <machine maxCpus='255'>pc-i440fx-zesty</machine>
      <machine maxCpus='288'>pc-q35-groovy</machine>
      <machine maxCpus='255'>pc-i440fx-disco-hpb</machine>
      <machine maxCpus='288'>pc-q35-lunar</machine>
      <machine maxCpus='1024'>pc-q35-mantic-hpb-maxcpus</machine>
      <machine maxCpus='255'>pc-i440fx-groovy</machine>
      <machine maxCpus='288'>pc-q35-7.1</machine>
      <machine maxCpus='288'>pc-q35-artful</machine>
      <machine maxCpus='255' deprecated='yes'>pc-i440fx-trusty</machine>
      <machine maxCpus='255' deprecated='yes'>pc-i440fx-2.2</machine>
      <machine maxCpus='288'>pc-q35-focal-hpb</machine>
      <machine maxCpus='1024'>pc-q35-8.1</machine>
      <machine maxCpus='255'>pc-i440fx-eoan-hpb</machine>
      <machine maxCpus='1024'>pc-q35-jammy-maxcpus</machine>
      <machine maxCpus='288'>pc-q35-bionic-hpb</machine>
      <machine maxCpus='288'>pc-q35-mantic-hpb</machine>
      <machine maxCpus='255'>pc-i440fx-artful</machine>
      <machine maxCpus='255'>pc-i440fx-8.1</machine>
      <machine maxCpus='255'>pc-i440fx-2.7</machine>
      <machine maxCpus='288'>pc-q35-6.1</machine>
      <machine maxCpus='255'>pc-i440fx-kinetic</machine>
      <machine maxCpus='1024'>pc-i440fx-jammy-maxcpus</machine>
      <machine maxCpus='255'>pc-i440fx-yakkety</machine>
      <machine maxCpus='255'>pc-q35-2.4</machine>
      <machine maxCpus='288'>pc-q35-cosmic-hpb</machine>
      <machine maxCpus='255'>pc-i440fx-7.1</machine>
      <machine maxCpus='288'>pc-q35-2.10</machine>
      <machine maxCpus='1'>x-remote</machine>
      <machine maxCpus='288'>pc-q35-5.1</machine>
      <machine maxCpus='288'>pc-q35-2.9</machine>
      <machine maxCpus='255'>pc-i440fx-2.11</machine>
      <machine maxCpus='255'>pc-i440fx-jammy-hpb-maxcpus</machine>
      <machine maxCpus='288'>pc-q35-3.1</machine>
      <machine maxCpus='255'>pc-i440fx-6.1</machine>
      <machine maxCpus='288'>pc-q35-4.1</machine>
      <machine maxCpus='288'>pc-q35-jammy</machine>
      <machine maxCpus='255'>pc-i440fx-2.4</machine>
      <machine maxCpus='255'>pc-i440fx-4.1</machine>
      <machine maxCpus='288'>pc-q35-eoan</machine>
      <machine maxCpus='288'>pc-q35-jammy-hpb</machine>
      <machine maxCpus='255'>pc-i440fx-5.1</machine>
      <machine maxCpus='255'>pc-i440fx-2.9</machine>
      <machine maxCpus='255'>pc-i440fx-bionic-hpb</machine>
      <machine maxCpus='255'>pc-i440fx-lunar</machine>
      <machine maxCpus='1'>isapc</machine>
      <machine maxCpus='255'>pc-i440fx-mantic-hpb</machine>
      <machine maxCpus='288'>pc-q35-cosmic</machine>
      <machine maxCpus='255'>pc-q35-2.6</machine>
      <machine maxCpus='1024'>pc-q35-mantic-maxcpus</machine>
      <machine maxCpus='255'>pc-i440fx-3.1</machine>
      <machine maxCpus='288'>pc-q35-bionic</machine>
      <machine maxCpus='288'>pc-q35-disco-hpb</machine>
      <machine maxCpus='255'>pc-i440fx-cosmic</machine>
      <machine maxCpus='288'>pc-q35-2.12</machine>
      <machine maxCpus='255'>pc-i440fx-bionic</machine>
      <machine maxCpus='288'>pc-q35-kinetic-hpb</machine>
      <machine maxCpus='288'>pc-q35-groovy-hpb</machine>
      <machine maxCpus='288'>pc-q35-7.0</machine>
      <machine maxCpus='255'>pc-i440fx-lunar-hpb</machine>
      <machine maxCpus='288'>pc-q35-disco</machine>
      <machine maxCpus='255'>pc-i440fx-cosmic-hpb</machine>
      <machine maxCpus='255' deprecated='yes'>pc-i440fx-2.1</machine>
      <machine maxCpus='1024'>pc-q35-noble</machine>
      <machine canonical='pc-q35-noble' maxCpus='1024'>ubuntu-q35</machine>
      <machine maxCpus='288'>pc-q35-8.0</machine>
      <machine maxCpus='255'>pc-i440fx-wily</machine>
      <machine maxCpus='288'>pc-q35-impish</machine>
      <machine maxCpus='255'>pc-i440fx-8.0</machine>
      <machine maxCpus='255'>pc-i440fx-2.6</machine>
      <machine maxCpus='288'>pc-q35-6.0</machine>
      <machine maxCpus='255'>pc-i440fx-impish</machine>
      <machine maxCpus='255'>pc-i440fx-jammy</machine>
      <machine maxCpus='288'>pc-q35-impish-hpb</machine>
      <machine maxCpus='288'>pc-q35-hirsute</machine>
      <machine maxCpus='288'>pc-q35-4.0.1</machine>
      <machine maxCpus='288'>pc-q35-hirsute-hpb</machine>
      <machine maxCpus='255'>pc-i440fx-7.0</machine>
      <machine maxCpus='288'>pc-q35-5.0</machine>
      <machine maxCpus='288'>pc-q35-2.8</machine>
      <machine maxCpus='255'>pc-i440fx-2.10</machine>
      <machine maxCpus='288'>pc-q35-3.0</machine>
      <machine maxCpus='288'>pc-q35-zesty</machine>
      <machine maxCpus='288'>pc-q35-7.2</machine>
      <machine maxCpus='288'>pc-q35-4.0</machine>
      <machine maxCpus='255'>pc-i440fx-6.0</machine>
      <machine maxCpus='288'>pc-q35-focal</machine>
      <machine maxCpus='288'>microvm</machine>
      <machine maxCpus='255' deprecated='yes'>pc-i440fx-2.3</machine>
      <machine maxCpus='1024'>pc-q35-jammy-hpb-maxcpus</machine>
      <machine maxCpus='255'>pc-i440fx-disco</machine>
      <machine maxCpus='255'>pc-i440fx-kinetic-hpb</machine>
      <machine maxCpus='255'>pc-i440fx-4.0</machine>
      <machine maxCpus='255'>pc-i440fx-focal-hpb</machine>
      <machine maxCpus='1024'>pc-q35-8.2</machine>
      <machine canonical='pc-q35-8.2' maxCpus='1024'>q35</machine>
      <machine maxCpus='255'>pc-i440fx-groovy-hpb</machine>
      <machine maxCpus='255'>pc-i440fx-hirsute-hpb</machine>
      <machine maxCpus='255'>pc-i440fx-8.2</machine>
      <machine canonical='pc-i440fx-8.2' maxCpus='255'>pc</machine>
      <machine maxCpus='255'>pc-i440fx-5.0</machine>
      <machine maxCpus='255'>pc-i440fx-2.8</machine>
      <machine maxCpus='288'>pc-q35-6.2</machine>
      <machine maxCpus='255'>pc-i440fx-eoan</machine>
      <machine maxCpus='255'>pc-q35-2.5</machine>
      <machine maxCpus='255'>pc-i440fx-3.0</machine>
      <machine maxCpus='255'>pc-q35-yakkety</machine>
      <machine maxCpus='255'>pc-i440fx-mantic-hpb-maxcpus</machine>
      <machine maxCpus='255'>pc-i440fx-7.2</machine>
      <machine maxCpus='288'>pc-q35-2.11</machine>
      <domain type='qemu'/>
      <domain type='kvm'/>
    </arch>
    <features>
      <acpi default='on' toggle='yes'/>
      <apic default='on' toggle='no'/>
      <cpuselection/>
      <deviceboot/>
      <disksnapshot default='on' toggle='no'/>
      <externalSnapshot/>
    </features>
  </guest>

</capabilities>
posted @ 2024-06-08 15:14  huhy  阅读(70)  评论(0)    收藏  举报  来源
--> --> /*文章评论*/