分享

openstack 命令行管理一:br-ex 网络设定、镜像管理命令总结

xioaxu790 发表于 2014-8-28 18:17:50 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 0 25172
本帖最后由 pig2 于 2014-8-28 19:09 编辑
问题导读
1、如何理解openstack 的内部网络结构?
2、怎样查看是否打开网络转发功能?
3、如何导入镜像和列出可用镜像?






理解:
openstack 内部网络结构如下
|------------  内部网络   ----------|    <- 虚拟路由 ->  |----- 外部网络 ------|
[instance1 eth0]  ==== br-int                                                br-ext====== 物理eth0
[instance2 eth1]  =====/

确保打开网络转发功能
  1. [root@station140 ~(keystone_admin)]# sysctl -p
  2. net.ipv4.ip_forward = 1
复制代码


cat /etc/sysconfig/network-scripts/ifcfg-eth0
  1. DEVICE="eth0"  
  2. BOOTPROTO="none"  
  3. HWADDR="00:50:56:81:C6:5B" [必须具有正确的 MAC, 否则报错]  
  4. IPV6INIT="no"  
  5. MTU="1500"  
  6. NM_CONTROLLED="no"  
  7. ONBOOT="yes"  
  8. TYPE="Ethernet"  
  9. UUID="f3690b2c-7707-4be0-8f76-648cb64da30f"  
  10. #IPADDR=192.168.48.140  
  11. #NETMASK=255.255.255.0  
  12. #GATEWAY=192.168.48.1
复制代码



cat /etc/sysconfig/network-scripts/ifcfg-br-ex
  1. DEVICE=br-ex  
  2. IPADDR=192.168.48.140  
  3. NETMASK=255.255.255.0  
  4. ONBOOT=yes  
  5. GATEWAY=192.168.48.1
复制代码



生效方法, 必须一行执行, 否则网络断开 ssh 连接
  1. ovs-vsctl add-port br-ex eth0; service network restart
复制代码


查询网络地址(只显示部分信息)

  1. [root@station140 ~(keystone_admin)]# ifconfig
  2. br-ex Link encap:Ethernet HWaddr 00:50:56:81:C6:5B
  3. inet addr:192.168.48.140 Bcast:192.168.48.255 Mask:255.255.255.0
  4. inet6 addr: fe80::250:56ff:fe81:c65b/64 Scope:Link
  5. UP BROADCAST RUNNING MTU:1500 Metric:1
  6. RX packets:32144 errors:0 dropped:0 overruns:0 frame:0
  7. TX packets:24644 errors:0 dropped:0 overruns:0 carrier:0
  8. collisions:0 txqueuelen:0
  9. RX bytes:11952047 (11.3 MiB) TX bytes:7386338 (7.0 MiB)
  10. br-int Link encap:Ethernet HWaddr AA:98:12:BD:BD:49
  11. inet6 addr: fe80::a898:12ff:febd:bd49/64 Scope:Link
  12. UP BROADCAST RUNNING MTU:1500 Metric:1
  13. RX packets:270 errors:0 dropped:0 overruns:0 frame:0
  14. TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
  15. collisions:0 txqueuelen:0
  16. RX bytes:23380 (22.8 KiB) TX bytes:468 (468.0 b)
  17. eth0 Link encap:Ethernet HWaddr 00:50:56:81:C6:5B
  18. inet6 addr: fe80::250:56ff:fe81:c65b/64 Scope:Link
  19. UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
  20. RX packets:17270550 errors:0 dropped:0 overruns:0 frame:0
  21. TX packets:25699 errors:0 dropped:0 overruns:0 carrier:0
  22. collisions:0 txqueuelen:1000
  23. RX bytes:19175912632 (17.8 GiB) TX bytes:7421019 (7.0 MiB)
复制代码






