<a id="common-vm-instance-management-operations"></a>

# Common VM Instance Management Operations

After a VM instance has been created, various operations allow you to stop,
modify, or delete it.

<a id="stop-vm-instance"></a>

## Stop a VM Instance

**To stop a VM instance**:

1. Navigate to the **Compute** > **Instances** view.
2. From the displayed list, select a VM instance.
3. In top toolbar, click **Stop**.

The VM instance will stop, and its status will change from **Active** to **Shutoff**.

## Modify a VM Instance

Modification of size and other parameters associated with a VM instance can
only be done when the VM instance is in shutoff state.

**To modify a VM instance**:

1. Navigate to the **Compute > Instances** view.
2. From the displayed list, select the VM instance to be modified.

   The VM’s detail screen displays.
3. If the VM not in the **Shutoff** state, in the VM’s top toolbar,
   click **Stop**.
4. In top toolbar, click **Modify**.
5. In the **Modify VM** dialog, you can modify the following:
   * **Instance Type**: Defines the amount of compute resources of the VM instance
     (CPU and RAM).
   * **Firmware Type**: The software that provides low-level control of
     computing device hardware.

     One of:
     * **BIOS**: The legacy Basic Input/Output System.
       The first software that runs after a computer starts, BIOS
       performs hardware initialization during the booting process and
       provides runtime services for operating systems, applications and
       IO devices (keyboard, mouse, display).
     * **UEFI**: The newer Unified Extensible Firmware Interface, that
       replaces legacy BIOS. UEFI has more features. Its main advantages
       are faster boot times, better security, and larger disk support.
   * **Protect from deletion**: Protects the VM instance from accidental
     deletion.
   * **VNC Admin Access**: Determines whether admins can access the VM’s
     VNC console.

## Deleting VM Instances

A VM instance may only be deleted in Shutoff status.

**To delete a VM instance**:

1. Navigate to the **Compute** > **Instances** view.
2. From the displayed list, select the VM instance to be deleted. The selected
   VM instance details appear at the bottom of the window.
3. If the VM instance is running, click **Stop**.
4. In top toolbar, click **Delete**.
5. The following appears: **Are you sure you want to delete the VM?**. Click **OK**.

## Managing Networks for a VM Instance

VM instances cannot be created without a network, but networking changes can
be made after creation. One network can be attached to numerous VM instances,
and one VM instance can be attached to numerous networks.

### Attaching Networks to VM Instances

1. Navigate to the **Networking > Networks Interfaces** view.
2. From the displayed list, select a network.
3. In the top toolbar, click **Attach**.
4. The **Attach Network** window is displayed with the VM instance list.
5. Select the VM instance to which the network should be attached and click **OK**.

The selected VM instance is now attached to this network, in addition to the
network to which it was attached during creation.

### Detaching Networks from VM Instances

Before detaching a network from a running VM instance, it is recommended to
stop the instance.  The network can be detached using the **Networking** view
or **Compute** view.

To detach network using the **Networking** view:

1. Navigate to the **Networking > Networks Interfaces** view.
2. From the displayed list, select a network.
3. In the **Networks** view, select the **VMs** tab and then click **Detach**.
   The Network is detached from the current VM.

To detach network using the **Compute** GUI:

1. Navigate to the **Compute** > **Instance** view.
2. From the displayed list, select the VM instance to be detach from a network.
3. In the Actions menu, select **Detach**. The VM instances will be detached
   from the network.

<a id="adding-storage"></a>

## Adding Storage to VM Instances

During VM instance creation, volumes can be attached to a VM instance.  If
additional storage is required after VM instance creation, new volumes can
be created and attached to the VM instance, or the boot volume size may be
extended.

See the zCompute Volumes, Snapshots and Protection Groups overview video:

<iframe class="embed-responsive-item"
        id="youtubeplayer"
        type="text/html"
        width="640"
        height="390"
        style="border: none"
        src="//www.youtube.com/embed/OG7Tbm_usaI"
        allowfullscreen="allowfullscreen">
</iframe>

### Create New Volumes

To create a new volume:

1. Navigate to the **Storage** > **Block Storage** view.
2. Click **+**.
3. In the  **Create Volume** window, enter volume name, description,
   Volume Type, size, and protection group.
4. Click **OK**.

