WholeHostAllocation-pcloud-example
Examples of using the nova client to create and manage pclouds
Contents
- 1 Nova Pcloud Commands
- 2 Create Pcloud Host Flavors (Administrator)
- 3 Add a host to a Host Flavor Pool (Administrator)
- 4 Create a Pcloud
- 5 Find the available Host Flavors
- 6 Allocate a Host of type "host.small" from az1 and call it "my-host"
- 7 Enable the host
- 8 Grant another tenant access to the Pcloud
- 9 See the list of available Pclouds (as a Tenant not Owner)
- 10 Create an instance in a Pcloud
- 11 See the details of the Pcloud, including hosts and instances
Nova Pcloud Commands
ubuntu@pcloud:/mnt/devstack$ nova help | grep pcloud
pcloud-host-flavor-add-host Add a host to a pcloud host flavor. pcloud-host-flavor-create Create a new pcloud host flavor with the specified pcloud-host-flavor-delete Delete the pcloud host flavor by its id. pcloud-host-flavor-remove-host Remove a host from a pcloud host flavor. pcloud-host-flavor-show Show details of the specified pcloud. pcloud-add-host Allocates a host for the specified Pcloud. pcloud-add-project Add the project to the specified pcloud as a tenant. pcloud-create Create a new pcloud with the specified details. pcloud-delete Delete the pcloud by its id. pcloud-disable-host pcloud-enable-host Enables a host in the specified Pcloud. pcloud-host-flavor-list Print a list of all pclouds. pcloud-list Print a list of all pclouds. pcloud-remove-host Removes a host from the specified Pcloud. pcloud-remove-project Remove the project from the specified pcloud. pcloud-rename Changes the name of the specificed Pcloud. pcloud-set-cpu-allocation-ratio pcloud-set-ram-allocation-ratio pcloud-show Show details of the specified pcloud.
Create Pcloud Host Flavors (Administrator)
$ nova pcloud-host-flavor-create host.small "HP DL320, 2 x E-5240, 48GB" 10 +------------+----------------------------+-------+ | Flavor_Id | Description | Units | +------------+----------------------------+-------+ | host.small | HP DL320, 2 x E-5240, 48GB | 10 | +------------+----------------------------+-------+
$ nova pcloud-host-flavor-create host.medium "HP DL360, 2 x E-5260, 96GB" 20 +-------------+----------------------------+-------+ | Flavor_Id | Description | Units | +-------------+----------------------------+-------+ | host.medium | HP DL360, 2 x E-5260, 96GB | 20 | +-------------+----------------------------+-------+
$ nova pcloud-host-flavor-create host.large "HP DL370, 2 x E-5600, 128GB" 30 +------------+-----------------------------+-------+ | Flavor_Id | Description | Units | +------------+-----------------------------+-------+ | host.large | HP DL370, 2 x E-5600, 128GB | 30 | +------------+-----------------------------+-------+
Add a host to a Host Flavor Pool (Administrator)
$ nova pcloud-host-flavor-add-host host.small testhost1 +------------+----------------------------+-------+-------------+ | Flavor_Id | Description | Units | Hosts | +------------+----------------------------+-------+-------------+ | host.small | HP DL320, 2 x E-5240, 48GB | 10 | [u'testhost1'] | +------------+----------------------------+-------+-------------+
Create a Pcloud
$ nova pcloud-create my-pcloud +--------------------------------------+-----------+-------+-------+ | Id | Name | Role | Hosts | +--------------------------------------+-----------+-------+-------+ | 0b26dc22-56f7-4444-a3e3-bfbcbb550b51 | my-pcloud | Owner | 0 | +--------------------------------------+-----------+-------+-------+
Find the available Host Flavors
$ nova pcloud-host-flavor-list +-------------+-----------------------------+-------+ | Flavor_Id | Description | Units | +-------------+-----------------------------+-------+ | host.small | HP DL320, 2 x E-5240, 48GB | 10 | | host.medium | HP DL360, 2 x E-5260, 96GB | 20 | | host.large | HP DL370, 2 x E-5600, 128GB | 30 | +-------------+-----------------------------+-------+
Allocate a Host of type "host.small" from az1 and call it "my-host"
$ nova pcloud-add-host 0b26dc22-56f7-4444-a3e3-bfbcbb550b51 my-host host.small --availability-zone az1 +----------+---------------------------------------+ | Property | Value | +----------+---------------------------------------+ | owner | 536205b4724f47d2b412cc0a3add1e5a | | tenants | [u'536205b4724f47d2b412cc0a3add1e5a'] | | id | 0b26dc22-56f7-4444-a3e3-bfbcbb550b51 | | name | my-pcloud | +----------+---------------------------------------+ +-------------------+------------+ | Property | Value | +-------------------+------------+ | status | disabled | | host_id | my-host | | flavor | host.small | | availability_zone | az1 | | instances | [] | +-------------------+------------+
Enable the host
$ nova pcloud-enable-host 0b26dc22-56f7-4444-a3e3-bfbcbb550b51 my-host +----------+---------------------------------------+ | Property | Value | +----------+---------------------------------------+ | owner | 536205b4724f47d2b412cc0a3add1e5a | | tenants | [u'536205b4724f47d2b412cc0a3add1e5a'] | | id | 0b26dc22-56f7-4444-a3e3-bfbcbb550b51 | | name | my-pcloud | +----------+---------------------------------------+ +-------------------+------------+ | Property | Value | +-------------------+------------+ | status | enabled | | host_id | my-host | | flavor | host.small | | availability_zone | az1 | | instances | [] | +-------------------+------------+
Grant another tenant access to the Pcloud
$ nova pcloud-add-project 0b26dc22-56f7-4444-a3e3-bfbcbb550b51 290aa41d7ad4464998702fbb1157a1ab Project 290aa41d7ad4464998702fbb1157a1ab has been successfully added to Pcloud 0b26dc22-56f7-4444-a3e3-bfbcbb550b51 as a Tenant +----------+----------------------------------------------------------------------------+ | Property | Value | +----------+----------------------------------------------------------------------------+ | owner | 536205b4724f47d2b412cc0a3add1e5a | | tenants | [u'290aa41d7ad4464998702fbb1157a1ab', u'536205b4724f47d2b412cc0a3add1e5a'] | | id | 0b26dc22-56f7-4444-a3e3-bfbcbb550b51 | | name | my-pcloud | +----------+----------------------------------------------------------------------------+
See the list of available Pclouds (as a Tenant not Owner)
$ nova pcloud-list
+--------------------------------------+-----------+--------+-------+ | Id | Name | Role | Hosts | +--------------------------------------+-----------+--------+-------+ | 0b26dc22-56f7-4444-a3e3-bfbcbb550b51 | my-pcloud | Tenant | - | +--------------------------------------+-----------+--------+-------+
Create an instance in a Pcloud
$ nova boot --image cirros-0.3.1-x86_64-uec --flavor 1 --hint pcloud=0b26dc22-56f7-4444-a3e3-bfbcbb550b51 --availability-zone az1 my_instance
+-----------------------------+--------------------------------------+ | Property | Value | +-----------------------------+--------------------------------------+ | status | BUILD | | updated | 2013-10-26T00:26:40Z | | hostId | | | key_name | None | | image | cirros-0.3.1-x86_64-uec | | OS-EXT-STS:task_state | scheduling | | OS-EXT-STS:vm_state | building | | flavor | m1.tiny | | id | 668bd437-8a7f-4e23-871c-310794b52f34 | | security_groups | [{u'name': u'default'}] | | user_id | bfe8c66cfb394ebdac0cc5af8c859152 | | name | my_instance | | adminPass | ESAHoR926gjb | | tenant_id | 290aa41d7ad4464998702fbb1157a1ab | | created | 2013-10-26T00:26:40Z | | accessIPv4 | | | accessIPv6 | | | progress | 0 | | OS-EXT-STS:power_state | 0 | | OS-EXT-AZ:availability_zone | nova | | metadata | {} | +-----------------------------+--------------------------------------+
ubuntu@pcloud:~$ nova list
+--------------------------------------+-------------+--------+------------+-------------+---------------------+ | ID | Name | Status | Task State | Power State | Networks | +--------------------------------------+-------------+--------+------------+-------------+---------------------+ | 668bd437-8a7f-4e23-871c-310794b52f34 | my_instance | ACTIVE | None | Running | public=172.24.4.227 | +--------------------------------------+-------------+--------+------------+-------------+---------------------+
See the details of the Pcloud, including hosts and instances
$ nova pcloud-show 0b26dc22-56f7-4444-a3e3-bfbcbb550b51
+----------+----------------------------------------------------------------------------+ | Property | Value | +----------+----------------------------------------------------------------------------+ | owner | 536205b4724f47d2b412cc0a3add1e5a | | tenants | [u'290aa41d7ad4464998702fbb1157a1ab', u'536205b4724f47d2b412cc0a3add1e5a'] | | id | 0b26dc22-56f7-4444-a3e3-bfbcbb550b51 | | name | my-pcloud | +----------+----------------------------------------------------------------------------+ +-------------------+----------------------------------------------------------------------------------------------------------+ | Property | Value | +-------------------+----------------------------------------------------------------------------------------------------------+ | status | enabled | | host_id | my-host | | flavor | host.small | | availability_zone | az1 | | instances | [{u'project_id': u'290aa41d7ad4464998702fbb1157a1ab', u'uuid': u'668bd437-8a7f-4e23-871c-310794b52f34'}] | +-------------------+----------------------------------------------------------------------------------------------------------+