t_a_k
Contributor
Contributor

SOAP call in xml to remove NFS mount

Hello,

I am trying to remove a mounted NFS datastore but I am not able to get my head around the manganged reference to the datastore.

Can somebody help

sub createUnmountMessage {
my $msg = <<SOAP_UNMOUNT_MESSAGE;
<soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<RemoveDatastore xmlns="urn:internalvim25">
<_this xsi:type="HostDatastoreSystem" type="HostDatastoreSystem" serverGuid="">ha-datastoresystem</_this>
<datastore xsi:type="Datastore" type="Datastore">NFS_HDD</datastore>
</RemoveDatastore>
</soap:Body>
</soap:Envelope>
SOAP_UNMOUNT_MESSAGE

return $msg;
}

 

Kind regards

Thomas

Reply
0 Kudos
doskiran
Enthusiast
Enthusiast

Pass the ManagedObjectReference(MOID) for both HostDatastoreSystem and Datastore( not the datastore name).

https://vdc-repo.vmware.com/vmwb-repository/dcr-public/1ef6c336-7bef-477d-b9bb-caa1767d7e30/82521f49...

Eg:

 

<soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <RemoveDatastore xmlns="urn:internalvim25">
            <_this xsi:type="HostDatastoreSystem" type="HostDatastoreSystem">datastoreSystem-200</_this>
            <datastore xsi:type="Datastore">datastore-20</datastore>
        </RemoveDatastore>
    </soap:Body>
</soap:Envelope>

 

t_a_k
Contributor
Contributor

Hello 

many thanks! Turns out I am an id...

It is even easier than that. The NFS full-mount description is already the MOID. The reference to ha-datastoresystem is working just fine in this combination.

e.g.

<RemoveDatastore xmlns="urn:internalvim25">
<_this xsi:type="HostDatastoreSystem" type="HostDatastoreSystem" serverGuid="">ha-datastoresystem</_this>
<datastore xsi:type="Datastore" type="Datastore">192.168.110.110:/mnt/NFS_HDD</datastore>
</RemoveDatastore>

Again, many thanks - Only now I started using the mob view on host and than it became obvious :slightly_smiling_face: