vinothkumarn
VMware Employee
VMware Employee

Looking for vCD PowerCLI script to update VM CoresPerSocket value.

Hello,

I am looking for a vCD PowerCLI script to update VM CoresPerSocket value.

I am using below but it is not working.

Connect-CIServer -Server vCD_IP -user User -password Password

$CIVM = Get-CIVM "VM_Name" -Org "ORG_Name"

$CIVM.ExtensionData.Section[0].Item[6].VirtualQuantity.Value = 2

$CIVM.ExtensionData.Section[0].UpdateServerData()

I can achieve this with vCloud REST API but i need vCD PowerCLI script.

Kindly help.

0 Kudos
2 Replies
vinothkumarn
VMware Employee
VMware Employee

Per: set vCloud Director vApp VM memory and hardware with PowerCLI I can see we can only edit RASD but,

<?xml version="1.0" encoding="UTF-8"?>

<Item xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vmw="http://www.vmware.com/schema/ovf" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:vcloud="http://www.vmware.com/vcloud/v1.5" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml" vcloud:href="https://192.18.1.8/api/vApp/vm-73040aa2-1ae9-47a4-8771-f5b9ac7f8fe3/virtualHardwareSection/cpu" xsi:schemaLocation="http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://www.vmware.com/vcloud/v1.5 http://192.18.1.8/api/v1.5/schema/master.xsd http://www.vmware.com/schema/ovf http://www.vmware.com/schema/ovf http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd">

    <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>

    <rasd:Description>Number of Virtual CPUs</rasd:Description>

    <rasd:ElementName>2 virtual CPU(s)</rasd:ElementName>

    <rasd:InstanceID>3</rasd:InstanceID>

    <rasd:Reservation>0</rasd:Reservation>

    <rasd:ResourceType>3</rasd:ResourceType>

    <rasd:VirtualQuantity>2</rasd:VirtualQuantity>

    <rasd:Weight>0</rasd:Weight>

    <vmw:CoresPerSocket ovf:required="false">1</vmw:CoresPerSocket>

    <Link rel="edit" href="https://192.18.1.8/api/vApp/vm-73040aa2-1ae9-47a4-8771-f5b9ac7f8fe3/virtualHardwareSection/cpu" type="application/vnd.vmware.vcloud.rasdItem+xml"/>

</Item>

but, how to edit "<vmw:CoresPerSocket ovf:required="false">1</vmw:CoresPerSocket>"  through PowerCLI ?


Is this possible ?

0 Kudos
paulrg
Contributor
Contributor

This is what I am using...

# Set Cores Per Socket

  $CIVM.ExtensionData.Section[0].Item[6].Any[0].'#text' = $coreval

  $CIVM.ExtensionData.Section[0].UpdateServerData()

0 Kudos