Instances: CloudStack

Description

Instances are virtual machines that have reservation of resources (cores, RAM, (root and data) volumes, network offering, storage offering, service offering).


Contents

Viewing Instances (by filters)

There are various filters using which you can sort and view instances. 

Perform the following steps to view instances:

  1. On the left panel, click Instances.
    The Instances page displays.
  2. Click the "Filter by" drop down list and select an option to view the instances. The following options are provided:


    Field Name Description
    All Lists all the instances. A domainadmin user can view all instances within the domain. A regular user can view instances associated to or created by the user.
    Mine Lists only the instances associated to or created by the currently logged in user. They could be in any state.
    Running Lists only the instances that are currently running. Note: You can Stop, Reboot, or Destroy a running instance.
    Stopped Lists only the instances that are currently stopped. Note: You can Start or Destroy a stopped instance.
    Destroyed Lists only the instances that are currently destroyed. Note: You can Restore or Expunge (permanently wipe) a destroyed instance.
    1. Based on your selection, the following information about instances is displayed:


      Field Name Description
      Name Displays the name of the instance. Note: You can click on individual instances to view additional information and perform various tasks on that instance.
      Display name Displays the display name of the instance. Note: This is an editable field.
      IP Address Displays the ip address of the instance.
      Domain Displays the domain in which the instance is deployed.
      Account Displays the account to which the instance belongs
      State Displays the current state of the instance. The following states can display: Running, Stopped, Destroyed, Starting, Migrating, Stopping, Expunging and Error.
      Quickview Displays an overview of the instance, the tasks that can be performed on the instance, and a quick link to volumes, snapshots, affinity group, and hosts associated to the instance.

Creating, adding an Instance

