使用ISO镜像启动实例。

使用ISO镜像启动实例。

使用ISO镜像启动实例。

OpenStack supports booting instances using ISO images. But before you make such instances functional, use the openstack server create command with the following parameters to boot an instance:

$ openstack server create --image ubuntu-14.04.2-server-amd64.iso \
  --nic net-id = NETWORK_UUID \
  --flavor 2 INSTANCE_NAME
+--------------------------------------+--------------------------------------------+
| Field                                | Value                                      |
+--------------------------------------+--------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                     |
| OS-EXT-AZ:availability_zone          | nova                                       |
| OS-EXT-SRV-ATTR:host                 | -                                          |
| OS-EXT-SRV-ATTR:hypervisor_hostname  | -                                          |
| OS-EXT-SRV-ATTR:instance_name        | instance-00000004                          |
| OS-EXT-STS:power_state               | 0                                          |
| OS-EXT-STS:task_state                | scheduling                                 |
| OS-EXT-STS:vm_state                  | building                                   |
| OS-SRV-USG:launched_at               | -                                          |
| OS-SRV-USG:terminated_at             | -                                          |
| accessIPv4                           |                                            |
| accessIPv6                           |                                            |
| adminPass                            | ZaiYeC8iucgU                               |
| config_drive                         |                                            |
| created                              | 2015-06-01T16:34:50Z                       |
| flavor                               | m1.small (2)                               |
| hostId                               |                                            |
| id                                   | 1e1797f3-1662-49ff-ae8c-a77e82ee1571       |
| image                                | ubuntu-14.04.2-server-amd64.iso            |
| key_name                             | -                                          |
| metadata                             | {}                                         |
| name                                 | INSTANCE_NAME                              |
| os-extended-volumes:volumes_attached | []                                         |
| progress                             | 0                                          |
| security_groups                      | default                                    |
| status                               | BUILD                                      |
| tenant_id                            | ccef9e62b1e645df98728fb2b3076f27           |
| updated                              | 2014-05-09T16:34:51Z                       |
| user_id                              | fef060ae7bfd4024b3edb97dff59017a           |
+--------------------------------------+--------------------------------------------+

在该命令中,镜像为``ubuntu-14.04.2-server-amd64.iso``,实例名称为``INSTANCE_NAME`` ,``NETWORK_UUID``是有效的网络ID.

Create a bootable volume for the instance to reside on after shutdown.

  1. Create the volume:

    $ openstack volume create \
      --size <SIZE_IN_GB> \
      --bootable VOLUME_NAME
    
  2. Attach the instance to the volume:

    $ openstack server add volume
      INSTANCE_NAME \
      VOLUME_NAME \
      --device /dev/vda
    

注解

You need the Block Storage service to preserve the instance after shutdown. The --block-device argument, used with the legacy nova boot, will not work with the OpenStack openstack server create command. Instead, the openstack volume create and openstack server add volume commands create persistent storage.

After the instance is successfully launched, connect to the instance using a remote console and follow the instructions to install the system as using ISO images on regular computers. When the installation is finished and system is rebooted, the instance asks you again to install the operating system, which means your instance is not usable. If you have problems with image creation, please check the Virtual Machine Image Guide for reference.

使从ISO镜像创建的实例可用

完成以下步骤使从ISO创建的实例可用。

  1. 使用以下命令删除实例。

    $ openstack server delete INSTANCE_NAME
    
  2. 删除实例后,操作系统仍然保留,因为已设置了``shutdown=preserve``, 运行以下命令。

    $ openstack volume list
    +--------------------------+-------------------------+-----------+------+-------------+
    | ID                       | Display Name            | Status    | Size | Attached to |
    +--------------------------+-------------------------+-----------+------+-------------+
    | 8edd7c97-1276-47a5-9563- |dc01d873-d0f1-40b6-bfcc- | available |   10 |             |
    | 1025f4264e4f             | 26a8d955a1d9-blank-vol  |           |      |             |
    +--------------------------+-------------------------+-----------+------+-------------+
    

    你会得到一个系统中所有硬盘的列表。在列表中你会发现硬盘已连接到以你的ISO创建的实例,且已设置为不作为启动盘。

  3. 上传硬盘到Glance.

    $ openstack image create --volume SOURCE_VOLUME IMAGE_NAME
    $ openstack image list
    +-------------------+------------+--------+
    | ID                | Name       | Status |
    +-------------------+------------+--------+
    | 74303284-f802-... | IMAGE_NAME | active |
    +-------------------+------------+--------+
    

    The SOURCE_VOLUME is the UUID or a name of the volume that is attached to your ISO created instance, and the IMAGE_NAME is the name that you give to your new image.

  4. 镜像成功上传后,可用来启动实例。

    启动后的实例中已包含用ISO安装的操作系统。

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.