CN115373793A - Resource allocation method and device, electronic equipment and storage medium - Google Patents

Resource allocation method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115373793A
CN115373793A CN202110548208.7A CN202110548208A CN115373793A CN 115373793 A CN115373793 A CN 115373793A CN 202110548208 A CN202110548208 A CN 202110548208A CN 115373793 A CN115373793 A CN 115373793A
Authority
CN
China
Prior art keywords
virtual machine
resource
occupancy rate
information
preset
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.)
Pending
Application number
CN202110548208.7A
Other languages
Chinese (zh)
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.)
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software Technology Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software Technology Co Ltd
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 China Mobile Communications Group Co Ltd, China Mobile Suzhou Software Technology Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN202110548208.7A priority Critical patent/CN115373793A/en
Publication of CN115373793A publication Critical patent/CN115373793A/en
Pending legal-status Critical Current

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/5061Partitioning or combining of resources
    • G06F9/5072Grid computing
    • 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/5061Partitioning or combining of resources
    • G06F9/5077Logical partitioning of resources; Management or configuration of virtualized resources
    • 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
    • G06F2009/4557Distribution of virtual machine instances; Migration and load balancing
    • 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
    • G06F2009/45575Starting, stopping, suspending or resuming virtual machine instances
    • 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
    • G06F2009/45583Memory management, e.g. access or allocation
    • 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
    • G06F2009/45591Monitoring or debugging support

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the application provides a resource configuration method, a resource configuration device, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring resource occupancy rate information of the virtual machine; comparing the resource occupancy rate information of the virtual machine with a preset resource occupancy rate to obtain a comparison result; and according to the comparison result and the resource capacity which can be occupied by the virtual machine, carrying out resource configuration on the virtual machine. Based on the resource configuration method provided by the application, the resource occupation condition of the virtual machine in the cloud platform can be flexibly controlled.

Description

