服务器1的正确的状态是关闭但是当我以普通用户身份运行命令时,它显示的状态为为普通用户运行和用 sudo 关闭
[msingh@localhost VMFiles]$ virsh list --all
Id Name State
----------------------------------------------------
1 server1 running
[msingh@localhost VMFiles]$ sudo virsh list --all
[sudo] password for msingh:
Id Name State
----------------------------------------------------
- generic shut off
- server1 shut off
- server2 shut off
- windows shut off
[msingh@localhost VMFiles]$
这是另一个命令:
[msingh@localhost server1]$ sudo virsh dominfo server1
Id: -
Name: server1
UUID: acd31081-b513-4e46-b2a2-20ad6bb9ac2e
OS Type: hvm
State: shut off
CPU(s): 1
Max memory: 1048576 KiB
Used memory: 1048576 KiB
Persistent: yes
Autostart: disable
Managed save: no
Security model: selinux
Security DOI: 0
[msingh@localhost server1]$ virsh dominfo server1
Id: 1
Name: server1
UUID: 8f6fa56a-b062-424a-9100-7f411df1c28b
OS Type: hvm
State: running
CPU(s): 1
CPU time: 18.8s
Max memory: 1024 KiB
Used memory: 2048 KiB
Persistent: yes
Autostart: disable
Managed save: no
Security model: selinux
Security DOI: 0
Security label: unconfined_u:unconfined_r:svirt_t:s0:c290,c658 (enforcing)
答案1
默认情况下,sudo virsh
将访问系统 libvirt 实例。
virsh
作为非特权用户,将尝试访问该用户的 libvirt 实例。
您有一个server1
在用户实例中调用的虚拟机和一个server1
在系统实例中调用的虚拟机,但它们不是同一个虚拟机:)。例如,您的输出显示它们具有不同的内存配置。