VMware Cloud Community
marcseitz
Enthusiast
Enthusiast
Jump to solution

How to extend a virtual Disk in a Workflow

Hello together,

I have a problem in creating a Workflow.

I want to deploy a VM using a CustSpec (Works fine). After the deploymente I want to extend the Disk - This is my problem.

Does anyone of you know how to extend a virtual Disk of a VM?

Thank You Very Much

Marc

Reply
0 Kudos
1 Solution

Accepted Solutions
storm27
Enthusiast
Enthusiast
Jump to solution

I haven't tried this at my end, but you can try something like this:

You need to create a scriptable task and search for the scripting class VirtualLsiLogicController from the API explorer. The properties which need are mandatory to set as seen in the vSphere reference guide are:

- busnumber( can be set to 0)

-key (can be set to 0)

-sharedBus( set VirtualSCSISharing.physicalSharing) // VirtualSCSISharing is a enum type , refer API explorer

After defining the above object (VirtualLsiLogicController ), set this in the virtualdeviceconfigspec object and set this deviceconfigspec to the devicechange property of the virtualmachine configspec (as done previously for adding a virtual disk).

Hope it helps!

-Angela-

View solution in original post

Reply
0 Kudos
5 Replies
storm27
Enthusiast
Enthusiast
Jump to solution

Hi,

For adding a new virtual disk to an existing VM, you need to invoke reconfigVM_task API.

You first need to retreive the SCSI controller key of the existing VM. Then create an action element with the API " createVirtualDiskFlatVer2ConfigSpec" and pass the required parameters. This API returns a deviceConfigSpec,assign this to the deviceChange property of the virtualmachineconfigspec and pass this config spec as a parameter to the reconfigVM_task.

Hope this helps!

-Angela

marcseitz
Enthusiast
Enthusiast
Jump to solution

Hi Angela,

thank you for your Answer! Now I know how to expand a virtual disk - very easy Smiley Happy

But I have another questeion:

How to connect a new virtual Disk to a new SCSI-Controller.

To add a disk to a existing SCSI-Controller is no Problem.

My Problem is, how to add a SCSI-Controller. I've tried to use the "VCVirtualSCSIController" - But it doesn't work.

Do You know something about this "problem"?

Thank You very much!

Marc

Reply
0 Kudos
storm27
Enthusiast
Enthusiast
Jump to solution

I haven't tried this at my end, but you can try something like this:

You need to create a scriptable task and search for the scripting class VirtualLsiLogicController from the API explorer. The properties which need are mandatory to set as seen in the vSphere reference guide are:

- busnumber( can be set to 0)

-key (can be set to 0)

-sharedBus( set VirtualSCSISharing.physicalSharing) // VirtualSCSISharing is a enum type , refer API explorer

After defining the above object (VirtualLsiLogicController ), set this in the virtualdeviceconfigspec object and set this deviceconfigspec to the devicechange property of the virtualmachine configspec (as done previously for adding a virtual disk).

Hope it helps!

-Angela-

Reply
0 Kudos
marcseitz
Enthusiast
Enthusiast
Jump to solution

Hi again,

I see - you are working a lot with the vCO Smiley Happy

I've tried to add a SCSI-Controller like you told - Works fine!!! THANK YOU!!

Here is the Code of the scriptable Task (if somebody needs this):

// 'New Controller'

var newLSIController = new VcVirtualLsiLogicController() ;

// New VM Config-Spec

var configSpec = new VcVirtualMachineConfigSpec();

var deviceConfigSpecs = new Array();

var deviceConfigSpec;

// Bus-Nummer, Key und Sharing definieren

newLSIController.busNumber = 1;

newLSIController.key = 1;

// Mode of the Controller

newLSIController.sharedBus = VcVirtualSCSISharing.physicalSharing;

// Device-Config-Spec (new Controller)

deviceConfigSpec = new VcVirtualDeviceConfigSpec();

deviceConfigSpec.device = newLSIController;

deviceConfigSpec.operation = VcVirtualDeviceConfigSpecOperation.add;

deviceConfigSpecs[0] = deviceConfigSpec;

configSpec.deviceChange = deviceConfigSpecs;

// Launch the reconfigVM task

task = in_vm.reconfigVM_Task( configSpec );

I hope it will work Smiley Happy

Marc

Reply
0 Kudos
pevm2008
Contributor
Contributor
Jump to solution

You should download and try fatVM

fatVM is a reliable, robust, and safe, 1-click solution for extending the C drive of your VMware Fusion virtual disk that is becoming full.

  • It provides a simple, intuitive, interface and a reliable process that hides the technical complexity of extending a virtual disk.

  • It is robust because it can extend virtual disks having snapshots and clones.

  • It is safe because it preserves your original disk, which remains available to you for when the need ever arises.

Reply
0 Kudos