Skip to content

Homework 2. DevStack Manipulation Through CLI

life1347 edited this page Nov 6, 2013 · 20 revisions

Nova

create instance through CLI

#creds
#Paste the following:
export OS_TENANT_NAME=xxx
export OS_USERNAME=xxx
export OS_PASSWORD=xxx
export OS_AUTH_URL="http://10.211.55.38:5000/v2.0/"

load creds

$ source creds

create instance

$ nova --os-cache boot --image 91547919-76f5-4fa8-b447-67e940b28aae --flavor 1 my_first_vm

nova-create-instance nova-launch-instance

$ nova pause 83dfe637-943c-45aa-956d-2481e53139d0

nova-launch-instance

Neutron

create network

$ neutron net-create --tenant-id 873298b5fbff44b4b13a41270296af0f demo

neutron-create-network

create subnet

$ neutron subnet-create --tenant-id 873298b5fbff44b4b13a41270296af0f demo 10.50.1.0/24 --dns_nameservers list=true 8.8.8.7 8.8.8.8

neutron-create-subnet

create router

$ neutron router-create --tenant-id 873298b5fbff44b4b13a41270296af0f R_test

neutron-create-router

get l3 agent id

must ensure that user in creds has admin permission, otherwise neutron will show nothing

$ neutron agent-list

neutron-agent-list

add router to l3 agent

$ neutron l3-agent-router-add 91c26035-5d98-4cf9-b4e3-4d1d61f7c7a2 R_test

add router to the subnet

$ neutron router-interface-add 674d9ed8-99be-47d6-8793-a857a564838c 79b488aa-2f5c-4542-8aae-f9ce145a02f5

add subnet to external network

$ neutron router-gateway-set 674d9ed8-99be-47d6-8793-a857a564838c 0ad3b25a-86a9-4710-af52-ee1269f7a6e0

neutron-sub-to-ext

allocate a floating ip

$ neutron floatingip-create public

neutron-allocate-ip

bind ip with instance

$ neutron port-list

neutron-port-list

create instance & attatch it to subnet just create

$ nova --os-cache --debug boot --image 91547919-76f5-4fa8-b447-67e940b28aae --flavor 1 my_first_vm --nic net-id=5c84b865-99cf-4b56-b233-206a9288c43e

neutron-attatch-network-to-instance nova-instance-in-newsubnet nova-neutron-cli-working

Cinder

create volume through CLI

$ cinder create --display_name testV 1

cinder-create-volume

show volumes

$ cinder-list

cinder-list

attatch volume to instance

$ nova volume-attach 6fc38207-94f8-43a2-ba3a-0624dfedb696 6617d80a-7893-458a-9d46-975b3832d6bc auto

nova-attatch-volume-to-instance

show volume which attatch to instance

//command on instance
$ find /dev/ -type b | grep vd

cinder-volumes-attatch-to-instance