码迷,mamicode.com
首页 > 其他好文 > 详细

openstack i版常用命令

时间:2015-11-02 21:25:55      阅读:341      评论:0      收藏:0      [点我收藏+]

标签:openstack 常用命令 glance cinder nova neutron

查看openstack的运行状态

nova service-list

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

| Binary           | Host                                | Zone               | Status  | State | Updated_at                 | Disabled Reason |

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

| nova-scheduler   | controller-127022.sh.xxx.com | internal           | enabled | up    | 2015-09-07T07:22:08.000000 | -               |

| nova-conductor   | controller-127022.sh.xxx.com | internal           | enabled | up    | 2015-09-07T07:22:14.000000 | -               |

| nova-cert        | controller-127022.sh.xxx.com | internal           | enabled | up    | 2015-09-07T07:22:14.000000 | -               |

| nova-consoleauth | controller-127022.sh.xxx.com | internal           | enabled | up  | 2015-06-29T10:40:03.000000 | -               |

| nova-console     | controller-127022.sh.xxx.com | internal           | enabled | up    | 2015-09-07T07:22:16.000000 | -               |

| nova-compute     | compute-127041.sh.xxx.com    | nova               | enabled | up    | 2015-09-07T07:22:08.000000 | None            |

| nova-compute     | compute-127054.sh.xxx.com    | develop-zone       | enabled | up    | 2015-09-07T07:22:09.000000 | None            |


查看某个 tenant下的云主机信息

source keystonerc_QA

nova list

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

| ID                                   | Name                                   | Status | Task State | Power State | Networks                    |

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

| 8e60fe41-90a8-4d54-a506-bdc37f97f3bb | xindatabase-agiqm.xxx.com  | ACTIVE | -          | Running     | QA_NET=10.197.11.13  |

| 1075b361-5ca3-4e23-837f-0edbbb780e68 | xindatabase-gsyi5.xxx.com  | ACTIVE | -          | Running     | QA_NET=10.197.11.12  |


查看所有tenant下的云主机信息

source keystonerc_admin 

nova list --all-tenants


keyfile文件

cat keystonerc_admin 

export OS_USERNAME=admin

export OS_TENANT_NAME=admin

export OS_PASSWORD=openstack_pass

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

export PS1=‘[\u@\h \W(keystone_admin)]\$ ‘

查看flavor

nova flavor-list

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

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

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

| 989f6219-3231-45b5-bcfd-daf87ac07705 | 8core-16g       | 16384     | 40   | 0         | 2048 | 8     | 1.0         | True      |

| 9bb5f019-0c7c-41fc-a3ed-e6e44413a3d3 | 8core-32G       | 32768     | 40   | 0         | 2048 | 8     | 1.0         | True      |


查看镜像


nova image-list

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

| ID                                   | Name                                            | Status | Server                               |

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

| 04135fe1-14d8-4480-a638-189ed93ea620 | Centos5.8                            | ACTIVE |                                      |

| f87f65e3-24ff-44c0-8858-9662334679e4 | Centos6.3                           | ACTIVE |                                      |

| 764b2022-0ecf-4013-b68a-898e9c31fb46 | Centos6.6                          | ACTIVE |                                      |

| 3043d3e7-c565-44c1-ad5d-8efcb5e3bfe1 | Centos6.5                             | ACTIVE |                                      |


查看网络


neutron net-list

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

| id                                   | name       | subnets                                              |

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

| 0007150e-b600-4ea6-841d-79261bf10af8 | QA_NET     | ecc5f5a4-1fd7-4428-9351-6809ada3ad08 10.197.160.0/19 |


查看用zone


nova aggregate-list

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

| Id | Name          | Availability Zone  |

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

| 1  | qa-zone  | qa-zone       |


查看zone下的物理主机

nova aggregate-details qa-zone

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

| Id | Name          | Availability Zone  | Hosts                                                                                                                                                                                                                                                                                          | Metadata                               |

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

| 5  | nghai-temp | nghai-temp-zone | ‘compute-127106.xx.com‘, ‘compute-127107.xx.com‘, ‘compute-127108.xx.com‘, ‘compute-127109.xx.com‘, ‘compute-127110.xx.com‘, ‘compute-127111.xx.com‘, ‘compute-127112.xx.com‘, ‘compute-127113.xx.com‘ | ‘availability_zone=qa-zone‘ |

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


创建并启动一台名为adams_test_vm的云主机

默认创建

nova boot --flavor 2core-8g --image Centos6.6 --security_group default --nic net-id=d107fe05-0fe9-4fea-9325-4cf2d0825101 adams_test_vm 

指定创建在某台物理主机及修改密码

nova boot --flavor 2core-8g --image Centos6.6 --security_group default --nic net-id=d107fe05-0fe9-4fea-9325-4cf2d0825101 --availability-zone  qa-nova:compute-127073.xxx.com adams_test_vm --user-data ./passwd.sh --poll


passwd.sh内容如下:

#!/bin/bash

echo qwe123qwe | passwd --stdin root



查看镜像列表

nova image-list
+--------------------------------------+-------------------------------------------------+--------+--------------------------------------+
| ID                                   | Name                                            | Status | Server                               |
+--------------------------------------+-------------------------------------------------+--------+--------------------------------------+
| 0c47db9c-5f74-4544-8ada-0894c1d2c20c | Win7                                            | ACTIVE |                                      |



下载win7镜像

glance  image-download 0c47db9c-5f74-4544-8ada-0894c1d2c20c --file Win7


上传win7镜像

 glance image-create --name Win7 --disk-format qcow2 --file /root/Win7 --container-format bare --is-public True
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | eaa3a3a6dfe605f6292675018d41afdf     |
| container_format | bare                                 |
| created_at       | 2015-10-30T02:50:47                  |
| deleted          | False                                |
| deleted_at       | None                                 |
| disk_format      | qcow2                                |
| id               | 9a3a7dcd-66e0-4f99-bf88-25db6ba236b5 |
| is_public        | True                                 |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | Win7                                 |
| owner            | 9caea2d0691644f1af63341a953d1462     |
| protected        | False                                |
| size             | 3547856896                           |
| status           | active                               |
| updated_at       | 2015-10-30T02:51:44                  |
| virtual_size     | None                                 |
+------------------+--------------------------------------+



openstack i版常用命令

标签:openstack 常用命令 glance cinder nova neutron

原文地址:http://bingdian.blog.51cto.com/94171/1708902

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!