### Adding Volumes

To attach an additional volume to a VM instance:

1. Navigate to the **Storage** > **Block Storage** view.
2. From the diplayed volume list, select the volume to attach to a VM instance.
3. In the top toolbar, click **Attach**.  The **Attach** icon is available only
   for unmapped volumes.
4. In the **Attach Volume** window, select the VM instance to which the volume
   should be attached.
5. Click **OK**.
6. The VM instance must now be stopped and restarted.  To stop the VM instance,
   navigate to **Compute** > **Instances**. Select the VM instance to be stopped
   and click **Stop** in the top toolbar.
7. Once the VM instance is stopped, click **Start**.

### Extend the size of the volume

The size of an existing volume can be extended after creation whether or not
it is attached to a VM instance. This can be performed using either the GUI
or CLI.

**Using the GUI**

1. Navigate to the **Storage > Block Storage** view.
2. From the displayed list, select the name of the volume to extend.
3. In the **More** menu, click **Extend.**
4. In the **Extend Volume** window, specify the new size of the volume in GB.
   **Note**: The size cannot be decreased.
5. Click **OK**. The volume will be extended to its new size.

**Using the CLI**

1. If the volume is not attached to a VM instance, it may be extended to a
   new size greater than the previous size by entering the following:
   ```default
   volume extend volume_id size
   ```
2. If the volume is attached to a VM instance, use the ‘vm resize’ command,
   as follows:
   ```default
   vm resize vm_id [--volume-id VOLUME_ID] [--disk-size DISK_SIZE]
   ```

If the volume is attached to a VM instance, there is no need to stop and restart
the VM instance after extension. Nevertheless, depending on the software application
running on the VM instance, user action such as resizing partitions, logical volumes,
and/or file systems may be necessary before the new capacity can be used.

<!-- comment TBD - for admin guide -->

### Volume Types

From version 23.08, zCompute simplifies storage management with Volume Types
that provide users with a range of options to meet their storage requirements,
balancing factors such as performance, cost, and specific workload demands.

By abstracting the underlying storage infrastructure, Volume Types simplify
storage management and allow users to focus on selecting the appropriate type
for their zCompute needs.

Different Volume Types offer varying levels of maximum input/output
operations per second (IOPS) and throughput, which determine the storage
performance.
Higher performance volumes are typically associated with faster data transfer
rates and lower latency, enabling applications to handle demanding workloads
or perform intensive operations.

<a id="changing-volume-type"></a>

#### Changing a volume’s type (retyping)

One or multiple volumes can be retyped in an online operation.

When a volume is created, its specified Volume Type determines the
volume’s performance attributes and the particular platform (storage class)
that hosts it.

At a later stage, various considerations could drive a decision to
change a volume’s Volume Type.

For example, a user wants a volume for a particular application to have
increased performance.
Assuming that the volume is hosted on an HDD storage class, one possible
performance improvement decision could be to change the volume’s Volume
Type to a Volume Type for volumes hosted on an SSD storage class.
In the background, the volume retype operation effectively runs a process
that configures a destination volume with all of its updated attributes on
the new type of hosting platform, and migrates the volume from the source
hosting platform to the destination.

To change the Volume Type for an individual volume or multiple volumes:

1. Navigate to **Storage > Block Storage**.

   The list of volumes displays.
2. Select the volumes to retype by marking their checkboxes in the
   volumes list.

   If multiple volumes are selected, the **Change Volume Type** option
   appears in the top menu bar.

   For an individual volume, the **Change Volume Type** option appears in
   the top menu bar’s **More** submenu.
3. Click **Change Volume Type**.

   In the **Change Volume Type** dialog, from the dropdown select the new
   **Volume Type** to apply.
4. Click **OK** to confirm changing the Volume Type.

<!-- comment TBD for admin guide?

.. _creating-custom-volume-type:

Creating a custom Volume Type
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Scope: :bdg-info:`Account Administrator`

To create a custom Volume Type:

#.  Navigate to **Storage Management > Volume Types**.

   The list of Volume Types displays.

