Importing an existing PowerVC or OpenStack virtual machine

You can import PowerVC and OpenStack virtual machines as Managed services stack instances, identify whether the instances are imported successfully, and manage the stack resources.

A default provided template, Import existing VM - PowerVC and OpenStack for Terraform 1.x.x, is shipped as a sample to import a virtual machine. You can use this template to import virtual machines, but it cannot be used to deploy new virtual machines.

Procedure

  1. Use the Managed services API to import virtual machine as a stack instance. For more information, see Import VM by IDs API and Import VM by Name API.

    Note:

    • The power_state property is discovered during import and is set to the power state of the virtual machine when it is imported.
    • The force_delete and stop_before_destroy properties are not discovered during import. These properties are given default values based on their default value in camvariables.json. These are non-destructive properties so they can easily be changed by modifying the instance.
  2. Log in to IBM Cloud Pak for AIOps console.

  3. In the navigation bar, click Automate Infrastructure > Instances. Click the Terraform templates tab.

  4. Click the deployed instance to open it and manage the imported virtual machine resources.

  5. From the Overview tab > Resources section, use the overflow menu to start, shutdown, taint, untaint, and view details. For more information, see Managing virtual machine resources.

    Note: If you make changes to the instance, be aware that the current virtual machine power_state may not match the discovered power_state. For example, if a virtual machine in "shutoff" state was active during import, then the value of the power_state property is still "active" when you modify the instance. Change the value to "shutoff", or else the virtual machine gets started after you apply your changes.

  6. You can also modify the virtual machine using the plan and apply process. For more information, see Modifying a deployed template instance.

Resizing a PowerVC Virtual Machine

Shut down your PowerVC virtual machine before resizing it. To resize the virtual machine, do the following steps:

  1. View the instance details for the imported virtual machine.
  2. In the Resource details section, click Shutdown OS from the overflow menu of the virtual machine resource.
  3. Modify the instance after the virtual machine is shutdown.
  4. Change the flavor to a desired value.
  5. Ensure the Power State is set to "shutoff".
  6. Plan and apply your changes.
  7. After the changes are applied, click Restart OS from the Actions overflow menu of the virtual machine resource.

For steps to shutdown and restart OS of the virtual machine, see Managing virtual machine resources.

Limitations

  • Storage attached to the imported virtual machine is not discovered during import. This includes volume attachments as well as any block devices specified when the virtual machine got created.
  • If the imported virtual machine was created using a bootable volume rather than an image, then the Image Name input variable value may be “Attempt to boot from volume – no image supplied”. If you make changes to the instance that results in the virtual machine being recreated, the virtual machine gets destroyed but does not get created. This issue occurs because block devices are not discovered during import.