WholeHostAllocation-pcloud-example
Examples of using the nova client to create and manage pclouds
Create a Pcloud
ubuntu@pcloud2(demo):/mnt/devstack$ nova pcloud-create phil +----------+--------------------------------------+ | Property | Value | +----------+--------------------------------------+ | uuid | a3e9a336-1277-496c-90b1-bba2ec9050ee | | name | phil | +----------+--------------------------------------+
List the Pclouds (Note we can see the Nr of Hosts as we own it)
ubuntu@pcloud2(demo):/mnt/devstack$ nova pcloud-list +--------------------------------------+------+-------+-------+ | Id | Name | Role | Hosts | +--------------------------------------+------+-------+-------+ | a3e9a336-1277-496c-90b1-bba2ec9050ee | phil | Owner | 0 | +--------------------------------------+------+-------+-------+
Show the details of a Pcloud
ubuntu@pcloud2(demo):/mnt/devstack$ nova pcloud-show a51edd73-3667-4c6f-b19c-daf4dc369ea9 +----------+---------------------------------------+ | Property | Value | +----------+---------------------------------------+ | owner | 6c1db1a4abde4170a29dc299e645ab0f | | tenants | [u'6c1db1a4abde4170a29dc299e645ab0f'] | | id | a3e9a336-1277-496c-90b1-bba2ec9050ee | | name | phil | +----------+---------------------------------------+
As Admin Add a host directly to the Aggregate (As we don't have the allocation code in place yet)
ubuntu@pcloud2(admin):/mnt/devstack$ nova aggregate-add-host 1 pcloud3
As the user list the Pclouds again – see we now have 1 host
ubuntu@pcloud2(demo):/mnt/devstack$ nova pcloud-list +--------------------------------------+------+-------+-------+ | Id | Name | Role | Hosts | +--------------------------------------+------+-------+-------+ | a3e9a336-1277-496c-90b1-bba2ec9050ee | phil | Owner | 1 | +--------------------------------------+------+-------+-------+
Show details of the Pcloud with the host (and get a list of instances) Note that host_id is the same hash as used in Server Details
ubuntu@pcloud2(demo):/mnt/devstack$ nova pcloud-show a51edd73-3667-4c6f-b19c-daf4dc369ea9 +----------+---------------------------------------+ | Property | Value | +----------+---------------------------------------+ | owner | 6c1db1a4abde4170a29dc299e645ab0f | | tenants | [u'6c1db1a4abde4170a29dc299e645ab0f'] | | id | a3e9a336-1277-496c-90b1-bba2ec9050ee | | name | phil | +----------+---------------------------------------+ +-----------+----------------------------------------------------------+ | Property | Value | +-----------+----------------------------------------------------------+ | host_id | 0e162c89056b0e3fba937e3202b94bccf1b848feb2a772c9873fe3c8 | | instances | [u'39f846ee-a4b8-40ab-aa2f-6fbd3f36a749'] | +-----------+----------------------------------------------------------+
Add another project to the Pcloud
ubuntu@pcloud2(demo):/mnt/devstack$ nova pcloud-add-project a3e9a336-1277-496c-90b1-bba2ec9050ee 0ef23163e7e3422b80f9c872a1bb1521 Project 0ef23163e7e3422b80f9c872a1bb1521 has been successfully added to Pcloud a3e9a336-1277-496c-90b1-bba2ec9050ee as a Tenant +----------+----------------------------------------------------------------------------+ | Property | Value | +----------+----------------------------------------------------------------------------+ | owner | 6c1db1a4abde4170a29dc299e645ab0f | | tenants | [u'6c1db1a4abde4170a29dc299e645ab0f', u'0ef23163e7e3422b80f9c872a1bb1521'] | | id | a3e9a336-1277-496c-90b1-bba2ec9050ee | | name | phil | +----------+----------------------------------------------------------------------------+
See the Pcloud from the other project (note can’t see # Hosts as we don’t own the Pcloud)
ubuntu@pcloud2(demo2):/mnt/devstack$ nova pcloud-list +--------------------------------------+------+--------+-------+ | Id | Name | Role | Hosts | +--------------------------------------+------+--------+-------+ | a3e9a336-1277-496c-90b1-bba2ec9050ee | phil | Tenant | - | +--------------------------------------+------+--------+-------+
But we can’t show detsils Pclouds we don’t own
ubuntu@pcloud2(demo2):/mnt/devstack$ nova pcloud-show a3e9a336-1277-496c-90b1-bba2ec9050ee ERROR: Not authorized. (HTTP 403) (Request-ID: req-283b1dd7-8730-4360-b6c6-f490538c7612)
Or delete Pclouds we don’t own
ubuntu@pcloud2(demo2):/mnt/devstack$ nova pcloud-delete a3e9a336-1277-496c-90b1-bba2ec9050ee ERROR: Not authorized. (HTTP 403) (Request-ID: req-2959c227-0b7e-4da9-85b1-1066a318db8d)
Remove the project form the Pcloud
ubuntu@pcloud2(demo):/mnt/devstack$ nova pcloud-remove-project a3e9a336-1277-496c-90b1-bba2ec9050ee 0ef23163e7e3422b80f9c872a1bb1521 Project 0ef23163e7e3422b80f9c872a1bb1521 has been successfully removed from Pcloud a3e9a336-1277-496c-90b1-bba2ec9050ee. +----------+---------------------------------------+ | Property | Value | +----------+---------------------------------------+ | owner | 6c1db1a4abde4170a29dc299e645ab0f | | tenants | [u'6c1db1a4abde4170a29dc299e645ab0f'] | | id | a3e9a336-1277-496c-90b1-bba2ec9050ee | | name | phil | +----------+---------------------------------------+
Check that the other user can’t see it any more
ubuntu@pcloud2(demo2):/mnt/devstack$ nova pcloud-list +----+------+------+-------+ | Id | Name | Role | Hosts | +----+------+------+-------+ +----+------+------+-------+