Perform the following steps to add an instance:

  1. On the left panel, click Instances.
    The Instances page displays.
     
  2. Click + Add Instance. 
    The Add Instance wizard is launched.
     
  3. The zone is pre-selected and based on the location your Private Cloud is deployed (NL/US/DE/UK/SG)
    Select either a default template (pre-configured instance image) or an ISO to start an installation, and click Next. 
    To understand these options and accordingly select a value, these options are explained below. 


    Field Name Description
    Select a zone Currently, LeaseWeb provides only 1 zone for each Private Cloud (domain).
    Select ISO or template


    Template Provides pre-configured, bootable operating systems for the instance. You can create templates yourself and some are provided out-of-the-box. You can view templates and select one in the next screen. The Featured tab contains prefab templates by LeaseWeb, the My Templates tabs contains templates made by the account which is logged in or which are made public by anyone in you Private Cloud (domain).
    ISO Allows you to attach an ISO (virtual DVD/CD) and, boot and install your instance from that CD. Any ISO can be chosen, also non bootable but for the purpose of creating an instance attaching a non bootable ISO makes no sense.
  4. Select a template/ISO for your virtual instance, and click Next.

    To understand them and accordingly select a template/ISO, the field names are explained below.


    Field Name Description
    Featured Lists all the templates that are provided out-of-the-box by LeaseWeb. You can select which template you want to use for the instance.
    Community Lists all the templates configured and made publicly available by any user on the CloudStack platform for a particular zone.(we disabled this option because publicly available templates should not be created by customers but by LeaseWeb)
    My templates Lists all the templates that you as a user have created or that other domain accounts/users have made and opted to set the 'public' option
    Shared Lists all the templates that are shared between users of the domain.

    Note : If you want to explicitly define the Root Disk Size ,you can mention same on the column box mentioned below in the template page.Else it will define same based on the template size.

  5. Select a compute offering (pre-configured set of resources) to associate it with the instance, and click Next.

    The options display the pre-defined set of compute offerings provided out-of-the-box by LeaseWeb, and also the ones configured by you.

    Tip: Create a Compute Offering if you want a new compute offering for the instance.

    Compute offerings determine the number of allocated CPU cores, memory allocation, high availability, and so forth.

  6. If needed, select a disk offering to associate it with the instance, and click Next. 

    If you chose a template in step 1 then this template contains a certain amount of disk space for your root volume.
    If you chose an ISO in step 1 of the instance configurator then you MUST select a Data Disk Offering. The installation will use this Data Disk to install to.
    For instances created from a template this option allows you to add an additional virtual disk device to your instance with certain capacity. 

    Tip: Create a Disk Offering if you want a different disk offering for the instance.

    The options display the pre-defined set of disk offerings provided out-of-the-box by LeaseWeb, and also the ones configured by you. Disk offering determines the disk size, and so forth. The Custom radio button allows you to set your own disk size with a maximum of 5120GB and a minimum of 1 GB.

  7. Select the affinity group to which you want this instance to belong, and click Next.

    Affinity Groups are profiles define deployment behavior of associated instances. Currently we provide 'anti-affinity' policy which ensures that instances assigned to that anti-affinity profile are not deployed on the same host (physical server).
    This ensures that if a specific host goes down at least some instances assigned to that profile keep running.

    Tip: Create an Affinity Group if you want a different affinity group for the instance.

  8. Select or add a network to your instance, and click Next.

    To understand them and accordingly select a network, the field names are explained below.


    Field Name Description
    VPC For Virtual Private Cloud, by default, all networks within your infrastructure are displayed regardless if they belong to a VPC or if so regardless of which VPC they belong to.
    Networks

    Lists all the existing networks (based on your VPC selection of course). This section displays networks configured by you and (if acquired) the network(s) pre-configured by LeaseWeb (shared network offerings).
    Note: LeaseWeb can provides a public network that is directly connected to the Internet (shared network).
    You can select to attach multiple networks to one instance. Each added network will create a Virtual NIC on your instance. These NICs/networks will be listed under the NICs tab for you instance.
    One network must be the instance default network. You cannot detach a network from an instance if it is set as the default network . 

    Add Network Allows you to add a new isolated (private) network for your cloud infrastructure. Note: To add a network, select the "New" check box, enter a name, and select a network offering.
    Currently we offer six isolated (private) network offerings which are identical in properties apart from the Virtual Router. In one offering the virtual router is single per network in the dual virtual router setup there are two virtual routers (master and backup) for each network.
    To make this new network your default network, select the "Default" radio button.
    Note: in order to be able to create a new isolated network and associate it with the instance you need to have a free public IPv4 address available in the IP pool which is assigned to the isolated network type or network creation (and therefor instance creation) will fail.
  9. SSH key pair preparation of you instance


    If you created SSH key pairs under the Account section they will show up here. You can associate an ssh key-pair with your instance allowing for easy login after instance creation. Provided the instance has the proper script inserted. Please refer below link for more info.

     https://svn.apache.org/repos/asf/cloudstack/docsite/html/docs/en-US/Apache_CloudStack/4.2.0/html/Admin_Guide/using-sshkeys.html

  10. Enter a name to identify your instance, verify that the information you selected/entered in the wizard is correct, and click Launch VM.
    Upon launch the instance will be created and started automatically.

    The name you enter here will display as both Name and Display Name for the instance. If you do not enter a value, CloudStack will generate a unique name for the instance, and the Display Name field will be blank. 

    To update any information from this screen, click the "Edit" link. The relevant screen in the wizard will display.

  11. The newly created instance is added to the list in the Instances page. 
    The password for the newly created instance will be displayed in a dialog box.

    You need this password to gain access to the instance either through SSH or by logging in through Remote Desktop. It is recommended to save the password. It will not be displayed again. If you forget the password, you must Reset the Password.

    Notes

    -To have the ability to reset the instance password, the template that you select to create the instance must have the "cloud-set-guest-password" script file and the Password Enabled check box must be selected for the specific template upon template creation. 
    -If you are configuring the template yourself, you can find information on downloading the "cloud-set-guest-password" script file from the CloudStack Admin Guide
    -The templates that are provided by LeaseWeb are already 'password reset' functionality enabled.

Once an instance is created, depending on the state of the instance, you can perform the following tasks on them:

  • If the instance is in a "Running" state, you can Stop, Reboot, Destroy (with expunge), Attach ISO, Reset password, and Access console.
  • If the instance is in a "Stopped" state, you can Start, Destroy (with expunge), Change affinity, Edit, Attach ISO, Reset password, Change compute offering, Reset SSH key pair, Assign instance to other account. Some of these options depend on either being the owner of an instance or being a domainadmin or a regular user.
     
  • If the instance is in a "Destroyed" state, you can Recover or Expunge.


Stopping an Instance

To temporarily power off your instance, you can stop your instance. When you stop an instance, the resources of the instance are still reserved.

Perform the following steps to stop a running instance: 

  1. On the left panel, click Instances.
    The Instances page displays.
  2. Click the instance name that you want to stop.
    The Details tab displays.
  3. Click the Stop Instance icon.
    The Stop Instance dialog box displays.

    Select the Force Stop check box if your instance is unresponsive and you need to change the state. This will force your instance to stop immediately. It is a non-graceful shutdown and all processing data will be lost.

  4. Click OK to confirm.  
    The status of the instance is changed to Stopped.

