本帖最后由 pig2 于 2014-8-28 19:09 编辑
问题导读
1、如何理解openstack 的内部网络结构?
2、怎样查看是否打开网络转发功能?
3、如何导入镜像和列出可用镜像?
理解:
openstack 内部网络结构如下
|------------ 内部网络 ----------| <- 虚拟路由 -> |----- 外部网络 ------|
[instance1 eth0] ==== br-int br-ext====== 物理eth0
[instance2 eth1] =====/
确保打开网络转发功能
- [root@station140 ~(keystone_admin)]# sysctl -p
- net.ipv4.ip_forward = 1
复制代码
cat /etc/sysconfig/network-scripts/ifcfg-eth0
- DEVICE="eth0"
- BOOTPROTO="none"
- HWADDR="00:50:56:81:C6:5B" [必须具有正确的 MAC, 否则报错]
- IPV6INIT="no"
- MTU="1500"
- NM_CONTROLLED="no"
- ONBOOT="yes"
- TYPE="Ethernet"
- UUID="f3690b2c-7707-4be0-8f76-648cb64da30f"
- #IPADDR=192.168.48.140
- #NETMASK=255.255.255.0
- #GATEWAY=192.168.48.1
复制代码
cat /etc/sysconfig/network-scripts/ifcfg-br-ex
- DEVICE=br-ex
- IPADDR=192.168.48.140
- NETMASK=255.255.255.0
- ONBOOT=yes
- GATEWAY=192.168.48.1
复制代码
生效方法, 必须一行执行, 否则网络断开 ssh 连接
- ovs-vsctl add-port br-ex eth0; service network restart
复制代码
查询网络地址(只显示部分信息)
- [root@station140 ~(keystone_admin)]# ifconfig
- br-ex Link encap:Ethernet HWaddr 00:50:56:81:C6:5B
- inet addr:192.168.48.140 Bcast:192.168.48.255 Mask:255.255.255.0
- inet6 addr: fe80::250:56ff:fe81:c65b/64 Scope:Link
- UP BROADCAST RUNNING MTU:1500 Metric:1
- RX packets:32144 errors:0 dropped:0 overruns:0 frame:0
- TX packets:24644 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:0
- RX bytes:11952047 (11.3 MiB) TX bytes:7386338 (7.0 MiB)
-
- br-int Link encap:Ethernet HWaddr AA:98:12:BD:BD:49
- inet6 addr: fe80::a898:12ff:febd:bd49/64 Scope:Link
- UP BROADCAST RUNNING MTU:1500 Metric:1
- RX packets:270 errors:0 dropped:0 overruns:0 frame:0
- TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:0
- RX bytes:23380 (22.8 KiB) TX bytes:468 (468.0 b)
-
- eth0 Link encap:Ethernet HWaddr 00:50:56:81:C6:5B
- inet6 addr: fe80::250:56ff:fe81:c65b/64 Scope:Link
- UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
- RX packets:17270550 errors:0 dropped:0 overruns:0 frame:0
- TX packets:25699 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:1000
- RX bytes:19175912632 (17.8 GiB) TX bytes:7421019 (7.0 MiB)
复制代码
openstack 命令行管理 - 镜像管理
帮助
- [root@station140 ~(keystone_admin)]# glance help | grep image
- [--os-image-url OS_IMAGE_URL] [-U OS_IMAGE_URL]
- [--os-image-api-version OS_IMAGE_API_VERSION]
- add DEPRECATED! Use image-create instead.
- delete DEPRECATED! Use image-delete instead.
- details DEPRECATED! Use image-list instead.
- image-create Create a new image.
- image-delete Delete specified image(s).
- image-download Download a specific image.
- image-list List images you can access.
- image-members DEPRECATED! Use member-list instead.
- image-show Describe a specific image.
- image-update Update a specific image.
- index DEPRECATED! Use image-list instead.
- member-create Share a specific image with a tenant.
- member-delete Remove a shared image from a tenant.
- member-images DEPRECATED! Use member-list instead.
- member-list Describe sharing permissions by image or tenant.
- show DEPRECATED! Use image-show instead.
- update DEPRECATED! Use image-update instead.
复制代码
下载镜像或者自行创建 [ 略 ]
导入镜像方法
- [root@localhost tmp]# source /root/keystonerc_admin
-
- [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
-
- +------------------+--------------------------------------+
- | Property | Value |
- +------------------+--------------------------------------+
- | checksum | 06de52dfbc2f582115b0c1981c2e3568 | 当前文件 md5 checksum 码
- | container_format | bare |
- | created_at | 2014-02-14T03:33:01 | 导入时间
- | deleted | False |
- | deleted_at | None |
- | disk_format | qcow2 | 磁盘格式
- | id | 2aad80bf-6fbb-4348-bb20-2c07dbf4f687 | 当前磁盘唯一 ID 值
- | is_public | True |
- | min_disk | 0 |
- | min_ram | 0 |
- | name | centos5.8_x86_64 |
- | owner | e3a71a59840c4e88b8740b789c3afb9c | 当前 openstack owner
- | protected | False |
- | size | 1151598592 |
- | status | active |
- | updated_at | 2014-02-14T03:33:11 |
- +------------------+--------------------------------------+
复制代码
列出当前可用镜像
- [root@station140 ~(keystone_admin)]# glance image-list
- +--------------------------------------+------------------+-------------+------------------+------------+--------+
- | ID | Name | Disk Format | Container Format | Size | Status |
- +--------------------------------------+------------------+-------------+------------------+------------+--------+
- | 2aad80bf-6fbb-4348-bb20-2c07dbf4f687 | centos5.8_x86_64 | qcow2 | bare | 1151598592 | active |
- | 2d6bb00d-002f-4675-ba84-73d90fdc1020 | cirros | qcow2 | bare | 13147648 | active |
- +--------------------------------------+------------------+-------------+------------------+------------+--------+
-
- [plain] view plaincopyprint?在CODE上查看代码片派生到我的代码片
- [root@station140 ~(keystone_admin)]# glance details
- ================================================================================
- URI: http://192.168.48.140:9292/v1/images/2aad80bf-6fbb-4348-bb20-2c07dbf4f687
- Id: 2aad80bf-6fbb-4348-bb20-2c07dbf4f687
- Public: Yes
- Protected: No
- Name: centos5.8_x86_64
- Status: active
- Size: 1151598592
- Disk format: qcow2
- Container format: bare
- Minimum Ram Required (MB): 0
- Minimum Disk Required (GB): 0
- Owner: e3a71a59840c4e88b8740b789c3afb9c
- Created at: 2014-02-14T03:33:01
- Deleted at: None
- Updated at: 2014-02-14T03:33:11
- ================================================================================
复制代码
删除镜像
- [root@station140 ~(keystone_admin)]# nova image-delete cirros
复制代码
|