1.查找要删除的SR的UUID
[root@xenserver-154-localnfs iso]# xe sr-list name-label=local_vm uuid ( RO) : 8f61c204-2b65-fae4-d211-af47d7b44397 name-label ( RW): local_vm name-description ( RW): host ( RO): xenserver-154-localnfs type ( RO): lvm content-type ( RO): user
2.通过SR的uuid,查找物理存储块PBD的UUID
[root@xenserver-154-localnfs iso]# xe pbd-list sr-uuid=8f61c204-2b65-fae4-d211-af47d7b44397 uuid ( RO) : e4ce6fed-87b9-2a0d-e8d1-dddadec160e8 host-uuid ( RO): fa80b448-4ac6-40ca-935f-7c9808d9ffad sr-uuid ( RO): 8f61c204-2b65-fae4-d211-af47d7b44397 device-config (MRO): device: /dev/mapper/vm--VG-vm--LV currently-attached ( RO): true
3.断开PBD连接
xe pbd-unplug uuid=e4ce6fed-87b9-2a0d-e8d1-dddadec160e8
4.最后删除记录
xe sr-forget uuid=8f61c204-2b65-fae4-d211-af47d7b44397
5.错误过程形成脚本,脚本后期会添加内容
#!/bin/bash read -p "please input name-label of SR that you want to delete" LABEL SR-uuid=`xe sr-list name-label=$LABEL | grep "uuid" | awk -F : ‘{print $NF}‘` PBD-uuid=`xe pbd-list sr-uuid=${SR-uuid}` | grep "uuid" | awk -F : ‘{print $NF}‘` xe pbd-unplug uuid=${PBD-uuid} xe sr-forget uuid=${SR-uuid}
本文出自 “不求最好,只求更好” 博客,请务必保留此出处http://yujianglei.blog.51cto.com/7215578/1731442
原文地址:http://yujianglei.blog.51cto.com/7215578/1731442