This page was exported from Knowledge Base [ https://kb.net4future.de ]
Export date: Wed Jul 28 18:09:02 2021 / +0000 GMT

vRO Classes



Storage Class

Create a new Instance

var storage = System.getModule("com.vmware.pso.classes").getStorageClass();

Methods

addSCSIAdapter

Creates a device config spec to add a SCSI adapter to a Virtual Machine

use: storage.addSCSIAdapter(type, counter)

String type allowed values SAS, LSI, PARA

Number counter

return Number counter

example:

var storage = System.getModule("com.vmware.pso.classes").getStorageClass();

var ii = 0;

ii = storage.addSCSIAdapter("LSI", ii);

addDisk

Creates a device config spec to add a Disk to a Virtual Machine

use: storage.addDisk(sizeInGB, controllerKey, diskIndex, diskMode, thinProvisioned, counter)

String sizeInGB

String controllerKey e.g. 0 (scsi 0)

String DiskIndex e.g. 0 (disk Index)

String diskMode

boolean thinProvisioned

number counter#

return Number counter

Example:

var storage = System.getModule("com.vmware.pso.classes").getStorageClass();

var ii = 0;

ii = storage.addDisk(diskSizeGB, scsi, bus, diskMode, false, ii);

Network Class

Create a new Instance

var net = System.getModule("com.vmware.pso.classes").getNetworkClass();

Methods

addNetwork

Creates a device config spec to add aNetwork to a Virtual Machine

use: ii = net.addNetwork(networks[network],null, "vmxnet3", ii)

vC:Network network

String macAddress  if null autoted generated

String netType (pcnet32, e1000, e1000e, vmxnet2, vmxnet3, sriov)

Number counter

return Number counter

Example:

var networks = vm.network;

for ( var network in networks){

if(networks[network] instanceof VcNetwork){

//addNetwork(networks[network], "vmxnet3");

ii = net.addNetwork(networks[network],null, "vmxnet3", ii)

}

if(networks[network] instanceof VcDistributedVirtualPortgroup){

//addDVSNetwork(networks[network], "vmxnet3");

ii = net.addDVSNetwork(networks[network], null, "vmxnet3", ii);

}

}

addDVSNetwork

Creates a device config spec to add a DVS Network to a Virtual Machine

use: ii = net.addNetwork(networks[network],null, "vmxnet3", ii)

vC:DistributedVirtualPortgroup network

String macAddress  if null autoted generated

String netType (pcnet32, e1000, e1000e, vmxnet2, vmxnet3, sriov)

Number counter

return Number counter

Example:

var networks = vm.network;

for ( var network in networks){

if(networks[network] instanceof VcNetwork){

//addNetwork(networks[network], "vmxnet3");

ii = net.addNetwork(networks[network],null, "vmxnet3", ii)

}

if(networks[network] instanceof VcDistributedVirtualPortgroup){

//addDVSNetwork(networks[network], "vmxnet3");

ii = net.addDVSNetwork(networks[network], null, "vmxnet3", ii);

}

}

 

Helper Class

Create a new Instance

var helper = System.getModule("com.vmware.pso.classes").getHelperClass();

Methods

addItemIfNotExists

Add a item to an existing array if it not exists in the provided array

use: scsiNumbers = helper.addItemIfNotExists(diskProps[p].get("scsiid").split(":")[0], scsiNumbers);

String Item

Array Array/String

return Array/String

Example:

var helper = System.getModule("com.vmware.pso.classes").getHelperClass();

var myArray = [];

myArray = helper.addItemIfNotExists("1", myArray);

myArray = helper.addItemIfNotExists("2", myArray);

myArray = helper.addItemIfNotExists("3", myArray);

myArray = helper.addItemIfNotExists("1", myArray);

myArray = helper.addItemIfNotExists("2", myArray);

myArray = helper.addItemIfNotExists("3", myArray);

myArray = helper.addItemIfNotExists("4", myArray);

System.log(myArray);

Output: [2018-02-22 10:28:39.678] [I] 1,2,3,4

sqlToJsDate

Converts a MSSQL date into a Javascript Date

SQLDate sqlDate

return Date

Example:

var helper = System.getModule("com.vmware.pso.classes").getHelperClass();

var sqlDate = "2023-01-26 09:22:03.500";

System.log(helper.sqlToJsDate(sqlDate));

Output:

[2018-02-22 10:24:47.590] [I] Thu Jan 26 2023 09:22:03 GMT+0100 (CET)

 

 

 


Post date: 2018-02-21 16:10:14
Post date GMT: 2018-02-21 16:10:14
Post modified date: 2018-02-22 09:31:05
Post modified date GMT: 2018-02-22 09:31:05

Powered by [ Universal Post Manager ] plugin. MS Word saving format developed by gVectors Team www.gVectors.com