When you provision a machine in vCAC you will probably integrate with other systems in your infrastructure like IPAM, AD, ITSM and the like. Sometimes this ia a lengthly process. At that point in time the user already sees his machine in the self service portal but only get a status like ‘MachineProvisioned’. Wouldn’t it be more useful to have a more precise message in that status field? Rhetoric question and the answer is: Actually yes. And it is actually possible by setting the ‘CurrentTask’ property on the VirtualMachine entity:

# $m is the MgmtContext (repository)
PS > $m.GetType();

IsPublic IsSerial Name                                     BaseType
-------- -------- ----                                     --------
True     False    ManagementModelEntities                  DynamicOps.Repository.RepositoryServiceContext

# Grab a VM to set its status
PS > $vm = $m.VirtualMachines |? VirtualMachineName -eq 'vc100148';
PS > $vm.CurrentTask = "Under investigation";
PS > $m.UpdateObject($vm);
PS > $m.SaveChanges();

Descriptor                        Headers                                                  StatusCode Error
----------                        -------                                                  ---------- -----
System.Data.Services.Client.En... {[DataServiceVersion, 1.0;], [...                               204

PS > $m.Detach($vm);

With that code the user will see something like the following in his ‘My Machines’ status field:

vCAC CurrentTask
vCAC CurrentTask

A side note: when you are ready with your task you have to remove your ‘CurrentTask’ message. You have to do this as described in my earlier blog post about NullStrings.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.