Importing Unmanaged (Brownfield) VMs             

Overview

When you import Brownfield (Unmanaged) VMs using the Import VM to CloudCenter API, you need to be aware of the cloud-specific nuances that are specific to API deployments. This section discusses those nuances and provides a process use case – should you use this route to import Unmanaged VMs.

Import Flow for Unmanaged VMs

The flow to import unmanaged VMs requires the use of multiple APIs:

  1. Issue the View Actions API for a specific import action:
    The response to the View Actions > includeSystemDefinedActions (optional attribute) API includes an ID as well as the actionType – Specify the IMPORT_VM actionType to view the details of an import action. For example:
    GET /v1/actions?includeSystemDefinedActions=true&actionType=IMPORT_VM"

    {
       "resource":"null",
       "size":"1",
       "pageNumber":"0",
       "totalElements":"1",
       "totalPages":"1",
       "actionJaxbs":[
          {
             "id":"8",
             "resource":"https://<HOST>:<PORT>/v1/actions/8",
             "name":"Import to CloudCenter",
             "description":"import brownfield vms",
             "actionType":"IMPORT_VM",
             "lastUpdatedTime":"",
             "timeOut":600,
             "enabled":true,
             "encrypted":false,
             "deleted":false,
             "systemDefined":true,
             "bulkOperationSupported":true,
             "isAvailableToUser":true,
             "currentlyExecuting":false,
             "owner":1,
             "actionParameters":[
    
             ],
             "actionResourceMappings":[
    
             ],
             "actionResourceMappingAncillaries":[
    
             ],
             "actionCustomParamSpecs":[
    
             ]
          }
       ]
    }

    Use the action ID provided in this response (8 in the above example) as the import actionID in the next step.

  2. Issue the Import VM to CloudCenter API based on the import action ID:
    POST: /v1/actions/{import actionId}/executions
    Based on the Step 1 example: POST: /v1/actions/8/executions

    AWS Payload
     {
       "executionResources":[
          {
             "regionId":"2",
             "cloudAccountId":"2",
             "cloudResourceId":"i-81b967de"
          },
          {
             "regionId":"2",
             "cloudAccountId":"2",
             "cloudResourceId":"i-d6fe0e0a"
          }
       ],
       "resourceType":"VIRTUAL_MACHINE",
       "acl":{
          "resourceName":"VIRTUAL_MACHINE",
          "users":[
             {
                "id":2,
                "perms":[
                   "administration"
                ]
             }
          ],
          "userGroups":[
          ],
          "tenantUsers":[
          ],
          "tenantAndSubtenantUsers":[
          ],
          "ownerUserId":"2"
       }
    }

    The response to this API contains the executionId attribute

    AWS Response
    {
       "id":"1189",
       "resource":"https://<HOST>:<PORT>/v1/executions/1189",
       "executionResources":[
          {
             "cloudResourceId":"i-81b967de",
             "id":0,
             "regionId":2,
             "cloudAccountId":2,
             "cloudResourceProperties":[
    
             ]
          },
          {
             "cloudResourceId":"i-d6fe0e0a",
             "id":0,
             "regionId":2,
             "cloudAccountId":2,
             "cloudResourceProperties":[
    
             ]
          }
       ],
       "resourceType":"VIRTUAL_MACHINE",
       "executionSpecs":[
    
       ],
       "acknowledgedByUser":false,
       "acl":null
    }
  3. The View Import Status API by providing the executionId attribute value from Step 1 above.
    GET: /v1/executions/executionId_from_step1_above/status?logs=true

    {
       "actionExecutionId":1189,
       "actionId":8,
       "actionName":"Import to CloudCenter",
       "resourceType":"VIRTUAL_MACHINE",
       "userId":2,
       "userName":"Cliqr Admin",
       "status":"SUCCEEDED",
       "startTime":"2017-06-21 19:59:12.076",
       "endTime":"2017-06-21 19:59:14.28",
       "acknowledgedByUser":false,
       "executionResources":[
          {
             "resourceId":"i-81b967de",
             "resourceName":"",
             "status":"SUCCEEDED",
             "result":"Managed Virtual MachineId: 2475",
             "logs":[
                {
                   "message":"Starting action IMPORT_VM",
                   "status":"IN_PROGRESS",
                   "timestamp":"2017-06-21 19:59:12.397"
                },
                {
                   "message":"INSTANCE_TYPE_MATCHED",
                   "status":"COMPLETED",
                   "timestamp":"2017-06-21 19:59:13.194"
                }
             ]
          },
          {
             "resourceId":"i-d6fe0e0a",
             "resourceName":"",
             "status":"SUCCEEDED",
             "result":"Managed Virtual MachineId: 2476",
             "logs":[
                {
                   "message":"Starting action IMPORT_VM",
                   "status":"IN_PROGRESS",
                   "timestamp":"2017-06-21 19:59:12.403"
                },
                {
                   "message":"INSTANCE_TYPE_MATCHED",
                   "status":"COMPLETED",
                   "timestamp":"2017-06-21 19:59:13.194"
                }
             ]
          }
       ]
    }
    • Gives the status for each VM submitted for import.

    • Each VM is associated to an existing instance type.

      Clouds such as AWS,AzureRM, and OpenStack carry a predefined (by the cloud) instance type. During the import process, the CloudCenter platform attempts to match the instance type.

      • Match Found: If an instance type match is found for each VM, you see a success message – INSTANCE_TYPE_MATCHED.

      • Match not Found: If an instance type match is not found for each VM, you see an error message, INSTANCE_TYPE_NO_MATCH

