Resizing disk VM through VCO

Hi all,

I'm trying to resize a disc of virtual machine through the VCO, without success.

In fact, I wrote the following script:

//*************************************************

VM is a parameter of VC:VirtualMachine

newSize is a parameter number

return type is VC:Task

If (! vm) return null;

var features = vm.config.hardware.device;
var firstDisk = null;
diskSize var = - 1;
var newSizeInKB = newSize * 1024 * 1024;

Find the first VM disk

for (var i in devices) {}
If (devices [i] instanceof VcVirtualDisk) {}

firstDisk = edge [i];
}
}


diskSize = firstDisk.capacityInKB;
If (diskSize < 0 | newSizeInKB < = diskSize) return null; No disk is found, or the newSize is too small

_key var = firstDisk.key;
var _controllerKey = firstDisk.controllerKey;
var _unitNumber = firstDisk.unitNumber;
var _backing = firstDisk.backing;
var _newDiskSizeInKB = newSizeInKB;

System.log ("key:" + _key + "\nControllerKey:" + _controllerKey + "\nUnitNumber:" + _unitNumber + "\nBacking:" + _backing);

var _newVirtualDevice = new VcVirtualDisk();
_newVirtualDevice.controllerKey = _controllerKey;
_newVirtualDevice.key = _key;
_newVirtualDevice.backing = _backing;
_newVirtualDevice.unitNumber = _unitNumber;
_newVirtualDevice.capacityInKB = _newDiskSizeInKB;

System.log ("key:" + _newVirtualDevice.key + "\nControllerKey:" + _newVirtualDevice.controllerKey + "\nUnitNumber:" + _newVirtualDevice.unitNumber + "\nBacking:" + _newVirtualDevice.backing + "\nNew size:" + _newVirtualDevice.capacityInKB);

var _virtualDeviceConfigSpec = new VcVirtualDeviceConfigSpec();
_virtualDeviceConfigSpec.device = _newVirtualDevice;
_virtualDeviceConfigSpec.operation = VcVirtualDeviceConfigSpecOperation.edit;
_virtualDeviceConfigSpec.fileOperation = VcVirtualDeviceConfigSpecFileOperation.replace;


var _virtualMachineConfigSpec = new VcVirtualMachineConfigSpec();
_virtualMachineConfigSpec.deviceChange = new Array();
_virtualMachineConfigSpec.deviceChange.push (_virtualDeviceConfigSpec);

Return vm.reconfigVM_Task (_virtualMachineConfigSpec);

//*************************************************

Execution of the code, I can see the task beginning and ending immediately in vCenter without errors, but the vm disk size remains the same.

Could you help me?

Hello

It may seem strange, but you can try to change these lines:

_virtualMachineConfigSpec.deviceChange = new Array();
_virtualMachineConfigSpec.deviceChange.push (_virtualDeviceConfigSpec);

with

var changedDevices = new Array();

changedDevices.push (_virtualDeviceConfigSpec);

_virtualMachineConfigSpec.deviceChange = changedDevices;

There is a problem with directly edit properties of type table.

Kind regards

-Martin

Tags: VMware

