[vCAC52] Change VirtualMachine Reservation and StoragePath – Revisited

Some time back I showed a way on how one can change the placement while provisioning. The central problem is that the placement takes place in that moment when the user submits his machine request. So at any step during the provisioning the placement has already been determined and resources already have been allocated.

During my research regarding the import of existing virtual machines I came across the ‘RegisterExistingVirtualMachine()’ SOAP action the VMPS ProvisionService in vCAC. As it turns out that same method also allows for changing a reservation of machine during provisioning.

PS > $vmps.RegisterExistingVirtualMachine;
OverloadDefinitions
-------------------
void RegisterExistingVirtualMachine(
  VMPS.IdentityToken securityToken,
  string virtualMachineID,
  string hostReservationID,
  string hostStorageReservationID,
  string virtualMachineTemplateID,
  string owner
  )

So in order to use this basically your placement logic only has to determine a HostReservation and a StorageReservation based upon any custom properties you define. (And it is still advisable not to rely on a ‘Vrm.DataCenter.Location’ field as this lives at the Compute Resource level and does not make sense for stretched clusters or physical machines.) Once you determined your two reservations (by taking into account free space, inactive resources, permissions of provisioning grooups and the like …) you only have to submit a SOAP call with these parameters and your reservation will be changed. The good thing is, that you can now be sure that vCAC is informed about what you are up to (and that you do not perform any actions behind its back.)

If you want to achieve the same with vCO or any other tool you will have to generate a SOAP call with a payload similar to this:

<!--
POST https://vcac52.sharedop.org/VMPS HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://dynamicops.com/VMPS/RegisterExistingVirtualMachine"
Host: vcac52.sharedop.org
Content-Length: 749
Expect: 100-continue
Accept-Encoding: gzip, deflate
-->

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
 <s:Body>
  <RegisterExistingVirtualMachine xmlns="http://dynamicops.com/VMPS">
   <securityToken xmlns:a="http://DynamicOps.VMPS.Model" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
    <a:ImpersonatingUser i:nil="true" />
    <a:User>SHAREDOP\vcacservice</a:User>
   </securityToken>
   <virtualMachineID>bdd9a7b2-c4ba-4455-86b7-004098af9e6c</virtualMachineID>
   <hostReservationID>93d0987d-1a3e-4ebf-8564-164a6bf985f4</hostReservationID>
   <hostStorageReservationID>8f81e3c5-13b6-41b0-ba2b-4d1b8f0552ee</hostStorageReservationID>
   <virtualMachineTemplateID>b9fe831b-26fd-4ef0-b5c2-ee8f258f1727</virtualMachineTemplateID>
   <owner>SHAREDOP\vcacservice</owner>
  </RegisterExistingVirtualMachine>
 </s:Body>
</s:Envelope>

<!--
HTTP/1.1 200 OK
Content-Length: 170
Content-Type: text/xml; charset=utf-8
Server: Microsoft-HTTPAPI/2.0
Date: Sun, 16 Feb 2014 15:09:54 GMT
-->

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
 <s:Body>
  <RegisterExistingVirtualMachineResponse xmlns="http://dynamicops.com/VMPS" />
 </s:Body>
</s:Envelope>

Comments

  1. UserVcac says:

    I have created a blueprint with those properties : VirtualMachine.Storage.Name and Vrm.DataCenter.Location . On the dictionnary, I specified a drown list type to choose the name of the datacenter and the storage.

    My question is: is it possible to don’t show to the user the real names on the choices?

    For example :

    Storage name : Store 1, Store 2 which refers for Disk1, Disk2 ( real names).
    Thank you for your help and this articl

    • Ronald Rink says:

      Hi Hamoussi, it is not really possible ot adjust the names, as when the user clicks “submit” the placement is already taking place, so rewriting the properties will not work. However, depending on whether you are using the (Kendo) SelfServicePortal or the original Administration Portal in vCAC 5.x you can customise the UI. When using the Kendo SelfServicePortal you can acutally use a (dirty?) workaround to have an event on the page to rewrite the the properties from the “display” names to the “real” names. You can actually use the REST service from the client portal to do this lookup dynamically. But it is a not so clean approch. Also, keep in mind that the whole request portal will change in vCAC v7 and already changed in vCAC v6 (so most of the stuff you are customising on the Portal will have to be done again). Hope this helps. Otherwise contact me directly so we can think of a solution for it. Regards, Ronald

Trackbacks

  1. […] For a different approach on how to change HostReservation and StorageReservation have a look at the method via RegisterExistingVirtualMachine().] One of the limitations in vCAC 5.2 is the fact that you can only use one predefined field […]

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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: