CN111736961B - Virtual machine release method and device, storage medium and electronic equipment - Google Patents

Virtual machine release method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN111736961B
CN111736961B CN202010833574.2A CN202010833574A CN111736961B CN 111736961 B CN111736961 B CN 111736961B CN 202010833574 A CN202010833574 A CN 202010833574A CN 111736961 B CN111736961 B CN 111736961B
Authority
CN
China
Prior art keywords
virtual machine
idle
state
user
time
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010833574.2A
Other languages
Chinese (zh)
Other versions
CN111736961A (en
Inventor
张晓梨
付志鹏
冯丹
王卓耀
梁俊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Peng Cheng Laboratory
Original Assignee
Peng Cheng Laboratory
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Peng Cheng Laboratory filed Critical Peng Cheng Laboratory
Priority to CN202010833574.2A priority Critical patent/CN111736961B/en
Publication of CN111736961A publication Critical patent/CN111736961A/en
Application granted granted Critical
Publication of CN111736961B publication Critical patent/CN111736961B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5022Mechanisms to release resources

Abstract

The invention provides a method and a device for releasing a virtual machine, a storage medium and an electronic device, wherein the method comprises the following steps: after a user successfully applies for the virtual machine, periodically judging whether the virtual machine is in an overdue state, generating overdue reminding information of the virtual machine when the virtual machine is determined to be in the overdue state, displaying the overdue reminding information to the user, determining whether the user selects to use the virtual machine in a delayed manner, and monitoring the virtual machine if the user does not use the virtual machine in a delayed manner so as to determine whether the virtual machine is in an idle releasable state; and when the user is in the idle releasable state, releasing the virtual machine. By applying the method and the device, whether the virtual machine is in the overuse state or not can be determined in time, the virtual machine is monitored when the virtual machine is in the overuse state, and the virtual machine is released when the virtual machine is in the idle releasable state, so that cloud service computing resources occupied by the virtual machine can be released, and the situation of shortage of computing resources of cloud service is relieved.

Description

Virtual machine release method and device, storage medium and electronic equipment
Technical Field
The invention relates to the technical field of cloud computing, in particular to a virtual machine release method and device, a storage medium and electronic equipment.
Background
The information technology field of China is rapidly developed, a lot of breakthroughs are made in many aspects, and the cloud computing service is one of the key research directions of China. Cloud computing services may also be referred to as cloud services, which are an augmentation, usage, and interaction model of internet-based related services, typically involving the provision of dynamically scalable and often virtualized resources over the internet.
The cloud service is mainly divided into three forms, namely public cloud service, private cloud service and hybrid cloud service; each cloud service can provide a virtual machine occupying cloud service resources for a user, and the virtual machine refers to a complete computer system which has complete hardware system functions and runs in a completely isolated environment through software simulation, so that the virtual machine has the advantages of encapsulation, isolation, compatibility and the like. Based on the advantages of the virtual machines, more and more users use the virtual machines, more and more expired virtual machines occupy a large amount of computing resources of the cloud service, so that the large amount of computing resources of the cloud service are in an unallocated state, and the allocable computing resources of the cloud service are in a shortage state.
Disclosure of Invention
In view of this, the present invention provides a method for releasing a virtual machine, and by applying the method provided by the present invention, a virtual machine in an idle releasable state can be determined in time and released, so that computing resources occupied by the virtual machine in the idle releasable state can be released in time, and the situation of computing resource shortage in cloud service resources is effectively alleviated.
In order to achieve the purpose, the invention provides the following technical scheme:
a virtual machine release method comprises the following steps:
after a user successfully applies for a virtual machine, periodically judging whether the virtual machine is in an overuse state;
when the virtual machine is determined to be in an overdue use state, generating overdue reminding information of the virtual machine;
displaying the expiration reminding information to the user to determine whether the user selects to postpone the use of the virtual machine;
if the user is determined not to postpone using the virtual machine, monitoring the virtual machine to determine whether the virtual machine is in an idle releasable state;
releasing the virtual machine when the virtual machine is in an idle releasable state.
Optionally, the periodically determining whether the virtual machine is in an out-of-date use state includes:
acquiring application information of the virtual machine according to a preset time period, and determining a current time point when the application information of the virtual machine is acquired;
comparing the service end time point in the application information of the virtual machine with the current time point to judge whether the current time point exceeds the service end time point of the virtual machine;
and if the current time point exceeds the end use time point of the virtual machine, determining that the virtual machine is in an overuse state.
Optionally, the generating of the expiration reminding information of the virtual machine includes:
acquiring basic information of the virtual machine;
and generating the expiration reminding information of the virtual machine based on the basic information and the application information of the virtual machine.
Optionally, the foregoing method, where monitoring the virtual machine to determine whether the virtual machine is in an idle releasable state includes:
acquiring monitoring information corresponding to the virtual machine and the current time step according to a preset time step, wherein the monitoring information comprises the utilization rate of each performance index of the virtual machine;
judging whether the virtual machine is in an idle state in the current time step length or not based on the utilization rate of each performance index;
if the virtual machine is in an idle state in the current time step, determining the time sum of the virtual machine continuously in the idle state based on the current time step, wherein the current time step is the final time step in the time sum;
judging whether the time sum is greater than or equal to a preset idle time, if so, acquiring the latest login time of the virtual machine, and determining the current time;
determining the unregistered time length of the virtual machine based on the latest login time and the current time, and comparing the unregistered time length with the idle time length to judge whether the virtual machine is in an idle releasable state;
and if the unregistered time length is greater than or equal to the idle time length, determining that the virtual machine is in an idle releasable state.
Optionally, in the method, the determining, based on the usage rate of each performance indicator, whether the virtual machine is in an idle state in the current time step includes:
for each performance index, judging whether the utilization rate of the performance index is greater than a preset threshold value of the performance index, and obtaining a judgment result of the performance index;
determining whether a judgment result representing that the utilization rate is greater than a preset threshold value exists in each judgment result;
and if the judgment result that the utilization rate is larger than the preset threshold value does not exist, determining that the virtual machine is in an idle state in the current time step.
Optionally, the method further includes, before releasing the virtual machine, the step of:
determining resource information of the virtual machine;
creating a resource snapshot of the virtual machine based on the resource information;
and saving the resource snapshot to a preset mirror image library.
The above method, optionally, further includes:
acquiring creating information of each resource snapshot in the mirror image library according to a preset query period;
determining the creating time length of each resource snapshot based on the creating time in each creating message;
for each resource snapshot, comparing the creation time length of the resource snapshot with a preset storage time length to judge whether the creation time length of the resource snapshot is greater than the storage time length;
and if the creating time length of the resource snapshot is greater than the saving time length, deleting the resource snapshot.
The above method, optionally, further includes:
when a request instruction for applying for a virtual machine sent by a user is received, acquiring resource application information corresponding to the request instruction;
displaying the resource application information to resource allocation personnel, and acquiring an allocation command fed back by the resource allocation personnel based on the resource application information;
if the allocation command represents that the user agrees to apply for the virtual machine, allocating the virtual machine corresponding to the resource application information for the user, and displaying preset application success information to the user;
and if the distribution command representation does not agree with the user to apply for the virtual machine, displaying preset application failure information to the user.
A virtual machine release apparatus, comprising:
the judging unit is used for periodically judging whether the virtual machine is in an overuse state or not after a user successfully applies for the virtual machine;
the generating unit is used for generating the expiration reminding information of the virtual machine when the virtual machine is determined to be in an expiration use state;
the first determining unit is used for displaying the overdue reminding information to the user so as to determine whether the user selects to postpone the use of the virtual machine;
the monitoring unit is used for monitoring the virtual machine to determine whether the virtual machine is in an idle releasable state or not if the user does not postpone the use of the virtual machine;
and the releasing unit is used for releasing the virtual machine when the virtual machine is in an idle releasable state.
The above apparatus, optionally, the determining unit includes:
the first obtaining subunit is configured to obtain, according to a preset time period, application information of the virtual machine, and determine a current time point when the application information of the virtual machine is obtained;
a first judging subunit, configured to compare an end use time point in the application information of the virtual machine with the current time point, so as to judge whether the current time point exceeds the end use time point of the virtual machine;
and the first determining subunit is used for determining that the virtual machine is in an overuse state if the current time point exceeds the end use time point of the virtual machine.
The above apparatus, optionally, the generating unit includes:
the second acquisition subunit is used for acquiring basic information of the virtual machine;
and the generating subunit is used for generating the expiry reminding information of the virtual machine based on the basic information and the application information of the virtual machine.
The above apparatus, optionally, the monitoring unit includes:
a third obtaining subunit, configured to obtain, according to a preset time step, monitoring information corresponding to the current time step of the virtual machine, where the monitoring information includes usage rates of various performance indexes of the virtual machine;
a second judging subunit, configured to judge, based on a usage rate of each of the performance indicators, whether the virtual machine is in an idle state within the current time step;
a second determining subunit, configured to determine, if the virtual machine is in an idle state within the current time step, a total time of the virtual machine continuously in the idle state based on the current time step, where the current time step is a final time step in the total time step;
a third judging subunit, configured to judge whether the time sum is greater than or equal to a preset idle duration, and if the time sum is greater than or equal to the idle duration, obtain the latest login time of the virtual machine, and determine a current time;
a fourth judging subunit, configured to determine an unregistered duration of the virtual machine based on the latest login time and the current time, and compare the unregistered duration with the idle duration to judge whether the virtual machine is in an idle releasable state;
and the third determining subunit is configured to determine that the virtual machine is in an idle releasable state if the unregistered duration is greater than or equal to the idle duration.
Optionally, the above apparatus, wherein the second determining subunit includes:
the judging module is used for judging whether the utilization rate of the performance index is greater than a preset threshold value of the performance index or not and obtaining a judging result of the performance index;
the first determining module is used for determining whether a judgment result which is characterized in that the utilization rate is greater than a preset threshold value exists in each judgment result;
and the second determining module is used for determining that the virtual machine is in an idle state in the current time step if a judgment result that the utilization rate is greater than a preset threshold value does not exist.
Optionally, the apparatus described above, before releasing the virtual machine, further includes:
a second determining unit, configured to determine resource information of the virtual machine;
a creating unit, configured to create a resource snapshot of the virtual machine based on the resource information;
and the saving unit is used for saving the resource snapshot to a preset mirror image library.
The above apparatus, optionally, further comprises:
the first obtaining unit is used for obtaining the creating information of each resource snapshot in the mirror image library according to a preset query period;
a third determining unit, configured to determine a creation time length of each resource snapshot based on the creation time in each creation information;
the comparison unit is used for comparing the creation time length of each resource snapshot with a preset storage time length so as to judge whether the creation time length of each resource snapshot is greater than the storage time length;
and the deleting unit is used for deleting the resource snapshot if the creating time length of the resource snapshot is greater than the saving time length.
The above apparatus, optionally, further comprises:
the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring resource application information corresponding to a request instruction when the request instruction for applying the virtual machine sent by a user is received;
the first display unit is used for displaying the resource application information to resource allocation personnel and acquiring an allocation command fed back by the resource allocation personnel based on the resource application information;
the allocation unit is used for allocating the virtual machine corresponding to the resource application information to the user and displaying preset application success information to the user if the allocation command represents that the user agrees to apply for the virtual machine;
and the second display unit is used for displaying preset application failure information to the user if the distribution command representation does not agree with the user application virtual machine.
A storage medium comprises a stored program, wherein when the program runs, a device where the storage medium is located is controlled to execute a release method of the virtual machine.
An electronic device specifically includes a memory, and one or more programs, where the one or more programs are stored in the memory and configured to be executed by one or more processors to perform the virtual machine release method.
Compared with the prior art, the invention has the following advantages:
the invention provides a virtual machine release method, which comprises the following steps: after a user successfully applies for the virtual machine, periodically judging whether the virtual machine is in an overdue state, generating overdue reminding information of the virtual machine when the virtual machine is determined to be in the overdue state, displaying the overdue reminding information to the user, determining whether the user selects to use the virtual machine in a delayed manner, and monitoring the virtual machine if the user does not use the virtual machine in a delayed manner so as to determine whether the virtual machine is in an idle releasable state; and when the user is in the idle releasable state, releasing the virtual machine. By applying the method and the device, whether the virtual machine is in the overuse state or not can be determined in time, the virtual machine is monitored when the virtual machine is in the overuse state, and the virtual machine is released when the virtual machine is in the idle releasable state, so that cloud service computing resources occupied by the virtual machine can be released, and the situation of shortage of computing resources of cloud service is relieved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a method for releasing a virtual machine according to an embodiment of the present invention;
fig. 2 is a flowchart of a method for determining whether a virtual machine is in an out-of-service state according to an embodiment of the present invention;
fig. 3 is a flowchart of a method for determining whether a virtual machine is in an idle releasable state according to an embodiment of the present invention;
fig. 4 is a flowchart of another method for releasing a virtual machine according to an embodiment of the present invention;
fig. 5 is a flowchart of another method for releasing a virtual machine according to an embodiment of the present invention;
fig. 6 is a device structure diagram of a release device of a virtual machine according to an embodiment of the present invention;
fig. 7 is a device structure diagram of an electronic apparatus according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In this application, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The invention is operational with numerous general purpose or special purpose computing device environments or configurations. For example: personal computers, server computers, hand-held or portable devices, tablet-type devices, multi-processor apparatus, distributed computing environments that include any of the above devices or equipment, and the like.
The invention provides a method for releasing a virtual machine, which can be applied to a system for managing cloud service resources or a platform for scheduling cloud service resources, wherein an execution subject of the method can be the platform or a computer terminal, a processor or a manager of the system, and a flow of the method is shown in fig. 1, and specifically comprises the following steps:
s101, after a user successfully applies for a virtual machine, periodically judging whether the virtual machine is in an overuse state.
In the method provided by the embodiment of the invention, after a user successfully applies for a virtual machine to a cloud service resource manager, whether the virtual machine is in an overdue use state is periodically judged, wherein the cloud service resource manager is used for allocating corresponding computing resources to the user applying for using the cloud service resources, and the virtual machine is composed of the computing resources allocated to the user by the cloud service resource manager, in other words, the virtual machine occupies the computing resources of the cloud service. Further, periodically judging whether the period of the virtual machine in the overuse state is set according to requirements, for example, taking one day as one period or taking ten minutes as one period; further, the term "overdue use state" in this application means that the user has expired the virtual machine use permission, that is, the virtual machine is not in the valid use duration set by the user, and the user cannot control the virtual machine.
S102, when the virtual machine is determined to be in the state of being used for the time limit, generating time limit reminding information of the virtual machine.
In the method provided by the embodiment of the invention, when judging whether the virtual machine is in the overuse state, the judgment is carried out periodically, that is, when the virtual machine is judged not to be in the overuse state in the current period, the next period continues to judge whether the virtual machine is in the overuse state, and the process is circulated until the virtual machine is determined to be in the overuse state. Further, when it is determined that the virtual machine is in the state of being used for a long time, generating the information of reminding the virtual machine of being used for a long time, wherein the information of reminding the long time includes, but is not limited to, data of being used for informing the user that the virtual machine is already in the state of being used for a long time and reminding data of reminding the user whether to select to use the virtual machine for a long time.
S103, displaying the overdue reminding information to the user to determine whether the user selects to postpone the use of the virtual machine.
In the method provided by the embodiment of the invention, the expiration reminding information is displayed to the user, wherein the display mode for the user can be short messages, small program notification information, mails and the like, and the small program is an application program small program which can be communicated with a cloud service resource manager. After the expiration reminding information is displayed to a user, determining whether the user selects to postpone the use of the virtual machine, wherein the process of determining whether the user selects to postpone the use of the virtual machine is as follows:
judging whether an instruction fed back by the user is received within a preset receiving time length;
if an instruction fed back by the user is received in the receiving duration, determining whether the instruction is characterized by selecting to postpone the use of the virtual machine;
if the indication instruction is characterized in that the virtual machine is selected to be used in a postponed mode, determining that the user selects to use the virtual machine in a postponed mode, and prompting the user to submit a postponed application corresponding to the virtual machine so as to postpone the virtual machine; if the indication instruction is characterized in that the virtual machine is not selected to be used in a postponed mode, determining that the user does not select to use the virtual machine in a postponed mode;
and if the instruction fed back by the user is not received within the receiving duration, determining that the user does not select to postpone the use of the virtual machine.
It should be noted that the deferred application includes, but is not limited to, a deferred use duration of the virtual machine, a unique identification number of the virtual machine, user information, and the like; further, the receiving time period may be set according to actual requirements, for example, 10 minutes, 30 minutes, or one hour.
And S104, if the user does not postpone the use of the virtual machine, monitoring the virtual machine to determine whether the virtual machine is in an idle releasable state.
In the method provided by the embodiment of the invention, if the user is determined not to postpone the use of the virtual machine, the virtual machine is monitored to determine whether the virtual machine is in an idle releasable state; it should be noted that, when the virtual machine is monitored, the state identifier of the virtual machine is updated to the monitoring identifier to indicate that the virtual machine is in the monitored state; further, when the virtual machine is monitored, information obtained when the virtual machine is monitored is periodically obtained, whether the virtual machine is in an idle releasable state is determined based on the information obtained when the virtual machine is monitored, and it is further described that when the virtual machine is in the idle releasable state, a user does not use the virtual machine for a long time.
And S105, releasing the virtual machine when the virtual machine is in an idle releasable state.
In the method provided by the embodiment of the invention, in the process of monitoring the virtual machine, when the virtual machine is determined to be in an idle releasable state, the virtual machine is released; in other words, the releasing of the virtual machine is to delete the virtual machine to release the computing resources occupied by the virtual machine, that is, to recycle the computing resources occupied by the virtual machine, so that the resources occupied by the virtual machine are in a distributable state.
The method provided by the embodiment of the invention can be applied to the release of free public cloud service resources, and can also be applied to the release of private cloud service resources or hybrid cloud service resources; after a user successfully applies for a virtual machine, periodically judging whether the virtual machine is in an overuse state; when the virtual machine is determined to be in an overdue use state, generating overdue reminding information of the virtual machine; displaying the expiration reminding information to the user to determine whether the user selects to postpone the use of the virtual machine; if the user is determined not to postpone using the virtual machine, monitoring the virtual machine to determine whether the virtual machine is in an idle releasable state; and releasing the virtual machine if the virtual machine is determined to be in the idle releasable state. By applying the method and the device, when the virtual machine applied for use by the user is in the overdue use state, whether the virtual machine is selected to be used in a delayed mode or not can be determined in time, if the virtual machine is determined not to be selected to be used in a delayed mode, the virtual machine is released when the virtual machine is monitored to be in the idle release state, and therefore computing resources occupied by the virtual machine which is not used by the user for a long time can be released in time, computing resources in a distributable state in cloud service resources can be increased, and the situation that the distributable computing resources are in short supply can be effectively relieved.
In the method provided by the embodiment of the present invention, in the process of releasing the virtual machine, it is necessary to determine whether the virtual machine is in an overuse state, and the determination process is shown in fig. 2 and specifically described as follows:
s201, acquiring application information of the virtual machine according to a preset time period, and determining a current time point when the application information of the virtual machine is acquired.
In the method provided by the embodiment of the invention, the application information of the virtual machine is acquired according to a preset time period, wherein the application information comprises but is not limited to the starting use time point, the ending use time point, the effective use duration and the like of the virtual machine; wherein, the starting time point is the time point when the user successfully applies for the virtual machine; the effective use duration can be set by a user when applying for the virtual machine, and the end use time point of the virtual machine can be determined based on the effective use duration and the start use time point which are set by the user when applying for the virtual machine.
It should be noted that the duration of the time period can be set according to actual requirements, and can be set as a period unit of the time period in minutes, hours or days; for example, 30 minutes, 24 hours, or 4 days may be used as a time period.
S202, comparing the service end time point in the application information of the virtual machine with the current time point to judge whether the current time point exceeds the service end time point of the virtual machine; if the current time point exceeds the end use time point of the virtual machine, executing S203; and if the current time point does not exceed the end use time point of the virtual machine, executing S204.
In the method provided by the embodiment of the present invention, the start time point, the end time point, and the current time point all include year, month, day, hour, minute, and second, and the specific expression form may be: year/month/day/hour/minute/second; assuming that the current time point is 49 minutes and 26 seconds at 15 hours and 18 days of 2020, the use starting time point is 12 hours and 00 minutes and 00 seconds at 6 months and 25 days of 2020, the application use duration is 20 days, and the use ending time point is 12 hours and 00 seconds at 15 days and 15 days of 2020, 7 months and 15 days of 2020, the use ending time point is compared with the current time point, namely 49 minutes and 26 seconds at 15 days and 00 minutes and 00 seconds at 12 days and 12 hours at 15 days and 15 days of 2020, it is obvious that the 49 minutes and 26 seconds at 15 days and 18 days of 2020 exceeds 12 minutes and 00 seconds at 7 months and 15 days of 2020, the current time point is determined to exceed the use ending time point of the virtual machine, and S203 is executed; based on the above assumptions about the current time point and the start time, assuming that the application time duration is 30 days, the end time point is 00 min 00S at 12 h, 00 h, 25 h, 7 h, 25 h, 2020, and it is obviously determined that the current time point does not exceed the end time point of the virtual machine, then S204 is performed.
S203, determining that the virtual machine is in an overuse state.
And S204, determining that the virtual machine is not in an overuse state.
In the method provided by the embodiment of the present invention, if the current time point exceeds the end use time point of the virtual machine, it is determined that the virtual machine is in an overdue use state, in other words, the virtual machine is expired, that is, the use authority of the virtual machine by the user is expired. If the current time does not exceed the end use time point of the virtual machine, it is determined that the virtual machine is not in an overdue use state, in other words, the virtual machine is not expired, that is, the use authority of the user on the virtual machine is not expired. It should be noted that the virtual machine being out of date indicates that the virtual machine has exceeded the usable time.
In the method provided by the embodiment of the invention, whether the virtual machine is in the overuse state is judged according to the preset time period, so that the virtual machine can be periodically judged, if the virtual machine is judged not to be in the overuse state in the current time period, the virtual machine is continuously judged in the next time period, so that the virtual machine in the overuse state can be timely obtained, and the virtual machine in the overuse state can be prevented from being timely discovered.
In the method provided by the embodiment of the present invention, when the virtual machine is in the state of being used for the expiration, the information of the virtual machine used for the expiration needs to be generated, and the specific process is as follows:
acquiring basic information of the virtual machine;
and generating the expiration reminding information of the virtual machine based on the basic information and the application information of the virtual machine.
It should be noted that the basic information of the virtual machine includes, but is not limited to, the size of the computing resource occupied by the virtual machine, the use number of the virtual machine, the name of the user, the contact information of the user, and the like; the generated expiry reminding information includes but is not limited to reminding data, expiry data and the like, and the expiry data includes but is not limited to specific expiry duration, an expiry starting time point and the like of the virtual machine; the reminding data includes but is not limited to name information of the user, contact information of the user, data for reminding the user whether to postpone the use of the virtual machine, and the like.
In the method provided by the embodiment of the invention, the overdue reminding information of the virtual machine is produced based on the basic information and the application information of the virtual machine, and the overdue reminding information is used for reminding a user whether to use the virtual machine in a delayed manner, so that when the virtual machine is determined to be in an overdue state, the overdue reminding information of the virtual machine can be generated in time so as to remind the user that the virtual machine is overdue, whether the user selects to use the virtual machine in a delayed manner is determined, and the virtual machine is processed in the next step based on the selection of the user, so that the computing resources of the cloud service can be effectively managed.
In the method provided in the embodiment of the present invention, when the user is reminded that the virtual machine has expired and it is determined that the user does not defer using the virtual machine, the virtual machine is monitored to determine whether the virtual machine is in an idle releasable state, and a specific flow is shown in fig. 3 and specifically described as follows:
s301, acquiring monitoring information corresponding to the virtual machine and the current time step according to a preset time step, wherein the monitoring information comprises the utilization rate of each performance index of the virtual machine.
In the method provided by the embodiment of the present invention, monitoring information of a virtual machine is obtained according to a preset time step, where the monitoring information is information corresponding to the virtual machine at a current time step, and the monitoring information includes usage rates of various performance indexes of the virtual machine, where the usage rates of the performance indexes include, but are not limited to, usage rates of CPUs, usage rates of memories, IO throughput, network bandwidth occupation conditions, and the like of the virtual machine. Further, the usage rate of each performance index may be one or more, and preferably, only one usage rate of each performance index is used. Further, the time step may be 10 minutes or 1 hour.
S302, judging whether the virtual machine is in an idle state in the current time step length or not based on the utilization rate of each performance index; if the virtual machine is in an idle state within the current time step, executing S303; otherwise, S308 is performed.
In the method provided in the embodiment of the present invention, based on the usage rate of each performance index, it is determined whether the virtual machine is in an idle state within the current time step, where a specific determination process is as follows:
for each performance index, judging whether the utilization rate of the performance index is greater than a preset threshold value of the performance index, and obtaining a judgment result of the performance index;
determining whether a judgment result representing that the utilization rate is greater than a preset threshold value exists in each judgment result;
if the judgment result that the utilization rate is larger than the preset threshold value does not exist, determining that the virtual machine is in an idle state in the current time step; in other words, the utilization rate of the performance index of each virtual machine is greater than the corresponding preset threshold value, so that the virtual machine can be determined to be in an idle state in the current time step;
and if a judgment result which is characterized in that the utilization rate is greater than a preset threshold value exists, determining that the virtual machine is not in an idle state in the current time step.
Further, each performance index has a preset threshold corresponding to the performance index, and the usage rate of the performance index is compared with the corresponding preset threshold to determine whether the usage rate of the performance index is greater than the preset threshold of the performance index; the judging result is used for indicating that the utilization rate of the performance index is greater than the preset threshold value of the performance index or that the utilization rate of the performance index is less than the preset threshold value of the performance index; to further illustrate, the preset threshold of each performance index may be different, and there are many methods for setting the preset threshold of the performance index, one of which is: preset threshold = standard threshold + standard threshold value ratio; for example, preset threshold = standard threshold + standard threshold 5%.
S303, determining the time sum of the virtual machine continuously in the idle state based on the current time step, wherein the current time step is the final time step in the time sum.
It should be noted that, each time step is assumed to be 10 minutes; if the last time step is in an idle state and the last time step is in a non-idle state, the time sum is the time sum of the last time step and the current time step, and the time sum is 20 minutes; assuming that the last time step is in the non-idle state, the sum of time is the current time step, and the sum of time is 10 minutes.
S304, judging whether the time sum is greater than or equal to a preset idle time length; if the sum of the time is greater than or equal to the idle duration, executing S305; otherwise, S308 is performed.
In the method provided by the embodiment of the present invention, the time sum is compared with a preset idle duration to determine whether the time sum is greater than or equal to the idle duration, and the idle duration may be set according to an actual requirement, for example, 5 days, 84 hours, or 8640 minutes. When the sum of the time is greater than or equal to the idle duration, executing S305; when the sum of the times is not greater than or equal to the idle period, S308 is performed.
S305, obtaining the latest login time of the virtual machine, and determining the current time.
In the method provided by the embodiment of the invention, the latest login time is the latest time when the user logs in the virtual machine, and both the latest login time and the current time can be accurate to seconds.
S306, determining the unregistered time length of the virtual machine based on the latest login time and the current time, comparing the unregistered time length with the idle time length, and judging whether the unregistered time length is greater than or equal to the idle time length; if the unregistered duration is greater than or equal to the idle duration, executing S307; if the unregistered duration is less than the idle duration, S308 is executed.
In the method provided by the embodiment of the invention, the unregistered time length of the virtual machine is determined based on the latest login time and the current time, wherein the unregistered time length is the sum of the latest login time and the current time; comparing the unregistered time length with the idle time length to judge whether the virtual machine is in an idle releasable state; in other words, it is determined whether the virtual machine is in the idle releasable state based on the comparison result of the unregistered duration and the idle time.
S307, determining that the virtual machine is in an idle releasable state.
And S308, determining that the virtual machine is not in an idle releasable state.
In the method provided by the embodiment of the invention, when the virtual machine is determined to be in the idle releasable state, the monitoring of the virtual machine can be finished. When it is determined that the virtual machine is not in the idle releasable state, the monitoring of the virtual machine cannot be finished, monitoring information corresponding to the virtual machine in the next time step needs to be acquired, and whether the virtual machine is in the idle releasable state is continuously judged.
In the method provided by the embodiment of the invention, in the process of monitoring the virtual machine, when the sum of the time that the virtual machine is continuously in the idle state is greater than the preset idle time and the unregistered time is greater than the idle time, the virtual machine can be determined to be in the idle releasable state, that is, the virtual machine is determined to be unregistered for a long time by a user and to be in the idle state for a long time, and the virtual machine meets the release condition. Therefore, the virtual machines which are not logged in by the user for a long time and are in the idle state for a long time can be accurately screened out, the process is simple and rapid, manual participation is not needed, the time spent on screening the virtual machines which are not logged in by the user for a long time and are in the idle state for a long time is effectively reduced, and the screening efficiency of the virtual machines is improved.
In the method provided by the embodiment of the present invention, in order to save the record of using the virtual machine by the user and avoid the user from subsequently using the virtual machine, before releasing the virtual machine, a resource snapshot of the virtual machine may be created, and the specific process is as follows:
determining resource information of the virtual machine;
creating a resource snapshot of the virtual machine based on the resource information;
and saving the resource snapshot to a preset mirror image library.
In the method provided by the embodiment of the present invention, the resource information of the virtual machine is current computing resource state information of the virtual machine and record information of the use of the virtual machine by a user, the resource snapshot of the virtual machine created based on the resource information is marked as a release-type snapshot, and the release-type snapshot indicates that the virtual machine corresponding to the resource snapshot has been released; by applying the method and the device, the resource snapshot containing the current computing resource state of the virtual machine and the record information of the use of the virtual machine by the user can be created, and the resource snapshot is stored in the mirror image library, so that the virtual machine can be recovered based on the resource snapshot if the subsequent user needs to use the virtual machine.
In the method provided by the embodiment of the present invention, when the resource snapshot stored in the mirror image library is too many, the resource snapshot in the mirror image library needs to be periodically cleaned in order to avoid the resource snapshot occupying too many storage resources, and the specific process is as follows:
acquiring creating information of each resource snapshot in the mirror image library according to a preset query period;
determining the creating time length of each resource snapshot based on the creating time in each creating message;
for each resource snapshot, comparing the creation time length of the resource snapshot with a preset storage time length to judge whether the creation time length of the resource snapshot is greater than the storage time length;
if the creation time length of the resource snapshot is longer than the storage time length, deleting the resource snapshot;
and if the creating time length of the resource snapshot is not greater than the saving time length, not deleting the resource snapshot.
In the method provided by the embodiment of the present invention, the query period may be a period of 20 minutes, or a period of one day, and the creation information includes, but is not limited to, creation time of the resource snapshot, and size of occupied storage resources; and determining the current acquisition time when acquiring the creation information of each resource snapshot in the mirror image library. Preferably, when the creation time of each resource snapshot is determined, the determination may be performed based on the current acquisition time and the creation time of the resource snapshot, that is, the creation time of the resource snapshot is the time from the creation time to the current acquisition time, for example, the creation time of the resource snapshot a is 9 o 'clock at 7, 15, and 18, 2020, 9 o' clock at 7, 18, and 2020, the creation time of the resource snapshot is 3 days, that is, 72 hours; if the storage time is 70 hours, the resource snapshot A needs to be deleted; assuming a save time of 240 hours, resource snapshot A need not be deleted.
In the method provided by the embodiment of the invention, the resource snapshot with the creation time length being longer than the storage time length is deleted by periodically judging whether the creation time length of the resource snapshot in the mirror image library is longer than the storage time length, so that the resource snapshot in the mirror image library can be periodically cleaned, and the storage resource in the mirror image library is ensured not to be in a shortage state.
In the method provided by the embodiment of the present invention, when a user needs to use a virtual machine, the user needs to apply for the virtual machine, and a specific application process is as follows:
when a request instruction for applying for a virtual machine sent by a user is received, acquiring resource application information corresponding to the request instruction;
displaying the resource application information to resource allocation personnel, and acquiring an allocation command fed back by the resource allocation personnel based on the resource application information;
if the allocation command represents that the user agrees to apply for the virtual machine, allocating the virtual machine corresponding to the resource application information for the user, and displaying preset application success information to the user;
and if the distribution command representation does not agree with the user to apply for the virtual machine, displaying preset application failure information to the user.
In the method provided by the embodiment of the present invention, the resource application information includes, but is not limited to, information of a use application, a required resource, and a use duration of the virtual machine, which are requested by the user. And the resource allocation personnel determines whether to allocate the virtual machine to the user or not based on the resource application information and the allocation state of the current cloud service resource. It should be noted that the duration of the virtual machine requested by the user needs to be within a reasonable range, that is, the duration of the virtual machine requested by the user needs to be within a preset range, for example, the range may be 3 days to 90 days.
In the method provided by the embodiment of the invention, the resource application information sent by the user is checked by the resource allocation personnel, and whether the virtual machine needs to be allocated to the user is reasonably judged, so that the cloud service resources can be reasonably scheduled.
Referring to fig. 4, a flowchart of monitoring a virtual machine according to an embodiment of the present invention is specifically described as follows:
s401, a user applies for a virtual machine.
S402, whether a virtual machine is allocated to the user or not is judged, and if the virtual machine is allocated to the user, S403 is executed; if the virtual machine is not allocated to the user, S407 is executed.
And S403, using the virtual machine by the user.
S404, judging whether the virtual machine is in an overuse state, and executing S405 if the virtual machine is in the overuse state; if the virtual machine is not in the state of being used for the period exceeding, S403 is executed.
S405, determining whether the user selects the virtual machine to be used in a postponed mode, and executing S403 if the user selects the virtual machine to be used in a postponed mode; if it is determined that the user chooses not to defer using the virtual machine, S406 is performed.
S406, monitoring the virtual machine, and releasing the virtual machine when the virtual machine is in an idle releasable state.
And S407, ending.
In the method provided by the embodiment of the invention, when a user applies for a virtual machine occupying free public cloud service resources, the user needs to select the use duration, the duration from 10 days to 90 days can be selected, and the user can completely control and use the resources of the virtual machine within the application use duration; when the application use duration is longer than the application use duration, the virtual machine is considered to be expired, and the virtual machine is in an overdue use state, for example, the use duration of the virtual machine B applied by the user is 13 days, that is, 312 hours, that is, the application use duration is from 6/1/9 click in 2020 to 6/14/9 click in 2020, and is 13 days in total; assuming that it is now No. 6/15 of 2020, virtual machine B, which the user applied for, has expired.
After determining that the virtual machine is expired, monitoring the virtual machine, and releasing the virtual machine when the virtual machine is in an idle releasable state, where a specific flow may refer to fig. 5, and the specific description is as follows:
s501, monitoring information of the expired virtual machines is obtained regularly.
S502, judging whether the virtual machine is in an idle releasable state or not based on the monitoring information of the virtual machine; if the virtual machine is determined to be in the idle releasable state, executing S503; if it is determined that the virtual machine is not in the idle releasable state, S504 is performed.
S503, creating a resource snapshot of the virtual machine and releasing the virtual machine.
And S504, ending.
In the method provided by the embodiment of the present invention, after the virtual machine expires, the monitoring information of the virtual machine is periodically obtained, that is, the monitoring information of the virtual machine is obtained according to a preset time step, for example, the monitoring information of the virtual machine can be obtained every 10 minutes, and the monitoring information includes usage rates of various performance indexes, for example: the utilization rate of a CPU (Central processing Unit), the utilization rate of a memory, IO (input output) throughput, the occupation condition of network bandwidth and the like are obtained, and whether the virtual machine is in an idle releasable state or not is judged based on monitoring information every time the monitoring information of the virtual machine is obtained; firstly, judging whether the utilization rate of each performance index is greater than a preset threshold corresponding to the performance index, or judging whether the utilization rate of each performance index is greater than 5% of the threshold corresponding to the performance index; if the utilization rate of each performance index is greater than the corresponding preset threshold value, determining that the virtual machine is in an idle state, and determining whether the sum of the continuous idle-state durations of the virtual machine is greater than the preset idle duration; further, if the sum of the duration of the virtual machine continuously in the idle state is greater than the idle duration, determining the latest login time and the current time of the virtual machine, determining the unregistered duration based on the latest login time and the current time, comparing the unregistered duration with the idle duration, and when the unregistered duration is greater than the idle duration, determining that the virtual machine is in the idle state, creating a resource snapshot of the virtual machine, and releasing the virtual machine. Further, assuming that the idle duration is 5 days, the condition to be satisfied when the virtual machine is in the idle releasable state is that the virtual machine is continuously in the idle state for more than 5 days, and the virtual machine is not logged in for 5 consecutive days.
Further, after the resource snapshot of the virtual machine is created, the creation time of the resource snapshot is recorded, the resource snapshot is marked as a release-type snapshot, the resource snapshot marked as the release-type snapshot in the mirror image library is periodically inquired, and the resource snapshot with the creation time longer than 20 days is deleted, so that the condition that the mirror image library occupies too large memory resources is avoided.
Corresponding to the method described in fig. 1, an embodiment of the present invention further provides a virtual machine releasing apparatus, which is used for implementing the method in fig. 1 specifically, and the virtual machine releasing apparatus provided in the embodiment of the present invention may be applied to a computer terminal or various mobile devices, and a schematic structural diagram of the virtual machine releasing apparatus is shown in fig. 6, and specifically includes:
the judging unit 601 is configured to periodically judge whether the virtual machine is in an out-of-date use state after a user successfully applies for the virtual machine;
a generating unit 602, configured to generate an expiration reminding message of the virtual machine when it is determined that the virtual machine is in an expiration use state;
a first determining unit 603, configured to show the expiration reminding information to the user to determine whether the user selects to defer using the virtual machine;
a monitoring unit 604, configured to monitor the virtual machine to determine whether the virtual machine is in an idle releasable state if it is determined that the user does not defer using the virtual machine;
a releasing unit 605, configured to release the virtual machine when the virtual machine is in an idle releasable state.
In the device provided by the embodiment of the invention, after a user successfully applies for a virtual machine, whether the virtual machine is in an overuse state is periodically judged; when the virtual machine is determined to be in an overdue use state, generating overdue reminding information of the virtual machine; displaying the expiration reminding information to the user to determine whether the user selects to postpone the use of the virtual machine; if the user is determined not to postpone using the virtual machine, monitoring the virtual machine to determine whether the virtual machine is in an idle releasable state; and releasing the virtual machine if the virtual machine is determined to be in the idle releasable state. By applying the method and the device, when the virtual machine applied for use by the user is in the overdue use state, whether the virtual machine is selected to be used in a delayed mode or not can be determined in time, if the virtual machine is determined not to be selected to be used in a delayed mode, the virtual machine is released when the virtual machine is monitored to be in the idle release state, and therefore computing resources occupied by the virtual machine which is not used by the user for a long time can be released in time, computing resources in a distributable state in cloud service resources can be increased, and the situation that the distributable computing resources are in short supply can be effectively relieved.
Based on the foregoing solution, in the apparatus provided in the embodiment of the present invention, the determining unit 601 includes:
the first obtaining subunit is configured to obtain, according to a preset time period, application information of the virtual machine, and determine a current time point when the application information of the virtual machine is obtained;
a first judging subunit, configured to compare an end use time point in the application information of the virtual machine with the current time point, so as to judge whether the current time point exceeds the end use time point of the virtual machine;
and the first determining subunit is used for determining that the virtual machine is in an overuse state if the current time point exceeds the end use time point of the virtual machine.
Based on the foregoing solution, in the apparatus provided in the embodiment of the present invention, the generating unit 602 includes:
the second acquisition subunit is used for acquiring basic information of the virtual machine;
and the generating subunit is used for generating the expiry reminding information of the virtual machine based on the basic information and the application information of the virtual machine.
Based on the foregoing solution, in the apparatus provided in the embodiment of the present invention, the monitoring unit 604 includes:
a third obtaining subunit, configured to obtain, according to a preset time step, monitoring information corresponding to the current time step of the virtual machine, where the monitoring information includes usage rates of various performance indexes of the virtual machine;
a second judging subunit, configured to judge, based on a usage rate of each of the performance indicators, whether the virtual machine is in an idle state within the current time step;
a second determining subunit, configured to determine, if the virtual machine is in an idle state within the current time step, a total time of the virtual machine continuously in the idle state based on the current time step, where the current time step is a final time step in the total time step;
a third judging subunit, configured to judge whether the time sum is greater than or equal to a preset idle duration, and if the time sum is greater than or equal to the idle duration, obtain the latest login time of the virtual machine, and determine a current time;
a fourth judging subunit, configured to determine an unregistered duration of the virtual machine based on the latest login time and the current time, and compare the unregistered duration with the idle duration to judge whether the virtual machine is in an idle releasable state;
and the third determining subunit is configured to determine that the virtual machine is in an idle releasable state if the unregistered duration is greater than or equal to the idle duration.
Based on the foregoing solution, in the apparatus provided in the embodiment of the present invention, the second determining subunit includes:
the judging module is used for judging whether the utilization rate of the performance index is greater than a preset threshold value of the performance index or not and obtaining a judging result of the performance index;
the first determining module is used for determining whether a judgment result which is characterized in that the utilization rate is greater than a preset threshold value exists in each judgment result;
and the second determining module is used for determining that the virtual machine is in an idle state in the current time step if a judgment result that the utilization rate is greater than a preset threshold value does not exist.
Based on the foregoing solution, in the apparatus provided in the embodiment of the present invention, before releasing the virtual machine, the apparatus further includes:
a second determining unit, configured to determine resource information of the virtual machine;
a creating unit, configured to create a resource snapshot of the virtual machine based on the resource information;
and the saving unit is used for saving the resource snapshot to a preset mirror image library.
Based on the above scheme, the apparatus provided in the embodiment of the present invention further includes:
the first obtaining unit is used for obtaining the creating information of each resource snapshot in the mirror image library according to a preset query period;
a third determining unit, configured to determine a creation time length of each resource snapshot based on the creation time in each creation information;
the comparison unit is used for comparing the creation time length of each resource snapshot with a preset storage time length so as to judge whether the creation time length of each resource snapshot is greater than the storage time length;
and the deleting unit is used for deleting the resource snapshot if the creating time length of the resource snapshot is greater than the saving time length.
Based on the above scheme, the apparatus provided in the embodiment of the present invention further includes:
the second acquisition unit is used for acquiring resource application information corresponding to a request instruction sent by a user when the request instruction for applying for the virtual machine is received;
the first display unit is used for displaying the resource application information to resource allocation personnel and acquiring an allocation command fed back by the resource allocation personnel based on the resource application information;
the allocation unit is used for allocating the virtual machine corresponding to the resource application information to the user and displaying preset application success information to the user if the allocation command represents that the user agrees to apply for the virtual machine;
and the second display unit is used for displaying preset application failure information to the user if the distribution command representation does not agree with the user application virtual machine.
An embodiment of the present invention further provides a storage medium, where the storage medium includes a stored program, where, when the program runs, a device in which the storage medium is located is controlled to execute a method for releasing the following virtual machines, where the method includes:
after a user successfully applies for a virtual machine, periodically judging whether the virtual machine is in an overuse state;
when the virtual machine is determined to be in an overdue use state, generating overdue reminding information of the virtual machine;
displaying the expiration reminding information to the user to determine whether the user selects to postpone the use of the virtual machine;
if the user is determined not to postpone using the virtual machine, monitoring the virtual machine to determine whether the virtual machine is in an idle releasable state;
releasing the virtual machine when the virtual machine is in an idle releasable state.
An electronic device is provided in an embodiment of the present invention, and its structural diagram is shown in fig. 7, which specifically includes a memory 701 and one or more programs 702, where the one or more programs 702 are stored in the memory 701 and configured to be executed by one or more processors 703 to perform the following operations of the one or more programs 702:
after a user successfully applies for a virtual machine, periodically judging whether the virtual machine is in an overuse state;
when the virtual machine is determined to be in an overdue use state, generating overdue reminding information of the virtual machine;
displaying the expiration reminding information to the user to determine whether the user selects to postpone the use of the virtual machine;
if the user is determined not to postpone using the virtual machine, monitoring the virtual machine to determine whether the virtual machine is in an idle releasable state;
releasing the virtual machine when the virtual machine is in an idle releasable state.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, the system or system embodiments are substantially similar to the method embodiments and therefore are described in a relatively simple manner, and reference may be made to some of the descriptions of the method embodiments for related points. The above-described system and system embodiments are only illustrative, wherein the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A method for releasing a virtual machine, comprising:
after a user successfully applies for a virtual machine, periodically judging whether the virtual machine is in an overuse state;
when the virtual machine is determined to be in an overdue use state, generating overdue reminding information of the virtual machine;
displaying the expiration reminding information to the user to determine whether the user selects to postpone the use of the virtual machine;
if the user is determined not to postpone using the virtual machine, monitoring the virtual machine to determine whether the virtual machine is in an idle releasable state;
releasing the virtual machine when the virtual machine is in an idle releasable state;
wherein the monitoring the virtual machine to determine whether the virtual machine is in an idle releasable state comprises:
acquiring monitoring information corresponding to the virtual machine and the current time step according to a preset time step, wherein the monitoring information comprises the utilization rate of each performance index of the virtual machine;
judging whether the virtual machine is in an idle state in the current time step length or not based on the utilization rate of each performance index;
if the virtual machine is in an idle state in the current time step, determining the time sum of the virtual machine continuously in the idle state based on the current time step, wherein the current time step is the final time step in the time sum;
judging whether the time sum is greater than or equal to a preset idle time, if so, acquiring the latest login time of the virtual machine, and determining the current time;
determining the unregistered time length of the virtual machine based on the latest login time and the current time, and comparing the unregistered time length with the idle time length to judge whether the virtual machine is in an idle releasable state;
and if the unregistered time length is greater than or equal to the idle time length, determining that the virtual machine is in an idle releasable state.
2. The method of claim 1, wherein the periodically determining whether the virtual machine is in an out-of-date state comprises:
acquiring application information of the virtual machine according to a preset time period, and determining a current time point when the application information of the virtual machine is acquired;
comparing the service end time point in the application information of the virtual machine with the current time point to judge whether the current time point exceeds the service end time point of the virtual machine;
and if the current time point exceeds the end use time point of the virtual machine, determining that the virtual machine is in an overuse state.
3. The method of claim 2, wherein the generating of the expiration reminder information for the virtual machine comprises:
acquiring basic information of the virtual machine;
and generating the expiration reminding information of the virtual machine based on the basic information and the application information of the virtual machine.
4. The method of claim 1, wherein determining whether the virtual machine is in an idle state within the current time step based on the usage of each of the performance indicators comprises:
for each performance index, judging whether the utilization rate of the performance index is greater than a preset threshold value of the performance index, and obtaining a judgment result of the performance index;
determining whether a judgment result representing that the utilization rate is greater than a preset threshold value exists in each judgment result;
and if the judgment result that the utilization rate is larger than the preset threshold value does not exist, determining that the virtual machine is in an idle state in the current time step.
5. The method of claim 1, prior to releasing the virtual machine, further comprising:
determining resource information of the virtual machine;
creating a resource snapshot of the virtual machine based on the resource information;
and saving the resource snapshot to a preset mirror image library.
6. The method of claim 5, further comprising:
acquiring creating information of each resource snapshot in the mirror image library according to a preset query period;
determining the creating time length of each resource snapshot based on the creating time in each creating message;
for each resource snapshot, comparing the creation time length of the resource snapshot with a preset storage time length to judge whether the creation time length of the resource snapshot is greater than the storage time length;
and if the creating time length of the resource snapshot is greater than the saving time length, deleting the resource snapshot.
7. The method of claim 1, further comprising:
when a request instruction for applying for a virtual machine sent by a user is received, acquiring resource application information corresponding to the request instruction;
displaying the resource application information to resource allocation personnel, and acquiring an allocation command fed back by the resource allocation personnel based on the resource application information;
if the allocation command represents that the user agrees to apply for the virtual machine, allocating the virtual machine corresponding to the resource application information for the user, and displaying preset application success information to the user;
and if the distribution command representation does not agree with the user to apply for the virtual machine, displaying preset application failure information to the user.
8. A virtual machine release apparatus, comprising:
the judging unit is used for periodically judging whether the virtual machine is in an overuse state or not after a user successfully applies for the virtual machine;
the generating unit is used for generating the expiration reminding information of the virtual machine when the virtual machine is determined to be in an expiration use state;
the first determining unit is used for displaying the overdue reminding information to the user so as to determine whether the user selects to postpone the use of the virtual machine;
the monitoring unit is used for monitoring the virtual machine to determine whether the virtual machine is in an idle releasable state or not if the user does not postpone the use of the virtual machine;
the release unit is used for releasing the virtual machine when the virtual machine is in an idle releasable state;
wherein, the monitoring unit includes:
a third obtaining subunit, configured to obtain, according to a preset time step, monitoring information corresponding to the current time step of the virtual machine, where the monitoring information includes usage rates of various performance indexes of the virtual machine;
a second judging subunit, configured to judge, based on a usage rate of each of the performance indicators, whether the virtual machine is in an idle state within the current time step;
a second determining subunit, configured to determine, if the virtual machine is in an idle state within the current time step, a total time of the virtual machine continuously in the idle state based on the current time step, where the current time step is a final time step in the total time step;
a third judging subunit, configured to judge whether the time sum is greater than or equal to a preset idle duration, and if the time sum is greater than or equal to the idle duration, obtain the latest login time of the virtual machine, and determine a current time;
a fourth judging subunit, configured to determine an unregistered duration of the virtual machine based on the latest login time and the current time, and compare the unregistered duration with the idle duration to judge whether the virtual machine is in an idle releasable state;
and the third determining subunit is configured to determine that the virtual machine is in an idle releasable state if the unregistered duration is greater than or equal to the idle duration.
9. A storage medium, characterized in that the storage medium comprises a stored program, wherein when the program runs, a device in which the storage medium is located is controlled to execute the virtual machine release method according to any one of claims 1 to 7.
10. An electronic device comprising a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by one or more processors to perform the method of freeing a virtual machine according to any one of claims 1 to 7.
CN202010833574.2A 2020-08-18 2020-08-18 Virtual machine release method and device, storage medium and electronic equipment Active CN111736961B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010833574.2A CN111736961B (en) 2020-08-18 2020-08-18 Virtual machine release method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010833574.2A CN111736961B (en) 2020-08-18 2020-08-18 Virtual machine release method and device, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN111736961A CN111736961A (en) 2020-10-02
CN111736961B true CN111736961B (en) 2020-12-01

Family

ID=72658612

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010833574.2A Active CN111736961B (en) 2020-08-18 2020-08-18 Virtual machine release method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN111736961B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115328666B (en) * 2022-10-14 2023-07-14 浪潮电子信息产业股份有限公司 Device scheduling method, system, electronic device and computer readable storage medium
CN116756091A (en) * 2023-08-22 2023-09-15 深圳富联富桂精密工业有限公司 Snapshot management method, electronic device and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104598291A (en) * 2014-12-02 2015-05-06 中广核工程有限公司 Recovery method and system of nuclear power service system virtual server resources
CN105468435A (en) * 2015-12-25 2016-04-06 赛特斯信息科技股份有限公司 NFV dynamic resource distribution method
CN109358947A (en) * 2018-10-08 2019-02-19 郑州云海信息技术有限公司 A kind of realization method and system of virtual machine snapshot
CN109558209A (en) * 2018-11-20 2019-04-02 郑州云海信息技术有限公司 A kind of monitoring method for virtual machine
CN111427668A (en) * 2020-04-15 2020-07-17 成都成信高科信息技术有限公司 Virtual resource automatic management method in cloud computing environment

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4906674B2 (en) * 2007-10-25 2012-03-28 株式会社日立製作所 Virtual computer system and control method thereof
CN110197368B (en) * 2018-03-21 2024-02-13 腾讯科技(深圳)有限公司 Cloud resource processing method, device and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104598291A (en) * 2014-12-02 2015-05-06 中广核工程有限公司 Recovery method and system of nuclear power service system virtual server resources
CN105468435A (en) * 2015-12-25 2016-04-06 赛特斯信息科技股份有限公司 NFV dynamic resource distribution method
CN109358947A (en) * 2018-10-08 2019-02-19 郑州云海信息技术有限公司 A kind of realization method and system of virtual machine snapshot
CN109558209A (en) * 2018-11-20 2019-04-02 郑州云海信息技术有限公司 A kind of monitoring method for virtual machine
CN111427668A (en) * 2020-04-15 2020-07-17 成都成信高科信息技术有限公司 Virtual resource automatic management method in cloud computing environment

Also Published As

Publication number Publication date
CN111736961A (en) 2020-10-02

Similar Documents

Publication Publication Date Title
CN111736961B (en) Virtual machine release method and device, storage medium and electronic equipment
CN108052384B (en) Task processing method, service platform and electronic equipment
US8782659B2 (en) Allocation of processing tasks between processing resources
CN107343023B (en) Resource allocation method and device in Mesos management cluster and electronic equipment
CN111104227B (en) Resource control method and device of K8s platform and related components
CN110599148B (en) Cluster data processing method and device, computer cluster and readable storage medium
CN109858655B (en) Method and system for reserved test
US11068317B2 (en) Information processing system and resource allocation method
CN113886069A (en) Resource allocation method and device, electronic equipment and storage medium
CN114064229A (en) Cluster node processing method, system, device and medium
CN112052133A (en) Service system monitoring method and device based on Kubernetes
CN114598484B (en) Certificate updating method, device, cluster and storage medium
CN110750350B (en) Large resource scheduling method, system, device and readable storage medium
CN108521524B (en) Agent collaborative task management method and device, computer equipment and storage medium
US20180027049A1 (en) Computing system and method of operating the computer system
CN111767199A (en) Resource management method, device, equipment and system based on batch processing operation
CN112860387A (en) Distributed task scheduling method and device, computer equipment and storage medium
CN115169925A (en) Battery swap station resource configuration method and device, electronic equipment and storage medium
CN114675954A (en) Task scheduling method and device
CN110046319B (en) Social media information acquisition method, device, system, equipment and storage medium
CN115168057B (en) Resource scheduling method and device based on k8s cluster
CN116483546B (en) Distributed training task scheduling method, device, equipment and storage medium
CN114780170B (en) Container resource configuration method, device, equipment and storage medium
EP4300892A1 (en) Resource scheduling method and apparatus, computer device, system, and storage medium
CN113886040A (en) Task scheduling method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant