Autonomous Deprovisioning of Virtual Machines

A computer implemented method for deprovisioning a virtual machine is provided. A number of processor units initializes a deprovisioning agent within the virtual machine. The number of processor units monitors a set of metrics in the virtual machine using the deprovisioning agent. The number of processor units deprovisions the virtual machine using the deprovisioning agent in response to the set of metrics meeting a set of criteria for deprovisioning the virtual machine.

BACKGROUND

The disclosure relates generally to an improved computer system and more specifically to automatically deprovisioning virtual machines.

A virtual machine is a virtualization or emulation of a computer system. Virtual machines are based on computer architectures that provide the functionality of physical computers. Virtual machines have become the backbone of cloud-focused scalars, which are providers of cloud computing services on a large scale. These cloud-focused scalars typically operate large data centers and can deliver vast amounts of computing resources.

Virtual machines are often treated as a resource that remains operational for a long time. The virtual machine can be customized and used through target end points, such as IP addresses and host names. With these types of virtual machines, the end points rarely change and the customer deploy and maintains operating systems and applications in the virtual machine. Users have control over the virtual infrastructure including configuring the operating system, installing software, and applying security patches.

Serverless computing has become more popular as a cloud computing model. Serverless computing is also known as a Function-as-a-Service (FaaS). In providing serverless computing services, a cloud provider dynamically allocates computing resources. With serverless computing systems, virtual machines can be used to provide for the execution of serverless applications or functions. Virtual machines allow for increased flexibility because virtual machines can be automatically scaled to take into account workload requests for a service computing system. Virtual machines can be provisioned and deprovisioned based on the requests for services. Virtual machines in a serverless computing system are used for a short period of time relative to virtual machines provisioned for customers. Virtual machines may run for a few hours, a few days, or few weeks to process workloads in the serverless computing system. As a result, the use of virtual machines can increase the ability for efficiently resourcing allocation and optimizing costs.

SUMMARY

According to one illustrative embodiment, a computer implemented method for deprovisioning a virtual machine is provided. A number of processor units initializes a deprovisioning agent within the virtual machine. The number of processor units monitors a set of metrics in the virtual machine using the deprovisioning agent. The number of processor units deprovisions the virtual machine using the deprovisioning agent in response to the set of metrics meeting a set of criteria for deprovisioning the virtual machine. According to other illustrative embodiments, a computer system and a computer program product for deprovisioning a virtual machine are provided.

DETAILED DESCRIPTION

The illustrative embodiments recognize and take into account a number of considerations as described herein. Currently, virtual machines used for serverless computing are managed using a centralized controller. The centralized controller controls the lifecycle of virtual machines. This centralized controller automatically provisions virtual machines and is also capable of deprovisioning the virtual machines when those virtual machines are no longer needed.

For example, when a request is received for workload, the centralized controller communicates to a node to create a virtual machine and assign a job to the virtual machine. The centralized controller also ensures that the virtual machine continues to run to perform the workload, receives an indication that the workload has been completed, and assigns another workload or deprovisions the virtual machine. These workloads can include simulations, scientific calculations, and training machine learning models. Using a centralized controller to monitor and control deprovisioning of virtual machines increases overhead. Resources are needed to set up communications for the centralized controller create, monitor, and control the virtual machines. Plus, the centralized controller can be a bottleneck when many virtual machines are managed by the central controller. For example, if a workload requires a thousand virtual machines, the centralized controller manages synchronizing the virtual machines. As a result, the centralized controller becomes a bottleneck.

With a decentralized system for the management the deprovisioning of virtual machines, the setup of virtual machines is simplified. For example, many virtual machines can be set up without needing to establish network connectivity between a central controller and the nodes with the virtual machines. Additionally, reduced security risks are present because a reduced attack surface. For example, the virtual machines and the deprovisioning agents are only present for a short period of time. Further, lower operational costs are present because a centralized controller is not needed to monitor the processing of workloads on the different virtual machines and maintenance and updates to virtual machines are not needed. Further a bottleneck is also not present because a centralized controller is not needed to manage the virtual machines.

Thus, the illustrative examples provide a computer implemented method, apparatus, computer system, and computer program product that enables managing deprovisioning of virtual machines autonomously. The deprovisioning can be controlled without needing supervision or management by a centralized controller. Instead, components within the virtual machine determine when the virtual machine should be deprovisioned.

In one illustrative example, a computer implemented method manages deprovisioning a virtual machine. A number of processor units initializes a deprovisioning agent within the virtual machine. The number of processor units monitors a set of metrics in the virtual machine using the deprovisioning agent. The number of processor units deprovisions the virtual machine using the deprovisioning agent in response to the set of metrics meeting a set of criteria for deprovisioning the virtual machine.

With reference now toFIG.2, a block diagram of a virtual machine environment is depicted in accordance with an illustrative embodiment. In this illustrative example, virtual machine environment200includes components that can be implemented in hardware such as the hardware shown in computing environment100inFIG.1. For example, virtual machine system201can manage the lifecycle of virtual machine202. In this example, virtual machine system201can also automatically deprovision virtual machine202when virtual machine202has completed performing a workload and is no longer needed.

Virtual machine202can be implemented in a number of different environments. For example, virtual machine202can be located in a serverless computing system where virtual machines exist for shorter periods of time as compared to virtual machines. Virtual machine202can also be located in a desktop virtualization system, a server virtualization system, or other types of environments.

In this illustrative example, virtual machine system201comprises computer system212, virtual machine manager214, and deprovisioning agent220. Virtual machine manager214is located in computer system212. Deprovisioning agent220can be implemented using deprovisioning agent190inFIG.1.

Virtual machine manager214and deprovisioning agent220can be implemented in software, hardware, firmware or a combination thereof. When software is used, the operations performed by deprovisioning agent220can be implemented in program instructions configured to run on hardware, such as a processor unit. When firmware is used, the operations performed by deprovisioning agent220can be implemented in program instructions and data and stored in persistent memory to run on a processor unit. When hardware is employed, the hardware can include circuits that operate to perform the operations in deprovisioning agent220.

As used herein, “a number of” when used with reference to items, means one or more items. For example, “a number of operations” is one or more operations.

As depicted, computer system212includes a number of processor units216that are capable of executing program instructions218implementing processes in the illustrative examples. In other words, program instructions218are computer readable program instructions.

As used herein, a processor unit in the number of processor units216is a hardware device and is comprised of hardware circuits such as those on an integrated circuit that respond to and process instructions and program code that operate a computer. A processor unit can be implemented using processor set110inFIG.1. When the number of processor units216executes program instructions218for a process, the number of processor units216can be one or more processor units that are in the same computer or in different computers. In other words, the process can be distributed between processor units216on the same or different computers in computer system212.

Further, the number of processor units216can be of the same type or different types of processor units. For example, the number of processor units216can be selected from at least one of a single core processor, a dual-core processor, a multi-processor core, a general-purpose central processing unit (CPU), a graphics processing unit (GPU), a digital signal processor (DSP), or some other type of processor unit.

In this illustrative example, virtual machine manager214provisions virtual machine202. In provisioning virtual machine202, virtual machine manager214allocates resources and obtains configuration information from configuration repository228for use in provisioning virtual machine202. This configuration information also includes information to initialize deprovisioning agent220within virtual machine202.

As part of initializing virtual machine202, virtual machine202initializes deprovisioning agent220within the virtual machine202. In one illustrative example, deprovisioning agent220can be initialized within virtual machine202using virtual machine initialization process223such as a cloud-init to install deprovisioning agent220in virtual machine202. Information needed to install deprovisioning agent220is located in configuration repository228.

Virtual machine202can retrieve a set of rules226implementing the set of criteria224from configuration repository228. In another example, the set of rules226can be received with a workload submission. Virtual machine202can configure deprovisioning agent220using the set of rules226retrieved from configuration repository228.

As used herein, a “set of” when used with reference items means one or more items. For example, a set of rules is one or more rules.

Deprovisioning agent220monitors a set of metrics222in virtual machine202. In one illustrative example, the monitoring can be performed using watchers232. With the use of watchers232, a set of watchers232can observe execution behavior234of virtual machine202.

Deprovisioning agent220can monitor the set of metrics222generated by the set of watchers232observing execution behavior234. In this example, the set of watchers232return the set of metrics222to deprovisioning agent220.

The set of watchers232can be any component or construct that can monitor execution behavior234of virtual machine202. For example, a watcher can be, for example, a real time system monitoring tool, a custom program, or other type of component. As another example, a watcher can be implemented using a “top” command used in systems such as Unix.

In monitoring execution behavior234, the set of watchers232can generate the set of metrics222based on execution behavior234observed by the set of watchers232. For example, execution behavior234may use different amounts of processor resources for storage. This usage of these resources in execution behavior234can be used to determine a set of metrics222such as processor usage and storage usage.

In the illustrative example, individual watchers in watchers232can be configured to monitor for different aspects of execution behavior234. For example, one watcher can monitor processor usage while another watcher can monitor input/output activity. In other examples, a watcher can monitor for multiple aspects of execution behavior234.

Deprovisioning agent220applies the set of metrics222received from the set of watchers232to a set of rules226implementing the set of criteria224. With the application of the set of metrics222to the set of rules226, deprovisioning agent220can determine whether the set of criteria224has been met to deprovision virtual machine202. In this example, when the set of metrics222takes the form of processor usage and storage usage, these metrics can be used in the set of rules226to determine whether criteria224met indicating that virtual machine202should be deprovisioned.

The set of rules226can take various forms and have different levels of complexity. For example, the set of rules226can indicate that virtual machine202is to be deprovisioned when the workload is complete. In another example, the set of rules226may also include both the workload being completed and an output file being generated. In yet another illustrative example, the set of rules226may include the workload being completed, output file having a name “abc.doc” being generated, and an upload of the output file being completed to a selected repository or other location.

As another example, a rule in the set of rules226can be whether a particular process ID is running. In still another illustrative example, a rule can be whether a selected amount of incoming traffic on a specific port for a specific period of time is present.

In another example, the rule can be whether the processor has been idle or a specific period of time. In yet another example, the rule can be whether the processor utilization is below a selected percentage for a given period of time. These and other rules can be used to implement the set of rules226to determine whether criteria224have been met to deprovision virtual machine202.

In this illustrative example, deprovisioning agent220sends request221to deprovision of virtual machine202in response to the set of metrics222meeting a set of criteria224for deprovisioning virtual machine202. Virtual machine manager214deprovisions virtual machine202in response to receiving this request from deprovisioning agent220. In this example, deprovisioning virtual machine202involves shutting down virtual machine202and releasing resources for virtual machine202. Part of releasing resources can involve training those resources to a pool for reuse.

In deprovisioning virtual machine202, grace period240can be used in some illustrative examples. For example, deprovisioning agent220can start grace period240in response to the set of metrics222meeting the set of criteria224for deprovisioning the virtual machine. Deprovisioning agent220sends request221to virtual machine manager214to deprovision virtual machine202in response to grace period240ending.

In the illustrative example, grace period240can allow for other activities to occur after virtual machine202is finished processing a workload. For example, grace period240may provide time for an output file to be generated sent to a location outside of virtual machine202. This location can be a snapshot repository, a database, a data store, a memory, or some other suitable location.

Further, deprovisioning agent220can optionally create snapshot230of virtual machine202prior to virtual machine202being deprovisioned in response to meeting the set of criteria for deprovisioning the virtual machine. In this depicted example, snapshot230can take a number of different forms. For example, snapshot230can be a snapshot of the workload, the entire virtual machine, or other information in virtual machine202.

Thus, virtual machine202can be managed using deprovisioning agent220. With deprovisioning agent220, virtual machine manager214does not need to manage the operation of virtual machine202directly. Instead, deprovisioning agent220located within virtual machine environment200can determine when to deprovision virtual machine202. Deprovisioning agent220runs independently within virtual machine202. Virtual machine manager214does not need to monitor virtual machine202to determine when virtual machine202should be deprovisioned. Instead, deprovisioning agent220can send request221to virtual machine manager214when set of criteria224for deprovisioning purge machine202has been met.

In one illustrative example, one or more solutions are present that overcome a problem with efficiently managing virtual machines. As a result, one or more solutions in the different illustrative examples may provide an ability to automatically deprovision virtual machines that have finished processing workloads without needing a centralized manager is currently used. In the different illustrative examples, a deprovisioning agent is initialized within the virtual machine and manages deprovisioning that virtual machine.

With this use of a deprovisioning agent within a virtual machine, the virtual machine can be managed without needing external network connectivity for monitoring and management of the virtual machine. This deprovisioning agent monitors metrics and applies as metrics to a set of rules to determine whether criteria are met to deprovision the virtual machine. The monitoring of these metrics can be performed through watchers, which are processes, tools, or other constructs that can monitor execution behavior of the virtual machine.

Computer system212can be configured to perform at least one of the steps, operations, or actions described in the different illustrative examples using software, hardware, firmware or a combination thereof. As a result, computer system212operates as a special purpose computer system in which deprovisioning agent220in computer system212enables deprovisioning a virtual machine when the virtual machine is no longer needed without needing an external central controller. In these examples, this deprovisioning can occur when the virtual machine has completed processing a workload. In particular, deprovisioning agent220transforms computer system212into a special purpose computer system as compared to currently available general computer systems that do not have virtual machine manager214.

In the illustrative example, the use of deprovisioning agent220in computer system212integrates processes into a practical application for deprovisioning virtual machines using deprovisioning agents within the virtual machines to increase the performance of computer system212. In this example, the increase in performance can result from increased availability of resources to perform workloads. In other words, deprovisioning agent220in computer system212is directed to a practical application of processes integrated into deprovisioning agent220in computer system212in which deprovisioning agent220monitors the execution behavior of the virtual machine. This deprovisioning agent deprovisions virtual machine once a set of criteria is met. The deprovision can be performed by deprovisioning agent220sending request221to virtual machine manager214to deprovision virtual machine202.

For example, one or more virtual machines may be present within computer system212in addition to virtual machine202. The deprovisioning of these additional virtual machines can also be managed using deprovisioning agents running within those virtual machines. These other virtual machines can use the same or different rules obtained from configuration repository228, through workload requests or other types of input. In other words, different virtual machines can use different criteria to determine when those virtual machines should be deprovisioned. In another example, configuration repository228can be checked while virtual machine202runs to obtain new sets of rules. In this manner, the roles that can be changed after a virtual machine has already started processing a workload.

With reference next toFIG.3, a process flow for a deprovisioning agent in a virtual machine is depicted in accordance with an illustrative embodiment. This process flow can be implemented using virtual machine system201with deprovisioning agent220inFIG.2. In this example, the process flow300begins with submission of a workload in block302. Provisioning begins to initialize virtual machine301to process the workload in block304.

In this example, Vm-init occurs in block306and is the initialization of virtual machine301. In this initialization, configurations of resources are prepared to start virtual machine301. In this depicted example, the particular type of Vm-init can be cloud-init in block306. In this example, cloud-init enables the automatic configuration and customization of virtual machine301when virtual machine301is used in a cloud environment.

After initialization of virtual machine301, workload subflow303in process flow300illustrates the steps that virtual machine301performs in processing the workload. Workload subflow303illustrates the steps involved in monitoring and deprovisioning virtual machine301.

In workload subflow303, the workload is deployed in block308and workload execution starts in block310. The workload is executed in block312and execution of the workload finishes in block314.

In monitoring subflow305, the deprovisioning agent is initialized in block320. In this example the initialization can be performed using information from configuration repository321. For example, configuration repository321can include a set of rules used by the deprovisioning agent to determine whether a set of criteria met to deprovision virtual machine301.

The deprovisioning agent starts observing virtual machine301in block322. In this example, this observation is an observation of execution behavior of virtual machine301and can be made by receiving metrics from watchers307. In this example, watchers307can monitor metrics309in virtual machine301. These metrics can include process identifiers, central processing unit usage, input/output operations, memory usage, and other types of metrics.

In this example, the deprovisioning criteria are met in block314. This deprovisioning criteria can be met in response to virtual machine301finishing execution of the workload in block314. In this example, a workload snapshot is created in block316. This workload snapshot is saved to snapshot repository318. The creation of a snapshot is an optional feature in this example. Virtual machine301is then deprovisioned in block324.

The illustration of process flow300inFIG.3is provided as an example of one manner in which process flow can occur in monitoring and deprovisioning a virtual machine. This illustration is not meant to limit the manner in which other process flows can be implemented. For example, a grace period can be included in other process flows. In yet another illustrative example, the set of rules can be obtained with the workload to be processed by virtual machine301.

Turning toFIG.4, a timeline illustrating deprovisioning of a virtual machine using a deprovisioning agent is depicted in accordance with an illustrative embodiment. As depicted, timeline400illustrates the lifecycle of a virtual machine with deprovisioning controlled by a deprovisioning agent within the virtual machine.

At time t0402, the virtual machine is provisioned. Additionally, the deprovisioning agent can also be initialized as part of deprovisioning of the virtual machine. The workload is deployed, and processing starts at time t1404. The workload completes processing at time t2406.

The deprovisioning agent detects that the workload has been completed and the virtual machine can be shut down at time t3408. In this example, a grace period is present in starts at time t3408. The grace period can enable other steps or activities to be performed from outputs generated by the workload. For example, a file can be uploaded to a location. In some cases, the grace period may be unnecessary when the set of criteria has a level of complexity that include determining when and output has been generated and uploaded to a desired location.

The grace period ends at time t4410and the deprovisioning agent begins termination of processes and the deprovisioning of the virtual machine. The virtual machine is shut down and deprovisioned at time t5412.

InFIG.5, a flowchart of a process for deprovisioning a virtual machine is depicted in accordance with an illustrative embodiment. The process inFIG.5can be implemented in hardware, software, or both. When implemented in software, the process can take the form of program instructions that are run by one of more processor units located in one or more hardware devices in one or more computer systems. For example, the process can be implemented in virtual machine system201in computer system212inFIG.2, which instantiates a deprovisioning agent in virtual machine to monitor and deprovision the virtual machine.

The process begins by initializing a deprovisioning agent within the virtual machine (step500). The process monitors a set of metrics in the virtual machine using the deprovisioning agent (step502). In step502, the set of metrics can be selected from at least one of process IDs, incoming traffic on a port, processor usage, memory usage, input/output operations, TCP/IP connections, or other suitable metrics for determining when a virtual machine has completed a workload or other processing and is no longer needed.

The process deprovisions the virtual machine using the deprovisioning agent in response to the set of metrics meeting a set of criteria for deprovisioning the virtual machine (step504). The process terminates thereafter. In this example, deprovisioning agent can send a request to the controller to the provision the virtual machine. The monitoring of execution behavior and determination of whether to deprovision the virtual machine is made within the virtual machine by the deprovisioning agent.

With reference now toFIG.6, a flowchart of a process for initializing a deprovisioning agent is depicted in accordance with an illustrative embodiment. The process in this flowchart is an example of an implementation for step500inFIG.5.

The process begins by installing the deprovisioning agent in the virtual machine (step600). The process retrieves a set of rules implementing the set of criteria from a configuration repository (step602).

The process configures the deprovisioning agent using a set of rules retrieved from the configuration repository (step604). The process terminates thereafter.

In some examples example, step602and step604repeated during the operation of the virtual machine. In other words, the rules implementing the criteria can change during the operation of the virtual machine in some illustrative examples.

Next inFIG.7, a flowchart of a process for creating a snapshot is depicted in accordance with an illustrative embodiment. This figure illustrates an additional step that can be performed with the steps inFIG.5.

The process creates a snapshot of the virtual machine using deprovisioning agent prior to the virtual machine being deprovisioned in response to meeting the set of criteria for deprovisioning the virtual machine (step700). The process terminates thereafter.

With reference toFIG.8, a flowchart of a process for monitoring a virtual machine is depicted in accordance with an illustrative embodiment. The process in this figure is an example of an implementation for step502inFIG.5.

The process observes execution behavior of the virtual machine using a set of watchers (step800). The process monitors the set of metrics generated by the set of watchers observing the execution behavior using the deprovisioning agent (step802). The process terminates thereafter.

Turning now toFIG.9, a flowchart of a process for deprovisioning a virtual machine is depicted in accordance with an illustrative embodiment. The process illustrated in this figure is an example of an implementation for step504inFIG.5.

The process begins by starting a grace period in response to the set of metrics meeting the set of criteria for deprovisioning the virtual machine (step900). The process deprovisions the virtual machine using the deprovisioning agent in response to the grace period ending (step902). The process terminates thereafter.

Turning now toFIG.10, a block diagram of a data processing system is depicted in accordance with an illustrative embodiment. Data processing system1000can be used to implement computers and computing devices in computing environment100inFIG.1. Data processing system1000can also be used to implement computer system212inFIG.2. In this illustrative example, data processing system1000includes communications framework1002, which provides communications between processor unit1004, memory1006, persistent storage1008, communications unit1010, input/output (I/O) unit1012, and display1014. In this example, communications framework1002takes the form of a bus system.

Processor unit1004serves to execute instructions for software that can be loaded into memory1006. Processor unit1004includes one or more processors. For example, processor unit1004can be selected from at least one of a multicore processor, a central processing unit (CPU), a graphics processing unit (GPU), a physics processing unit (PPU), a digital signal processor (DSP), a network processor, or some other suitable type of processor. Further, processor unit1004can be implemented using one or more heterogeneous processor systems in which a main processor is present with secondary processors on a single chip. As another illustrative example, processor unit1004can be a symmetric multi-processor system containing multiple processors of the same type on a single chip.

Memory1006and persistent storage1008are examples of storage devices1016. A storage device is any piece of hardware that is capable of storing information, such as, for example, without limitation, at least one of data, program instructions in functional form, or other suitable information either on a temporary basis, a permanent basis, or both on a temporary basis and a permanent basis. Storage devices1016may also be referred to as computer readable storage devices in these illustrative examples. Memory1006, in these examples, can be, for example, a random-access memory or any other suitable volatile or non-volatile storage device. Persistent storage1008may take various forms, depending on the particular implementation.

