Hi,
I'm making a workflow in Orchestrator to automatically add a new datastore to a cluster.
This all works but I have to set the Multipath settings for this specific LUN to Round Robin on each host.
I created code that sets all the LUNs to Round Robin, but it only has to be for this specific LUN only.
Can somebody help me out with this?
This is the current code I have:
var mpp = new VcHostMultipathInfoLogicalUnitPolicy() ;
mpp.policy = "VMW_PSP_RR";
for each (var host in hosts) {
for each (var lun in host.config.storageDevice.multipathInfo.lun) {
var id = lun.id;
host.configManager.storageSystem.setMultipathLunPolicy(id, mpp);
}
}
I have the "naa", so I can do the check, but I can't get the "naa" from the multipathInfo.
I tried to use:
lun.lun.displayName
lun.lun.canonicalName
lun.lun.deviceName
But it gives "undefined" as output
Output example:
[2013-12-27 11:12:18.346] [D] LUN.id: 020003000060050768018086e430000000000003f1323134352020
[2013-12-27 11:12:18.346] [D] LUN.LUN: key-vim.host.ScsiDisk-020003000060050768018086e430000000000003f1323134352020
[2013-12-27 11:12:18.346] [D] LUN.LUN.displayName: undefined
[2013-12-27 11:12:18.346] [D] LUN.LUN.canonicalName: undefined
[2013-12-27 11:12:18.346] [D] LUN.LUN.deviceName: undefined
Hi,
I can't get the Details you've listed at the bottom of your post, too!
But when you have a look to the ID from the LUN you've extracted, you can see that the naa.XXX is included in there.
So I think it should be possible to extract this number, here a quick example from my Environment:
lun.id = 0200bf000060060e8016546b000001546b00006abf4f50454e2d56
naa = naa.60060e8016546b000001546b00006abf
Extracting:
var myNaa = lun.id.slice(10,42);
System.log("My Naa: naa." + myNaa);
So in your code it could be something like this:
var mpp = new VcHostMultipathInfoLogicalUnitPolicy() ;
mpp.policy = "VMW_PSP_RR";
for each (var host in hosts) {
for each (var lun in host.config.storageDevice.multipathInfo.lun) {
var id = lun.id;
var myNaaExtract = lun.id.slice(10,42);
if(myNaaExtract.search("60060e8016546b000001546b00006abf")!= -1) {
System.log("Found the matching NAA...");
host.configManager.storageSystem.setMultipathLunPolicy(id, mpp);
}}
}
Maybe you have to modify the "slice" to match with your Array (using other numbers than 10 and 42) and of course in line 7 the "naa id".
Hopefully it helps for you...
Regards,
Marc
Hi,
I can't get the Details you've listed at the bottom of your post, too!
But when you have a look to the ID from the LUN you've extracted, you can see that the naa.XXX is included in there.
So I think it should be possible to extract this number, here a quick example from my Environment:
lun.id = 0200bf000060060e8016546b000001546b00006abf4f50454e2d56
naa = naa.60060e8016546b000001546b00006abf
Extracting:
var myNaa = lun.id.slice(10,42);
System.log("My Naa: naa." + myNaa);
So in your code it could be something like this:
var mpp = new VcHostMultipathInfoLogicalUnitPolicy() ;
mpp.policy = "VMW_PSP_RR";
for each (var host in hosts) {
for each (var lun in host.config.storageDevice.multipathInfo.lun) {
var id = lun.id;
var myNaaExtract = lun.id.slice(10,42);
if(myNaaExtract.search("60060e8016546b000001546b00006abf")!= -1) {
System.log("Found the matching NAA...");
host.configManager.storageSystem.setMultipathLunPolicy(id, mpp);
}}
}
Maybe you have to modify the "slice" to match with your Array (using other numbers than 10 and 42) and of course in line 7 the "naa id".
Hopefully it helps for you...
Regards,
Marc
Indeed the naa is hidden in the id. Thanks for the answer!