Let's what these commands look like on a real cloud.
First, I have to take on an identity, and I will select the demo project.
Now let me gather the ingredients for launching a server.
I start with images. By default, Packstack has a single CirrOS image,
CirrOS is a very small operating system. These are the flavors,
and in most cases, we will use the first flavor named tiny.
You can add --long to this command, and this adds a few columns,
in this case it's the receive transmit factor, which allows us to
implement a crude way of limiting network bandwidth for an instance.
Next, the networks, remember that I created the private and the appnet
network in one of the earlier modules of this course.
The public network was there already, and it corresponds to the external network.
With that, I can create an instance. I provide the image, the flavor,
note that I provide the image name and the flavor ID, and then the nic
option with the network ID. It has to be an IT, in this case I cannot
use the name, and finally the instance name.
Alright, that didn't work, actually I forgot something,
the OpenStack line is a bit picky sometimes regarding syntax,
I need an equal sign between the net-id string and the net ID.
And that seems to have worked. So let me point out a few things here.
This instance is currently in the status of build, and I hope that by
now it is active. And since it is in a build status, it doesn't have
an address yet. Also, look at its power_state, it currently doesn't
have any power_state. The flavor and the image are as expected.
The security_groups is default, and there is no key.
Now the server create command has returned immediately or almost,
but in reality, launching a server is a very complex process that can
take several minutes if the image is large or if the flavor is large.
So to check what your instance is doing, it's always good to have a
look, for example, by listing all the servers.
And here they are, you can see here the server I just started is at
the top, and it's right now active, and it has an IP address by now.
Let me create another one, and note that I used the same name,
myserver, just to prove that it's possible to run two instances with
the same name. Let me delete the unwanted instances, three of them
here are shut off, this is because I restarted my Packstack server,
as a side effect, it shut off all the instances.
So one of the deleted servers is still there, and the reason is that
deletion of an instance is also a longer process.
And now this process is complete. Let me try to delete one of the
servers here as well, and obviously that has to fail,
because Nova doesn't know which of the two myserver servers I actually mean.
It can be useful to list servers with a different format, for example,
if you want to copy and paste the ID, this way I'm just listing the ID
and the Name column, and the format is value.
I can delete a server based on its ID if I can't use the name.
Let me look at the details of the remaining server, now the name
myserver is unique, and you can see it's basically the same as the
output of the server create command. By now, by the way,
the power_state is running, and you can see the addresses,
the status is ACTIVE too.
Now I will take a snapshot from a running instance.
The command is image create, and I'm going to add an option to give a
different name to the resulting image, because a snapshot is an image.
That seems to have worked. You can see here the properties of that
image make it clear that this is indeed a snapshot.
They also tell us the ID of the instance from which it was taken and
the ID of the user who took it. Here is the list of all the images,
and you can see now the alt-cirros image was added.
I can now use this image to create another instance.
And that seems to have worked. Now we have two servers running,
and you can see one comes from the original CirrOS image,
and the other one from the old CirrOS image.
The other thing I can do with an image or with a snapshot is to save
it to a file, and that is easy as well. How do I know that this is a
qcow3 file, well we will talk about that when we talk about Glance.
And here is my file, I can now use it to, for example, port my server
to another cloud.