For example, persistent storage1008may contain one or more components or devices. For example, persistent storage1008can be a hard drive, a solid-state drive (SSD), a flash memory, a rewritable optical disk, a rewritable magnetic tape, or some combination of the above. The media used by persistent storage1008also can be removable. For example, a removable hard drive can be used for persistent storage1008.

Communications unit1010, in these illustrative examples, provides for communications with other data processing systems or devices. In these illustrative examples, communications unit1010is a network interface card.

Input/output unit1012allows for input and output of data with other devices that can be connected to data processing system1000. For example, input/output unit1012may provide a connection for user input through at least one of a keyboard, a mouse, or some other suitable input device. Further, input/output unit1012may send output to a printer. Display1014provides a mechanism to display information to a user.

Instructions for at least one of the operating system, applications, or programs can be located in storage devices1016, which are in communication with processor unit1004through communications framework1002. The processes of the different embodiments can be performed by processor unit1004using computer-implemented instructions, which may be located in a memory, such as memory1006.

These instructions are referred to as program instructions, computer usable program instructions, or computer readable program instructions that can be read and executed by a processor in processor unit1004. The program instructions in the different embodiments can be embodied on different physical or computer readable storage media, such as memory1006or persistent storage1008.

Program instructions1018are located in a functional form on computer readable media1020that is selectively removable and can be loaded onto or transferred to data processing system1000for execution by processor unit1004. Program instructions1018and computer readable media1020form computer program product1022in these illustrative examples. In the illustrative example, computer readable media1020is computer readable storage media1024.

Computer readable storage media1024is a physical or tangible storage device used to store program instructions1018rather than a medium that propagates or transmits program instructions1018. Computer readable storage media1024, as used herein, is not to be construed as being transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission media (e.g., light pulses passing through a fiber-optic cable), or electrical signals transmitted through a wire.

Alternatively, program instructions1018can be transferred to data processing system1000using a computer readable signal media. The computer readable signal media are signals and can be, for example, a propagated data signal containing program instructions1018. For example, the computer readable signal media can be at least one of an electromagnetic signal, an optical signal, or any other suitable type of signal. These signals can be transmitted over connections, such as wireless connections, optical fiber cable, coaxial cable, a wire, or any other suitable type of connection.

Further, as used herein, “computer readable media1020” can be singular or plural. For example, program instructions1018can be located in computer readable media1020in the form of a single storage device or system. In another example, program instructions1018can be located in computer readable media1020that is distributed in multiple data processing systems. In other words, some instructions in program instructions1018can be located in one data processing system while other instructions in program instructions1018can be located in one data processing system. For example, a portion of program instructions1018can be located in computer readable media1020in a server computer while another portion of program instructions1018can be located in computer readable media1020located in a set of client computers.

The different components illustrated for data processing system1000are not meant to provide architectural limitations to the manner in which different embodiments can be implemented. In some illustrative examples, one or more of the components may be incorporated in or otherwise form a portion of, another component. For example, memory1006, or portions thereof, may be incorporated in processor unit1004in some illustrative examples. The different illustrative embodiments can be implemented in a data processing system including components in addition to or in place of those illustrated for data processing system1000. Other components shown inFIG.10can be varied from the illustrative examples shown. The different embodiments can be implemented using any hardware device or system capable of running program instructions1018.

Thus, illustrative embodiments provide a computer implemented method, computer system, and computer program product for deprovisioning a virtual machine is provided. In one illustrative example, a number of processor units initializes a deprovisioning agent within the virtual machine. The number of processor units monitors a set of metrics in the virtual machine using the deprovisioning agent. The number of processor units deprovisions the virtual machine using the deprovisioning agent in response to the set of metrics meeting a set of criteria for deprovisioning the virtual machine.

As a result, the use of a deprovisioning agent does not require network connectivity outside of the virtual machine. As a result, a simplified set up occurs in being able to monitor the virtual machine to determine when to deprovision the virtual machine. Further, a lower security risk is present because of a reduced attack surface in which virtual machine and components within the virtual machine that monitor and deprovision the virtual machine last for shorter period of time as compared to other techniques. In addition, lower operational costs are present because the deprovisioning agent does not have to be maintained beyond the life of the virtual machine. A lower use of resources is also present and the deprovisioning agent avoids bottlenecks resulting from using centralized controllers with large numbers of virtual machines.