We assume that you already have credentials to get access to use SAVI testbed and the focus of this tutorial is to show how to create a virtual machine using the command-line interface (CLI). Previously, we talked about how to access the testbed using the Web Portal here.
Log in to the client1 machine using your credentials.
Once you logged in you can change your password by using:
The first step to use the testbed is selecting a region and a project you have access to. Please note some regions may not be available temporarily. You are required to use the project name that you have access to. Try running the command below and provide your password when it is asked:
source savi <username> <project> <region>
Upon successful login, you will see a message showing the project and region are ready to be used.
Now that you have logged in, you are ready to create your first VM. Try running:
savi-run-server <flavor> <image> <key> <security group> <vm name>
In order to boot up a VM, you need to specify 5 parameters:
<security group> and
<vm name>. Below we will specify what these parameters are and how you can use them.
Flavor defines the compute, memory, and storage capacity. To see the list of available flavors try running:
openstack flavor list
Image is a single file that is used as the operating system for your VM. To see the list of available images try running:
openstack image list
Key or Keypair is the public key of an OpenSSH key pair used to access the VM. You need to create your Keypair by providing your public key. You can upload either your existing key or create a new one. Below we are going to create a new private and public key and use it as the Keypair for testbed:
# Create a public and private key, press enter when you are prompted to all questions: ssh-keygen
You will find your private and public key in
~/.ssh/ folder. Now let’s use the public key and upload it to the openstack system:
openstack keypair create --public-key ~/.ssh/id_rsa.pub my-key
Security groups are sets of IP filter rules that define networking access to the VM. There is a
default security group you can use. To list of all available security group try:
openstack security group list
In case you need to open a port/protocol for your environment you can easily do that using:
openstack security group rule create \ --remote-ip 0.0.0.0/0 --protocol tcp --dst-port 22 default # You can also open a range of ports using similar command: openstack security group rule create \ --remote-ip 0.0.0.0/0 --protocol tcp --dst-port 8080:8090 default
To view your security group rules:
openstack security group rule list
This is just an arbitrary name for your VM.
Now you should be able to
create a VM by providing all five parameters. Let’s try:
savi-run-server m1.small Ubuntu-18-04.4 my-key default test-vm1
You can get the
list of all existing VMs using:
openstack server list
Once your job is done and you are ready to
delete a VM, try running:
openstack server delete <vm-name>
Once your VM is booted, you can just log in to the VM using ssh through client1 machine. Hence, within client1 machine try:
You can also try to use
ProxyJump within ssh and directly get connected to the VM by:
ssh -J <username>@client1.savitestbed.ca ubuntu@<ip-address>
If you prefer to have access to the VM using an external public IP address you might try to create and attach a floating IP to your VM. In order to do this, first let’s search for any available public IPs:
openstack floating ip list -c 'Floating IP Address' -c 'Fixed IP Address'
If you did not find any IPs with empty (None)
Fixed IP Address, then you might need to create one:
# If you are using CORE-2, or CORE you need to use ext_net # Otherwise please use ext-net # Pay attention to the difference between dash (-) and underline (_) openstack floating ip create ext-net # Query the floating ip list again openstack floating ip list -c 'Floating IP Address' -c 'Fixed IP Address'
Once you successfully created a public IP, try to attach it to your server:
openstack server add floating ip <vm name> <floating ip>
You can remove a public ip from your VM by:
openstack server remove floating ip <vm name> <floating ip>