Inventory

Properties

Name Description Optional Valid Value Starting Version
uuid The UUID. For more information, see Resource Property. 0.6
name The name. For more information, see Resource Property. 0.6
description The description. For more information, see Resource Property. Yes 0.6
cpuNum The number of virtual CPUs (vCPUs). For more information, see CPU Capacity. 0.6
cpuSpeed The vCPU speed. For more information, see CPU Capacity. 0.6
memorySize The memory size. Unit: byte. 0.6
type The instance offering type. Default type: UserVm. For more information, see Type. Yes
  • UserVm
  • VirtualRouter
0.6
allocatorStrategy The host allocator strategy. For more information, see Allocator Strategy.
  • DefaultHostAllocatorStrategy
  • LastHostPreferredAllocatorStrategy
  • LeastVmPreferredHostAllocatorStrategy
  • MinimumCPUUsageHostAllocatorStrategy
  • MinimumMemoryUsageHostAllocatorStrategy
  • MaxInstancePerHostHostAllocatorStrategy
0.6
state The state. For more information, see State.
  • Enabled
  • Disabled
0.6
sortKey 0.6
createDate The creation date. For more information, see Resource Property. 0.6
lastOpDate The last operation date. For more information, see Resource Property. 0.6

Sample

{
    "inventories": [
        {
            "allocatorStrategy": "LeastVmPreferredHostAllocatorStrategy",
            "cpuNum": 1,
            "cpuSpeed": 0,
            "createDate": "Oct 30, 2017 3:51:50 PM",
            "description": "",
            "lastOpDate": "Oct 30, 2017 4:49:03 PM",
            "memorySize": 1073741824,
            "name": "1G-1CPU",
            "sortKey": 0,
            "state": "Enabled",
            "type": "VirtualRouter",
            "uuid": "fa550cb9bdcc4fd397ae37f9ddf4c390"
        }
    ],
    "success": true
}

CPU Capacity

Instance offerings use cpuNum and cpuSpeed to define the CPU capacity of a VM instance. The cpuNum field means the number of vCPUs that a VM instance has. The vCPU of a VM instance always has the same frequency as that of the host's physical CPU. Therefore, the cpuSpeed field here actually means the vCPU weight in hypervisors. The use and implementation of cpuSpeed vary depending on hypervisor types.

KVM CPU Speed

In KVM, ZStack Cloud uses the result of shares=cpuSpeed * cpuNum to set the VM instance XML configuration of libvirt.
<cputune>
  <shares>128</shares>
</cputune>

shares = cpuNum * cpuSpeed
Note: When cpuSpeed is set to 0, the value of shares is displayed as 2 by default.

Type

The type of instance offering. Currently, two instance offering types are available:
  • UserVm:

    The instance offering for creating user VM instances.

  • VirtualRouter:

    The instance offering for creating virtual router (vRouter) VM instances.

Allocator Strategy

Allocator strategy defines the algorithm of selecting destination hosts for creating VM instances.

DefaultHostAllocatorStrategy

Algorithm:
l2_networks = get_parent_l2_networks(l3_networks)
host_set1 = find_hosts_in_cluster_that_have_attached_to_l2_networks()
check_if_backup_storage_having_image_have_attached_to_zone_of_hosts(host_set1)
host_set2 = remove_hosts_not_having_state_Enabled_and_status_Connected(host_set1)
host_set3 = remove_hosts_not_having_capacity_required_by_instance_offering(host_set2)
primary_storage = find_Enabled_Connected_primary_storage_having_enough_capacity_for_root_volume_and_attached\
_to_clusters_of_hosts(image, host_set3)
host_set4 = remove_hosts_that_cannot_access_primary_storage(host_set3)
host_set5 = remove_avoided_hosts(host_set4)
host_set6 = call_tag_plugin(tags, host_set5)

return randomly_pick_one_host(host_set6)

LastHostPreferredAllocatorStrategy

Algorithm:
l2_networks = get_parent_l2_networks(l3_networks)
host_set1 = find_hosts_in_cluster_that_have_attached_to_l2_networks()
check_if_backup_storage_having_image_have_attached_to_zone_of_hosts(host_set1)
host_set2 = remove_hosts_not_having_state_Enabled_and_status_Connected(host_set1)
host_set3 = remove_hosts_not_having_capacity_required_by_instance_offering(host_set2)
primary_storage = find_Enabled_Connected_primary_storage_having_enough_capacity_for_root_volume_and_attached\
_to_clusters_of_hosts(image, host_set3)
host_set4 = remove_hosts_that_cannot_access_primary_storage(host_set3)
host_set5 = remove_avoided_hosts(host_set4)
host_set6 = call_tag_plugin(tags, host_set5)

