Images

CHAPTER

4

Oracle VM Lifecycle
Management

Oracle VM lifecycle management describes the change in state of the virtual machine—from creation to destruction and every state in between. For example, the lifecycle of a virtual machine starts with the machine being built and then continues with it being started, suspended, resumed, stopped, and eventually deleted. Within the lifecycle of a virtual machine are four major states—nonexistent, stopped, running, and suspended—and a virtual machine can transition between these states, as this chapter describes. Also, various tasks take place within these states, and the transitions that can be made vary according to which state the machine is in. There are several ways in which transitions occur between each state of existence, all of which comprises the virtual machine lifecycle, as described in this chapter.

The Oracle VM Virtual Machine Lifecycle

A virtual machine built with Oracle VM has various states in which it can exist. For the purposes of this chapter, I will add an additional state: nonexistent. This state is used as the starting point and ending point of the lifecycle and describes a state of nothingness from which the virtual machine is created and where it is returned after it has been removed from the system and the system resources it utilized are released.

From nonexistence, the virtual machine is created and enters the lifecycle. It may enter many states within the lifecycle before returning to the state of nonexistence. This entire process is known as the lifecycle. Managing the lifecycle refers to how users transition between the various states.

The various states that a virtual machine can exist in consist of the following:

Images   Nonexistent    This state is the starting and ending point, where the virtual machine does not exist. The virtual machine has no definition or state and uses no system resources. This is the state before the virtual machine is created and after the virtual machine has been removed from the VM Server. From the nonexistent state, you create the virtual machine.

Images   Stopped    The virtual machine is defined in this state. Both a configuration file and data files exist. In the stopped state, the virtual machine consumes disk space but does not consume memory or CPU resources. From the stopped state, you can start, migrate or move, clone, edit, or delete the virtual machine.

Images   Running    This is the operational state of the virtual machine from which tasks and processes are performed. When in the running state, the virtual machine consumes not only disk space but also memory and CPU resources. From the running state, you can stop/kill, restart, migrate or move, clone or suspend the virtual machine.

Images   Suspended    This state preserves the machine’s current settings and application states without releasing system resources, allowing the machine to resume this state with a short load period. In this state, the virtual machine consumes memory and disk resources but very little CPU resources. When in the suspended state, you can resume the virtual machine.

Figure 4-1 shows all the states that are possible in Oracle VM and the transitions that are available.

Images

FIGURE 4-1.    The Oracle VM lifecycle

Creating and Deleting

The virtual machine is “born” when you create it. The virtual machine “dies” when you delete it. Everything that happens between creation and deletion is the virtual machine’s lifecycle. The lifecycle is not complete until you delete the machine: its lifecycle does not end upon entering the shutdown or suspended state.

When you create or clone a virtual machine, it initially enters the stopped state. In this state, you can modify the virtual machine’s configuration before starting it. A virtual machine is typically in the stopped state when you remove it from the system, thus allowing for proper resource cleanup.

When the virtual machine is in the stopped state, you can add resources to it, such as memory, vCPUs, network resources, and more disk space. You can modify a few resources while the virtual machine is running, but in order for them to become visible to the virtual machine, a reboot is often required.

In this state you can also migrate and/or clone the virtual machine. When migrating the virtual machine, you can move the virtual machine to a different server or server pool or you can move the virtual machine storage (or part of it) to another repository. In this state the movement is easier because no “live migration” is done.

Images

NOTE

Although a virtual machine can be created through several different menus, each method uses the same command: Create Virtual Machine. This command invokes a wizard to assist you with creating the virtual machine. You can choose to create a virtual machine from an existing template or a virtual machine from a virtual appliance, or you can choose to create a virtual machine manually. Creating a virtual machine from a template is covered in detail in Chapter 18. Creating a virtual machine manually is covered in detail in Chapter 19. Because creating the virtual machine is the first step in the lifecycle, it is a critical step.

Starting and Stopping

In Xen (Oracle VM) terminology, starting a virtual machine is referred to as “creating a domain,” and stopping or shutting down the virtual machine is known as “destroying the virtual machine.” From the stopped state (shutdown), the virtual machine can move to the running state. You do this by starting the guest VM.