Cloud Nuances

The following clouds use the executionId – the response for the Import VM to CloudCenter API contains the executionId. Use the executionId provided in this response to query the status of an import.

  •  AWS
    AWS Payload
     {
       "executionResources":[
          {
             "regionId":"2",
             "cloudAccountId":"2",
             "cloudResourceId":"i-81b967de"
          },
          {
             "regionId":"2",
             "cloudAccountId":"2",
             "cloudResourceId":"i-d6fe0e0a"
          }
       ],
       "resourceType":"VIRTUAL_MACHINE",
       "acl":{
          "resourceName":"VIRTUAL_MACHINE",
          "users":[
             {
                "id":2,
                "perms":[
                   "administration"
                ]
             }
          ],
          "userGroups":[
          ],
          "tenantUsers":[
          ],
          "tenantAndSubtenantUsers":[
          ],
          "ownerUserId":"2"
       }
    }
    AWS Response
    {
       "id":"1189",
       "resource":"https://<HOST>:<PORT>/v1/executions/1189",
       "executionResources":[
          {
             "cloudResourceId":"i-81b967de",
             "id":0,
             "regionId":2,
             "cloudAccountId":2,
             "cloudResourceProperties":[
    
             ]
          },
          {
             "cloudResourceId":"i-d6fe0e0a",
             "id":0,
             "regionId":2,
             "cloudAccountId":2,
             "cloudResourceProperties":[
    
             ]
          }
       ],
       "resourceType":"VIRTUAL_MACHINE",
       "executionSpecs":[
    
       ],
       "acknowledgedByUser":false,
       "acl":null
    }
  •  OpenStack
    OpenStack Payload
     {
       "executionResources":[
          {
             "regionId":"9",
             "cloudAccountId":"9",
             "cloudResourceId":"i-0ec123bc98e63d6cd"
          },
          {
             "regionId":"9",
             "cloudAccountId":"9",
             "cloudResourceId":"i-0ec935bc28e84d6ba"
          }
       ],
       "resourceType":"VIRTUAL_MACHINE",
       "acl":{
          "resourceName":"VIRTUAL_MACHINE",
          "users":[
             {
                "id":2,
                "perms":[
                   "administration"
                ]
             }
          ],
          "userGroups":[
          ],
          "tenantUsers":[
          ],
          "tenantAndSubtenantUsers":[
          ],
          "ownerUserId":"2"
       }
    }
    OpenStack Response
    {
       "id":"1189",
       "resource":"https://<HOST>:<PORT>/v1/executions/1189",
       "executionResources":[
          {
             "cloudResourceId":"i-0ec123bc98e63d6cd",
             "id":0,
             "regionId":9,
             "cloudAccountId":9,
             "cloudResourceProperties":[
    
             ]
          },
          {
             "cloudResourceId":"i-0ec935bc28e84d6ba",
             "id":0,
             "regionId":9,
             "cloudAccountId":9,
             "cloudResourceProperties":[
    
             ]
          }
       ],
       "resourceType":"VIRTUAL_MACHINE",
       "executionSpecs":[
    
       ],
       "acknowledgedByUser":false,
       "acl":null
    }
  •  VMware

    The user who is importing the VM must be the cloud region owner in order to create an instance type. Otherwise, the instance type is not created and that VM will not be imported.

    Since VMware does not have a concept of predefined instance types unlike the public clouds the instance type association is different. Following is the order:

    1. For the VM being imported, check if there is an instance type definition present with same number of CPUs, memory, and local storage size.

      1. Present: Associate the VM being imported with this instance type definition.

      2. Not Present: Try to find an instance type definition with the same number of CPUs and memory size. 

        The local storage size is not applicable here.

    2. If an instance type definition exists, associate the VM being imported with this instance type definition.
    3. If an instance type definition does not exist,  the CloudCenter platform create a new instance type definition based on the following parameters:
      1. The number of CPUS
      2. memory size.

        The local storage size is not used in VMware as you can have VMs with any combination of local storage sizes and multiple instance type definitions will have the same CPUs and memory but with different storage sizes.

    Vmware Payload
    {
       "executionResources":[
          {
             "regionId":"4",
             "cloudAccountId":"3",
             "cloudResourceId":"4221dbc1-41d2-0bea-205d-fcc33b52411c"
          },
          {
             "regionId":"4",
             "cloudAccountId":"3",
             "cloudResourceId":"4221b620-c785-c893-cfa7-6ad4745ac591"
          }
       ],
       "resourceType":"VIRTUAL_MACHINE",
       "acl":{
          "resourceName":"VIRTUAL_MACHINE",
          "users":[
             {
                "id":2,
                "perms":[
                   "administration"
                ]
             }
          ],
          "userGroups":[
          ],
          "tenantUsers":[
          ],
          "tenantAndSubtenantUsers":[
          ],
          "ownerUserId":"2"
       }
    }
    VMware Response
    {
       "id":"1192",
       "resource":"https://<HOST>:<PORT>/v1/executions/1192",
       "executionResources":[
          {
             "cloudResourceId":"4221dbc1-41d2-0bea-205d-fcc33b52411c",
             "id":0,
             "regionId":4,
             "cloudAccountId":3,
             "cloudResourceProperties":[
    
             ]
          },
          {
             "cloudResourceId":"4221b620-c785-c893-cfa7-6ad4745ac591",
             "id":0,
             "regionId":4,
             "cloudAccountId":3,
             "cloudResourceProperties":[
    
             ]
          }
       ],
       "resourceType":"VIRTUAL_MACHINE",
       "executionSpecs":[
    
       ],
       "acknowledgedByUser":false,
       "acl":null
    }

    The status is based on the executionId 1192 – In this example, the user made a request to import 2 VMs:

    1. 4221b620-c785-c893-cfa7-6ad4745ac591: An instance type definition was not present and therefore the CloudCenter platform created a new instance type definition without the cost per hour.

      1. If the value is entered by the user, then the user sees the following message – INSTANCE_TYPE_CREATED_NO_COST.

      2. If instance type definition is present, but the cost information is missing, then the user sees the following message  – INSTANCE_TYPE_MATCHED_NO_COST.

      3. If a user is not the cloud region owner and if no matching instance type definition is found, then the user sees the following message  – INSTANCE_TYPE_NOT_CREATED_ACCESS_DENIED

    2. 4221dbc1-41d2-0bea-205d-fcc33b52411c: The CloudCenter platform found a matching instance type definition with the cost information present, and the user sees the following message  – INSTANCE_TYPE_MATCHED.

    CloudCenter Processing for VMware
    {
       "actionExecutionId":1192,
       "actionId":8,
       "actionName":"Import to CloudCenter",
       "resourceType":"VIRTUAL_MACHINE",
       "userId":2,
       "userName":"Cliqr Admin",
       "status":"SUCCEEDED",
       "startTime":"2017-06-21 20:42:55.602",
       "endTime":"2017-06-21 20:43:14.619",
       "acknowledgedByUser":false,
       "executionResources":[
          {
             "resourceId":"4221b620-c785-c893-cfa7-6ad4745ac591",
             "resourceName":"",
             "status":"SUCCEEDED",
             "result":"Managed Virtual MachineId: 2480",
             "logs":[
                {
                   "message":"Starting action IMPORT_VM",
                   "status":"IN_PROGRESS",
                   "timestamp":"2017-06-21 20:42:55.845"
                },
                {
                   "message":"INSTANCE_TYPE_CREATED_NO_COST",
                   "status":"COMPLETED",
                   "timestamp":"2017-06-21 20:42:56.72"
                }
             ]
          },
          {
             "resourceId":"4221dbc1-41d2-0bea-205d-fcc33b52411c",
             "resourceName":"",
             "status":"SUCCEEDED",
             "result":"Managed Virtual MachineId: 2481",
             "logs":[
                {
                   "message":"Starting action IMPORT_VM",
                   "status":"IN_PROGRESS",
                   "timestamp":"2017-06-21 20:42:55.845"
                },
                {
                   "message":"INSTANCE_TYPE_MATCHED",
                   "status":"COMPLETED",
                   "timestamp":"2017-06-21 20:42:56.72"
                }
             ]
          }
       ]
    }