#.  In the top menu bar, click **Create**.

   The **Create Volume Type** dialog opens.

   #.  In the **Details** tab, enter the relevant properties:

      *  **Name**:  The Volume Type's display name.

      *  **Description**: The Volume Type's description.

      *  **Alias**:
         If specified, the alias will be the Volume Type's name presented
         via the AWS-compatible APIs.
         Otherwise, the original name will be used.

      *  **Storage Class**: The type of storage platform that hosts
         volumes of this Volume Type.

      *  **Set as Default for New Volumes**:
         When selected, this Volume Type is automatically populated as
         the default option for new volumes during creation.

      *  **Disable Provisioning**:
         Select this option to restrict the use of this Volume Type when
         creating new volumes.

      Click **Next**.

   #.  In the **Performance** tab, update the relevant properties.

      Performance capping attributes, limiting the maximum input or
      output operations or throughput per second, for volumes of this
      Volume Type:

      *  **Max read IOPs**:
         The maximum number of read operations per second.

      *  **Max write IOPs**:
         The maximum number of write operations per second.

      *  **Max read MB/s**:
         The maximum throughput of data for read operations, measured in
         megabytes per second.

      *  **Max write MB/s**:
         The maximum throughput of data for write operations, measured in
         megabytes per second.

      Capacity capabilities:

      *  **Enable deduplication**: Permit the ability to activate
         deduplication on volumes of this Volume Type.

      *  **Enable compression**: Permit the ability to activate
         data compression on volumes of this Volume Type.

      Security and accessibility attributes:

      *  **Enable encryption**: Permit the ability to activate
         data encryption on volumes of this Volume Type.

      *  **Shared**: Permit the ability to specify volumes of this volume
         type as shared volumes, that can be accessed by other VMs in the
         project.

      *  **Allowed Accounts**: To limit creation of volumes of this
         Volume Type to projects of specific accounts, from the dropdown,
         select the permitted accounts.

   #.  Click **Finish** to save the custom Volume Type configuration.

.. _modifying-volume-type-properties:

Modifying Volume Type properties
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Modifying the properties of a Volume Type is the reconfiguration of
one or more of a Volume Type's attributes, such as the Volume Type's name,
description, storage class, quality of service attributes and more.

.. comment TBD

This differs from retyping an individual volume or multiple volumes.
See :ref:`changing-volume-type`.

.. note::

   Modifying a Volume Type's properties will also update existing volumes
   of that Volume Type, so that they'll adopt the modifications.


To modify a Volume Type:

#.  Navigate to **Storage Management > Volume Types**.

   The list of Volume Types displays.

#.  Click the Volume Type that you want to modify.

#.  In the top menu bar, click **Modify**.

   The **Modify Volume Type** dialog opens.

   #.  In the **Details** tab, update the relevant properties:

      .. comment - TBD - is Name modifiable?

      *  **Name**:  The Volume Type's display name.

      *  **Description**: The Volume Type's description.

      *  **Alias**:
         If specified, the alias will be the Volume Type's name presented
         via the AWS-compatible APIs.
         Otherwise, the original name will be used.

      .. comment - TBD - is Storage Class modifiable?

         *  **Storage Class**: The type of storage platform that hosts
            volumes of this Volume Type.

      *  **Set as Default for New Volumes**:
         When selected, this Volume Type is automatically populated as
         the default option for new volumes during creation.

      *  **Disable Provisioning**:
         Select this option to restrict the use of this Volume Type when
         creating new volumes.

      Click **Next**.

   #.  In the **Performance** tab, update the relevant properties.

      Performance capping attributes, limiting the maximum input or
      output operations or throughput per second, for volumes of this
      Volume Type:

      *  **Max read IOPs**:
         The maximum number of read operations per second.

      *  **Max write IOPs**:
         The maximum number of write operations per second.

      *  **Max read MB/s**:
         The maximum throughput of data for read operations, measured in
         megabytes per second.

      *  **Max write MB/s**:
         The maximum throughput of data for write operations, measured in
         megabytes per second.

      Capacity capabilities:

      *  **Enable deduplication**: Permit the ability to activate
         deduplication on volumes of this Volume Type.

      *  **Enable compression**: Permit the ability to activate
         data compression on volumes of this Volume Type.

      Security and accessibility attributes:

      *  **Enable encryption**: Permit the ability to activate
         data encryption on volumes of this Volume Type.

      *  **Shared**: Permit the ability to specify volumes of this volume
         type as shared volumes, that can be accessed by other VMs in the
         project.

      *  **Allowed Accounts**: To limit creation of volumes of this
         Volume Type to projects of specific accounts, from the dropdown,
         select the permitted accounts.

   #.  Click **Finish** to save the modifications to the Volume Type.