Windows Instances with VirtIO

Creating a new Windows Instance

If you are installing Windows on our Cloudstack Private Cloud it is recommended to include the VirtIO drivers during installation.
To do this you should mount the VirtIO driver ISO that we offer to your instance, or download the latest version from https://fedoraproject.org/wiki/Windows_Virtio_Drivers.

  1. Set the OS Type of your Windows ISO to Windows PV.
    When registering an ISO.

    On an already registered ISO.
  2. During installation it can’t find the disks due to missing drivers
  3. Now unmount the Windows ISO and mount the VirtIO ISO.

  4. Load the missing drivers from the VirtIO ISO.
  5. Swap back to the Windows ISO and continue the installation.

Updating an existing Windows Instance

If you already had a Windows installation it is recommended to install the VirtIO drivers.

To install the virtIO drivers follow the steps below.

  1. Mount the virtIO ISO to the instance.
  2. Create an additional disk of for example 5 GB, this disk will have virtIO by default.
  3. Attach the disk to the instance (select from drop down).
  4. Install all missing drivers for the unknown hardware in the device manager.
  5. Turn the instance off and change the OS Type to Windows PV.
     
  6. Turn the instance on and this should boot without issues.
  7. Now you can also install the drivers for the network card which now should also show as unknown hardware.

Rebooting an Instance

Perform the following steps to reboot an instance: 

  1. On the left panel, click Instances.
    The Instances page displays.
  2. Click the instance name that you want to reboot.
    The Details tab displays.
     
  3. Click the Reboot Instance icon.
    A Confirmation dialog box appears. 
  4. Click YES to confirm.
    The instance is rebooted. 

Destroying an Instance

To totally remove an instance and free the resources allocated to it, you must destroy and expunge it.
It is important to understand the two step process which will lead to total removal:

By default once you destroy an instance, it will be set to destroyed state and will be retained for 3 days(72 hours exactly). You can revive the instance within this time by performing a 'restore' action. After 3 days, the instance is automatically expunged. The expunge process wipes the disk and reallocates the reserved resources for this instance.
If you are sure you want to get rid of an instance straight away you can opt for expunging it at destruction by selecting this option on destroy. 

Perform the following steps to destroy an instance: 

  1. On the left panel, click Instances.
    The Instances page displays.
  2. Click the instance that you want to destroy.
    The Details tab displays.
     
  3. Click the Destroy Instance icon.
    A Confirmation dialog box displays. If immediate removal is necessary select the 'expunge' tick box.
    NB!: if you select expunge you will NOT be able to recover the instance or its data. (LeaseWeb cannot restore an expunged instance either! So think twice)
     
  4. Click YES to destroy the instance.
    The status of the instance is changed to Destroyed. 

    A instance in destroyed state can be restored by clicking the Recover VM icon.
     

    Once restored, the status of the instance is displayed as Stopped. To run the instance again, click the Start Instance icon.

Attaching an ISO to an Instance

You can attach an ISO, i.e. a Live CD, to an instance to perform various rescue operations. You can access an attached ISO from the Console.

Perform the following steps to attach an ISO to an instance: 

  1. On the left panel, click Instances.
    The Instances page displays.
  2. Click the instance name to which you want to attach an ISO.
    The Details tab displays.
     
  3. Click the Attach ISO icon.
    The Attach ISO dialog box displays.
     
  4. Select an ISO from the ISO drop-down list, and click OK.
    The ISO gets attached to the instance.

    To detach an ISO, click the Detach ISO icon. In the Confirmation dialog box, click YES.

Resetting Password for an Instance

If you have forgotten the password for an instance, you can reset it. 

To reset the root password for an instance, you must stop the instance. The template of your instance must have the "cloud-set-guest-password" script file, and the Password Enabled check box must be selected during creation of the template. The default templates that LeaseWeb provides include this script file and are prepared for reset password functionality.

If you are configuring the template yourself, you can find information on downloading the "cloud-set-guest-password" script file from the CloudStack Admin Guide

Perform the following steps to reset the password for an instance: 

  1. On the left panel, click Instances.
    The Instances page displays.
  2. Click the instance for which you want to reset the password.
    The Details tab displays.
     
  3. Click the Reset Password icon.
    A confirmation dialog box displays.
  4. Click YES to reset the password.
    The new password is displayed. 

    You need this password to gain access to the instance either through SSH or by logging in to the Console. It is recommended to save the password. It will not be displayed again. If you forget the password, you need to reset it again.

