# Check the list of project (overcloud) [stack@director ~]$ openstack project list --domain Haoyang +----------------------------------+-------------+ | ID | Name | +----------------------------------+-------------+ | ec0e24ddf10841b08ae63fe094e25587 | Engineering | +----------------------------------+-------------+
User
Robert serves as the Engineering project administrator.
William is a member of the Engineering project and is not permitted administrator access.
All users within the Engineering project belong to the Haoyang domain.
# Use the administrator credential (overcloud) [stack@director ~]$ source overcloudrc
# Create the users (undercloud) [stack@director ~]$ openstack user create -h (overcloud) [stack@director ~]$ openstack user create \ > --domain Haoyang \ > --project Engineering \ > --project-domain Haoyang \ > --password Flectrag \ > Robert +---------------------+----------------------------------+ | Field | Value | +---------------------+----------------------------------+ | default_project_id | ec0e24ddf10841b08ae63fe094e25587 | | domain_id | 5ecb4e207166423494f02ade2d289efe | | enabled | True | | id | 5a7970ef27424053913c54ebb85ae123 | | name | Robert | | options | {} | | password_expires_at | None | +---------------------+----------------------------------+
(overcloud) [stack@director ~]$ openstack user create \ > --domain Haoyang \ > --project Engineering \ > --project-domain Haoyang \ > --password Flectrag \ > William +---------------------+----------------------------------+ | Field | Value | +---------------------+----------------------------------+ | default_project_id | ec0e24ddf10841b08ae63fe094e25587 | | domain_id | 5ecb4e207166423494f02ade2d289efe | | enabled | True | | id | 9615d8cee44947a4bbce4e490f1391e4 | | name | William | | options | {} | | password_expires_at | None | +---------------------+----------------------------------+
# Check the results (overcloud) [stack@director ~]$ openstack user list --domain Haoyang +----------------------------------+---------+ | ID | Name | +----------------------------------+---------+ | 5a7970ef27424053913c54ebb85ae123 | Robert | | 9615d8cee44947a4bbce4e490f1391e4 | William | +----------------------------------+---------+
# Allocate the role to users (overcloud) [stack@director ~]$ openstack role add \ > --project Engineering \ > --user Robert \ > --user-domain Haoyang \ > --project-domain Haoyang \ > admin
(overcloud) [stack@director ~]$ openstack role add \ > --project Engineering \ > --user William \ > --user-domain Haoyang \ > --project-domain Haoyang \ > member
# Check the results (overcloud) [stack@director ~]$ openstack role assignment list --project-domain Haoyang --project Engineering --names +--------+-----------------+-------+---------------------+--------+--------+-----------+ | Role | User | Group | Project | Domain | System | Inherited | +--------+-----------------+-------+---------------------+--------+--------+-----------+ | admin | Robert@Haoyang | | Engineering@Haoyang | | | False | | member | William@Haoyang | | Engineering@Haoyang | | | False | +--------+-----------------+-------+---------------------+--------+--------+-----------+
1 2 3 4 5 6 7 8 9
# Create the user called Robert credential for administration (overcloud) [stack@director ~]$ cp overcloudrc robertrc (overcloud) [stack@director ~]$ vim robertrc # Modify 5 line contents in total export OS_USERNAME=Robert export OS_PROJECT_NAME=Engineering export OS_USER_DOMAIN_NAME=Haoyang export OS_PROJECT_DOMAIN_NAME=Haoyang export OS_PASSWORD=Flectrag
Note: The following error will occur during creation, as only one external network is allowed. The system has already created provider-datacentre. Please delete it first before recreating.
# Set the interface of external gateway (overcloud) [stack@director ~]$ openstack router set --external-gateway public cl210-router
# Set the interface of internal subnet (overcloud) [stack@director ~]$ openstack router add subnet cl210-router engsubnet
# Check the list of router (overcloud) [stack@director ~]$ openstack router list +--------------------------------------+--------------+--------+-------+----------------------------------+ | ID | Name | Status | State | Project | +--------------------------------------+--------------+--------+-------+----------------------------------+ | 590e3024-35f4-42f2-95b4-87c1afdea3e1 | cl210-router | ACTIVE | UP | ec0e24ddf10841b08ae63fe094e25587 | +--------------------------------------+--------------+--------+-------+----------------------------------+
Server
Create an instance (virtual machine) named myserver:
The instance belongs to the Engineering project
It uses the web image
It is launched with the m1.petite flavour
The instance is connected to the engnet network
The following security groups are attached:
ssh
web
The instance uses a key pair named webkey
A floating IP is associated with the instance, selected from the allowed range between 172.25.250.101 and 172.25.250.109
The router is connected to both the external network public and the internal network engnet
The root password for the instance is redhat
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# Finally, create the server (overcloud) [stack@director ~]$ openstack server create \ > --flavor m1.petite \ > --image web \ > --nic net-id=engnet \ > --security-group ssh \ > --security-group web \ > --key-name webkey \ > --wait \ > shy
(overcloud) [stack@director ~]$ openstack server list +--------------------------------------+------+--------+-----------------------+-------+--------+ | ID | Name | Status | Networks | Image | Flavor | +--------------------------------------+------+--------+-----------------------+-------+--------+ | 232caad5-f79a-4652-8995-9715c0b5cd17 | shy | ACTIVE | engnet=192.168.101.50 | web | | +--------------------------------------+------+--------+-----------------------+-------+--------+
1 2 3 4 5 6 7 8 9 10 11 12 13
# Create the floating ip (overcloud) [stack@director ~]$ openstack floating ip create public
# Check the list of floating ip (overcloud) [stack@director ~]$ openstack floating ip list +--------------------------------------+---------------------+------------------+------+--------------------------------------+----------------------------------+ | ID | Floating IP Address | Fixed IP Address | Port | Floating Network | Project | +--------------------------------------+---------------------+------------------+------+--------------------------------------+----------------------------------+ | 90511fbd-e927-4882-923a-7fe140b5f8dd | 172.25.250.108 | None | None | 775da214-c50b-4f51-b2eb-60c631316a09 | ec0e24ddf10841b08ae63fe094e25587 | +--------------------------------------+---------------------+------------------+------+--------------------------------------+----------------------------------+
# Bind the floating ip to server "shy" (overcloud)[stack@director ~]$ openstack server add floating ip shy 172.25.250.108
1 2 3 4 5 6 7 8 9 10 11 12 13 14
# Login to the Virtual machine in compute1 node (overcloud) [stack@director ~]$ ssh -i webkey.pem cloud-user@172.25.250.108 [cloud-user@shy ~]$
# Test on the director node (overcloud) [stack@director ~]$ curl 172.25.250.108 1111111111111111111111
Delete a VM instance in CLI
Delete the server
1 2 3
source robertrc
openstack server delete shy
Then, Let’s check the server list.
1 2
(overcloud) [stack@director ~]$ openstack server list
Delete the network
1 2 3
openstack network list openstack network delete engnet openstack network delete public
1 2
openstack subnet list openstack subnet delete engsubnet
1
openstack port list --fixed-ip subnet=ff1be714-007c-4f19-bbc4-824b4509c8c5
1
openstack port show 8af1f1d2-6811-475e-9c94-4c2eeba481dc
1 2
Failed to delete network with name or ID 'public': ConflictException: 409: Client Error for url: http://172.25.250.50:9696/v2.0/networks/775da214-c50b-4f51-b2eb-60c631316a09, Unable to complete operation on network 775da214-c50b-4f51-b2eb-60c631316a09. There are one or more ports still in use on the network. 1 of 1 networks failed to delete.
After determine the port , please delete the port at first.
1
openstack port delete 8af1f1d2-6811-475e-9c94-4c2eeba481dc
Then, you could delete the subnet(internal).
1
openstack network delete engnet
Check the port in public(external).
1
openstack port list --network public
Check the port info.
1
openstack port show 6ccb8845-879b-48cd-a871-81d5a9698e1b
Delete the external port.
1
openstack port delete 6ccb8845-879b-48cd-a871-81d5a9698e1b
There will be an error in the terminal, do not worry! Because we need to cancel the bound with router gate-way.
Copyright Notice: This article is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. Please attribute the original author and source when sharing.