return pick_vm_last_host(host_set6)

LeastVmPreferredHostAllocatorStrategy

Algorithm:
l2_networks = get_parent_l2_networks(l3_networks)
host_set1 = find_hosts_in_cluster_that_have_attached_to_l2_networks()
check_if_backup_storage_having_image_have_attached_to_zone_of_hosts(host_set1)
host_set2 = remove_hosts_not_having_state_Enabled_and_status_Connected(host_set1)
host_set3 = remove_hosts_not_having_capacity_required_by_instance_offering(host_set2)
primary_storage = find_Enabled_Connected_primary_storage_having_enough_capacity_for_root_volume_and_attached\
_to_clusters_of_hosts(image, host_set3)
host_set4 = remove_hosts_that_cannot_access_primary_storage(host_set3)
host_set5 = remove_avoided_hosts(host_set4)
host_set6 = call_tag_plugin(tags, host_set5)

return pick_host_with_the_fewest_vm(host_set6)

MinimumMemoryUsageHostAllocatorStrategy

Algorithm:
l2_networks = get_parent_l2_networks(l3_networks)
host_set1 = find_hosts_in_cluster_that_have_attached_to_l2_networks()
check_if_backup_storage_having_image_have_attached_to_zone_of_hosts(host_set1)
host_set2 = remove_hosts_not_having_state_Enabled_and_status_Connected(host_set1)
host_set3 = remove_hosts_not_having_capacity_required_by_instance_offering(host_set2)
primary_storage = find_Enabled_Connected_primary_storage_having_enough_capacity_for_root_volume_and_attached\
_to_clusters_of_hosts(image, host_set3)
host_set4 = remove_hosts_that_cannot_access_primary_storage(host_set3)
host_set5 = remove_avoided_hosts(host_set4)
host_set6 = call_tag_plugin(tags, host_set5)

return pick_host_with_the_lowest_memory_load(host_set6)

MinimumCPUUsageHostAllocatorStrategy

Algorithm:
l2_networks = get_parent_l2_networks(l3_networks)
host_set1 = find_hosts_in_cluster_that_have_attached_to_l2_networks()
check_if_backup_storage_having_image_have_attached_to_zone_of_hosts(host_set1)
host_set2 = remove_hosts_not_having_state_Enabled_and_status_Connected(host_set1)
host_set3 = remove_hosts_not_having_capacity_required_by_instance_offering(host_set2)
primary_storage = find_Enabled_Connected_primary_storage_having_enough_capacity_for_root_volume_and_attached\
_to_clusters_of_hosts(image, host_set3)
host_set4 = remove_hosts_that_cannot_access_primary_storage(host_set3)
host_set5 = remove_avoided_hosts(host_set4)
host_set6 = call_tag_plugin(tags, host_set5)

return pick_host_with_the_lowest_cpu_load(host_set6)

MaxInstancePerHostHostAllocatorStrategy

Algorithm:
l2_networks = get_parent_l2_networks(l3_networks)
host_set1 = find_hosts_in_cluster_that_have_attached_to_l2_networks()
check_if_backup_storage_having_image_have_attached_to_zone_of_hosts(host_set1)
host_set2 = remove_hosts_not_having_state_Enabled_and_status_Connected(host_set1)
host_set3 = remove_hosts_not_having_capacity_required_by_instance_offering(host_set2)
primary_storage = find_Enabled_Connected_primary_storage_having_enough_capacity_for_root_volume_and_attached\
_to_clusters_of_hosts(image, host_set3)
host_set4 = remove_hosts_that_cannot_access_primary_storage(host_set3)
host_set5 = remove_avoided_hosts(host_set4)
host_set6 = call_tag_plugin(tags, host_set5)

return pick_host_with_vm_is_less_than_expected(host_set6)

State

An instance offering has the following two states:
  • Enabled:

    Indicates that VM instances can be created from this instance offering.

  • Disabled:

    Indicates that VM instances cannot be created from this instance offering.