openstack 命令行管理 - 镜像管理
帮助
  1. [root@station140 ~(keystone_admin)]# glance help  | grep image  
  2.               [--os-image-url OS_IMAGE_URL] [-U OS_IMAGE_URL]  
  3.               [--os-image-api-version OS_IMAGE_API_VERSION]  
  4.     add                 DEPRECATED! Use image-create instead.  
  5.     delete              DEPRECATED! Use image-delete instead.  
  6.     details             DEPRECATED! Use image-list instead.  
  7.     image-create        Create a new image.  
  8.     image-delete        Delete specified image(s).  
  9.     image-download      Download a specific image.  
  10.     image-list          List images you can access.  
  11.     image-members       DEPRECATED! Use member-list instead.  
  12.     image-show          Describe a specific image.  
  13.     image-update        Update a specific image.  
  14.     index               DEPRECATED! Use image-list instead.  
  15.     member-create       Share a specific image with a tenant.  
  16.     member-delete       Remove a shared image from a tenant.  
  17.     member-images       DEPRECATED! Use member-list instead.  
  18.     member-list         Describe sharing permissions by image or tenant.  
  19.     show                DEPRECATED! Use image-show instead.  
  20.     update              DEPRECATED! Use image-update instead.
复制代码


下载镜像或者自行创建 [ 略 ]
导入镜像方法
  1. [root@localhost tmp]# source /root/keystonerc_admin  
  2.   
  3. [root@localhost tmp(keystone_admin)]# glance image-create --name centos5.8_x86_64 --disk-format=qcow2 --container-format=bare --is-public=True --file=/tmp/centos5.8_x86_64_growroot_1.2_20131231.qcow2  
  4.   
  5. +------------------+--------------------------------------+  
  6. | Property         | Value                                |  
  7. +------------------+--------------------------------------+  
  8. | checksum         | 06de52dfbc2f582115b0c1981c2e3568     | 当前文件 md5 checksum 码  
  9. | container_format | bare                                 |  
  10. | created_at       | 2014-02-14T03:33:01                  | 导入时间  
  11. | deleted          | False                                |  
  12. | deleted_at       | None                                 |  
  13. | disk_format      | qcow2                                | 磁盘格式  
  14. | id               | 2aad80bf-6fbb-4348-bb20-2c07dbf4f687 | 当前磁盘唯一 ID 值  
  15. | is_public        | True                                 |  
  16. | min_disk         | 0                                    |  
  17. | min_ram          | 0                                    |  
  18. | name             | centos5.8_x86_64                     |  
  19. | owner            | e3a71a59840c4e88b8740b789c3afb9c     | 当前 openstack owner  
  20. | protected        | False                                |  
  21. | size             | 1151598592                           |  
  22. | status           | active                               |  
  23. | updated_at       | 2014-02-14T03:33:11                  |  
  24. +------------------+--------------------------------------+
复制代码


列出当前可用镜像
  1. [root@station140 ~(keystone_admin)]# glance image-list  
  2. +--------------------------------------+------------------+-------------+------------------+------------+--------+  
  3. | ID                                   | Name             | Disk Format | Container Format | Size       | Status |  
  4. +--------------------------------------+------------------+-------------+------------------+------------+--------+  
  5. | 2aad80bf-6fbb-4348-bb20-2c07dbf4f687 | centos5.8_x86_64 | qcow2       | bare             | 1151598592 | active |  
  6. | 2d6bb00d-002f-4675-ba84-73d90fdc1020 | cirros           | qcow2       | bare             | 13147648   | active |  
  7. +--------------------------------------+------------------+-------------+------------------+------------+--------+  
  8. [plain] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  9. [root@station140 ~(keystone_admin)]# glance details  
  10. ================================================================================  
  11. URI: http://192.168.48.140:9292/v1/images/2aad80bf-6fbb-4348-bb20-2c07dbf4f687  
  12. Id: 2aad80bf-6fbb-4348-bb20-2c07dbf4f687  
  13. Public: Yes  
  14. Protected: No  
  15. Name: centos5.8_x86_64  
  16. Status: active  
  17. Size: 1151598592  
  18. Disk format: qcow2  
  19. Container format: bare  
  20. Minimum Ram Required (MB): 0  
  21. Minimum Disk Required (GB): 0  
  22. Owner: e3a71a59840c4e88b8740b789c3afb9c  
  23. Created at: 2014-02-14T03:33:01  
  24. Deleted at: None  
  25. Updated at: 2014-02-14T03:33:11  
  26. ================================================================================
复制代码


删除镜像
  1. [root@station140 ~(keystone_admin)]# nova image-delete cirros  
复制代码






没找到任何评论,期待你打破沉寂

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条