Installing OS from ISO image in OpenStack

  1. Upload the ISO image:

    openstack image create \
        --file input.iso \
        --disk-format iso \
        --container-format bare \
        --public \
        my-iso-image
    
  2. Choose the disk bus depending on OS requirements:

    • VirtIO (recommended):

      --block-device source_type=blank,destination_type=volume,volume_size=20,disk_bus=virtio,boot_index=1
      
      • High performance

      • Requires driver support

    • IDE (compatibility, e.g. Kerio Control, earlier Windows versions):

      --block-device source_type=blank,destination_type=volume,volume_size=20,disk_bus=ide,boot_index=1
      
      • Lower performance

      • No additional drivers required

  3. And create an instance with a CD-ROM and a target disk:

    openstack server create \
        --flavor my_flavor \
        --block-device source_type=blank,destination_type=volume,volume_size=20,boot_index=1 \
        --block-device source_type=image,uuid=<IMAGE_ID>,destination_type=volume,volume_size=2,disk_bus=ide,device_type=cdrom,boot_index=0 \
        --network <NETWORK_ID> \
        install-vm
    

    Note

    • boot_index=0 = CD-ROM (boot first)

    • boot_index=1 = installation disk

    • CD-ROM is created as a volume

  4. After instance creation open the VNC console and complete OS installation onto the blank volume.

  5. Reboot the instance.

    Note

    The CD-ROM is attached as a volume-backed root device, so it cannot be detached. In order to boot from OS we can create a snapshot of the volume where the OS is installed and boot a new instance from that snapshot.

  6. Get the Volume ID (search for first volume in volumes property):

    openstack server show install-vm
    
  7. Verify the Volume is bootable:

    openstack volume show <VOLUME_ID>
    

    Expected output:

    ---------------------------------------------------+
    | Field                          | Value           |
    +--------------------------------+-----------------+
    | bootable                       | true            |
    +--------------------------------+-----------------+
    
  8. Shut off instance and create a volume snapshot:

    openstack volume snapshot create \
       --force --volume <VOLUME_ID> \
        installed-os-snapshot
    
  9. Verify snapshot status:

    openstack volume snapshot show <SNAPSHOT_ID>
    

    Expected output:

    ---------------------------------------------------+
    | Field                          | Value           |
    +--------------------------------+-----------------+
    | status                         | available       |
    +--------------------------------+-----------------+
    

Boot Instance from Snapshot

  1. Create a new instance from the snapshot:

    openstack server create \
        --flavor my_flavor \
        --block-device source_type=snapshot,uuid=<SNAPSHOT_ID>,destination_type=volume,volume_size=20,boot_index=0 \
        --network <NETWORK_ID> \
        vm-from-snapshot