www.vmwareadmins.com

how many VMs can you put in a box?

  • Increase font size
  • Default font size
  • Decrease font size
Home Articles Add NFS Mount To Host Using vOrchestrator

Add NFS Mount To Host Using vOrchestrator

E-mail Print PDF

So, in PowerCLI to add an NFS mount to a host, you would use the following code:

$myhost = Get-VMHost 
    New-Datastore -Nfs -VMHost $myhost -Name nas-staging -Path /nas-staging -NfsHost devnas5s1.dev.org

However, you would need PowerShell, PowerCLI and the permissions to perform the action. Not only that, but you would also need the knowledge of how to execute PowerShell code, and be able to determine what vCenter server the host your trying to work with is connected too. 

Let's automate this! So in vOrchestrator, get a new workflow going.

Add a scriptable task, I used the following code block:

var hostDatastoreSystemRef = VMHost.configManager.datastoreSystem;
var hostDatastoreSys = VcPlugin.convertToVimManagedObject(VMHost, hostDatastoreSystemRef);

var NasVolumeSpec = new VcHostNasVolumeSpec();
NasVolumeSpec.accessMode = "readWrite";
NasVolumeSpec.localPath = name;
NasVolumeSpec.remoteHost = nfsHost;
NasVolumeSpec.remotePath = path;

hostDatastoreSys.createNasDatastore(NasVolumeSpec);

Add the following inputs:

Set up your bindings:

Validate and add your end point:

And execute your workflow!

Done!

 

From here, you can add permissions to your operations or lower-level administration teams for execution.

 

Follow Me On...

Facebook linkedin twitter youtube