Applying the Storage
Profile to a Virtual Machine
To use a storage profile for a virtual
machine, specify a
VirtualMachineDefinedProfileSpec
object for the
VirtualMachineConfigSpec.vmProfile
property.
The following code fragment sets the storage
profile and creates the virtual machine. The profile (
spbmProfile
) is a
VirtualMachineDefinedProfileSpec
. See
Retrieving an Existing Storage Profile from the Storage Policy Server.
Associating a Storage Profile with a Virtual
Machine
[...] VirtualMachineConfigSpec configSpec = new VirtualMachineConfigSpec(); // Set SPBM profile configSpec.getVmProfile().add(spbmProfile); [...] ManagedObjectReference taskmor = connection.getVimPort().createVMTask(vmFolderMor, vmConfigSpec, resourcepoolmor, hostmor);
The following figure shows how a storage profile
is integrated into a virtual machine configuration specification. Your client
establishes the link between the storage profile (
PbmCapabilityProfile
) and the
VirtualMachineDefinedProfileSpec
by setting the
profileId
property in the
VirtualMachineDefinedProfileSpec
. The Server
sets the
profileData
property when it
configures the virtual machine.
Using a Storage
Profile for Virtual Machine Provisioning
