XenServer

Things that have cropped up.

These notes are more for my notes than anything else. However someone might find them useful.

Cannot unplug/forget a storage resource.

XenCentre won't allow you to detach a storage resource. You see something like the following;

SR Failure

So, you break out the command line and do the following;

[[email protected] ~]# xe sr-list name-label=NFS\ ISO\ library uuid ( RO) : b3ef0d38-d702-791f-5ad5-62999131fc14 name-label ( RW): NFS ISO library name-description ( RW): NFS ISO Library [192.168.10.1:/export/isoshare] host ( RO): type ( RO): iso content-type ( RO): iso

and then you get the pbd-list to find out which you need to unplug

[[email protected] ~]# xe pbd-list sr-uuid=b3ef0d38-d702-791f-5ad5-62999131fc14 uuid ( RO) : 68dae2a6-51df-9fe2-10f6-29fab837777c host-uuid ( RO): 779ad98e-0dd8-4c01-8a09-cd00a785d10f sr-uuid ( RO): b3ef0d38-d702-791f-5ad5-62999131fc14 device-config (MRO): type: nfs_iso; location: 192.168.10.1:/export/isoshare currently-attached ( RO): true uuid ( RO) : 474a1538-088f-2166-359b-0d5e5fc53037 host-uuid ( RO): 77740ea2-957a-487a-b53a-96e5b3aa9e33 sr-uuid ( RO): b3ef0d38-d702-791f-5ad5-62999131fc14 device-config (MRO): type: nfs_iso; location: 192.168.10.1:/export/isoshare currently-attached ( RO): false

you attempt to unplug it....

[[email protected] ~]# xe pbd-unplug uuid=68dae2a6-51df-9fe2-10f6-29fab837777c Error code: SR_BACKEND_FAILURE_202 Error parameters: , General backend error [opterr=Command os.stat(/var/run/sr-mount/b3ef0d38-d702-791f-5ad5-62999131fc14) failed (5): failed],

But no, it doesn't work. This is because, somewhere, one of your hosts in your pool still has this mounted. So, just go around and find it and unmount. As you can see from below, it took a bit of brute force.

[[email protected] ~]# umount /var/run/sr-mount/b3ef0d38-d702-791f-5ad5-62999131fc14 umount.nfs: 192.168.10.1:/export/isoshare: not found / mounted or server not reachable umount.nfs: 192.168.10.1:/export/isoshare: not found / mounted or server not reachable [[email protected] ~]# umount -fl /var/run/sr-mount/b3ef0d38-d702-791f-5ad5-62999131fc14

Then, everything works as it should.

[[email protected] ~]# xe pbd-unplug uuid=68dae2a6-51df-9fe2-10f6-29fab837777c force=true [[email protected] ~]# xe sr-forget uuid=b3ef0d38-d702-791f-5ad5-62999131fc14