Similar Questions

  • In the face of the question and try to set the affinity through VCO workflow rule

    In the face of the question then to attempt to set the affinity through VCO workflow rule I'm trying to write workflow VCO to set up the level of affinity of cluster, but it throws the error message cannot convert ClusterComputeResource 'mycluster' to com.vmware.vim.vi4.ClusterConfigSpec (Workflow: create vm-virtual machine affinity rule / Scriptable task (item1) #19) my script to workflow is var rule = new VcClusterAntiAffinityRuleSpec(); Rule.Key = - 30; Rule.enabled = true; Rule.Name = ruleName; rule.userCreated = true; Rule.VM = MV; var clusterSpecRules = new Array(); var clusterSpecRule = new VcClusterRuleSpec(); clusterSpecRule.operation = VcArrayUpdateOperation.add; clusterSpecRule.info = rule; clusterSpecRules.push (clusterSpecRule); var clusterSpec = new VcClusterConfigSpec(); clusterSpec.rulesSpec = clusterSpecRules; var m = computeCluster.vimHost //spec = task = computeCluster.reconfigureCluster_Task (computeCluster, spec, true); Note: In the above code, what are the entry parameter computeCluster entered type parameter VC:clusterComputeResource ruleName is a parameter of type String - APR

    Here is the code I use, give it a shot.

    var affinitySpec = new VcClusterAffinityRuleSpec();
    affinitySpec.enabled = true;
    affinitySpec.name = att_ruleName;
    affinitySpec.userCreated = true;
    affinitySpec.vm = att_vmArray;

    var clusterRuleSpec = new Array (new VcClusterRuleSpec());
    clusterRuleSpec [0] = new VcClusterRuleSpec()
    .operation clusterRuleSpec [0] = VcArrayUpdateOperation.add;
    clusterRuleSpec [0] .info = affinitySpec;

    var clusterConfigSpec = new VcClusterConfigSpecEx();
    clusterConfigSpec.rulesSpec = clusterRuleSpec;

    att_task = att_clusterComputeResource.reconfigureComputeResource_Task (clusterConfigSpec, true);

  • Resizing disk and extend the volume

    Hello

    We receive many questions with drives running out of space. So I want to automatically resize these discs and trigger the server assigned to run diskpart to extend the drive. otherwise, there has no presence for the task of resizing automatically.

    My problem is: is he a psossibity to trigger this disk extend with powershell plugin vco, without installation on each server certificate and by adding it as a powershellhost to vco.

    My workflow resizing works and the powershell script is also no problem. But how to group them?

    My idea was to run the script to a central powershellhost. Unfortunately PS plug-ins use ps-remote access and remote in a remote session access is not possible: S

    That's why I'm looking for any other in comments operations to handle this.

    Do you have any other idea or a good indication.

    Thanks in advance

    Hello!

    I see two ways:

    1 use my Plugin PowerSSHell for vCO, he called Powershell via SSH, so you might be able to use ps-distance communication.

    Download and info here: http://www.vcoportal.de/powersshell-plugin/

    To download powershell ssh server: http://www.powershellinside.com/powershell/ssh/Default.aspx (a free license is available as far as I KNOW)

    (A central script host script was exactly the use case, I created the plugin for)

    2. you use VIX-plugin (if you're on vSphere 4), or the API vSphere comments 5 to call the script inside the VM guest.

    See the discussion here: http://communities.vmware.com/message/2006040

    Kind regards

    Joerg

  • Cannot resize disk

    Today, I created a new virtual machine using "Import Windows XP Mode". This has created a machine with a disk of size 127 GB. I moved this virtual machine to another location. Everything works fine.

    BUT... then I tried to resize the drive using 'Virtual Machine Settings' > select hard drive > "Utilities" > "expand...". »

    This gives the following error:

    "The called function cannot perform partial channels. Please open the virtual disk parent. »

    Looked for clues of what he must do next, but did not find anything useful (in my opinion). Subjects were not associated with VMWare Player or referred to in the questions with snapshots, but I believe that I don't have any snapshot. So after hours searching the web, I ran out of options.

    Does anyone know what I should do next?

    Well, I had some time to install Windows XP Mode in Windows 7 and then using VMware Player chosen import VM from Microsoft Windows XP Mode and it has created the Virtual Machine from Windows XP Mode VMware and first without running the image below shows the default files created during this process.

    "As I previously well that the 'Windows XP Mode.vmdk" VHD is linked to the virtual hard disk "Windows XP Mode base.vhd" as evidenced by the information contained in the disc DescriptorFile built into the Windows XP Mode.vmdk ' of the virtual hard disk as shown below.

    # Disk DescriptorFile
    version=1
    CID=37ee0fdc
    parentCID=00000000
    createType="monolithicSparse"
    parentFileNameHint="C:\Program Files\Windows XP Mode\Windows XP Mode base.vhd"
    # Extent description
    RW 266338304 SPARSE "Windows XP Mode.vmdk"
    
    # The Disk Data Base
    #DDB
    
    ddb.encoding = "windows-1252"
    

    This means that, unless you resize the virtual hard disk "Windows XP Mode base.vhd" first before using the command import Windows XP Mode in VMware Player, then you won't be able to have a larger hard under VMware Player as the "Windows XP Mode.vmdk" virtual hard disk is for all purposes useful just a disk snapshot and under normal circumstances a virtual hard disk with the snapshots can be expanded through normal default methods.

  • Resizing disk C of Server 2008 VM

    I'm having a problem of resizing of one of my virtual machines.  I had 4 virtual machines that are running as Terminal servers, I could resize the vm 3 successfully 4.  It's really a bit easy, after all the post, I stumbled across how to resize a disk, it turned a virtual computer that is running Server 2008 is frank.

    The steps that worked:

    Delete all snapshots

    Shutdown VM

    Change the settings through VI

    Change hard disk 1 for correct size (Changed from 40 GB to 60 GB)

    Restart the virtual machine

    In the Server Manager & gt; Storage & gt; New analysis management of drive and you should see the new unallocated space. Right click on the C drive and choose expand volumes.

    That's it, you're done.  I restarted the server just to be safe.

    However, on my last server when I change the space of 40-60 GB disk and click OK.  If the back, I opened the settings, the HD is 40 GB.  I have more than 500 GB left in my data store.  The player is a basic player and it seems to be the same as the rest.

    Any thoughts?

    sergio1228 wrote:

    However, on my last server when I change the space of 40-60 GB disk and click OK.  If the back, I opened the settings, the HD is 40 GB.  I have more than 500 GB left in my data store.  The player is a basic player and it seems to be the same as the rest.

    You are 100% sure that this virtual machine is not any snapshots?

  • Resize Disk Partition problem

    I'm trying to remove a partition on a HARD internal disk and place the unused disk space in C: drive.  I currently have two partitions C: and D:.  The D: partition was initially used for recovery purposes, but is now empty.  The problem I have is when I go to disk Management, it's that the partition d: is located to the left of the C: partition (I guess that this was done by the manufacturer.  Therefore, even if I delete the partition to the unallocated space, I can't even extend C left since extend cannot be used after the C: partition.  I tried to use diskpart.exe, but have had no success with that either.  I tried Gparted boot disk for resize/move, but when I try to apply I get an error and nothing happens.  Any help would be appreciated.

    You will not be able to do it, because the disc was encrypted by OEM making it to prevent the violation of copyright or corruption of files. You will need a third party app to save your data and repartition the entire disk.

    Messages rating helps other users

    Mark L. Ferguson MS - MVP

  • Resizing disk partitions.

    I removed two unused partitions on my hard drive. Now I have C:\, D:\ (original image) and 2 spaces of the same size as the partitions that I deleted. One is not entitled 'allocated' and the other 'free '. I would like to combine the two in a partition with the combined size of the 2 I have deleted, but when I try to create a new partition of one of them, their size is limited by the size of the old partitions. Is it possible to combine the non allocated and free spaces in a new larger partition? Thank you. ... Jim

    Tom...

    Thanks for your comments. I am able to create a (E:\) partition out of unallocated space, but can't locate 'disk management' to try to resize to take advantage of the free space. How do you get the drive management? I use Vista 64 Home Premium.

    ... Jim

    http://www.Vistax64.com/tutorials/95418-disk-management-delete-extend.html

    http://www.Vistax64.com/tutorials/95398-disk-management-shrink-partition-3.html

    Read the above.

    See you soon.

    Mick Murphy - Microsoft partner

  • Resizing disk Server 2008 all online

    Hello

    Ive just resized a few 2003 Windows Server system partitions on the fly by allocating additional space by v-sphere, then Aoemi.

    Well impressed that a reboot was necessary. Interviewed just out of curiosity, why it can be live on 2008 Server (the v-sphere bit) - two basic on the same storage disks.

    Thank you!

    HerveJean wrote:

    I resized 2008 front in and out of VMware if this isn't a problem, just curious as to why he would let me do work on 2003, but not on 2008.

    I think you may have a glimpse on the VM Windows 2008, this prevents the extension.

  • Resizing disk Question

    Hi all

    I have a small question which I'm sure will be an easy answer.  I just want to be sure before doing this.  I have a server Exchange (VM) I need to resize the C drive.  I need to reduce it 90 GB to 50 GB.  Is there something I need to be concerned or any problems?  I shrunk the partition in Windows server 2008 now I need to resize the disk in the VI client.  Any info is appreciated.  Thank you!

    Perry

    Sorry, not the version of the OS.  Yes, W2K8 has a tool for resizing for expansion and shrinkage.  I've never had the need to shrink, so I can't say for sure...

    I don't know what will happen by changing just the size of the HARD drive by changing the settings of the virtual machine.  I would say that if you have a test of the virtual machine, try it on this first.

  • Resizing disks after P2V...?

    I don't know if this is possible, or if I did it correctly, but here is the scenario...

    I managed to convert a machine using the 'Stand Alone' P2V tool. During this process are created files hard on the virtual machine "perimeter" in terms of size, which is a huge waste of space, so I want to reduce the size of the files hard...

    It should have at the point of conversion maybe? I remember all the options for this...?

    I tried to detach the computer drives virtual newly created and attached to an existing VM from the mine and their resizing using the parameters of the virtual machine window, but they will not accept the new sizes, I want them to be... When you click OK to reconfigure the computer sizes simply go back to the original size that they were created as...

    Can someone give me some advice on how these hard files are best created and how or even not at all I can handle them in order to free up space lost in these files because there is no possibility of this data ever expanding beyond what is now so all free space in these hard files is lost sapce on my MSA.

    You could do that while you did the P2V. However, the best way to resize the disks is to reuse the free Converter Standalone as she handles the resizing of the partition (in case of Windows), as well.

    AWo

  • Installation of a product of disk based through download?

    So I bought a basic version of Adobe Creative Suite Production Premium 5.5 disk, and I find myself eager to intall it on another computer. However, the computer in question is not a disk drive, so I have no way to install it.

    Is it possible to download a copy of the product on the Adobe site after its purchase as a disc?

    You can download the demo version of the software through the page linked below and then use your current serial number to activate it.

    Don't forget to follow the steps described in the Note: very important article Instructions on the pages to download to this site or the download may not work properly.

    CS5.5:

    http://prodesigntools.com/Adobe-CS5-5-direct-download-links.html

  • API how to resize the area through drawing

    Hi there, Just wana know if I created a box or L shape box dynamically, how it can be resized through specific points.

    I have a project, something like www.kitchenplanneronline.com and when you select a Layout section it gives you points to change the size of the box.

    Any help would be appreciated.

    Thanks in advance.

    Fred.

    When you resize startDrag() to one of the points, start a loop that repeatedly redraws your shape.

  • Fill in the description field of the virtual machine through VCO with Notes?

    I read in several positions, it should be possible to give a description using the notes (or __Notes) property

    However if I try to do from within VCO when installing a virtual machine using

    var Updateproperties = new Properties ();

    updateProperties.put ("Notes", "Your field new description here");

    I get the "unknown field" error

    What I'm missing or doing wrong.

    Thanks in advance

    problem solved. I had to use "provider-__Notes.

  • Request for catalogue through VCO

    I installed the 6.0.1 plugin in VCO and was able to set it up.  I'm looking to replace my blueprint.provision with the new requestcatalogitem script.  I get this error: [null] null (the dynamic Script Module name: requestCatalogItem #1).

    Any ideas?

    Thank you

    Yes, it's more or less a known issue. We have seen that in some environments, infrastructure services return 'null' instead of an empty list of properties when obtaining the form fields, and the first version of the plug-in wasn't expecting that. Here you will find a technical preview version which should fix this:

  • WIN8.1 &amp; Server 2012R2 resizing disks when Clone - Possible?

    Hello

    I would like to adjust the capacity of the disk "C:\". "dynamically during cloning.

    Some of my clients need 60 GB disks and others need more than 200GB.  The preference would be to use the same model or the other.  8.1 both supposed to 2012r2 have hooks to facilitate this.


    Is it possible to script, or am I Chase butterflies?


    T

    The name of this virtual machine, I guess that's running W2K12R2?

    I fear that the cmdlets that are based on or use the Invoke-VMSCript concept, are not yet support Windows 2012 R2 AFAIK.

Maybe you are looking for

  • Cannot enter BIOS - Satellite-P50t-A-119

    Cannot get into the BIOS. F2 works Océ try 20 times. Same problem with the F8 key. I tried 30 times, it worked only once. Laptop is brand new.Is there a stable way to get into the Bios?Is there a stable way to use the F8 key. I never had problems lik

  • Connection to a device via Virtual Box

    Hi all I'm under LabVIEW 2015 in Windows 7 in a VM (virtual machine) on an Ubuntu machine.  I would like to connect a USB - DAQ device, but it seems to be coming up with an error on the connection that does not allow me to work with the device to the

  • How can I get my printer to use just the color cartridge for the black & white you are exhausted?

    Whenever my on my dell printer black ink cartridge runs out, I'm generally left with a color cartridge, which is a total waste of money, because they are purchased together in a common case; is it possible that I can tell my printer to switch to the

  • Removing items from the file delete Email

    Got a laptop with windows vista.  After removal of e-mails I of Villa try to clean the file deletion to everry days by selecting all (control), and then hit delete... may take some time but still cleans that file.  for a few weeks, that this process

  • Setup HTTPPushDemo

    Hello I am trying to run the HTTPPushDemo. I understand that I should see onscreen. When I run on the Simulator, I see just "Object HTTP listening has begun" on the screen and nothing more... I run the application in the JDE and the MDS - CS. What I