From the running state, you can stop the virtual machine. Depending on the command you use, this might be a hard stop (similar to pulling the power cord) via the kill command or a graceful shutdown using the stop command. Whenever possible, you should shut down the system gracefully rather than perform a hard shutdown. If you perform a hard stop, you might find it takes much longer to restart the virtual machine. For example, stopping a system might cause the database application running on that system to take much longer to restart because it has to perform data recovery.

Suspending

The suspended state offers the ability to stop the virtual machine in its current operating state and to return the machine to that exact state upon resuming. The difference between the two states is the manner in which the machine’s settings are preserved and how the resources that the virtual machine uses are affected.

Putting a virtual machine into the suspended state simply stops the execution of further commands momentarily, much like a Windows desktop enters Sleep mode. In the suspended state, the machine’s applications and settings are simply stopped (that is, they are kept the same as they were when the suspended state was entered). The settings and application states are not saved to files that are then used upon resuming the virtual machine; they are simply stopped and kept as they are. This allows for a fairly short load period upon resuming operation, but the virtual machine also continues to utilize (some of) the Oracle VM server’s resources.

If your desire is to simply stop execution of the virtual machine for a short period of time and to restart it quickly, you should choose to suspend the virtual machine. This option provides a fast restart as well as holds system resources. If the VM Server were to fail, the suspended system will be lost and require recovery if applicable.

Cloning, Creating from a Template, and Migrating

Cloning a virtual machine involves creating a new virtual machine from a template or duplicating an existing virtual machine. A cloned virtual machine is an exact copy of the machine or template from which it is cloned; however, it is assigned a different MAC address for the network adapters. This option is great for creating a copy of a virtual machine. By copying a virtual machine that is already configured for the desired application, you save significant time by avoiding time-consuming tasks such as adding packages and installing and configuring applications.

Templates allow you to create virtual machines rapidly using preconfigured settings. Templates are not virtual machines themselves; rather, they are profiles that determine what resources the machine will use. The Template Library is one of Oracle VM’s most significant features. Templates allow you to save a preconfigured system and reuse it over and over again to provision additional virtual machines quickly and efficiently. With a few configuration changes, you can quickly put the new virtual machine into production, allowing you to add more capacity in an efficient manner.

In addition to using the Oracle predefined templates, you can create a template of a virtual machine that you have created. This is done via the clone command. When you select the clone option, you will be asked whether to clone to a virtual machine or clone to a template. Cloning your own, already configured virtual machine to a template can be very efficient and useful because all of the software and updates you require are already installed.

Migrating a virtual machine involves moving the execution of an existing machine from one Oracle VM server where it’s currently running to another Oracle VM server, server pool, or storage repository, without duplicating the virtual machine. Migration helps you balance resources as well as achieve high availability. With Oracle VM, you can migrate a virtual machine while keeping it in a running state. This way, you can also balance resources while the virtual machine is live. If you need additional CPU resources and/or memory and they are not available on the Oracle VM server the virtual machine is currently running on, you can move it live to a Oracle VM server that has sufficient resources. Once the migration is complete, you can add resources. In addition, if maintenance is required, you can abandon a VM server during the maintenance period and then return to it once the maintenance has been completed.

State Management and Transitions

The major states of the virtual machines were introduced earlier in this chapter. The transitions between the various states differ based on what state the virtual machine is in. This section describes these transitions and states. From each state, specific transitions can be accomplished. Of course, all states can move to the stopped state if the virtual machine server fails, and all states can move to the nonexistent state if the storage repository fails, but in this chapter, we are really only concerned with orderly and normal transitions.

For each state, there are a number of operations that are not mentioned in this section because they do not change the state of the virtual machine. These operations include gathering display information, creating a report, and viewing the parameter. Operations that change the state of the virtual machine are the ones covered in this section.

Stopped

In the stopped state, the virtual machine exists but is only consuming storage resources. The virtual machine is not running and is nonfunctional. The stopped state offers you the following options:

Images   Start    From the shutdown state, you can start the virtual machine. This activates the system, taking it to the running state. Once the virtual machine has started, a Power-On Self-Test (POST) process runs and then the OS boots. At an early stage of the start process, the virtual machine console becomes available.

Images   Clone    Cloning allows you to copy a stopped virtual machine to either the same or a different server pool. A cloned system is identical to the original. During this process, the virtual machine is not available. In this version of OVM, a hot-clone can be created while the source virtual machine is still running, but this process does not create a completely reliable clone and should only be used for backup purposes. It is best practice to create a clone while the source virtual machine is in the stopped state.

Images   Clone to a template    In order for you to create a template of a virtual machine, it should be in the stopped state. A running virtual machine that you copy will most likely result in a corrupted image. The template process saves the virtual machine images as well as the virtual machine configuration file. The virtual machine configuration file is modified to reflect the template path. This template makes a great starting point for creating virtual machines. Creating a virtual machine, customizing it as needed, and cloning it to a template is an easy way to deploy custom virtual machines.

Images   Delete    You can remove a virtual machine from the stopped state. You can probably delete the image files of a running virtual machine, but doing so might leave the VM Server in an unknown state. Of course, deleting a running virtual machine causes it to crash.

Images   Edit    In order for you to edit a virtual machine, it should be in the stopped state. Modifications include adding disks, network adapters, and so on. In this state, you can add additional disks and/or modify the ones you have. You can modify a few options with the virtual machine running, but the underlying OS might not recognize those changes.

Because stopped systems are currently not running, they are in the ideal state for the operations mentioned here.

Running

In the running state, the virtual machine is available for users and can be accessed. In this state, only some changes can be made to the virtual machine configuration. The following state transitions are available from the running state:

Images   Stop    Stopping the virtual machine moves it from the running state to the stopped state. You can do this either via an orderly shutdown or by killing it (similar to powering it off). An orderly shutdown is preferable, if at all possible. By stopping the system, you might have to perform recovery operations, resulting in performance problems on startup.

Images   Restart    The restart state is identical to a system reboot in Linux. The system is shut down and then restarted. However, it is important to note that the virtual machine configuration is not reloaded during a restart, so any manual changes to the vm.cfg file will remain unrecognized until the virtual machine is stopped and then started again.

Images   Kill    The kill state is identical to powering off a system in Linux. The system is immediately aborted.

Images   Migrate    You can migrate the virtual machine to another VM server without ceasing operation via live migration from the running state. There are many reasons for migrating the virtual machine, such as load balancing, maintenance, and so on. You can also migrate the virtual machine configuration file and any virtual storage to a different storage repository within the same server pool as long as the virtual machine is stopped.

Images   Edit    You can edit a few things while the system is in the running state, including memory (up to Max Memory Size). Regardless of whether Oracle VM allows the edit to occur while the virtual machine is running and whether the virtual machine recognizes the changes depends on the virtual machine itself. Not all operating systems recognize dynamic configuration changes.

Images   Suspended    Entering the suspended state preserves the machine’s current settings and processes in memory without releasing system resources, allowing for quick resumption of the virtual machine’s state. The suspended state can return to the running state via a resume transition.

The running state is where most of the work gets done and is the most useful state.

Suspended

Entering the suspended state preserves the machine’s current settings and processes in memory without releasing system resources, allowing for quick resumption of the virtual machine’s state. From the suspended state, the virtual machine can enter the running state or the shutdown state, and the following transitions are possible:

Images   Resume    Via the resume transition, the virtual machine returns to its previous state and processes at the point where the suspended state was entered after a short load period. Resuming results in the virtual machine entering the running state.

Images   Kill    In suspended mode, a kill command powers off the virtual machine and moves to the stopped state.

This state is only useful for short periods of time. In the event of a virtual machine server failure, the suspended state is lost.

Summary

The virtual machine lifecycle is defined by the various states in which it exists and operates in. Four basic states exist within the lifecycle, each one allowing for different tasks and configurations. The beginning of the lifecycle is the creation of the virtual machine. The end of the lifecycle is the deletion of the virtual machine. The states in between are known as the lifecycle of the virtual machine.

Images

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.21.43.26