Get around with patchHostManager

Hello together,

i've some problem to get around with the patchHostManager of the Orchestrator.

The following i want to do at the start of the concept:

I have a database which includes black out schedules (maintenance time) for the ESX hosts . The workflow should do the following:

You enter the ESX Host and select a VUM baseline. After this the workflow retrieves the blackout schedule (just a SQL query) for this host, schedule a workflow for this time and stage the patches of the chosen baseline. To the specified time the host shut down his guest VMs, enter the maintenance mode and start patching. After a reboot, the host should exit maintenance mode and restart the VMs.

Now after some help i know that it won't be possible to select VUM Baselines in the Orchestrator (it is not implemented - hope it is at the next release). But i think should be no problem so far, i hope i can create a metadata.zip file and get around with this.

But now my question is "how" to start my workflow? I did not found any description or example how to use the patchHostManager class. Does anybody can give me a start oder a quick example how to get what i want?

Thanks a lot for your help!


Tags (1)
0 Kudos
1 Reply

so here is at least part of the answer to the question.

The below sample code shows you how to use the query method. It basically allows you to find the patches already applied to the host.

The reference to the vSphere API I used to write the code is here: http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/index.html

Please post any improvement you make to the workflow back here so we can share each other's fruits of labor.

I am also including the working workflow. I have another one that actually prints the XML result to the system log if you need it.

// Sia Yiu July 20, 2009

// since host.configManager.patchManager is an data object instead of a managed object,

// first convert it to a VimManagedObject so I can manipulate it and pass it between boxes.

var patchManager = VcPlugin.convertToVimManagedObject(ESX, ESX.configManager.patchManager);

// create a variable containing the patch manager operation spec

var patchSpec = new VcHostPatchManagerPatchManagerOperationSpec();

// pass the inputs to the obejct

patchSpec.cmdOption = cmdOption;

patchSpec.userName = userName;

patchSpec.password = password;

patchSpec.proxy = proxy;

patchSpec.port = port

// Now put together the task you actually want VC to perform and pass it the prarmeter

// the task will be passed to the

var task = patchManager.queryHostPatch_Task(patchSpec);

//actionResult = ESX.configManager.patchManager.queryHostPatch_Task.vim3WaitTaskEnd(task)

//System.log = ("result in XML is:" +actionResult)

0 Kudos