VMware Cloud Community
dkfbp
Expert
Expert
Jump to solution

Resize VM disk and hot add disk in vCloud director?

Hi,

At the moment you can hot-add cpu and hot-add memory to a virtual machine in vCloud director. Two great features. But from a management perspective I would much rather have the option to hot-add disks and hot-extend disks in virtual machines. Extending disks and adding disks on the fly is a very common practise in vSphere.

Does anyone have any input on this? Can it be done through the API? Or is it on the road map for a future version of vCloud Director?

Best regards Frank Brix Pedersen blog: http://www.vfrank.org
0 Kudos
1 Solution

Accepted Solutions
lamw
Community Manager
Community Manager
Jump to solution

Yes this is possible using the vCloud API, take a look at this blog post by Jake Robinson that shows you how using the new vCloud Director cmdlets - http://geekafterfive.com/2012/02/24/vcloud-apigui-throwdown-part-2/

View solution in original post

0 Kudos
10 Replies
lamw
Community Manager
Community Manager
Jump to solution

Yes this is possible using the vCloud API, take a look at this blog post by Jake Robinson that shows you how using the new vCloud Director cmdlets - http://geekafterfive.com/2012/02/24/vcloud-apigui-throwdown-part-2/

0 Kudos
milton123
Hot Shot
Hot Shot
Jump to solution

I think this a great Idea!!!

It should be the road map for a future version of vCloud Director.

Cheers, Yours Udin

0 Kudos
finnzi
Contributor
Contributor
Jump to solution

Hi all,

Just tried the PowerCLI code from Jake's Blog:

(($vm.ExtensionData.Section | where {$_ -is [VMware.VimAutomation.Cloud.Views.OvfVirtualHardwareSection]}).item | where {$_.ResourceType.value -eq 17})[0].hostresource[0].AnyAttr[0]."#text" = $newsize gives me this error:

Unable to index into an object of type VMware.VimAutomation.Cloud.Views.OvfRASD
.
At C:\Users\finnurg\Documents\Work\resize.ps1:8 char:153
+ (($vm.ExtensionData.Section | where {$_ -is [VMware.VimAutomation.Cloud.Views
.OvfVirtualHardwareSection]}).item | where {$_.ResourceType.value -eq 17})[ <<<
< 0].hostresource[0].AnyAttr[0]."#text" = $newsize
    + CategoryInfo          : InvalidOperation: (0:Int32) [], RuntimeException
    + FullyQualifiedErrorId : CannotIndex

(newsize is set)

I checked out the ouput of:

(($vm.ExtensionData.Section | where {$_ -is  [VMware.VimAutomation.Cloud.Views.OvfVirtualHardwareSection]}).item |  where {$_.ResourceType.value -eq 17})

It shows me this:

Required              : True
Configuration         :
Bound                 :
AnyAttr               :
Address               :
AddressOnParent       : 0
AllocationUnits       :
AutomaticAllocation   :
AutomaticDeallocation :
Caption               :
ChangeableType        :
ConfigurationName     :
Connection            :
ConsumerVisibility    :
Description           : Hard disk
ElementName           : Hard disk 1
Generation            :
HostResource          : {}
InstanceID            : 2000
Limit                 :
MappingBehavior       :
OtherResourceType     :
Parent                : 3
PoolID                :
Reservation           :
ResourceSubType       :
ResourceType          : 17
VirtualQuantity       :
VirtualQuantityUnits  :
Weight                :
Any                   :

I see no size there.

Any ideas on how one could get this working?

---- Finnur Orn Gudmundsson
0 Kudos
jake_robinson_b
Hot Shot
Hot Shot
Jump to solution

Basically your error says that you are trying to get an member of an array where there is no array. You need to go deeper to find the size.

Try this:

(($vm.ExtensionData.Section | where {$_ -is [VMware.VimAutomation.Cloud.Views.OvfVirtualHardwareSection]}).item | where {$_.ResourceType.value -eq 17}).hostresource[0].AnyAttr[0]."#text"

Cheers,

Jake

Jake Robinson VCP, vExpert - geekafterfive.com - Twitter: @jakerobinson
0 Kudos
finnzi
Contributor
Contributor
Jump to solution

Works like a charm.

Thanks alot !

---- Finnur Orn Gudmundsson
0 Kudos
JustinLambe
Contributor
Contributor
Jump to solution

Hi,

I was running into the same error, and the above solved it for me as well however I am have run into a new error on the final (updateserverdata) step:

PowerCLI C:\> (($vm.ExtensionData.Section | where {$_ -is [VMware.VimAutomation.Cloud.Views.OvfVirtualHardwareSection]}).item | where {$_.ResourceType.value -eq 17}).hostresource[0].AnyAttr[0]."#text" = $newsize
PowerCLI C:\> ($vm.ExtensionData.Section | where {$_ -is [VMware.VimAutomation.Cloud.Views.OvfVirtualHardwareSection]}).updateserverdata()
Exception calling "UpdateServerData" with "0" argument(s): "Invalid hard disk parameters specified. The following parameters are invalid or conflict with other configured devices in the virtual machine:    Adaptor Type: SCSILSILOGIC, Bus Number: 0, Unit Number: 0"
At line:1 char:123
+ ($vm.ExtensionData.Section | where {$_ -is [VMware.VimAutomation.Cloud.Views.OvfVirtualHardwareSection]}).updateserverdata <<<< ()
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

The VM is a thin provisioned linked clone, using LSI Logic Parallel SCSI.

Do you know what might cause this error?

EDIT: Nevermind, I worked it out. It was because of linked clones.

Thanks,

Justin

Message was edited by: JustinLambe

0 Kudos
cvrich
Contributor
Contributor
Jump to solution

I am running to much of the same issue... Below is what is being returned...

Exception calling "UpdateServerData" with "0" argument(s): "Argument ''uriTempl
ate' must not be null' cannot be null.
Parameter name: 'uriTemplate' must not be null"
At C:\users\rharber\desktop\modifydrive.ps1:7 char:123
+ ($vm.ExtensionData.Section | where {$_ -is [VMware.VimAutomation.Cloud.Views.
OvfVirtualHardwareSection]}).updateserverdata <<<< ()
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

0 Kudos
Exwork
Enthusiast
Enthusiast
Jump to solution

Under vCD 5.1.1, you can extend the size of existing disks. Hot adding disks is also possible.

I assume there's also a way to do this via the API.

0 Kudos
rastarockman
Contributor
Contributor
Jump to solution

Were you able to figure out the UpdateServerData for disk resize. I am getting the same error on vcd 5.1.

0 Kudos
rastarockman
Contributor
Contributor
Jump to solution

In vCloud Director 5.1.2 the following works to Resize a hard disk:

#VM to update

$vm = Get-CIVM MyVMName

#Size of Hard Disk in MB

$newsize = “32768”

#Retrieves the hardware section of VM

$drive = $vm.ExtensionData.getvirtualhardwaresection()

# [3] needs to be updated with Disk number, the first disk will be [0]

($drive.Item | where {$_.ResourceType.value -eq 17})[3].hostresource[0].AnyAttr[0]."#text" = $newsize

#Update Server with new size

$drive.updateserverdata()

0 Kudos