Editing an Instance

To edit an instance, you must stop the instance.

Perform the following steps to edit an instance: 

  1. On the left panel, click Instances.
    The Instances page displays.
  2. Click the instance that you want to edit.
    The Details tab displays.
     
  3. Click the Edit icon.
    The editable fields allow you to enter/select new values.
  4. Update the values and click Apply.
    The updated values display.

    Some of the editable fields are Display Name, OS Type, Dynamically Scalable, and Group.

Changing Service Offering for an Instance

You can select a different compute offering for the instance.

To change the compute offering, you must stop the instance.

Perform the following steps to change the compute offering for an instance:

  1. On the left panel, click Instances.
    The Instances page displays.
  2. Click the instance name for which you want to change the compute offering.
    The Details tab displays.
     
  3. Click the Change service offering icon.
    The Change service offering dialog box displays.
     
  4. Select a compute offering from the drop-down list and click OK.
    The selected offering is applied to the instance.

Assigning an Instance to another Account

If you are a domainadmin, you can allocate instances to another account.   

On the left panel, click Instances.Perform the following steps to assign an instance to another account:

  1. The Instances page displays.
  2. Click the instance name that you want to assign to another account.
    The Details tab displays.
     
  3. Click the Assign Instance to Another Account icon.
    The Assign Instance to Another Account dialog box displays.
  4. Select a Domain, select the name of the account to which you want to assign the instance, and click OK.

Viewing the Console

There are multiple use cases when you need to access the Console. Some of them are:

  • When your instance is not reachable via a public IP address, so you cannot SSH or RDP to it directly. 
  • When your instance is inaccessible due to network configuration or firewall issues.
  • When you have an ISO attached and you need to access the Live CD.

Perform the following steps to to view/access the Console:

  1. On the left panel, click Instances.
    The Instances page displays.
  2. Click the instance name for which you need to access the Console.
    The Details tab displays.
     
  3. Click the View console icon.
    The Console view displays.
     
  4. Hit enter to activate the screen and enter credentials to gain access to the Console.

    The menu bar of the Console contains the following options:

    Ctrl-Alt-Del Linux: It will reboot the instance. Windows: It will display the login screen.
    Clipboard To copy text from host to guest instances.
    Ctrl-Esc Functional only for Windows.
    Keyboard Functional only for Windows. It changes the keyboard layout.

Adding Network to the Virtual Machine

