新的一周,又要忙活,早上来发现服务器又关机了,又得手动启动我的个人虚拟机,可是我的是mac的系统,没有xencenter的客户端,每次都得找个windows机器打开xencenter,太麻烦了。决定还是用命令比较省事。

1、连到xenserver的console,提示找不到SR

[root@xs-10 ~]# xe vm-start uuid=1a934247-d109-b9c2-5ff7-ef49ac511145
There are no suitable hosts to start this VM on.
The following table provides per-host reasons for why the VM could not be started:

xs-10.8    : Cannot start here [VM requires access to SR: a8462cf0-f52d-6727-d698-498e9dd33414 (ufs_test)]

There were no hosts available to complete the specified operation.

2、查看pbd,可以看到状态为false

[root@xs-10 ~]# xe pbd-list

uuid ( RO)                  : 40309720-8274-da82-7ab6-40a1e9211b7b
             host-uuid ( RO): 09b5d6b1-9594-49a2-bd4f-b20b2dd5ed47
               sr-uuid ( RO): a8462cf0-f52d-6727-d698-498e9dd33414
         device-config (MRO): port: 3260; target: 172.20.10.107; SCSIid: 1554954000000000000000000020000000000000000000000; targetIQN: iqn.2007-10.uit.com:techtest.ufstest2
    currently-attached ( RO): false

3、重新添加pbd

xe pbd-plug uuid=40309720-8274-da82-7ab6-40a1e9211b7b

4、再次启动即可
xe vm-start uuid=1a934247-d109-b9c2-5ff7-ef49ac511145

可是,为什么提示是vm找不到SR?为什么添加一个pbd就好了呢?还得知道xenserver的存储关系。如下图,是xenserver的存储关系图。

Image

各个术语解释如下:

存储库 (SR)

虚拟磁盘映像 (VDI)

物理块设备 (PBD)

虚拟块设备 (VBD)

  可以知道SR是存储库,里面有很多的VDI,我的虚拟机(VM)利用VBD使用VDI。

  而xenserver的主机,是通过PBD链接到SR的。

所以上文中提示找不到SR (ufs_test),是因为xenserver主机和pbd之间的链接断掉了,我只要重新plug一下即可。