Work with KVM using the CLI

Note

For general information on CLI authentication and use, see Command Line Interface (CLI).

Creating a lease and launching an instance

KVM@TACC reservations use the same flavor-based lease pattern as the rest of the CLI reservation workflow. See Creating a lease for a flavor (on KVM@TACC) for creating a lease for a flavor and launching an instance against it.

Security groups

Unlike the bare metal sites, KVM@TACC enforces Security Groups on every instance, and blocks all inbound traffic — including SSH — by default. Before you can reach an instance over SSH, you must create a Security Group that allows inbound TCP port 22 and apply it to the instance.

Create a Security Group and add a rule allowing SSH:

openstack security group create allow-ssh
openstack security group rule create --protocol tcp --dst-port 22:22 allow-ssh

Apply it to a running instance:

openstack server add security group <server> allow-ssh

To remove a Security Group from an instance:

openstack server remove security group <server> allow-ssh

Tip

You can also apply Security Groups at launch time with the --security-group flag on openstack server create.

Creating an instance snapshot

Bare metal instances require the The cc-snapshot utility to create a snapshot, since Ironic-managed bare metal has no hypervisor-level snapshot support. KVM@TACC instances are virtualized, so you can snapshot them directly through Nova instead — no additional tooling required:

openstack server image create --name <snapshot-name> <server>

Once the snapshot completes, the new image appears in openstack image list and can be used to launch new instances the same way as any other image.

Uploading qcow2 images to raw format for better instance launch performance

KVM images are stored on our Ceph cluster, which is able to serve raw images much faster than qcow2 for instance launches. Openstack includes the experimental command Glance image-create-via-import, which allows uploading of images in various standard formats including qcow2 to then be automatically converted to raw in the backend.

In order to use this method, authenticate to KVM using the OpenStack RC script downloaded from the KVM@TACC site as described in The OpenStack RC script.

Next, issue the following command:

glance image-create-via-import --container-format bare --disk-format qcow2 --file </path/to/image> --name <image name>

Details and other options for this command are available via the Glance image-create-via-import documentation.

Attention

Glance image-create-via-import is currently unable to handle conversion of iso images to raw.

Alternatively, you may convert qcow2 images to raw format before upload. qemu-img is one tool that is able to this with the following command:

qemu-img convert -f qcow2 -O raw <original.qcow2> <converted.img>

Once converted, use glance to upload the image:

openstack image create --file </path/to/converted.img> --disk-format raw <image-name>

Details and other options for this command are available within Openstack documentation.