制作windows镜像

 

下载包含windows驱动的iso:

http://222.186.58.77/virtio-win-0.1-30.iso?fid=kF46uzxlPMrgvLDErP0ohhZYwAUASLoCAAAAAMNwTkBRCZezi*ycfjcpu9*AxNot&mid=666&threshold=150&tid=65B307952179330AD16190FD2B8DA063&srcid=119&verno=1

上传iso镜像:

# glance image-create --name "virtio-win-0.1-30.iso" --file virtio-win-0.1-30.iso --disk-format iso --container-format bare --is-public True --progress

 

查询iso镜像的ID:

# nova image-list
+--------------------------------------+---------------------------------------------------+--------+--------+
| ID                                   | Name                                              | Status | Server |
+--------------------------------------+---------------------------------------------------+--------+--------+
| 867364a6-8185-40c5-8cb2-7f5111097cde | CentOS-7-x86_64-DVD-1503-01                       | ACTIVE |        |
| 669b05e5-60cd-4060-b1e9-2fc098970de9 | CentOS-7-x86_64-DVD-1503-01.iso                   | ACTIVE |        |
| 5f7dae91-4230-434f-83b3-b7a6db2ebb77 | TestVM                                            | ACTIVE |        |
| 1f72c2fb-c867-4679-b8cd-64431a7a8b5e | virtio-win-0.1-30.iso                             | ACTIVE |        |
| 64282c19-128a-4639-abcb-12f74e4cef1d | win2k8r2.iso                                      | ACTIVE |        |
+--------------------------------------+---------------------------------------------------+--------+--------+

 

引导的同时挂载iso:
# nova boot --image win2k8r2.iso --flavor m1.small --nic net-id=7cdd55d7-eb6a-49c4-a3a2-a38019a94d95 --block-device source=blank,dest=volume,size=10,shutdown=preserve --block-device source=image,dest=volume,id=1f72c2fb-c867-4679-b8cd-64431a7a8b5e,bus=ide,type=cdrom,size=1 admin-instance2
或:

nova boot --flavor m1.small --nic net-id=7cdd55d7-eb6a-49c4-a3a2-a38019a94d95 --block-device source=image,dest=volume,id=64282c19-128a-4639-abcb-12f74e4cef1d,bus=ide,type=cdrom,size=5,bootindex=0 --block-device source=blank,dest=volume,size=10,shutdown=preserve,bootindex=1 --block-device source=image,dest=volume,id=1f72c2fb-c867-4679-b8cd-64431a7a8b5e,bus=ide,type=cdrom,size=1,bootindex=2 admin-instance3

 

查看同时被自动创建的卷:

# cinder list
+--------------------------------------+-----------+------------------------------------------------+------+-------------+----------+--------------------------------------+
|                  ID                  |   Status  |                  Display Name                  | Size | Volume Type | Bootable |             Attached to              |
+--------------------------------------+-----------+------------------------------------------------+------+-------------+----------+--------------------------------------+
| 04c5cc81-163f-4629-8b9e-f3355ad1f445 |   in-use  |                 admin-volume1                  |  1   |     None    |  false   | 36630285-5705-4d19-9a7d-461c37bc3fa2 |
| b2f348fa-1f75-4c05-973c-66c9888bda47 |   in-use  |                                                |  1   |     None    |   true   | a81ed189-f224-465e-8449-a4aab8a39853 |
| e10dbd30-e499-4f07-8319-3b3acc32c43e |   in-use  | a81ed189-f224-465e-8449-a4aab8a39853-blank-vol |  10  |     None    |  false   | a81ed189-f224-465e-8449-a4aab8a39853 |
+--------------------------------------+-----------+------------------------------------------------+------+-------------+----------+--------------------------------------+

 

进入VNC窗口安装windows,直到重启:

# nova get-vnc-console admin-instance2 novnc

 

查询实例ID:

# nova list
+--------------------------------------+-----------------+--------+------------+-------------+---------------------+
| ID                                   | Name            | Status | Task State | Power State | Networks            |
+--------------------------------------+-----------------+--------+------------+-------------+---------------------+
| 36630285-5705-4d19-9a7d-461c37bc3fa2 | admin-instance1 | ACTIVE | -          | Running     | VLAN549=168.5.49.2  |
| a81ed189-f224-465e-8449-a4aab8a39853 | admin-instance2 | ACTIVE | -          | Running     | VLAN549=168.5.49.22 |
+--------------------------------------+-----------------+--------+------------+-------------+---------------------+

 

删除该实例:

# nova delete a81ed189-f224-465e-8449-a4aab8a39853

 

把卷上传成image:

# cinder upload-to-image e10dbd30-e499-4f07-8319-3b3acc32c43e Win2K8R2SP1

 

使用新建的image创建新的实例:

# nova boot --image Win2K8R2SP1 --flavor m1.small --nic net-id=7cdd55d7-eb6a-49c4-a3a2-a38019a94d95 admin-instance2

 

查考文档:

https://wiki.openstack.org/wiki/BlockDeviceConfig

http://docs.openstack.org/user-guide/cli_nova_launch_instance_using_ISO_image.html

posted @ 2016-01-10 20:31  Endoresu  阅读(735)  评论(0编辑  收藏  举报