Skip to content

Instantly share code, notes, and snippets.

@madorn
Last active January 3, 2016 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save madorn/8438906 to your computer and use it in GitHub Desktop.
Save madorn/8438906 to your computer and use it in GitHub Desktop.
Havana: Glance

Havana: Glance

API

Havana comes with both v1 and v2 Glance API (v2.2 is now in development).

python-glanceclient currently supports Glance API v1.

v2 support is in progress.

v2 adds:

  • Share images with specified users or projects
  • Image tagging
  • Schemas: Gets a JSON-schema document that represents an images or image entity

Using v2:

glance --os-image-api-version 2 image-list

New Image Format

VHDX: The version of Hyper-V that ships with Microsoft Server 2012 uses the newer VHDX format, which has some additional features over VHD such as support for larger disk sizes and protection against data corruption during power failures.

Container Support

OpenStack Compute does not currently have support for OVF packages, so you will need to extract the image file(s) from an OVF package if you wish to use it with OpenStack.

Editing Images

libguestfs: cli tools for accessing and modifying virtual machine disk images.

libguestfs includes:

  • guestfish for modifying files inside a virtual image via shell.
  • virt-edit for editing a file inside of an image.
  • virt-df for displaying free space inside of an image.
  • virt-resize for resizing an image.
  • virt-sysprep for preparing an image for distribution (e.g., delete SSH host keys, remove MAC address info, remove user accounts).
  • virt-sparsify for making an image sparse
  • virt-p2v for converting a physical machine to an image that runs on KVM
  • virt-v2v for converting Xen and VMWare images to KVM images

Example:

# guestfish --rw -a centos63_desktop.img

Welcome to guestfish, the libguestfs filesystem interactive shell for
editing virtual machine filesystems.

Type: 'help' for help on commands
     'man' to read the manual
      'quit' to quit the shell

><fs>

Create Images

qemu-img: qemu disk-image utlity

virt-install: utilizes libvirt mgmt library to provision VMs

Example:

# qemu-img create -f qcow2 /data/centos-6.4.qcow2 10G
# virt-install --virt-type kvm --name centos-6.4 --ram 1024 \
--cdrom=/data/CentOS-6.4-x86_64-netinstall.iso \
--disk path=/data/centos-6.4.qcow2,size=10,format=qcow2 \
--network network=default\
--graphics vnc,listen=0.0.0.0 --noautoconsole \
--os-type=linux --os-variant=rhel6

Starting install...
Creating domain...                                                                                                                                       |    0 B     00:00
Domain installation still in progress. You can reconnect to
the console to complete the installation process.

Converting Images

qemu-img: Qemu disk-image utlity

$ qemu-img convert -f vmdk -O raw centos64.vmdk centos64.img
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment