VMware {code} Community
newsharon86
Contributor
Contributor
Jump to solution

How to edit VM Image settings using VI SDK 4

Hi

All

I just wanted to know how to edit VM Image setting using VI SDK 4

Vm Image Setting could be(memory setting etc)

Reply
0 Kudos
1 Solution

Accepted Solutions
lamw
Community Manager
Community Manager
Jump to solution

1) yes (whether or not you do this while the VM is online is totally based on whether the OS supports it or not)

2) I'm not sure what 'TTL you're referring to?

I would say take a look at the previous documents I've linked to familiarize yourself with what you can do and another great reference point is the vSphere API doc itself: http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/index.html and make use of the search functionality to see what properties/attributes are available on what entities/objects.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

Twitter: @lamw

If you find this information useful, please award points for "correct" or "helpful".

View solution in original post

Reply
0 Kudos
8 Replies
lamw
Community Manager
Community Manager
Jump to solution

You'll need to get a reference to a VM and then use ReconfigureVM_Task() which accepts a configuration spec of the changes you would like to make whether that be an additional virtual hard disk, more cpu or memory. Not all operations can be done while the VM is online, so you can easily test that by using vSphere Client.

Here are some Perl utilities that are bundled with the vSphere SDK for Perl that you can look at the Perl code to see how certain operations are performed: http://www.vmware.com/support/developer/viperltoolkit/viperl40/doc/vsperl_util_index.html

One that might be of interest is vmreconfig.pl

Here is a collection of other Perl scripts that may show certain operations that may be of help as well to get you started:

If you're new to VI/vSphere SDK, I would highly recommend starting off here:

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

Twitter: @lamw

If you find this information useful, please award points for "correct" or "helpful".

Reply
0 Kudos
newsharon86
Contributor
Contributor
Jump to solution

Hi

Thanks for reply

I had some more queries

1)Does that mean we can extend the memory of existing VM using reconfigVm_task()

2) Can We extend the TTL(time to live )attribute of existing VM using reconfigVM_task()

It would be great help if you could answer the above queries

Reply
0 Kudos
lamw
Community Manager
Community Manager
Jump to solution

1) yes (whether or not you do this while the VM is online is totally based on whether the OS supports it or not)

2) I'm not sure what 'TTL you're referring to?

I would say take a look at the previous documents I've linked to familiarize yourself with what you can do and another great reference point is the vSphere API doc itself: http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/index.html and make use of the search functionality to see what properties/attributes are available on what entities/objects.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

Twitter: @lamw

If you find this information useful, please award points for "correct" or "helpful".

Reply
0 Kudos
newsharon86
Contributor
Contributor
Jump to solution

hi

For eg , Every VM will have some time allocated to it in which it can be alive, if we are performing some operations on VM and the time is not sufficient , can we increase the time of that VM using VI SDK 4

I am not able to find this out

Kindly help

Reply
0 Kudos
lamw
Community Manager
Community Manager
Jump to solution

Are you referring to timeouts when connecting to the SDK? If you stay idle for ~30min it'll disconnect but if you have an on-going task, you can refresh the data set or check back to keep the connection alive.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

Twitter: @lamw

If you find this information useful, please award points for "correct" or "helpful".

Reply
0 Kudos
newsharon86
Contributor
Contributor
Jump to solution

Hi,

Thank you for your reply. But my question is different.

- I have a requirement where virtual machine should be either deleted or shut down after specified time. If I'm not wrong TTL (Time To Live) is the attribute which talks about how long a particular image can be active. Could you please guide me on how to set TTL of a virtual machine using ESX web services ?

Reply
0 Kudos
lamw
Community Manager
Community Manager
Jump to solution

There is no such thing .... if you can do this via the vSphere Client, then perhaps I can help. You can set a scheduled task to perform certain operations, I don't recall if you can delete. Though there definitely is not a defined "life cycle" for a VM. If you're interested in that type of functionality you would need to build it into a custom application or take a look at something like VMware Lab Manager which does provide a time period a VM is available and you can renew the lease or have it automatically archive or be deleted. Again this is something you could script or create a program but it's not available within the SDK by default.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

Twitter: @lamw

If you find this information useful, please award points for "correct" or "helpful".

newsharon86
Contributor
Contributor
Jump to solution

Thanks A lot

It was very kind of you

GOOD DAY

Reply
0 Kudos