Resource allocation method and device, electronic equipment and storage medium
Technical Field
The embodiment of the application relates to the technical field of cloud computing, in particular to a resource configuration method and device, electronic equipment and a computer storage medium.
Background
A plurality of Virtual Machines (VMs) are deployed on a physical Machine in a Cloud Platform (Cloud Platform), the Virtual machines can be used to provide Cloud services to different users, and when a user orders a Cloud Service, performance indexes of Cloud computing resources provided by the Cloud Service are different, which shows that the higher the performance index of the Cloud computing resources provided by the user and available for the Virtual Machine to occupy, the higher the price of the Cloud Service, where the performance index of the Cloud computing resources includes resource capacity of the Cloud computing resources available for the Virtual Machine to occupy. In practical application, the Resource occupancy rate (Utility) of the virtual machine may reflect a ratio of a Resource Capacity actually occupied by the virtual machine to a Resource Capacity (Resource Capacity) available for the virtual machine to occupy.
In the related art, under the condition that the resource occupancy rate of the virtual machine is not controlled, the resource occupancy rate of part of the virtual machines in the cloud platform may be too high, so that resource occupancy conflicts exist among a plurality of virtual machines, and the system stability of the cloud platform in providing the cloud service is affected. Therefore, how to flexibly control the resource occupation situation of the virtual machine in the cloud platform becomes an important problem to be solved urgently.
Disclosure of Invention
The embodiment of the application provides a resource configuration method and device, electronic equipment and a computer storage medium, which can realize flexible control of resource occupation conditions of virtual machines in a cloud platform.
The resource allocation method provided by the embodiment of the application comprises the following steps:
acquiring resource occupancy rate information of the virtual machine;
comparing the resource occupancy rate information of the virtual machine with a preset resource occupancy rate to obtain a comparison result;
and according to the comparison result and the resource capacity which can be occupied by the virtual machine, carrying out resource configuration on the virtual machine.
In an implementation manner, the performing resource configuration on the virtual machine according to the comparison result and the resource capacity that can be occupied by the virtual machine includes:
acquiring information of preset resource capacity within a jth preset time length T; j is a natural number greater than 0, and T is a time length value greater than 0;
when the resource occupancy rate information is greater than the preset resource occupancy rate within the jth preset time length T, closing resources with preset resource capacity for the virtual machine within the jth +1 th preset time length T;
and when the resource occupancy rate information is smaller than the preset resource occupancy rate within the jth preset time length T, opening resources with preset resource capacity for the virtual machine within the jth +1 th preset time length T.
In an implementation manner, the obtaining information of the preset resource capacity within the jth preset time length T includes:
acquiring information of a first resource amount, wherein the information of the first resource amount is an accumulated value of the resource amount of any type of resource actually occupied by the virtual machine in the jth preset time length T; the host is any physical machine in cluster resources, and at least one virtual machine is deployed on the host;
acquiring information of a second resource amount, wherein the information of the second resource amount is an accumulated value of the resource amount of any type of resource of a host machine which can be occupied by the virtual machine within the jth preset time length T;
and acquiring the information of the preset resource capacity within the jth preset time length T according to the difference value information of the first resource quantity and the second resource quantity.
In an implementation manner, the performing resource configuration on the virtual machine according to the comparison result and the resource capacity that can be occupied by the virtual machine includes:
under the condition of repairing the operating system of the virtual machine, adjusting the resource capacity which can be occupied by the virtual machine according to the comparison result to obtain the adjusted resource capacity;
and according to the comparison result and the adjusted resource capacity, performing resource allocation on the virtual machine.
In one implementation manner, the performing resource configuration on the virtual machine according to the comparison result and the adjusted resource capacity includes:
when the resource occupancy rate information of the virtual machine is greater than the preset resource occupancy rate, improving the resource capacity occupied by the virtual machine; and according to the improved resource capacity, carrying out resource configuration on the virtual machine.
In one implementation, the repairing an operating system in which the virtual machine is located includes:
when the operation system of the virtual machine runs abnormally, a repair instruction for repairing the operation system of the virtual machine is generated;
and repairing the operating system of the virtual machine according to the repairing instruction and the operating system image file corresponding to the operating system of the virtual machine.
In one implementation, the obtaining resource occupancy information of the virtual machine includes:
and acquiring the resource occupancy rate information of at least one virtual machine on the host where the virtual machine is located.
An embodiment of the present application provides a resource allocation apparatus, including:
the detection module is used for acquiring the resource occupancy rate information of the virtual machine;
the processing module is used for comparing the resource occupancy rate information of the virtual machine with a preset resource occupancy rate to obtain a comparison result;
and the configuration module is used for carrying out resource configuration on the virtual machine according to the comparison result and the resource capacity occupied by the virtual machine.
In an implementation manner, the configuring module is configured to perform resource configuration on the virtual machine according to the comparison result and a resource capacity that can be occupied by the virtual machine, and includes:
acquiring information of preset resource capacity within a jth preset time length T; j is a natural number greater than 0, and T is a time length value greater than 0;
when the resource occupancy rate information is greater than the preset resource occupancy rate within the jth preset time length T, closing the resources with the preset resource capacity for the virtual machine within the jth +1 th preset time length T;
and when the resource occupancy rate information is smaller than the preset resource occupancy rate within the jth preset time length T, opening the resources with the preset resource capacity for the virtual machine within the jth +1 th preset time length T.
In an implementation manner, the configuring module is configured to acquire information of a preset resource capacity within a jth preset time length T, and includes:
acquiring information of a first resource amount, wherein the information of the first resource amount is an accumulated value of the resource amount of any type of resource actually occupied by the virtual machine in the jth preset time length T; the host is any physical machine in cluster resources, and at least one virtual machine is deployed on the host;
acquiring information of a second resource amount, wherein the information of the second resource amount is an accumulated value of the resource amount of any type of resource of a host machine which can be occupied by the virtual machine within the jth preset time length T;
and acquiring the information of the preset resource capacity within the jth preset time length T according to the difference value information of the first resource quantity and the second resource quantity.
In an implementation manner, the configuring module is configured to perform resource configuration on the virtual machine according to the comparison result and a resource capacity that can be occupied by the virtual machine, and includes:
under the condition of repairing the operating system of the virtual machine, adjusting the resource capacity which can be occupied by the virtual machine according to the comparison result to obtain the adjusted resource capacity;
and according to the comparison result and the adjusted resource capacity, performing resource configuration on the virtual machine.
In an implementation manner, the configuring module is configured to perform resource configuration on the virtual machine according to the comparison result and the adjusted resource capacity, and includes:
when the resource occupancy rate information of the virtual machine is greater than the preset resource occupancy rate, improving the resource capacity occupied by the virtual machine; and according to the improved resource capacity, carrying out resource configuration on the virtual machine.
In one implementation manner, the apparatus further includes a repair module, where the repair module is configured to repair an operating system where the virtual machine is located, and the repair module includes:
when the operation system of the virtual machine runs abnormally, a repair instruction for repairing the operation system of the virtual machine is generated;
and repairing the operating system of the virtual machine according to the repairing instruction and the operating system image file corresponding to the operating system of the virtual machine.
In one implementation manner, the detecting module is configured to obtain resource occupancy rate information of a virtual machine, and includes:
and acquiring the resource occupancy rate information of at least one virtual machine on the host where the virtual machine is located.
The application provides an electronic device, including: at least one processor, at least one memory, and computer program instructions stored in the memory that, when executed by the processor, implement any of the data processing methods described above.
The present application provides a computer storage medium having stored thereon a computer program which, when executed by a processor, implements any of the above-described resource allocation methods.
Based on the resource allocation method provided by the embodiment of the application, the resource occupancy rate information of the virtual machine is obtained; and based on the comparison result of the resource occupancy rate information of the virtual machine and the preset resource occupancy rate and the resource capacity occupied by the virtual machine, performing resource configuration on the virtual machine, so that the virtual machine in the cloud platform operates in the range of the resource capacity corresponding to the preset resource occupancy rate, and the problem that the virtual machine in the cloud platform is in transition contention for resources is solved. Therefore, the resource occupation condition of the virtual machine in the cloud platform can be flexibly controlled.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
Fig. 1 is an application scenario diagram of a resource allocation method according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a resource allocation method according to an embodiment of the present application;
fig. 3 is a schematic flowchart of another resource allocation method according to an embodiment of the present application;
FIG. 4 is a system architecture diagram of a resource allocation method provided in the related art;
fig. 5 is a system architecture diagram of a resource allocation method according to an embodiment of the present application;
fig. 6 is a system architecture diagram of another resource allocation method according to an embodiment of the present application;
fig. 7 is a flowchart illustrating another resource allocation method according to an embodiment of the present application;
fig. 8 is a schematic flowchart of another resource allocation method according to an embodiment of the present application;
fig. 9 is a schematic diagram of a resource allocation apparatus according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The present application will be described in further detail below with reference to the accompanying drawings and examples. It should be understood that the examples provided herein are merely illustrative of the present application and are not intended to limit the present application. In addition, the following examples are provided for the purpose of carrying out some embodiments of the present application, and not for the purpose of providing all embodiments for carrying out the present application, and the technical solutions described in the embodiments of the present application may be implemented in any combination without conflict.
Referring to fig. 1, in an application scenario diagram of a resource configuration method provided in an embodiment of the present application, a plurality of virtual machines are deployed on a physical machine in a cloud platform, and the plurality of virtual machines can provide cloud services to different users, and when a user orders a cloud service, based on different performance indexes of cloud computing resources provided by the cloud service, it is indicated that the higher the performance index of the cloud computing resources provided by the user and available for the virtual machines to occupy is, the higher the price of the cloud service is.
Table 1 table of performance index and cloud service price information of cloud computing resource
Figure BDA0003074410780000061
Illustratively, referring to table 1, for computing resources, the performance indicators may include dominant frequency sizes of the processors, e.g., 8G, 12G; for storage resources, the performance indicators may include the capacity size of the memory, e.g., 2G; for network resources, the performance indicators may include capacity sizes of network bandwidth, e.g., 100M, 200M.
Illustratively, the cloud platform can adopt a cloud computing management platform OpenStack, which is a cloud computing management platform that is simple to implement, large-scale expandable, rich and standard-uniform, and can provide expandable and elastic cloud computing services for private clouds and public clouds. The components in the Openstack platform comprise Web end display components, nova, ceilometer, libvirt, qemu/kvm and the like. The Ceilometer component serves as a monitoring service component and provides a uniform resource usage data collection function for charging, settlement or monitoring applications on an upper layer.
Here, openStack is an open-source cloud computing management platform project, and is a combination of a series of software open-source projects. Open source code projects, developed by the National Aeronautics and Space Administration (NASA) and Rackspace collaboratively, authorized with the Apache license. The Apache license is a free software license issued by the Apache software foundation. KVM (Kernel-based Virtual Machine) is a full-function virtualization solution on an x86 hardware platform under a Linux system.
In the related art, the resource occupation condition of the virtual machine in the cloud platform is not realized yetAnd flexible control is performed. In practical application, the resource occupancy rate of part of virtual machines in the cloud platform is too high, for example, the ith virtual machine V i Is greater than a preset resource occupancy rate, in which case the ith virtual machine V i Occupying excessive resource capacity of the physical machine. Under the condition that the resource occupancy rate of the virtual machine is not controlled, resource occupancy conflicts exist among a plurality of virtual machines running on the same physical machine, and the system stability of the cloud platform in providing cloud services is affected.
Referring to fig. 2, a resource allocation method provided in an embodiment of the present application may include the following steps:
step A201: and acquiring the resource occupancy rate information of the virtual machine.
Here, the resource occupancy information may be occupancy information of any type of resource of the host occupied by the virtual machine. The host machine can be any physical machine in the cluster resources, and at least one virtual machine can be deployed on the host machine.
It should be understood that the virtual machines are deployed on a host machine, and the host machine and the virtual machines belong to the same cluster.
For example, the occupancy rate information that the virtual machine occupies any type of resource of the host may be the occupancy rate information that the virtual machine actually occupies any type of resource of the host. The resource occupancy rate of the virtual machine may reflect a ratio of a resource capacity actually occupied by the virtual machine to a resource capacity available for the virtual machine to occupy.
Illustratively, the resource type of any type of resource of the host may include any of:
computing resources, storage resources, and network resources, wherein the computing resources may be processors, the storage resources may include disks, memories, and the network resources may include network bandwidth.
In practical application, the price of the cloud service provided to the user can be determined based on the performance index of the cloud computing resource, so that the user can select the cloud computing resource meeting the actual use requirement. Here, the performance index of the cloud computing resource may include a size of a resource capacity of the cloud computing resource.
For example, the resource occupancy information may include any one of the following information for different resource types of the cloud computing resources: processor occupancy, memory occupancy, network bandwidth occupancy and disk occupancy.
In practical application, the resource occupancy rate information of the virtual machine can be acquired based on a ceilometer component in an Openstack platform. Or, an Agent node (Agent) is deployed on a physical machine where the virtual machine is located, and the Agent acquires resource occupancy rate information of the virtual machine based on a socket interface.
Here, the proxy node may be a client deployed on the physical machine, the client is configured to perform data interaction with a Web, and the Web may be controlled by a user, for example, the Web may be deployed on a host used by the user, and the user may log in a tenant account of the cloud platform by the Web, visualize the virtual machine data on the Web based on the virtual machine data acquired by the proxy node, and present a visualization result of the virtual machine data.
For example, when multiple virtual machines are deployed on the same host, the resource occupancy information of the virtual machine may be the ith virtual machine V deployed on the host i The resource occupancy rate of the memory.
Step A202: and comparing the resource occupancy rate information with a preset resource occupancy rate to obtain a comparison result.
Here, the preset resource occupancy of the virtual machine may be a resource occupancy reference value of the virtual machine. For example, a processor occupancy reference value, a memory occupancy reference value, a network bandwidth occupancy reference value, a disk occupancy reference value.
For example, the ith virtual machine V deployed on the host i The memory capacity of the system is 16G, and the preset resource occupancy rate is 90%. That is, the ith virtual machine V is permitted i And using the memory resource with the resource capacity of 16G within the range of 90% of the memory occupancy rate.
Illustratively, the ith virtual machine V deployed on the host i When the resource occupancy rate of the memory is 65%, the resource occupancy rate information of the virtual machine is compared with the preset resource occupancy rateAnd the comparative result is obtained as follows: ith virtual machine V deployed on host i The resource occupancy rate of the memory is smaller than the preset resource occupancy rate.
Illustratively, the ith virtual machine V deployed on the host i When the resource occupancy rate of the memory is 93%, comparing the resource occupancy rate information of the virtual machine with the preset resource occupancy rate, and obtaining a comparison result as follows: ith virtual machine V deployed on host i The resource occupancy rate of the memory is larger than the preset resource occupancy rate.
Step A203: and according to the comparison result and the resource capacity which can be occupied by the virtual machine, carrying out resource configuration on the virtual machine.
Illustratively, the ith virtual machine V is within the jth preset time span T i The resource occupancy rate of the memory is less than the preset resource occupancy rate, Q m =Q 0 +Q 1 -Q 2 >Q 0 . In this case, the virtual machine V may be targeted for the (j + 1) th preset time length T i And opening resources with preset resource capacity, thereby improving the resource capacity of the memory occupied by the ith virtual machine Vi.
Wherein Q m The amount of resources Q that can be occupied by the virtual machine after the preset time length T is over 0 An initial value, Q, of the amount of resources available to be occupied by the virtual machine at an initial moment of a preset time length T 1 For the cumulative value of the amount of resources, Q, available for a virtual machine to occupy within a preset time period, T 1 For the cumulative value of the amount of resources available for the virtual machine to occupy, Q, over a preset time period T 2 The resource amount is an accumulated value of the resource amount actually occupied by the virtual machine in the preset time length T.
Illustratively, the ith virtual machine V is within the jth preset time length T i The resource occupancy rate of the memory is larger than the preset resource occupancy rate, Q m =Q 0 +Q 1 -Q 2 <Q 0 . In this case, the virtual machine V may be targeted for the (j + 1) th preset time length T i And closing the resources with the preset resource capacity, thereby reducing the resource capacity of the memory occupied by the ith virtual machine Vi.
Illustratively, the result of comparing the resource occupancy rate information of the virtual machine with the preset resource occupancy rate is as follows: ith virtual machine V deployed on host i The resource occupancy rate of the memory is smaller than the preset resource occupancy rate. In this case, the resource capacity of the memory that can be occupied by the ith virtual machine Vi is increased.
For example, the ith virtual machine V deployed on the host i Has a memory capacity of 8G and can be supplied to the ith virtual machine V i The resource capacity of the occupied memory is increased from 8G to 10G.
Illustratively, the result of comparing the resource occupancy rate information of the virtual machine with the preset resource occupancy rate is as follows: ith virtual machine V deployed on host i The resource occupancy rate of the memory is greater than the preset resource occupancy rate. In this case, the ith virtual machine V is lowered i The resource capacity of the occupied memory.
For example, the ith virtual machine V deployed on the host i The memory capacity of (1) is 16G, and the resource capacity of the memory occupied by the ith virtual machine Vi is reduced from 16G to 12G.
Based on the resource allocation method provided by the embodiment of the application, the resource occupancy rate information of the virtual machine is obtained; and performing resource allocation on the virtual machines based on the comparison result of the resource occupancy rate information of the virtual machines and the preset resource occupancy rate and the resource capacity occupied by the virtual machines, so that all the virtual machines on the physical machine can be ensured to run in the specification of the virtual machines, and the situation that a certain virtual machine is in transition to contend for resources is avoided. Therefore, the resource occupation condition of the virtual machine in the cloud platform can be flexibly controlled.
In practical applications, the steps a201 to a203 may be implemented by a Processor, and the Processor may be at least one of an Application Specific Integrated Circuit (ASIC), a Digital Signal Processor (DSP), a Digital Signal Processing Device (DSPD), a Programmable Logic Device (PLD), a Field Programmable Gate Array (FPGA), a Central Processing Unit (CPU), a controller, a microcontroller, and a microprocessor.
Referring to table 2, 10 virtual machines are deployed on a host in the cloud platform, and Vi is any one of the 10 virtual machines. Table 2 shows resource usage for multiple virtual machines on a host.
Table 2 resource occupancy rate information and preset resource occupancy rate information table of virtual machine
Figure BDA0003074410780000101
Figure BDA0003074410780000111
In practical application, the resource occupancy rate information of the virtual machine within the preset time length T can be calculated based on the resource occupancy rate information and the preset resource occupancy rate information of the virtual machine, and the resource capacity available for the virtual machine to occupy is dynamically controlled based on the resource occupancy rate information.
In an implementation manner, in the step a203, the performing resource configuration on the virtual machine according to the comparison result and the resource capacity available for the virtual machine may include the following steps:
step A1: and acquiring the resource occupancy rate information of the virtual machine within the preset time length T according to the resource occupancy rate information of the virtual machine and the preset resource occupancy rate information.
In practical applications, the preset time length T may be a time period for dynamically controlling the resource capacity that can be occupied by the virtual machine.
For example, when the resource capacity available for the virtual machine to occupy is dynamically controlled, the resource occupancy condition information of the virtual machine in the time period T may be obtained based on the resource occupancy rate of the virtual machine and the preset resource occupancy rate. And according to the resource occupation condition information of the virtual machine, performing feedback control on the resource capacity which can be occupied by the virtual machine, and controlling the resource capacity actually occupied by the virtual machine to be within the range of the resource capacity corresponding to the preset resource occupancy rate.
Here, the resource occupation situation information of the virtual machine in the time period T may include any one of the following information: the method comprises the steps of obtaining an accumulated value of the resource amount which can be occupied by the virtual machine within a preset time length T, obtaining an accumulated value of the resource amount which can be occupied by the virtual machine within the preset time length T, obtaining an accumulated value of the resource amount which can be actually occupied by the virtual machine within the preset time length T, and obtaining the resource amount which can be occupied by the virtual machine after the preset time length T is finished.
In an implementation manner, in the step a203, the configuring, according to the comparison result and the resource capacity available for the virtual machine, resources of the virtual machine may include at least one of the following:
acquiring information of preset resource capacity within a jth preset time length T; j is a natural number greater than 0, and T is a time length value greater than 0; and when the resource occupancy rate information is greater than the preset resource occupancy rate within the jth preset time length T, closing resources with preset resource capacity for the virtual machine within the jth +1 th preset time length T.
Here, the information of the preset resource capacity may be difference information Δ Q, Δ Q = | Q, between an accumulated value Q1 of the resource amount of any type of resource of the host that can be occupied by the virtual machine and an accumulated value Q2 of the resource amount of any type of resource of the host that is actually occupied by the virtual machine in the jth preset time length T 1 -Q 2 |。
Illustratively, during the jth preset time length T, Q1=12G, Q2=16G, Δ Q =4G, the ith virtual machine V deployed on the host machine i The resource occupancy rate of the memory is greater than the preset resource occupancy rate. In this case, within the j +1 th preset time length T, the resources of the 4G memory capacity are closed for the virtual machine.
Here, the jth preset time length T and the j +1 th preset time length T may be time periods corresponding to two consecutive control periods, for example, 60 seconds.
In an implementation manner, in the step a203, the configuring the resource of the virtual machine according to the comparison result and the resource capacity that can be occupied by the virtual machine may include at least one of the following cases:
acquiring information of preset resource capacity within a jth preset time length T; and when the resource occupancy rate information is smaller than the preset resource occupancy rate within the jth preset time length T, opening resources with preset resource capacity for the virtual machine.
Illustratively, during the jth preset time length T, Q1=12G, Q =8G, Δ Q =4G, the ith virtual machine V deployed on the host machine i The resource occupancy rate of the memory is smaller than the preset resource occupancy rate. In this case, within the j +1 th preset time length T, resources of 4G memory capacity are opened for the virtual machine.
It should be understood that, when the resource occupancy rate of the virtual machine is greater than the preset resource occupancy rate, the resource capacity actually occupied by a part of the virtual machines in the cloud platform is too high, which may cause resource occupancy conflicts among the multiple virtual machines.
Based on the resource allocation method, the resource capacity actually occupied by the virtual machine can be controlled within the range of the resource capacity corresponding to the preset resource occupancy rate. Therefore, the system stability of the cloud platform in providing the cloud service is improved.
In an implementation manner, in the step a203, the configuring the resources of the virtual machine according to the comparison result and the resource capacity that can be occupied by the virtual machine may include the following steps: and after the operating system of the virtual machine is repaired, adjusting the resource capacity which can be occupied by the virtual machine according to the comparison result.
For example, after the operating system of the virtual machine is repaired, if it is determined that the ith virtual machine has an abnormal fault and the resource occupancy rate of the virtual machine is greater than the preset resource occupancy rate, the available V of the ith virtual machine may be increased i Occupied resource capacity.
It should be understood that the ith virtual machine V deployed on the host machine i When the resource occupancy rate is greater than the preset resource occupancy rate, the idle resource of the virtual machine is insufficient, so that the virtual machine is outputAn abnormal failure occurs. Therefore, after the operating system of the virtual machine is repaired, the available ith virtual machine V is increased i The occupied resource capacity can avoid the abnormal fault condition caused by insufficient resource capacity of the virtual machine, thereby reducing the probability of abnormal fault of the virtual machine.
In an implementation manner, the obtaining information of the preset resource capacity within the jth preset time length T includes:
step A301: and acquiring information of a first resource amount, wherein the information of the first resource amount is an accumulated value of the resource amount of any type of resource actually occupied by the virtual machine in the jth preset time length T.
Illustratively, the information of the first resource amount is denoted as Q 1 Based on the information of the preset resource occupancy rate and the sampling frequency information, the form of the cumulative value of the resource amount occupied by the virtual machine in the jth preset time length T is obtained as follows:
Figure BDA0003074410780000131
wherein Q is k The resource capacity of the kth processor of the host is shown, vbase _ k is the preset resource occupancy rate of the ith virtual machine within the jth preset time length T, Δ T is sampling period information, T is a sampling time point, T =0 is the initial time of the preset time length T, and N is the number of the plurality of processors occupied by the virtual machine.
Here, Δ t may be a time interval between two adjacent sampling time points, and for example, when minutes are taken as a time unit, the value of Δ t may be 1/60min, 7/60min.
It should be understood that the following description,
Figure BDA0003074410780000132
and the accumulated value of the resource amount which can be occupied by the virtual machine in the jth preset time length T can be obtained according to the preset acquisition period information based on the resource occupancy rate reference value.
Step A302: and acquiring information of a second resource amount, wherein the information of the second resource amount is an accumulated value of the resource amount of any type of resource of the host machine which can be occupied by the virtual machine in the jth preset time length T.
Illustratively, the information of the second resource amount is denoted as Q 2
Figure BDA0003074410780000141
The method can reflect the accumulated value of the resource amount actually occupied by the virtual machine in the physical machine in the preset time length T according to the preset acquisition cycle information based on the resource occupancy value.
Wherein Q k As the resource capacity of the kth processor of the host, the value _ k is the resource occupancy rate of a certain sampling time point of the ith virtual machine within the jth preset time length T.
In practical application, the accumulated value Q of the resource amount that can be occupied by the virtual machine in the jth preset time length T can be obtained in an integral form or a form of summation based on sampled data 1 Cumulative value Q of amount of resources actually occupied by virtual machine to physical machine 2
Step A303: and acquiring the information of the preset resource capacity within the jth preset time length T according to the difference value information of the first resource quantity and the second resource quantity.
Here, the resource of the preset resource capacity may be denoted as Δ Q, and the following form may be adopted as a calculation manner of the resource of the preset resource capacity Δ Q:
Figure BDA0003074410780000142
illustratively, the resource of the preset resource capacity may be a resource described by an integration result of integrating computation for Vbase _ -kVactual _ k within the ith preset time T.
It should be understood that, when a resource with a preset resource capacity is opened for the virtual machine within the j +1 th preset time length T, the virtual machine may be allowed to use the computing resource of the physical machine for more than a preset time length under the condition that the virtual machine is less than the preset resource occupancy rate; or allowing the virtual machine to overuse the computing resources of the physical machine within a preset time length under the condition that the virtual machine is larger than the preset resource occupancy rate.
In an implementation manner, in the step a203, the configuring the resources of the virtual machine according to the comparison result and the resource capacity that can be occupied by the virtual machine may include the following steps:
under the condition of repairing the operating system of the virtual machine, adjusting the resource capacity which can be occupied by the virtual machine according to the comparison result to obtain the adjusted resource capacity;
and according to the comparison result and the adjusted resource capacity, performing resource allocation on the virtual machine.
For example, if the ith virtual machine has an abnormal fault and the resource occupancy rate of the virtual machine before the abnormal fault occurs in the ith virtual machine is greater than the preset resource occupancy rate under the condition of repairing the operating system where the virtual machine is located, the resource occupancy rate of the virtual machine before the abnormal fault occurs in the ith virtual machine can be increased by increasing the resource occupancy rate of the virtual machine V available for the ith virtual machine i The occupied resource capacity avoids the abnormal fault of the virtual machine caused by insufficient available resources.
In this case, the resource capacity available for the virtual machine may be adjusted to obtain the adjusted resource capacity, for example, the ith virtual machine V is available before the adjustment i The occupied resource capacity is 8G, and the adjusted resource capacity can be supplied to the ith virtual machine V i The occupied resource capacity is 12G. And further, performing resource allocation on the virtual machine according to the adjusted resource capacity.
In an implementation manner, in the step a201, the obtaining resource occupancy rate information of the virtual machine may include the following steps:
and acquiring the resource occupancy rate information of at least one virtual machine on the host machine of the virtual machine by adopting a detection module, wherein the detection module is a newly-added proxy node deployed on the host machine of the virtual machine.
Illustratively, at least one Agent node (Agent) is deployed at a host where the virtual machine is located, and the Agent is used for implementing part or all of functions in data acquisition, resource configuration and system Repair (ADCR) of the virtual machine.
In practical applications, a plurality of functional modules of the ADCR proxy node may be implemented by the same client application program, integrated in the same client application program, or implemented by a plurality of different client application programs, which is not limited in this application.
Illustratively, the ADCR proxy node may include an ADCR monitoring module, which runs on the physical machine and monitors resource occupancy of each virtual machine on the physical machine. The representation of each virtual machine on the physical machine may be a separate process. The ADCR monitoring module can directly read the resource occupation condition information of the target process from the running memory of the virtual machine.
Here, the resource occupancy information may include any one of the following information: processor occupancy, memory occupancy, and network bandwidth occupancy of the target process.
Illustratively, the ADCR detection module detects virtual machine data of at least one virtual machine deployed on the physical machine, and determines whether the virtual machine is in a virtual machine abnormal state according to the virtual machine data. Here, the virtual machine abnormal state may include any one of the following abnormal states: and when the system is crashed, stuck and restarted, the system cannot be normally accessed.
In the embodiment of the application, the ADCR agent node can run on a physical machine, and when the system is monitored, the ADCR agent node directly sends data to a Web end database without components such as nova, ceilometer, libvirt, qemu/kvm and the like in an Openstack platform, so that the acquisition path of the running state information of the virtual machine in the kvm virtualization environment of the Openstack platform is shortened. Therefore, the real-time performance of information acquisition on the virtual machine is high.
In an implementation manner, in the step a203, the performing resource configuration on the virtual machine according to the comparison result and the resource capacity that can be occupied by the virtual machine includes:
and adopting a processing module to perform resource configuration on the virtual machine according to the comparison result and the resource capacity which can be occupied by the virtual machine, wherein the processing module is a newly-added agent node which is deployed on a host machine where the virtual machine is located.
For example, the ADCR proxy node may include an ADCR processing module, where the ADCR configuration module runs on the physical machine, reserves an interface for an upper layer to call when controlling the virtual machine, and dynamically adjusts resource usage of all virtual machines on the physical machine based on monitoring resource occupancy information of each virtual machine on the physical machine according to a resource control policy.
Hereinafter, the resource control policy of the ADCR configuration module will be described in detail by taking the control of the processor occupancy as an example.
Illustratively, during the jth preset time length T, the consumption of the virtual machine for the virtual processor (virtual cpu, vcpu) is excessive, for example, the resource occupancy rate of the virtual machine is greater than the preset resource occupancy rate. In this case, within the j +1 th preset time length T, the ADCR processing module dynamically limits the resource usage of the virtual machine, and reduces the influence on the vcpu resource of the relevant virtual machine on the node. For example, the ADCR configuration module closes a resource of a predetermined resource capacity for the virtual machine.
Here, the preset resource occupancy may be a resource occupancy reference value corresponding to a resource capacity that can be occupied by the virtual machine when the user subscribes to the cloud service.
Illustratively, during the jth preset time length T, the resource consumption of the virtual machine for the virtual processor is too small, for example, the resource occupancy rate of the virtual machine is smaller than the preset resource occupancy rate. In this case, in the j +1 th preset time period T, the ADCR processing module opens a resource of a preset resource capacity for the virtual machine.
In one implementation, the performing resource configuration on the virtual machine according to the comparison result and the adjusted resource capacity includes:
when the resource occupancy rate information of the virtual machine is greater than the preset resource occupancy rate, improving the resource capacity which can be occupied by the virtual machine; and according to the improved resource capacity, carrying out resource configuration on the virtual machine.
For example, after the operating system of the virtual machine is repaired, if it is determined that the ith virtual machine has an abnormal fault and the resource occupancy rate of the virtual machine is greater than the preset resource occupancy rate, the available V of the ith virtual machine may be increased i Occupied resource capacity. And according to the improved resource capacity, carrying out resource configuration on the virtual machine.
In one implementation manner, in the step a203, the repairing the operating system where the virtual machine is located includes:
when the operation system of the virtual machine runs abnormally, a repair instruction for repairing the operation system of the virtual machine is generated; and repairing the operating system of the virtual machine according to the repairing instruction and the operating system image file corresponding to the operating system of the virtual machine.
Illustratively, the ADCR proxy node may include an ADCR configuration module, and the ADCR configuration module is configured to repair the operating system of the virtual machine according to the repair instruction and the operating system image file corresponding to the operating system of the virtual machine.
Illustratively, the configuration module is a newly added proxy node deployed on the host where the virtual machine is located.
Fig. 4 is a system architecture diagram illustrating a resource allocation method provided in the related art. Referring to fig. 4, in the related art, a resource control path needs to pass through a nova → libvirt → python → libvirt → qemu/kvm component in the Openstack platform, the resource control path for the virtual machine is too long, and no real-time performance exists when performing dynamic resource control on the resource occupation condition of the virtual machine.
It should be understood that the monitoring path of the virtual machine is long, the cloud platform is abnormal in operation when any component has a problem, the real-time performance of reporting the abnormal operation state of the virtual machine is poor, and the abnormal operation state of the virtual machine cannot be repaired in time when the abnormal operation state is obtained. Meanwhile, dynamic adjustment cannot be performed according to the acquired resource occupancy rate condition of the virtual machine. Therefore, how to improve the flexible control of the resource occupation situation of the virtual machine in the cloud platform becomes an important problem to be solved urgently.
Fig. 5 is a system architecture diagram illustrating a resource configuration method according to an embodiment of the present application. Referring to fig. 5, based on the resource control policy, when the resource occupation condition of the virtual machine is dynamically controlled, components such as nova, libvirt-python, libvirt and the like in the Openstack platform do not need to be passed through, so that the resource control efficiency is high, and the real-time performance is good.
In the embodiment of the application, based on the comparison result of the resource occupancy rate information of the virtual machine and the preset resource occupancy rate and the resource capacity occupied by the virtual machine, the resource configuration is performed on the virtual machine, so that all the virtual machines on the physical machine can be ensured to operate in the specification of the virtual machine, the situation that a certain virtual machine is in transition to contend for the resource is avoided, and therefore, the system stability of the cloud platform in the process of providing the cloud service can be improved.
In the embodiment of the application, the resource occupation condition information of the virtual machine is obtained based on the agent node deployed on the physical machine and is not affected by nova, ceilometer, libvirt and qemu/kvm components in the platform, so that the robustness of a virtual machine system when the cloud platform provides cloud service can be improved.
In the embodiment of the application, the ADCR monitoring module acquires the resource occupancy rate information of the virtual machine, and the ADCR processing module dynamically adjusts the load condition of the virtual machine according to the resource occupancy rate information of the virtual machine, so as to realize the dynamic adjustment of the resource occupancy rate of the virtual machine.
In one implementation, the repairing the operating system in which the virtual machine is located includes:
when the operation system of the virtual machine is abnormal, configuring a mirror image file of the operation system for the virtual machine; the priority of the image file of the operating system is higher than that of the operating system of the virtual machine; and repairing the operating system of the virtual machine according to the operating system image file.
Illustratively, the starting priority of the virtual machine is modified, the priority of an operating system image file higher than the operating system of the virtual machine is defined, and the operating system image file is added to the virtual machine as a virtual CDROM device, so that the virtual machine enters the virtual CDROM device when being restarted.
Here, the virtual CDROM device may be an operating system image file corresponding to an operating system where the virtual machine is located.
Illustratively, the virtual machine is controlled to be preferentially started from the virtual CDROM drive equipment based on the fact that the virtual edge mechanism temporarily modifies the starting level of the virtual machine. After the modification of the starting level of the virtual machine is completed, the virtual machine is restarted in a soft mode, and the virtual machine with the problem can normally enter the ADCR configuration module.
Illustratively, referring to fig. 6, the operating system of the virtual machine may be a first operating system, which may be the native operating system of the virtual machine. In practical applications, the second operating system may be a temporary operating system that is booted based on loading the operating system image file.
In one implementation manner, the repairing the operating system where the virtual machine is located according to the operating system image file includes:
step B1: and obtaining the operating system type information of the operating system of the virtual machine.
Here, the operating system type information of the operating system in which the virtual machine is located may be system version information of the operating system in which the virtual machine is located.
Illustratively, the log information of the operating system where the virtual machine is located is monitored in real time, and whether the virtual machine is in a system abnormal state is judged.
For example, if a watchdog device timeout is detected to occur, the virtual machine system is determined to be in a system exception state.
Illustratively, when the virtual machine has an abnormal fault, the system version information of the operating system of the virtual machine is obtained according to the log information of the operating system of the virtual machine. Or acquiring the system version information of the operating system of the virtual machine according to the system information output by the serial port of the operating system of the virtual machine.
And step B2: and acquiring the operating system image file according to the operating system type information of the operating system of the virtual machine.
Illustratively, the ADCR monitoring module automatically triggers a repair mechanism of the ADCR configuration module when the virtual machine is monitored to be in an abnormal state.
Further, the ADCR configuration module downloads an operating system image file corresponding to the system version information of the virtual machine according to the system version information of the virtual machine.
Here, the os image file is divided into a Linux format and a Windows system format based on the os type. Such as an operating system image of a rescue Linux system or a Windows system.
And step B3: and when the virtual machine is started, repairing the operating system of the virtual machine according to the image file of the operating system.
Illustratively, the ADCR configuration module may start working after the virtual machine is soft restarted, mount an image file of the operating system through a virsh attach mechanism, and run inside the virtual machine to perform a recovery operation on the virtual machine.
Illustratively, the ADCR monitoring module mounts the virtual optical drive device into the virtual machine, automatically enters the ADCR configuration module after the virtual machine is soft restarted, runs a repair mechanism related to the ADCR configuration module, and performs system repair on an operating system where the virtual machine is located according to information of an abnormal interface of the virtual machine and an operating system image file. Here, the repair object of the abnormality repair includes any one of: the system comprises a file system, a partition table, a bootloader boot sector, a kernel/initramfs file and system-level error deletion software.
It should be understood that when the automatic repair fails to solve the problem, the ADCR processing module further provides a manual operation mode, and provides a shell terminal for operation and maintenance personnel for the Linux system. And providing an WinPE desktop for operation and maintenance personnel aiming at the Window system. Here, the shell terminal and the WinPE desktop are used for troubleshooting and repairing problems for operation and maintenance personnel.
In one implementation, the determining that the operating system in which the virtual machine is located runs abnormally includes:
acquiring running state log information of the virtual machine; and determining that the operating system of the virtual machine runs abnormally according to the running state log information of the virtual machine.
Illustratively, the ADCR monitoring module monitors an operation state log of the virtual machine in real time, and judges whether the virtual machine has an abnormal fault or not based on the operation state log of the virtual machine.
In one implementation, the method further comprises: when the operating system where the virtual machine is located is determined to be successfully repaired, the mount of the mirror image file of the operating system is cancelled; and starting the virtual machine according to the operating system of the virtual machine.
Illustratively, the ADCR configuration module is automatically exited after the repair is completed, and the ADCR detection module is triggered to perform a hard restart on the virtual machine when the ADCR configuration module is exited. And when the virtual machine is restarted, recovering the starting level of the virtual machine, canceling the mounting of the mirror image file of the operating system, and automatically entering the operating system where the virtual machine is located.
In the related technology, when the virtual machine has an abnormal fault, a user is required to feed back the abnormality to a cloud manufacturer when the virtual machine is found to be abnormal, the operation and maintenance of the cloud manufacturer selects a virtual machine image template to start a temporary virtual machine based on a resume function provided by Openstack, and a system disk of the virtual machine with the problem is used as a data disk and is mounted under an operating system of the temporary virtual machine. Logging in a temporary virtual machine by operation and maintenance, troubleshooting the problem of the virtual machine, repairing according to the reason of the problem, and rebooting the virtual machine from an original starting disk by using Unresult operation of Openstack. Therefore, the timeliness of performing exception repair on the virtual machine in the cloud platform is poor.
In the embodiment of the application, the operating system image file is used as a temporary operating system based on automatic mounting of the operating system image file, and the operating system where the virtual machine is located is recovered based on the temporary operating system, so that the method is not limited by the type of the virtual machine, and supports fault recovery of the virtual machines of different system types. Thus, flexibility in exception repair of virtual machines in the cloud platform. Meanwhile, the limitation of Rescue and UnRescue mechanisms in the Openstack platform is overcome, and virtualized resources in the Openstack platform are not occupied, so that the timeliness of performing abnormal repair on the virtual machine in the cloud platform can be improved.
Based on the same technical concept of the foregoing embodiment, referring to fig. 7, a resource allocation method provided by the present application may include the following steps:
step A701: and determining that the virtual machine system is in a system abnormal state.
Step A702: and recording interface information when the virtual machine system is in a system abnormal state.
Illustratively, interface output information when the system is abnormal is recorded through a vnc interface of the virtual machine, and the interface output information is used for acquiring information required for repairing the virtual machine.
Step A703: and acquiring system version information of an operating system where the virtual machine is located.
Step A704: and matching the operating system image file according to the system version information.
Step A705: and mounting the image file of the operating system to the virtual machine.
Step A706: the priority of the operating system image file at the time of the virtual machine starting is determined.
Step A707: when the virtual machine is started, the operating system where the virtual machine is located is repaired based on the image file of the operating system.
Illustratively, the virtual machine system is repaired based on the temporary operating system corresponding to the loaded operating system image file.
Here, regarding the implementation process from the step a701 to the step a707, reference may be made to the foregoing related contents regarding virtual machine repair, which are not described herein again.
Based on the same technical concept of the foregoing embodiment, referring to fig. 8, a resource allocation method provided by the present application may include the following steps:
step A801: and acquiring repair mode information for performing system repair on the first operating system where the virtual machine is located.
Here, the first operating system in which the virtual machine is located may be an operating system inherent to the virtual machine.
Illustratively, after entering the rescue system loaded based on the system image file, the rescue system is started within a preset time length. And acquiring the repairing mode information selected by the operation and maintenance personnel based on the detected repairing mode instruction selected by the operation and maintenance personnel to be used.
Step A802: it is determined whether an automatic repair mode is entered.
For example, when the operation and maintenance personnel are not detected to select the repair mode to be used within the preset time length, the repair mode information of the virtual machine is determined to be the automatic repair mode.
Exemplarily, in case of entering the automatic repair mode, the following step a803 is performed; without entering the automatic repair mode, the following step a808 is performed.
Step A803: and loading the second operating system based on the operating system image file.
Here, the second operating system may be a temporary operating system used when performing system repair on the first operating system in which the virtual machine is located.
Step A804: and performing system repair on the first operating system of the virtual machine based on the second operating system.
Step A805: and judging whether the first operating system of the virtual machine is successfully repaired.
Exemplarily, in case that the first operating system where the virtual machine is located is successfully repaired, the following step a806 is executed; in case the first operating system repair of the virtual machine fails, the following step a808 is performed.
Step A806: and (4) restarting the virtual machine hard, and cancelling the mount of the mirror image file of the operating system.
Step A807: and entering a first operating system where the virtual machine is located.
Step A808: and entering a manual repair mode, and performing system repair based on a shell terminal or a WinPE system.
Here, regarding the implementation process of the step a801 to the step a808, reference may be made to the related contents related to virtual machine repair, which are not described herein again.
Based on the same technical concept as the foregoing embodiment, referring to fig. 9, a resource configuration apparatus 900 provided in an embodiment of the present application may include:
the detection module 901 is configured to obtain resource occupancy rate information of the virtual machine;
the processing module 902 is configured to compare the resource occupancy rate information of the virtual machine with a preset resource occupancy rate to obtain a comparison result;
a configuration module 903, configured to perform resource configuration on the virtual machine according to the comparison result and the resource capacity that can be occupied by the virtual machine.
In an implementation manner, the configuring module 903 is configured to perform resource configuration on the virtual machine according to the comparison result, where the resource configuration includes:
acquiring information of preset resource capacity in a jth preset time length T; j is a natural number greater than 0, and T is a time length value greater than 0;
when the resource occupancy rate information is greater than the preset resource occupancy rate within the jth preset time length T, closing the resources with the preset resource capacity for the virtual machine within the jth +1 preset time length T;
and when the resource occupancy rate information is smaller than the preset resource occupancy rate within the jth preset time length T, opening the resources with the preset resource capacity for the virtual machine within the jth +1 th preset time length T.
In an implementation manner, the configuring module 903 is configured to obtain information of a preset resource capacity within a jth preset time length T, and includes:
acquiring information of a first resource amount, wherein the information of the first resource amount is an accumulated value of the resource amount of any type of resource actually occupied by the virtual machine in the jth preset time length T; the host is any physical machine in cluster resources, and at least one virtual machine is deployed on the host;
acquiring information of a second resource amount, wherein the information of the second resource amount is an accumulated value of the resource amount of any type of resource of a host machine which can be occupied by the virtual machine within the jth preset time length T;
and acquiring the information of the preset resource capacity within the jth preset time length T according to the difference value information of the first resource quantity and the second resource quantity.
In an implementation manner, the configuring module 903 is configured to perform resource configuration on the virtual machine according to the comparison result and a resource capacity that can be occupied by the virtual machine, and includes:
under the condition of repairing the operating system of the virtual machine, adjusting the resource capacity which can be occupied by the virtual machine according to the comparison result to obtain the adjusted resource capacity;
and according to the comparison result and the adjusted resource capacity, performing resource configuration on the virtual machine.
In an implementation manner, the configuring module 903 is configured to perform resource configuration on the virtual machine according to the comparison result and the adjusted resource capacity, and includes:
when the resource occupancy rate information of the virtual machine is greater than the preset resource occupancy rate, improving the resource capacity which can be occupied by the virtual machine; and according to the adjusted resource capacity, carrying out resource configuration on the virtual machine.
In one implementation manner, the apparatus further includes a repair module, where the repair module is configured to repair an operating system where the virtual machine is located, and the repair module includes:
when the operation system of the virtual machine runs abnormally, a repair instruction for repairing the operation system of the virtual machine is generated;
and repairing the operating system of the virtual machine according to the repairing instruction and the operating system image file corresponding to the operating system of the virtual machine.
In an implementation manner, the detecting module 901 is configured to obtain resource occupancy rate information of a virtual machine, and includes:
and acquiring the resource occupancy rate information of at least one virtual machine on the host where the virtual machine is located.
In some embodiments, functions of or modules included in the apparatus provided in the embodiments of the present application may be used to execute the method described in the above method embodiments, and specific implementation thereof may refer to the description of the above method embodiments, and for brevity, will not be described again here.
Based on the same technical concept as the foregoing embodiment, referring to fig. 10, an electronic device 1000 provided in an embodiment of the present application may include: a memory 1010 and a processor 1020; wherein the content of the first and second substances,
a memory 1010 for storing computer programs and data;
a processor 1020 for executing a computer program stored in the memory to implement any one of the resource allocation methods in the foregoing embodiments.
In practical applications, the memory 1010 may be a volatile memory (volatile memory), such as RAM; or a non-volatile memory (non-volatile memory), illustratively a ROM, a flash memory, a Hard Disk Drive (HDD) or a Solid-State Drive (SSD); or a combination of the above types of memories. The memory 1010 may provide instructions and data to the processor 1020.
The foregoing descriptions of the various embodiments are intended to highlight different aspects of the various embodiments, which have the same or similar aspects, and thus, for brevity, detailed descriptions thereof are omitted
The methods disclosed in the method embodiments provided by the present application can be combined arbitrarily without conflict to obtain new method embodiments.
The features disclosed in the various product embodiments provided in the present application may be combined arbitrarily without conflict, to arrive at new product embodiments.
The features disclosed in the various method or apparatus embodiments provided herein may be combined in any combination to arrive at new method or apparatus embodiments without conflict.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described device embodiments are merely illustrative, and for example, the division of the unit is only one logical function division, and there may be other division ways in actual implementation, such as: multiple units or components may be combined, or may be integrated into another system, or some features may be omitted, or not implemented. In addition, the coupling, direct coupling or communication between the components shown or discussed may be through some interfaces, and the indirect coupling or communication between the devices or units may be electrical, mechanical or other forms.
The units described as separate parts may or may not be physically separate, and 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 grid units; some or all of the units can be selected according to actual conditions to achieve the purpose of the scheme of the embodiment.
In addition, all functional units in the embodiments of the present application may be integrated into one processing module, or each unit may be separately regarded as one unit, or two or more units may be integrated into one unit; the integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
Those of ordinary skill in the art will understand that: all or part of the steps of implementing the method embodiments may be implemented by hardware related to program instructions, and the program may be stored in a computer-readable storage medium, and when executed, executes the steps including the method embodiments.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A method for resource allocation, comprising:
acquiring resource occupancy rate information of the virtual machine;
comparing the resource occupancy rate information with a preset resource occupancy rate to obtain a comparison result;
and according to the comparison result and the resource capacity which can be occupied by the virtual machine, carrying out resource configuration on the virtual machine.
2. The method according to claim 1, wherein the performing resource configuration on the virtual machine according to the comparison result and the resource capacity available for the virtual machine comprises:
acquiring information of preset resource capacity within a jth preset time length T; j is a natural number greater than 0, and T is a time length value greater than 0;
when the resource occupancy rate information is greater than the preset resource occupancy rate within the jth preset time length T, closing the resources with the preset resource capacity for the virtual machine within the jth +1 th preset time length T;
and when the resource occupancy rate information is smaller than the preset resource occupancy rate within the jth preset time length T, opening the resources with the preset resource capacity for the virtual machine within the jth +1 preset time length T.
3. The method according to claim 2, wherein the obtaining information of the preset resource capacity within the jth preset time length T comprises:
acquiring information of a first resource amount, wherein the information of the first resource amount is an accumulated value of the resource amount of any type of resource actually occupied by the virtual machine in the jth preset time length T; the host is any physical machine in cluster resources, and at least one virtual machine is deployed on the host;
acquiring information of a second resource amount, wherein the information of the second resource amount is an accumulated value of the resource amount of any type of resource of a host machine which can be occupied by the virtual machine within the jth preset time length T;
and acquiring the information of the preset resource capacity within the jth preset time length T according to the difference value information of the first resource quantity and the second resource quantity.
4. The method according to claim 1, wherein the performing resource configuration on the virtual machine according to the comparison result and the resource capacity available for the virtual machine comprises:
under the condition of repairing the operating system of the virtual machine, adjusting the resource capacity which can be occupied by the virtual machine according to the comparison result to obtain the adjusted resource capacity;
and according to the comparison result and the adjusted resource capacity, performing resource allocation on the virtual machine.
5. The method according to claim 4, wherein the performing resource configuration on the virtual machine according to the comparison result and the adjusted resource capacity comprises:
when the resource occupancy rate information of the virtual machine is greater than the preset resource occupancy rate, improving the resource capacity which can be occupied by the virtual machine; and according to the improved resource capacity, carrying out resource configuration on the virtual machine.
6. The method according to claim 4, wherein the repairing the operating system where the virtual machine is located includes:
when the operation system of the virtual machine runs abnormally, a repair instruction for repairing the operation system of the virtual machine is generated;
and repairing the operating system of the virtual machine according to the repairing instruction and the operating system image file corresponding to the operating system of the virtual machine.
7. The method of claim 1, wherein the obtaining resource occupancy information of the virtual machine comprises:
and acquiring the resource occupancy rate information of at least one virtual machine on the host where the virtual machine is located.
8. A resource allocation apparatus, comprising:
the detection module is used for acquiring the resource occupancy rate information of the virtual machine;
the processing module is used for comparing the resource occupancy rate information of the virtual machine with a preset resource occupancy rate to obtain a comparison result;
and the configuration module is used for carrying out resource configuration on the virtual machine according to the comparison result and the resource capacity occupied by the virtual machine.
9. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the resource allocation method of any one of claims 1 to 7 when executing the program.
10. A computer storage medium storing a computer program; characterized in that said computer program is capable, when executed, of implementing a resource allocation method as claimed in any one of claims 1 to 7.
CN202110548208.7A 2021-05-19 2021-05-19 Resource allocation method and device, electronic equipment and storage medium Pending CN115373793A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110548208.7A CN115373793A (en) 2021-05-19 2021-05-19 Resource allocation method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110548208.7A CN115373793A (en) 2021-05-19 2021-05-19 Resource allocation method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115373793A true CN115373793A (en) 2022-11-22

