$ pip install python-openstackclient
$ cat openrc
export OS_USERNAME=osuser
export OS_TENANT_NAME=engineering
export OS_PASSWORD=<enter password>
export OS_AUTH_URL=https://<openstack-auth-url>/
keystone/v2.0
export OS_REGION_NAME=us-east-1
$ source openrc
$ ssh-keygen -t rsa
$ nova keypair-add --public-key ~/.ssh/id_rsa.pub
<keypair_name> (legacy CLI)
- or -
$ openstack keypair create --public-key ~/.ssh/id_rsa.
pub <keypair_name> (new Unified OpenStack CLI)
$ glance image-create --name <image_name> --disk-
format <disk_format> --container-format bare --file
<image_file>
- or -
$ openstack image create --container-format bare
--disk-format <disk_format> --file <image_file> <image_name>
$ nova boot --image <image_name> --avor <avor_name>
--nic net-id=<network_id> --key-name <keypair_name>
<server_name>
- or -
$ openstack server create --avor <avor_name> --nic
net-id=<network_id> --key-name <keypair_name> <server_name>
$ nova avor-list
- or -
$ openstack avor list
$ nova list
- or -
$ openstack list
$ nova rebuild <server> <image>
- or -
$ openstack server rebuild --image <image_name>
<server_name>
$ nova console-log <server>
- or -
$ openstack console log show
$ nova image-create <nova_instance_name> <image_
name>
- or -
$ openstack server image create <nova_instance_name>
<image_name>
$ glance image-list
- or -
$ openstack image list
$ glance image-delete <image_name>
- or -
$ openstack image delete <image_name>
$ neutron network-list
- or -
$ openstack network list
$ neutron net-create devops_network
- or -
$ openstack network create devops_network
$ neutron subnet-create --gateway 10.10.10.1 devops_
network 10.10.10.0/24
- or -
$ openstack subnet create --gateway 10.10.10.1
--network devops_network --subnet-range 10.10.10.0/24
devops_subnet
$ neutron oatingip-list
- or -
$ openstack oating ip list
$ neutron oatingip-create <oating ip network>
- or -
$ openstack oating ip create <oating IP network>
$ nova oating-ip-associate <instance> <oating_ip>
- or -
$ openstack server oating ip add <instance>
oating_ip>
$ neutron security-group-create ssh_secgroup
- or -
$ openstack security group create ssh_secgroup
$ neutron security-group-rule-create --protocol tcp
--direction ingress --port-range-min 22 --port-rangemax 22 ssh_secgroup
- or -
$ openstack security group rule create --protocol tcp
--ingress --protocol tcp --dst-port 22 ssh_secgroup
$ nova add-secgroup <server> ssh_secgroup
- or -
$ openstack server add security group <server> ssh_
secgroup
$ cinder create --name <name> <size_in_GB>
- or -
$ openstack volume create --size <size_in_GB> <volume_name>
$ nova volume-attach <instance_name> <volume_name>
- or -
$ openstack server add volume <instance_name> <volume_name>
$ swift upload <container_name> <local_file_name>
- or -
$ openstack object create <container_name> <local_file_
name>
$ swift download <container_name> <object_name>
- or -
$ openstack object save <container_name> <object_name>
$ openstack user-create
$ openstack role-create <name>
$ openstack project-create <name>
$ openstack role add --user <user> --project
<project> <role>
$ openstack user delete <user>
$ openstack project delete <project>
$ openstack role delete <role>
$ openstack quota set --gigabytes <GB_of_storage>
--ram <GB_of_ram> --cores <number_of_cores>
--snapshots <number_of_snapshots> <project_name>
$ openstack quota show <project>
$ nova help
- or -
$ openstack server
欢迎光临 51学通信论坛2017新版 (http://bbs.51xuetongxin.com/) | Powered by Discuz! X3 |