You can add multiple NIC`s/networks to your instance. Each network an instance is attached to will get its own virtual NIC.

Perform the following steps to add a network to an instance:

  1. On the left panel, click Instances.
    The Instances page displays.
  2. Click the instance name to which you want to add a network.
    The Details tab displays.
  3. Click the NICs tab, and click + Add network to VM.
  4. In the Add network to VM dialog box, select a network and click OK.
  5. The network is added to the list in the NICs tab. 

    From the NICs tab, you can remove a network, or set a network as the default network of the instance.
    Note: The network that you set as default cannot be removed.

    Depending on your operating system, the network interface which is created upon adding a new network will be automatically detected or not. If the operating system does not support hot plugin, you may have to reboot and/or configure the network interface manually.

Autoscaling of instances

Autoscaling allows you to scale up or down back-end services or application virtual machines (guest VMs) based on various conditions you define. It ensures optimum use of virtual resources, thus providing high availability and also saving cost. Scale up is the action where extra Virtual Machines will be created and scale down is the action where unwanted Virtual Machines will be destroyed depending on the conditions users specify. Conditions for triggering a scale up or scale down action includes a combination of monitoring the CPU usage of a server and its memory usage. Depending on the threshold and the condition specified, either a scale up or a scale down will be performed.

For this feature to work properly, you need to set up the proper templates which VMs will be using when they are created. Also make sure that you have sufficient RAM and CPU cores left in your domain. The CPU utilization and the memory consumption of a VM are fetched every minute, and the average of this value is used to decide whether any scale action has to be performed or not. At any time, only two hours worth of these counter values are stored.

Creating a new Autoscale group

Autoscaling can be applied for the Virtual Machines (VM) belonging to isolated networks. You can create the isolated networks by following the steps mentioned here. If isolated network already exists, you don't need to create it, and the autoscaling can be applied to it directly.

  1. Select the isolated network on which you want autoscaling to be enabled. 
  2. In the isolated network details window, click on "View Public IP addresses". 
  3. In the new window select the IP address for which "Source NAT" is enabled.
    This is shown in the diagram below.


  4. In the new window select the "configuration" tab which will display a figure and you have to click on "View All" in the Load Balancing box.


  5. This will display a new window where you can enter the name for the autoscaling group, public port and the private port.
    After entering the auto scaling group name, public port and the private port click on "Configure" under the "AutoScale" tab.


  6. When you click on the "configure" button, you will be displayed with new pop-up where the actual scale up or scale down actions can be configured.
    1. Make sure that you select the latest version of Ubuntu or CentOS template so that they can export counter statistics. If older templates are used then auto scaling may not work properly. Second point is to select the service offering for the VM which will be used to create the VM. 
    2. You also have to specify the minimum number and the maximum number of VM's that will be part of this autoscaling group. 

      When you configure the auto scaling group for the first time, then the minimum number of instances mentioned are created by default. It can scale up to maximum number of instances mentioned. Similarly it can scale down to minimum number of instances, and not below that.

    3. The VM statistics are fetched every minute and the values are stored for a overall period of two hours. When configuring the scale up action you need to mention the duration in seconds which is a critical value in deciding the action. In the image, the "duration" is set to 300 seconds, which means the counter values to be considered in an average value obtained in the past 5 minutes. If this value is high then average value is calculated from the statistics stored for longer duration. Providing a higher value leads to making decision very effectively rather than specifying the lower value.
    4. The scale up/scale down action takes two counters which are:
      1. CPU utilization
      2. memory consumption
      There are also five operators which trigger these actions and these are : 
      1. greaterthan
      2. greater than or equalto
      3. lesser than
      4. lesser than or equal to
      5. equal to 

        These operators are self explanatory and are crucial is defining the action. For example you can mention "CPU utilisation" "greater than" 75 percent then perform Scale Up action. Similarly you can mention other conditions to perform scale down operation as well. Below figure shows the conditions mentioned for the scale up action. The CPU utilisation is set for 75% and when the cpu utilisation of the user VM exceeds this value then Scale up action is performed. Similarly memory consumption is set for 85%



  7. In the same way you have to configure the scale down action.

    You have to mention the duration (in seconds) for which average value of counters has to be calculated to make a decision along with counter threshold value and the operator value. 

    In the image, you perform a scale down action if CPU utilization is less than or equal to 30% or memory consumption is less than 40%. The average value of the above two counters are calculated for previous 5 minutes and then used to compare with the threshold values. If this satisfies, then scale down operation is performed and the recently created VM will be destroyed.

    1. "Quiet time" indicates for how long the system has to wait to perform a scale action after the earlier scale action was performed. Mentioning the value of 300 seconds means no scale up/scale down action will be performed for the next 5 minutes after the current scale operation. This ensures that VMs are not created or destroyed too frequently because of the changing value in the counters. If this value is less, then system will spend more time on doing scale actions, which might not be suitable for your need. Preferred value is to set it for 5 minutes or more.

  8. Once all these values are configured, click on apply button and new autoscaling group is configured successfully.



Disabling the Autoscale group

After creating the autoscale group, you can disable it by clicking on the "Disable Autoscale" button on the top right hand corner of the pop up window. Also if you want to make any changes to the autoscale group, you first need to disable it, change the rules and then enable it back.


Enabling the Autoscale group

If the autoscaling group is disabled, or if you have made any changes to it, then you have to enable it to save the changes, else it wont be applied to the group. To enable it, you have to navigate to the autoscaling popup view which is described in "Creating autoscaling group", and then click on "configure" button for the corresponding group which has to enabled. In the new pop up window, click on "Enable Autoscale" which can be found on the top right hand corner.


Editing the rules of Autoscale group

To make any changes to the existing autoscaling group, first you need to disable it and then make the changes. To disable it, refer to the steps mentioned above. After disabling it, you can add new rules, change the threshold value, delete existing rules or any other parameters.

After making the changes, you need to enable the autoscaling group else the changes you made will not be reflected. To enable the autoscaling group, please refer to the steps mentioned above. The diagram below shows how to change the rules.


Displaying virtual machines of Autoscale group

You can see the list of virtual machines belonging to a particular autoscale group in the main autoscale configuration window.


You can also view more information about a particular instance in the main "Instances" tab of the CloudStack UI.

Deleting Autoscale group

To delete, you need to first disable the feature. You can refer to the steps mentioned above to disable the autoscale group. Click the delete icon from the main autoscaling configuration window.