Virsh 无法检测到我的新虚拟机

Virsh 无法检测到我的新虚拟机

我有一个来自旧操作系统的 *.qcow2 映像,其中包含 Windows 10。然后我将其复制到新操作系统并尝试安装它。我按照此处写的方法进行操作“如何在 virsh 中从现有基础映像创建新域“。

但是我的虚拟机没有从 virsh 中显示出来?(virsh list --all)那么我该如何让 virsh 检测我的新虚拟机?或者如果 virsh 无法检测到,我该如何从命令行运行我的虚拟机?

以下是我在终端窗口中运行的一些命令:

$ sudo virt-sysprep -a /home/vm-images/win10.qcow2 
[sudo] password for ita: 
[   0.0] Examining the guest ...
[   4.9] Performing "abrt-data" ...
[   4.9] Performing "backup-files" ...
[  27.3] Performing "bash-history" ...
[  27.3] Performing "blkid-tab" ...
[  27.3] Performing "crash-data" ...
[  27.3] Performing "cron-spool" ...
[  27.3] Performing "dhcp-client-state" ...
[  27.4] Performing "dhcp-server-state" ...
[  27.4] Performing "dovecot-data" ...
[  27.4] Performing "logfiles" ...
[  27.4] Performing "machine-id" ...
[  27.4] Performing "mail-spool" ...
[  27.4] Performing "net-hostname" ...
[  27.5] Performing "net-hwaddr" ...
[  27.5] Performing "pacct-log" ...
[  27.5] Performing "package-manager-cache" ...
[  27.6] Performing "pam-data" ...
[  27.6] Performing "passwd-backups" ...
[  27.6] Performing "puppet-data-log" ...
[  27.6] Performing "rh-subscription-manager" ...
[  27.7] Performing "rhn-systemid" ...
[  27.7] Performing "rpm-db" ...
[  27.7] Performing "samba-db-log" ...
[  27.7] Performing "script" ...
[  27.7] Performing "smolt-uuid" ...
[  27.7] Performing "ssh-hostkeys" ...
[  27.8] Performing "ssh-userdir" ...
[  27.8] Performing "sssd-db-log" ...
[  27.8] Performing "tmp-files" ...
[  27.8] Performing "udev-persistent-net" ...
[  27.9] Performing "utmp" ...
[  27.9] Performing "yum-uuid" ...
[  27.9] Performing "customize" ...
[  27.9] Setting a random seed
virt-sysprep: warning: random seed could not be set for this type of guest
[  28.2] Performing "lvm-uuids" ...
$ virt-install -n windows-10 --connect=qemu:///system --description "Windows 10" --os-type=win10 --ram=2048 --vcpus=1 --disk path=/home/vm-images/win10.qcow2,bus=virtio,size=12 --network default --boot hd

Starting install...
Domain creation completed.
You can restart your domain by running:
  virsh --connect qemu:///system start windows-10
$ virsh list --all
 Id   Name   State
--------------------

答案1

您忘记了virsh命令行选项--connect qemu:///system

因为您没有以 root 身份运行 virsh,所以它默认为qemu:///session,仅显示在您的用户帐户下运行的虚拟机。

相关内容