4.5. Reconfiguring Virtual Machines

Once you create a virtual machine, you can manage its CPU and RAM resources, as well as network interfaces and volumes.

Prerequisites:

4.5.1. Changing Virtual Machine Resources

You can change amount of CPU and RAM resources used by a virtual machine by applying another flavor to it. To be able to resize a running VM, you need to enable CPU and RAM hot plug for it first. You can change the hot plug settings for both new and existing VMs.

A running virtual machine has a resize limit, which defines the maximum number of vCPUs and the maximum amount of RAM you can allocate to the VM. The resize limit on vCPUs is static and equal to 64 for all VMs. The resize limit on RAM, on the contrary, is dynamic and depends on the amount of RAM a running VM is currently using. This limit is updated on a VM startup, and its values are listed in the table below.

Current RAM size, in GiB

RAM size limit, in GiB

1-4

16

5-8

32

9-16

64

17-32

128

33-64

256

65-128

512

129-256

1024

For example, you can resize a running VM with a flavor that has 16 GiB to a flavor with 256 GiB in two iterations:

  1. Resize the VM to a flavor with 64 GiB.

  2. Restart the VM to update the RAM size limit.

  3. Resize the VM to a flavor with 256 GiB.

Limitations:

  • You cannot change the flavor for shelved VMs. To resize such a VM, unshelve it first.

  • You cannot decrease the number of CPUs and the amount of RAM for running VMs.

  • [For all Linux guests] If a VM has no guest tools installed, new cores may be offline after CPU hot plugging. You can verify which CPU cores are online by using the command:

    # cat /sys/devices/system/cpu/online
    

    To activate offline CPU cores, run:

    # echo 1 > /sys/devices/system/cpu/cpu<cpu_number>/online
    

Prerequisites:

  • Before changing a flavor, ensure that the node hosting the VM has at least as much free CPU and RAM resources as the new VM size. For example, to resize a VM to the large flavor, the host must have at least 4 vCPUs and 8 GiB of RAM free.

  • CPU and RAM hot plug is enabled by the system administrator.

  • Before resizing a running VM, ensure that the guest operating system supports CPU and RAM hot plug (refer to Supported Guest Operating Systems). Note that otherwise the guest operating system may become unstable after a resize. To increase CPU or RAM resources for such a guest operating system, you need to stop the virtual machine first.

  • Before resizing a running VM, ensure that the guest operating system has the latest updates installed.

4.5.1.1. Enabling or Disabling CPU and RAM Hot Plug for Virtual Machine

  1. On the Virtual machines screen, ensure that the required virtual machine in the “Shut down” state, and then click it.

  2. On the Overview tab, click the pencil icon in the CPU and RAM hot plug field.

    Note

    If you do not see this field, CPU and RAM hot plug is disabled in your project. To enable it, contact your system administrator.

  3. Select or clear the Enable hot plug check box, and then click the tick icon to save the changes.

With CPU and RAM hot plug enabled, you can change the flavor of a running VM.

4.5.1.2. Changing Virtual Machine Flavor

  1. On the Virtual machines screen, click the required virtual machine.

  2. On the Overview tab, click the pencil icon in the Flavor field.

  3. In the Flavor window, select a new flavor, and then click Done.

4.5.2. Configuring Network Interfaces of Virtual Machines

You can add new network interfaces to your virtual machines, edit IP addresses and security groups for the existing interfaces, and remove network interfaces by detaching them.

Limitations:

  • You cannot manage network interfaces of shelved VMs.

  • A VM that is connected to a dual-stack network always receives an IPv6 address, if the IPv6 subnet is in the SLAAC or DHCPv6 stateless mode.

4.5.2.1. Connecting Virtual Machine to Private Network

  1. On the Virtual machines screen, click the required virtual machine.

  2. On the Overview tab, click Edit in the Network interfaces section.

  3. In the Network interfaces window, click Add to attach a network interface.

  4. In the Add network interface window:

    1. Select a compute network to connect to. By default, MAC and primary IP addresses are assigned automatically. To specify them manually, clear the Assign automatically checkboxes and ensure that free IP and MAC are selected.

    2. A secondary IP can be used by applications inside the VM.

      Note

      Virtuozzo DHCP does not configure additional IP for an interface inside the VMs. Therefore any additional IP must be configured manually inside the VM guest.

    3. A security group is a port firewall rules list; fault opens all connections. The default security group is selected by default. Create other rules on the Security group tab if required. Please refer to Managing Security Group Rules.

    4. Spoofing protection is enabled by default. It is a security feature that blocks outgoing traffic with source MAC and IP addresses that differs from what was defined above. Disabling the spoofing protections also means disabling any firewall control. Do not disable the spoofing protection. If required, deselect the security group.

    5. Click Add.

      ../_images/vhc-connecting-virtual-machine-to-private-network.png
  5. Click Done to finish editing VM network interfaces and save your changes.

4.5.2.2. Editing Network Interface of Virtual Machine

  1. On the Virtual machines screen, click the required virtual machine.

  2. On the Overview tab, click Edit in the Network interfaces section.

  3. In the Network interfaces window, click the ellipsis button next to the interface you want to edit, and then click Edit.

  4. In the Edit network interface window, modify the network interface parameters as follows:

    • Change the primary IP address. To update the address inside the VM guest OS, restart the network interface.

    • Add or remove secondary IP addresses.

    • Modify security groups assigned to the VM.

    After updating the required parameters, click Save.

  5. Click Done to finish editing VM network interfaces and save your changes.

4.5.2.3. Detaching Network Interface from Virtual Machine

  1. On the Virtual machines screen, click the required virtual machine.

  2. On the Overview tab, click Edit in the Network interfaces section.

  3. In the Network interfaces window, click the ellipsis button next to the interface you want to detach, and then click Remove.

  4. Click Done to finish editing VM network interfaces and save your changes.

4.5.3. Configuring Virtual Machine Volumes

You can add new volumes to your virtual machines, attach existing volumes, and detach unneeded volumes from virtual machines.

Limitations:

  • You cannot change, detach, or delete the boot volume.

  • You can only attach and detach non-boot volumes.

  • You cannot manage volumes of shelved VMs.

Prerequisites:

To be able to use volumes attached to VMs, they must be initialized inside the guest OS by standard means.

4.5.3.1. Attaching Volume to Virtual Machine

  1. On the Virtual machines screen, click the required virtual machine.

  2. On the Overview tab, click the pencil icon in the Disks field.

  3. In the Volumes window:

    • Click Attach to attach an existing volume, and then select the volume in the Attach volume window.

    • Click Add to create a new volume, and then specify the volume name, size, and storage policy. The created volume will be automatically added to the VM disks.

  4. Click Done to finish editing VM disks and save your changes.

4.5.3.2. Detaching Volume from Virtual Machine

  1. On the Virtual machines screen, click the required virtual machine.

  2. On the Overview tab, click the pencil icon in the Disks field.

  3. In the Volumes window:

    • Click Detach to detach a volume from a stopped virtual machine.

    • Click Force detach to detach a volume from a running virtual machine.

      Note

      There is a risk of data loss.

  4. Click Done to finish editing VM disks and save your changes.