VMware Cloud Community
thechaos
Enthusiast
Enthusiast
Jump to solution

Get the scsi information for a datastore if the datastore name is known

Hi,

i'm looking for a way to get the scsci Information for a datastore if the name of the datastore is known. In perl/powershell this is not a big problem, but how to do this using the orchestrator. It seems that some informations are not available/accessible in vCO, like the volume.extent information (VcHostFileSystemVolume object).

As an example on how to do that in powershell see

http://vwiki.co.uk/Datastore_to_LUN_Mapping_%28PowerCLI%29

Any idea on how to do the same with the orchestrator.

Regards

     Thomas

0 Kudos
1 Solution

Accepted Solutions
thechaos
Enthusiast
Enthusiast
Jump to solution

Hi,

onyx would not help in this case. After thinking a little bit i found the solution. I looks like:

for each (var lun in wfHostObject.configManager.storageSystem.storageDeviceInfo.multipathInfo.lun) {

    System.debug("Number of pathes :: "+lun.path.length);

    for each (var path in lun.path) {

        if (path.state == "active") {       

            //

            // Get the mountinfo

            //

            System.debug("mountinfo length :: "+wfHostObject.configManager.storageSystem.fileSystemVolumeInfo.mountInfo.length);

            for each (var mount in wfHostObject.configManager.storageSystem.fileSystemVolumeInfo.mountInfo) {

                if (mount.volume.hasOwnProperty("extent")) {

                    for each (var extent in mount.volume.extent) {                   

                        var tmp = extent.diskName.split(/\./);                   

                        var regExp = new RegExp(tmp[1],'gi');

                        if (lun.id.match(regExp)) {

                            System.debug("mount.type :: "+mount.volume.type);

                            System.debug("mount.name :: "+mount.volume.name);

                            System.debug("extent.diskName :: "+extent.diskName);       

                        }

                    }

                }

            }

        }

    }

}

View solution in original post

0 Kudos
3 Replies
mcfadyenj
Hot Shot
Hot Shot
Jump to solution

I find the easiest way of doing this against vCenter is using onyx.

check out the fling on onyx it is invaluable for learning the api.

change a parameter on the object you are looking for and onyx will write that code for you. saves a stack of time and questions and you almost always get the right answer 🙂

0 Kudos
mcfadyenj
Hot Shot
Hot Shot
Jump to solution

a bit more detail is likely to help.

you basically put onyx in between your client and your vcenter.

Normally you are

vcenter client -> vcenter

http://labs.vmware.com/flings/onyx

with this its

vcenter client -> onyx -> vcenter

it will intercept all calls you make on the client and script it out for you in your weapon of choice. When looking for curly ones like this that are somewhat obscure this is by far the quickest resolution I have found to date.

0 Kudos
thechaos
Enthusiast
Enthusiast
Jump to solution

Hi,

onyx would not help in this case. After thinking a little bit i found the solution. I looks like:

for each (var lun in wfHostObject.configManager.storageSystem.storageDeviceInfo.multipathInfo.lun) {

    System.debug("Number of pathes :: "+lun.path.length);

    for each (var path in lun.path) {

        if (path.state == "active") {       

            //

            // Get the mountinfo

            //

            System.debug("mountinfo length :: "+wfHostObject.configManager.storageSystem.fileSystemVolumeInfo.mountInfo.length);

            for each (var mount in wfHostObject.configManager.storageSystem.fileSystemVolumeInfo.mountInfo) {

                if (mount.volume.hasOwnProperty("extent")) {

                    for each (var extent in mount.volume.extent) {                   

                        var tmp = extent.diskName.split(/\./);                   

                        var regExp = new RegExp(tmp[1],'gi');

                        if (lun.id.match(regExp)) {

                            System.debug("mount.type :: "+mount.volume.type);

                            System.debug("mount.name :: "+mount.volume.name);

                            System.debug("extent.diskName :: "+extent.diskName);       

                        }

                    }

                }

            }

        }

    }

}

0 Kudos