The payload for AzureRM contains an additional cloudResourceProperties attribute where the user must additionally provide the VM resource group value.

  •  Azure RM

    POST https://<HOST>:<PORT>/v1/actions/{actionId}/executions

    Azure RM Payload
    {
       "executionResources":[
          {
             "regionId":"6",
             "cloudAccountId":"7",
             "resourceId":"ccmAppOne",
             "cloudResourceProperties":[
                {
                   "name":"resourceGroup",
                   "value":"YXU-US-WEST"
                },
                {
                   "name":"vmId",
                   "value":"b54a5c08-6a9d-4a48-967d-fcd3c421ab47"
                }
             ],
             "cloudResourceId":"ccmAppOne"
          }
       ],
       "resourceType":"VIRTUAL_MACHINE",
       "executionSpecs":[
       ],
       "acknowledgedByUser":"false",
       "acl":{
          "resourceName":"VIRTUAL_MACHINE",
          "users":[
             {
                "id":2,
                "perms":[
                   "administration"
                ]
             }
          ],
          "userGroups":[
          ],
          "tenantUsers":[
          ],
          "tenantAndSubtenantUsers":[
          ],
          "ownerUserId":"2"
       }
    }
    Azure RM Response
    {
       "id":"1206",
       "resource":"https://<HOST>:<PORT>/v1/executions/1206",
       "executionResources":[
          {
             "cloudResourceId":"ccmAppOne",
             "id":0,
             "regionId":6,
             "cloudAccountId":7,
             "cloudResourceProperties":[
    
             ]
          }
       ],
       "resourceType":"VIRTUAL_MACHINE",
       "executionSpecs":[
    
       ],
       "acknowledgedByUser":false,
       "acl":null
    }

    GET https://<HOST>:<PORT>/v1/executions/{executionId}/status?logs=true

    The executionId is 1206 in this example

    Azure RM executionId Example
    {
       "actionExecutionId":1206,
       "actionId":8,
       "actionName":"Import to CloudCenter",
       "resourceType":"VIRTUAL_MACHINE",
       "userId":2,
       "userName":"Cliqr Admin",
       "status":"SUCCEEDED",
       "startTime":"2017-07-18 14:35:06.766",
       "endTime":"2017-07-18 14:35:11.815",
       "acknowledgedByUser":false,
       "executionResources":[
          {
             "resourceId":"ccmAppOne",
             "resourceName":"",
             "status":"SUCCEEDED",
             "result":"Managed Virtual MachineId: 2485",
             "logs":[
                {
                   "message":"Starting action IMPORT_VM",
                   "status":"IN_PROGRESS",
                   "timestamp":"2017-07-18 14:35:06.858"
                },
                {
                   "message":"INSTANCE_TYPE_MATCHED",
                   "status":"COMPLETED",
                   "timestamp":"2017-07-18 14:35:07.975"
                }
             ]
          }
       ]
    }

Manual Sync Import Use Case

To ensure that imported Brownfield VMs are syncing with their respected clouds, follow this process.

  1. Import VM and bring it under CloudCenter management using the Import VM to CloudCenter API.
  2. Access your cloud console.
    For example, if you launched the imported VM on a AWS cloud, then access the AWS console.
  3. Perform an action on your cloud console.
    For example, add an additional Network Interface Card (NIC).
  4. For your cloud console change to be reflected in the CloudCenter platform, perform a Sync operation using the Sync VM API.



  • No labels
© 2017-2019 Cisco Systems, Inc. All rights reserved