Enabling or disabling a Volume Type
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

To enable or disable provisioning of volumes using a specific Volume Type:

#.  Navigate to **Storage Management > Volume Types**.

   The list of Volume Types displays.

#.  Click or mark the Volume Type that you want to enable or disable.

#.  In the top menu bar, click the **Enable/Disable** toggle to
   enable or disable provisioning of volumes respectively, using this
   Volume Type.

#.  In the **Enable/Disable Volume Type** dialog, click **Enable/Disable**
   to confirm permitting or preventing provision of volumes using this
   Volume Type.

Setting the default Volume Type
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

On creation of new volumes, the **Create Volume** dialog prepopulates
the new volume's **Volume Type** property with the default Volume Type,
and the option to override it.

To specify a Volume Type as the default for new volumes:

#.  Navigate to **Storage Management > Volume Types**.

   The list of Volume Types displays.
   The **Default** column indicates the current default Volume Type.

#.  Click or mark the Volume Type that you want to set as the default.

#.  In the top menu bar, click **Set Default** to
   specify this Volume Type as the default for new volumes.

A notification indicates that the selected Volume Type is now the default.

In the **Storage Management > Volume Types** list, the selected volume
type's **Default** column indicates that it is the default.

.. _viewing-volume-type-volumes:

Viewing the volumes of a Volume Type
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

To list the volumes of a specific Volume Type:

#.  Navigate to **Storage Management > Volume Types**.

   The list of Volume Types displays.

#.  Click the Volume Type that you want to set as the default.

   The selected Volume Type's detail screen displays.

#.  In the lower menu bar, click the **Volumes** tab.

   The list of volumes of the selected Volume Type displays.

Deleting a Volume Type
^^^^^^^^^^^^^^^^^^^^^^

.. note::

   A Volume Type can be deleted only if there are no volumes of that
   Volume Type.

   :ref:`viewing-volume-type-volumes` indicates the volumes that prevent
   deletion of a Volume Type.

   If relevant, :ref:`changing-volume-type` for those volumes might be a
   consideration for enabling deletion of a no longer or infrequently
   used Volume Type.

To delete a Volume Type:

#.  Navigate to **Storage Management > Volume Types**.

   The list of Volume Types displays.

#.  Click or mark the Volume Type that you want to delete.

#.  In the top menu bar, click **Delete**.

#.  In the **Delete Volume Type** dialog, click **Delete**
   to confirm deletion of this Volume Type.

   The selected Volume Type is removed from the
   **Storage Management > Volume Types** list. -->

<a id="sg-attach"></a>

## Associating Security Groups with VM Instances

Security Groups can be associated with a VM instance after creation, in addition
to the association included in the Create VM Instance wizard.

**To associate a security group with a VM instance after creation**:

1. Navigate to the **Compute > Instances** view.
2. From the displayed list, select a VM instance.
3. Click **More** > **Attach** > **Security Group**.
4. In the **Attach Security Groups** window, select the desired security group
   from the pull down list.
5. Click **OK**. The VM instance is now associated with the selected security group.

## Recovering Windows VM Instances

If storage or network drivers do not inject properly for a Windows-based VM
instance which was imported from VMware or Hyper-V, the VM instance will not
start properly (it will start in a blue screen). When this happens, the VM
instance must first be recovered.

**Driver Recovery Mode** allows starting a VM with legacy IDE virtual
hardware.

This is useful for such VMs that don’t have the required VirtIO drivers
installed, and because of that fail to boot (for example, VMs imported from
other platforms).
As most Linux distributions have VirtIO drivers available even with older
versions, this feature is mostly useful with Windows VMs that for some
reason don’t have the VirtIO drivers installed.

**To recover a Windows VM Instance**:

1. Navigate to the **Compute > Instances** view.
2. From the Instances list, select the VM instance to be recovered.
3. Click **More > Driver Recovery Mode**.
4. Click **OK** in the **VM Driver Recovery Mode** confirmation window.

   The storage and network drivers will be installed on the VM instance.
5. Click **Start** to restart the VM instance.