Family

ID=84059136

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110548208.7A Pending CN115373793A (en) 2021-05-19 2021-05-19 Resource allocation method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115373793A (en)

Similar Documents

Publication Publication Date Title
US11108859B2 (en) Intelligent backup and recovery of cloud computing environment
US8413144B1 (en) Providing application-aware high availability of virtual machines
JP2022520005A (en) Patch management in a hybrid computing environment
US10379922B1 (en) Error recovery in a virtual machine-based development environment
US9886284B2 (en) Identification of bootable devices
JP2010086181A (en) Virtual machine system, method for managing thereof, program, and recording medium
US9471358B2 (en) Template provisioning in virtualized environments
US20130138998A1 (en) Method for switching application server, management computer, and storage medium storing program
US20210117272A1 (en) Basic input/output system (bios) device management
US10921871B2 (en) BAS/HVAC control device automatic failure recovery
US20200150950A1 (en) Upgrade managers for differential upgrade of distributed computing systems
CN111209110A (en) Task scheduling management method, system and storage medium for realizing load balance
US9465643B1 (en) Systems and methods for monitoring a primary operating system (OS) and/or migrating data using an OS hypervisor
CN111181780A (en) HA cluster-based host pool switching method, system, terminal and storage medium
US9529656B2 (en) Computer recovery method, computer system, and storage medium
US10353729B1 (en) Managing service dependencies across virtual machines in a development environment
CN111538585A (en) Js-based server process scheduling method, system and device
EP3591530A1 (en) Intelligent backup and recovery of cloud computing environment
CN111090546A (en) Method, device and equipment for restarting operating system and readable storage medium
US10754753B1 (en) Performance of virtual machine instances using machine recognition of screenshot images
CN115373793A (en) Resource allocation method and device, electronic equipment and storage medium
US11461131B2 (en) Hosting virtual machines on a secondary storage system
US20230161643A1 (en) Lifecycle management for workloads on heterogeneous infrastructure
CN112035295A (en) Virtual machine crash event processing method, system, terminal and storage medium
US11144487B1 (en) Method to overload hardware pin for improved system management

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