openstack常用命令

#查看nova服务状态

nova-manage service list

#启动服务

nova-compute start #带日志

service nova-compute start

/etc/init.d/nova-compute start

#重启服务

nova-compute restart #带日志

service nova-compute restart 

/etc/init.d/nova-compute restart

 

时间不同步解决

date -s "2014-03-20 15:27:03"

hwclock -w

-----------------------------network--------------------------------------

#显示创建的网络

nova-manage network list

 

#删除创建的网络

nova-manage network delete 192.168.23.0/24

 

#设置network 和sfixed ip

nova-manage network create private --fixed_range_v4=192.168.22.0/23 --num_networks=2 --bridge=br192 --bridge_interface=eth1 --network_size=254

 

nova-manage network create private --fixed_range_v4=192.168.10.0/22 --num_networks=1 --bridge=br192 --bridge_interface=eth1 --network_size=1000

 

内网分配不上解决办法:(DHCP原因)

# killall dnsmasq

# restart nova-network

# ps aux | grep dnsmasq

-----------------------------floating ip--------------------------------------

#设定floating IP

nova-manage floating create --ip_range=172.26.80.0/24

 

#申请floating IP

export OS_TENANT_NAME=admin

export OS_USERNAME=admin

export OS_PASSWORD=123456

export OS_AUTH_URL=http://127.0.0.1:5000/v2.0/

export NOVA_VERSION=1.1

nova floating-ip-create

 

#查看申请flating IP 列表

nova floating-ip-list

 

#查看虚拟机的floating IP (nova list,就可以查看,需要等待1分钟)

nova list

 

添加floating IP给虚拟机(id是虚拟机的ID,通过nova list获得)

nova add-floating-ip  6fd9df91-17d7-477c-a3ae-78d23bbb7afb 172.26.80.199

 

#删除floating IP (ID就是虚拟机ID,通过 nova list 获得)

nova remove-floating-ip ID 10.1.199.33

 

-----------------------------instance--------------------------------------

#创建虚拟机

nova boot --flavor 1 --image 472821c8-d02b-4561-818e-efa1e1605bc9 --nic net-id=4f45a389-82b4-4f25-b4c3-dc9283b65f80,v4-fixed-ip=172.26.22.10 test_llz

nova boot --flavor 1 --image 11dd6b54-b7fc-4457-82f4-b736c93b86c8 e4   --availability-zone nova

 

#查看虚拟机列表

nova list

+--------------------------------------+----------------+--------+------------------------------------+

|                  ID                  |      Name      | Status |              Networks              |

+--------------------------------------+----------------+--------+------------------------------------+

| d2f7ee1b-1c97-4580-b0e9-c639d12b59e4 | donenotdelete3 | ACTIVE | private=172.26.22.8, 172.26.80.240 |

| d82e9ddd-f5fc-4d2c-b9a1-dbe4463c67d9 | donotdelete2   | ACTIVE | private=172.26.22.7, 172.26.80.236 |

| f109ca38-8813-4859-864b-f5ed91323684 | test           | BUILD  | private=172.26.22.2                |

+--------------------------------------+----------------+--------+------------------------------------+

#查看虚拟机信息

nova show ac9e6a9f-58c3-47c3-9b4c-485aa421b8a8

 

#删除虚拟机

nova delete ID

 

#虚拟机暂停、重置、重启

nova suspend ac9e6a9f-58c3-47c3-9b4c-485aa421b8a8

nova resume ac9e6a9f-58c3-47c3-9b4c-485aa421b8a8

nova reboot ac9e6a9f-58c3-47c3-9b4c-485aa421b8a8

 

#查看配置类型列表

nova flavor-list

+----+-----------+-----------+------+-----------+------+-------+-------------+

| ID |    Name   | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor |

+----+-----------+-----------+------+-----------+------+-------+-------------+

| 1  | m1.tiny   | 512       | 10   | 0         |      | 1     | 1.0         |

| 10 | e2e256M5g | 256       | 5    | 0         |      | 2     | 1.0         |

| 14 | test1     | 1024      | 30   | 0         |      | 1     | 1.0         |

| 2  | m1.small  | 2048      | 10   | 20        |      | 1     | 1.0         |

| 3  | m1.medium | 2048      | 50   | 40        |      | 2     | 1.0         |

| 4  | m1.large  | 8192      | 10   | 80        |      | 4     | 1.0         |

| 5  | m1.xlarge | 16384     | 10   | 160       |      | 8     | 1.0         |

| 6  | test      | 512       | 30   | 0         |      | 1     | 1.0         |

| 8  | e1        | 128       | 5    | 0         |      | 1     | 1.0         |

| 9  | e2h2g30g  | 2048      | 30   | 0         |      | 2     | 1.0         |

+----+-----------+-----------+------+-----------+------+-------+-------------+

#查看镜像列表

nova image-list

+--------------------------------------+-------------+--------+--------------------------------------+

|                  ID                  |     Name    | Status |                Server                |

+--------------------------------------+-------------+--------+--------------------------------------+

| 25f358b9-2591-494b-9d8e-86c75ca097bd | 111         | ACTIVE | d2f7ee1b-1c97-4580-b0e9-c639d12b59e4 |

| 54d5566d-63dc-4da4-a655-4246e4a803b4 | ubuntu12.04 | ACTIVE |                                      |

| 6ef67683-4225-44ab-b5dc-11cf0c606a30 | test2_img   | ACTIVE | 3bdfb65d-0c2e-4208-90a5-70b1cec47e37 |

| 8ad0fff7-89e5-4816-ba67-babd8d757edf | win2008     | ACTIVE |                                      |

| bfc5d1d1-33e7-4917-ad3e-4f574d501638 | test        | ACTIVE |                                      |

| e15470f6-edfc-4da8-84db-4c4aa9e86cf2 | kuaizhao    | ACTIVE | f4e51bb0-f5b9-42dd-9ca4-8c2dd9087566 |

| e8b5ce31-08ca-4730-8ae2-500028c9466f | CentOS64    | ACTIVE |                                      |

| eb28a0d1-0461-4907-9e00-bf0ce83c1c89 | whv1        | ACTIVE | 7a732971-2880-48f8-a0b5-b8815f746e21 |

+--------------------------------------+-------------+--------+--------------------------------------+

 

----------------------------------------------secgroup-----------------------------------------------------

$ nova secgroup-list

$ nova secgroup-create SEC_GROUP_NAME GROUP_DESCRIPTION

$ nova secgroup-delete SEC_GROUP_NAME 

 

----------------------------------------------keystone-----------------------------------------------------

keystone命令

$ keystone user-list

$ keystone role-list

$ keystone tenant-list

$ keystone  user-create  --name=alice  --pass=mypassword123  --mail=alice@example.com 

$ keystone  tenant-create  --name=acme 

$ keystone  role-create  --name=compute-user 

$ keystone user-role-add --user=96a6ebba0d4c441887aceaeced892585 --role=f8dd5a2e4dc64a41b96add562d9a764e --tenant_id=2395953419144b67955ac4bab96b8fd2

 

----------------------------------------------glance-----------------------------------------------------

glance add name="CentOS6.4" is_public=true container_format=ovf disk_format=qcow2 < CentOS6.464bitmin30G.qcow2

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值