Let’s say that we created all five of our virtual machines from the shell script example and that we left them powered on. We can easily check their status by issuing a simple
virsh list command:
If we want to completely remove a virtual machine (for example,
MasteringKVM02), you’d normally shut it down first (gracefully or forcefully) and then use the
virsh undefine command:
Bear in mind that you can actually do
virsh undefine first, and then
destroy, and that the end result is going to be the same. However, that may go against the expected behavior in which you first shut down an object before you actually remove it.
We just learned how to use the
virsh command to manage a virtual machine – start it and stop it – forcefully and gracefully. This will come in handy when we start extending our knowledge of using the
virsh command in the following chapters, in which we’re going to learn how to manage KVM networking and storage.
We could do all these things from the GUI as well. As you may recall, earlier in this chapter, we installed a package called
virt-manager. That’s actually a GUI application for managing your KVM host. Let’s use that to play with our virtual machines some more. This is the basic GUI interface of
If we want to do our regular operations on a virtual machine – start, restart, shut down, turn off – we just need to right-click it and select that option from the menu. For all the operations to become visible, first, we must start a virtual machine; otherwise, only four actions are usable out of the available seven – Run, Clone, Delete, and Open. The Pause, Shut Down sub-menu, and Migrate options will be grayed-out as they can only be used on a virtual machine that’s powered on. So, after we – for example – start
MasteringKVM01, the list of available options is going to get quite a bit bigger:
We will use
virt-manager for various operations throughout this book, so make sure that you familiarize yourself with it. It is going to make our administrative jobs quite a bit easier in many situations.