Skip to content

Your first VM

Create a first VM on the all-in-one host from Install. Horizon can do the same (Horizon guide); this page uses the CLI, which is easy to reproduce.

Become root and load the admin credentials:

Terminal window
sudo -i
. /etc/hagistack/admin-openrc

Run the following commands in this root shell.

Terminal window
openstack image list
openstack flavor list

Expected result (example): the image cirros-0.6.3-x86_64 is active, and the flavor m1.tiny (RAM 256, Disk 1, VCPUs 1) is listed.

+--------------------------------------+---------------------+--------+
| ID | Name | Status |
+--------------------------------------+---------------------+--------+
| 3f0c... | cirros-0.6.3-x86_64 | active |
+--------------------------------------+---------------------+--------+
Terminal window
openstack server create --flavor m1.tiny --image cirros-0.6.3-x86_64 \
--network hagistack-tenant --key-name hagistack-key --wait demo1
  • What it does: creates the VM demo1 on the tenant network and injects the public key of hagistack-key through the metadata service. --wait waits until it is up.
  • Security group: without --security-group, the project’s default group is used. HAGISTACK has added SSH and ICMP rules to the admin project’s default group.
Terminal window
openstack server list
openstack server show demo1 -c status -c addresses

Expected result: status is ACTIVE, and addresses shows hagistack-tenant=10.10.10.x. If it is ERROR, see Troubleshooting.

The boot log (including cloud-init’s output):

Terminal window
openstack console log show demo1
Terminal window
openstack floating ip create hagistack-provider
openstack server add floating ip demo1 FLOATING_IP
  • Replace FLOATING_IP with the floating_ip_address printed by the first command (for example 198.51.100.150).
  • Expected result: openstack server show demo1 -c addresses shows both the tenant address and the floating IP.
Terminal window
SG=$(openstack security group list --project admin -f value -c ID -c Name | awk '$2=="default"{print $1}')
openstack security group rule list "$SG"

Every project has a group named default, so a name alone is ambiguous. Look up the ID of the admin project’s default group first (HAGISTACK adds its rules the same way). Expected result: ingress rules for tcp 22:22 and for icmp.

The CirrOS user is cirros, and the key is /etc/hagistack/hagistack-key. There are two ways in.

Method A: the tenant address, from the metadata namespace

Section titled “Method A: the tenant address, from the metadata namespace”

The host that runs the VM (the same host on all-in-one) has an OVN metadata namespace for the tenant network. SSH to the VM’s tenant address from there:

Terminal window
NETID=$(openstack network show hagistack-tenant -f value -c id)
ip netns exec ovnmeta-$NETID ssh -i /etc/hagistack/hagistack-key cirros@TENANT_IP

TENANT_IP is the 10.10.10.x address from step 14. This is how the all-in-one acceptance test (s66r5c) logged in.

Give the host’s br-ex the provider gateway address; this host then reaches the floating IPs. 198.51.100.1/24 is an example: use your --provider-gateway and the prefix of your --provider-cidr.

Terminal window
ip addr add 198.51.100.1/24 dev br-ex
ip link set br-ex up
ssh -i /etc/hagistack/hagistack-key cirros@FLOATING_IP

This is how the controller + compute acceptance test (s66r5d) logged in. The ip addr add setting is lost at a reboot. It is not a production way to provide external access.

Expected result: you log in as cirros without a password and get a $ prompt. In the VM, curl http://169.254.169.254/latest/meta-data/instance-id returns the instance ID from the metadata service.

Terminal window
openstack server stop demo1
openstack server show demo1 -c status # SHUTOFF
openstack server start demo1
openstack server show demo1 -c status # ACTIVE
openstack server delete --wait demo1

The floating IP stays after the VM is deleted. Release it when you no longer need it:

Terminal window
openstack floating ip list
openstack floating ip delete FLOATING_IP