[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN108574718B - Cloud host creation method and device - Google Patents

Cloud host creation method and device Download PDF

Info

Publication number
CN108574718B
CN108574718B CN201710256717.6A CN201710256717A CN108574718B CN 108574718 B CN108574718 B CN 108574718B CN 201710256717 A CN201710256717 A CN 201710256717A CN 108574718 B CN108574718 B CN 108574718B
Authority
CN
China
Prior art keywords
physical machine
cloud host
target
physical
tag
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
CN201710256717.6A
Other languages
Chinese (zh)
Other versions
CN108574718A (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.)
Beijing Kingsoft Cloud Network Technology Co Ltd
Beijing Kingsoft Cloud Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud Network Technology Co Ltd
Beijing Kingsoft Cloud 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 Beijing Kingsoft Cloud Network Technology Co Ltd, Beijing Kingsoft Cloud Technology Co Ltd filed Critical Beijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN201710256717.6A priority Critical patent/CN108574718B/en
Publication of CN108574718A publication Critical patent/CN108574718A/en
Application granted granted Critical
Publication of CN108574718B publication Critical patent/CN108574718B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network 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/45562Creating, deleting, cloning virtual machine instances

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the invention provides a cloud host creating method and a cloud host creating device, wherein the method comprises the following steps: receiving a creation request for a target cloud host; judging whether the creating request carries a first virtual ratio label, wherein the first virtual ratio label is used for determining a target virtual ratio of a physical machine for creating a target cloud host, and the physical machine with the target virtual ratio is identified by the first virtual ratio label; if the cloud host is carried, judging whether at least one first physical machine identified by a first virtual ratio label exists, wherein the number of the cloud hosts in the first physical machine is smaller than the target virtual ratio; if yes, determining the first physical machine as a target physical machine; if the virtual ratio labels do not exist, selecting a first preset number of empty physical machines which do not create cloud hosts and are not identified by the virtual ratio labels to determine as target physical machines, and identifying the target physical machines by the first virtual ratio labels; and creating a target cloud host on the target physical machine. By applying the embodiment of the invention, the cloud host can be quickly created on the physical machine with the specified virtual ratio, and errors are reduced.

Description

Cloud host creation method and device
Technical Field
The invention relates to the technical field of cloud computing, in particular to a cloud host creation method and device.
Background
In the cloud computing technology, a cloud host is a part of a plurality of similar independent hosts simulated on a physical machine through virtual machine technology, and the cloud host and the similar independent hosts share the hardware resources of the physical machine. With the popularization and commercialization of virtualization technologies, more and more users need to create cloud hosts on physical machines to improve the utilization of the physical machines.
In practical applications, many users have requirements for specifying the virtual ratio of physical machines when creating cloud hosts, that is, it is desirable that the cloud hosts are created on physical machines with the virtual ratio less than or equal to a certain specified value, and the virtual ratio can be understood as the maximum number of created cloud hosts in a certain physical machine set in advance. For such a demand, it is currently practiced to isolate the physical machine of the designated virtual ratio from the physical machine of the common dispatch area, for example, the physical machine Enable (available) of the common dispatch area, the physical machine Disable (unavailable) of the designated virtual ratio are made available in advance. After a background receives a request of a user for creating a cloud host, if the user has a specified virtual ratio, manually scheduling a physical machine conforming to the virtual ratio to create the cloud host; if the user does not specify a virtual ratio, the request is sent to the scheduler for scheduling.
That is, in the prior art, the scheduler can only schedule the physical machines in the common scheduling area, and cannot schedule the physical machines with the specified virtual ratio. Therefore, if the user specifies the virtual ratio of the physical machine when creating the cloud host, the physical machine needs to be manually selected from all the physical machines with the specified virtual ratio to create the cloud host, but this approach is too cumbersome and error-prone.
Disclosure of Invention
The embodiment of the invention aims to provide a cloud host creating method and device, so that a cloud host can be rapidly created on a physical machine with a specified virtual ratio, and errors are reduced. The specific technical scheme is as follows:
in order to achieve the above object, an embodiment of the present invention discloses a cloud host creation method, where the method includes:
receiving a creation request for a target cloud host;
judging whether the creating request carries a first virtual ratio label or not, wherein the first virtual ratio label is used for determining a target virtual ratio of a physical machine for creating the target cloud host, and the physical machine with the target virtual ratio is identified by the first virtual ratio label;
if the creation request carries the first virtual ratio label, judging whether at least one first physical machine identified by the first virtual ratio label exists, wherein the number of cloud hosts in the first physical machine is smaller than the target virtual ratio;
if the at least one first physical machine exists, determining the at least one first physical machine as a target physical machine;
if the virtual ratio labels do not exist, selecting a first preset number of empty physical machines which do not create cloud hosts and are not identified by the virtual ratio labels to determine as target physical machines, and identifying the target physical machines by the first virtual ratio labels;
and creating the target cloud host on the target physical machine according to the creation request of the target cloud host.
In order to achieve the above object, an embodiment of the present invention further discloses a cloud host creation apparatus, where the apparatus includes:
the receiving module is used for receiving a creation request aiming at a target cloud host;
a first determining module, configured to determine whether the creation request carries a first virtual ratio tag, where the first virtual ratio tag is used to determine a target virtual ratio of a physical machine that creates the target cloud host, and a physical machine having the target virtual ratio uses the first virtual ratio tag identifier; if the mobile phone is carried, triggering a second judgment module;
the second judging module is configured to judge whether at least one first physical machine identified by the first virtual ratio tag exists, where the number of cloud hosts in the first physical machine is smaller than the target virtual ratio; if yes, triggering a first determination module; if not, triggering a second determination module;
the first determining module is used for determining the at least one first physical machine as a target physical machine; a trigger creation module;
the second determining module is used for selecting a first preset number of empty physical machines which do not create cloud hosts and are not identified by the virtual ratio tags to determine as target physical machines, and identifying the target physical machines by the first virtual ratio tags; a trigger creation module;
the creating module is used for creating the target cloud host on the target physical machine according to the creating request of the target cloud host.
The cloud host creating method and device provided by the embodiments of the present invention indicate that a user has a requirement for specifying a virtual ratio of a physical machine when a first virtual ratio tag is carried in a creating request for a target cloud host, if a first physical machine identified by the first virtual ratio tag exists and the number of cloud hosts in the first physical machine is less than the target virtual ratio, determine the first physical machine as the target physical machine, and create the target cloud host on the target physical machine, if there is no physical machine identified by the first virtual ratio tag or there is a physical machine identified by the first virtual ratio tag but the number of cloud hosts in the physical machine is equal to the target virtual ratio, select a first preset number of empty physical machines which do not create a cloud host and are not identified by the virtual ratio tag, determine the empty physical machines as the target physical machines, and identify the target physical machines by the first virtual ratio tag, and then creating a target cloud host on the target physical machine. Therefore, according to the scheme provided by the embodiment of the invention, the automatic matching of the virtual ratio can be realized without manual scheduling for the creation request of the user with the virtual ratio requirement of the specified physical machine, and the cloud host is automatically created in the physical machine with the specified virtual ratio, so that errors are reduced.
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 some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a cloud host creation method according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of another cloud host creation method according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating physical machines grouped using tags in an embodiment of the present invention;
fig. 4 is a schematic flowchart of dynamic tagging of virtual ratio labels of a physical machine in an embodiment of the present invention;
fig. 5 is a schematic flowchart illustrating dynamic de-tagging of a virtual ratio tag of a physical machine in an embodiment of the present invention;
FIG. 6 is a flow diagram illustrating tag separation logic for a physical machine in an exemplary embodiment of the invention;
fig. 7 is a schematic structural diagram of a cloud host creation 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 order to solve the problem of the prior art, embodiments of the present invention provide a cloud host creation method and apparatus. First, a method for creating a cloud host according to an embodiment of the present invention is described in detail below.
It should be noted that the execution main body of the scheme provided by the embodiment of the present invention may be a scheduler, and the scheduler is configured to schedule the cloud host creation task to the physical machine, so that the physical machine completes the creation of the cloud host.
Fig. 1 is a schematic flowchart of a cloud host creation method provided in an embodiment of the present invention, where the method includes:
s101, a creation request for a target cloud host is received.
The creation request may carry information about the number of target cloud hosts to be created, the type of the target cloud host, the virtual ratio of the physical machine that creates the target cloud host, and the like, and certainly, the creation request may also carry other information, which is not limited in this embodiment.
S102, judging whether the creating request carries a first virtual ratio label or not; if the creation request carries the first virtual ratio tag, S103 is executed.
Wherein the first virtual ratio label is used to determine a target virtual ratio of the physical machine that created the target cloud host, and the physical machine with the target virtual ratio is identified with the first virtual ratio label.
For example, if a user requests to create a cloud host and wishes to create the cloud host on a specific physical machine, the specific physical machine means that the maximum number of the created cloud hosts in the physical machine does not exceed a specific value, which may be referred to as a virtual ratio. The physical machines assigned with the virtual ratio can create the number of cloud hosts corresponding to the virtual ratio at most.
In practical applications, if a physical machine is assigned a virtual ratio, the physical machine may be identified by a virtual ratio tag, for example, if the assigned virtual ratio of a physical machine is 3, the virtual ratio tag of the physical machine may be: ratio _ 3. The physical machine identified by the virtual ratio label ratio _3 can be understood as the physical machine in which a maximum of 3 cloud hosts can be created.
Tags may be understood as labeling physical machines in the form of keywords to enable classification of the physical machines. In practical applications, the situation that the physical machine is identified by the virtual ratio tag can be managed by using a data table. When a physical machine is not assigned with a virtual ratio, the data table does not record the virtual ratio tag corresponding to the physical machine, and when the physical machine is assigned with a certain virtual ratio, the virtual ratio tag corresponding to the physical machine in the data table is updated according to the assigned virtual ratio. As shown in the data table of Table 1, the column "virtual ratio label" corresponding to the row of physical machine PM _1 is labeled with virtual ratio label ratio _3, which indicates that the physical machine is identified by virtual ratio label ratio _3, while the column "virtual ratio label" corresponding to the row of physical machine PM _2 is not labeled with a virtual ratio label, which indicates that the physical machine is not identified by a virtual ratio label. When judging whether a physical machine identified by the virtual ratio label ratio _3 exists, inquiring whether a label ratio _3 exists in a 'virtual ratio label' column in a data table. The data table may be stored in a scheduler, and after selecting an empty physical machine which does not create a cloud host and is not identified by the virtual ratio tag as a target physical machine, the scheduler stores a first virtual ratio tag corresponding to the target physical machine in the data table.
TABLE 1
Physical machine identification Virtual ratio label
PM_1 ratio_3
PM_2
PM_3 ratio_4
It should be noted that, after a physical machine is identified by a virtual ratio label, the physical machine cannot be identified by other virtual ratio labels until the virtual ratio label is deleted, but if the virtual ratio label is deleted, the physical machine can be identified by other virtual ratio labels, that is, one physical machine cannot be identified by a plurality of virtual ratio labels at the same time.
The physical machine identified by the virtual ratio tag may be understood as a physical machine specifying the virtual ratio, and the physical machine not identified by the virtual ratio tag may be understood as a normal physical machine. It can be understood that the physical machine with the specified virtual ratio belongs to the specified area, the common physical machine belongs to the common scheduling area, the physical machine with the specified virtual ratio is isolated from the common physical machine, the physical isolation means such as artificial division of areas and the like are not needed, natural isolation is achieved by identifying the virtual ratio label, the isolation method greatly reduces artificial intervention, manual scheduling is not needed, and therefore the workload of technical personnel is reduced.
It is understood that not all users have a requirement to specify the virtual ratio of the physical machine, and for those ordinary users who do not specify the virtual ratio of the physical machine, the cloud host they want to create may be created in the physical machine without the virtual ratio tag identification, i.e., in the ordinary physical machine in the common dispatch area.
Specifically, for a creation request for creating a cloud host by an ordinary user who does not specify a virtual ratio of a physical machine, the scheduler may select the physical machine for creating the cloud host from the ordinary physical machines; and aiming at each cloud host in the creation request, creating a corresponding cloud host creation task, and scheduling the cloud host creation task to one or more common physical machines according to the resources required by each cloud host and the resource condition of each common physical machine to complete the creation of the cloud host.
Specifically, the weight value of each common physical machine may be calculated according to the resource usage of the physical machine, and the weight value of the physical machine may be: and determining the physical machine for creating the cloud host from the common physical machines according to the calculated weight value. For example, a physical machine with a weight value smaller than a preset weight value threshold may be randomly selected to create the cloud host, or a physical machine with a small weight value may be preferentially selected to create the cloud host according to the size of the weight value. When calculating the weight value, a certain resource of the physical machine, such as the remaining capacity of the disk, the memory, and the like, may be considered separately, or a combination of multiple resources may also be considered at the same time, which is not limited in this embodiment.
Further, if the creating request of the general user for creating the cloud host without specifying the virtual ratio of the physical machine also carries the CPU type of the physical machine for creating the cloud host, the physical machine meeting the CPU type requirement is selected from the determined physical machines to create the cloud host. For example, if the CPU type of the physical machine that creates the cloud host is 2680v4, the scheduler will schedule the cloud host creation task to one or more ordinary physical machines that have the CPU type of 2680v4 and the weight value that meets the requirement.
S103, judging whether at least one first physical machine identified by a first virtual ratio label exists or not, wherein the number of cloud hosts in the first physical machine is smaller than a target virtual ratio; if so, S104 is performed, and if not, S105 is performed.
S104, determining at least one first physical machine as a target physical machine; s106 is executed again.
S105, selecting a first preset number of empty physical machines which do not create cloud hosts and are not identified by the virtual ratio labels to determine as target physical machines, and identifying the target physical machines by the first virtual ratio labels; s106 is executed again.
And S106, creating the target cloud host on the target physical machine according to the creation request of the target cloud host.
It can be understood that if the number of cloud hosts corresponding to the first virtual ratio is currently created in the physical machines identified by the first virtual ratio label, the physical machines can not create other cloud hosts. Therefore, if a first physical machine which is identified by a first virtual ratio label and has the number of cloud hosts smaller than a target virtual ratio exists currently, the first physical machine can be directly used as a target physical machine, and a target cloud host is created on the target physical machine; if the first physical machine identified by the first virtual ratio label does not exist currently, or the physical machines identified by the first virtual ratio label exist but the number of the cloud hosts in the physical machines is equal to the target virtual ratio, a first preset number of empty physical machines which do not create cloud hosts and are not identified by the virtual ratio label are selected from common physical machines to be determined as target physical machines, the target physical machines are identified by the first virtual ratio label, and then the target cloud hosts are created on the determined target physical machines.
It should be noted that the empty physical machine that does not create a cloud host only indicates that there is no cloud host in the current physical machine, and does not limit whether the physical machine has created a cloud host, and the physical machine may be a physical machine that has never created a cloud host, a physical machine that has created a cloud host of an ordinary user, or a physical machine that has been identified by a virtual ratio tag and is not identified by the virtual ratio tag.
Specifically, the step of creating the target cloud host on the target physical machine according to the creation request of the target cloud host may include:
determining a second physical machine for creating a target cloud host from the target physical machines;
aiming at each target cloud host in the creation request, creating a corresponding cloud host creation task;
and scheduling each cloud host creation task to one or more second physical machines to complete the creation of the target cloud host according to the resources required by each target cloud host and the resource condition of each second physical machine.
Specifically, the weight value of each target physical machine may be calculated according to the resource usage of the physical machine, a smaller weight value indicates more remaining resources of the physical machine, and then, according to the calculated weight value, a second physical machine that creates the target cloud host is determined from the target physical machines. The weight values of the physical machines may be: a ratio of the resource value used by the physical machine to the total resource value of the physical machine.
For example, a physical machine with a weight value smaller than a preset weight value threshold may be randomly selected as the second physical machine, or a physical machine with a small weight value may be preferentially selected as the second physical machine according to the size of the weight value. When calculating the weight value, a certain resource of the physical machine, such as the remaining capacity of the disk, the memory, and the like, may be considered separately, or a combination of multiple resources may also be considered at the same time, which is not limited in this embodiment.
It is understood that one creation request may require creation of multiple target cloud hosts, one for each cloud host creation task. In this case, due to resource limitations of the physical machines, such as resources of a disk remaining capacity, a memory, and the like, it may be that resources of one second physical machine cannot meet requirements of multiple target cloud hosts, and therefore the multiple target cloud hosts need to be created in one or multiple second physical machines, and according to the resources required by each target cloud host and the resource condition of each second physical machine, the cloud host creation task is scheduled to one or multiple second physical machines to complete creation of all target cloud hosts.
Further, if the creation request also carries the CPU type of the physical machine that creates the target cloud host, then a physical machine that meets the CPU type requirement needs to be selected from the second physical machine to create the target cloud host. For example, if the physical machine carrying the creation target cloud host in the creation request is 2680v4 in CPU type, the scheduler will schedule the cloud host creation task to one or more second physical machines with 2680v4 selected CPU type.
Specifically, the step of scheduling each cloud host creation task to one or more second physical machines to complete creation of the target cloud host according to the resource required by each target cloud host and the resource condition of each second physical machine may include:
judging whether each cloud host creation task can be completed according to the resource condition of each second physical machine;
if yes, scheduling each cloud host creation task to one or more second physical machines to complete the creation of the target cloud host;
if not, selecting a second preset number of empty physical machines which do not create the cloud host and are not identified by the virtual ratio tags to determine as second physical machines, identifying the second physical machines by the first virtual ratio tags, and then executing the step of scheduling each cloud host creation task to one or more second physical machines to complete creation of the target cloud host.
For example, currently, there are 5 second physical machines, one creation request needs to create 10 target cloud hosts, and if the resources of the 5 second physical machines can complete the creation tasks of the 10 target cloud hosts, the 10 cloud host creation tasks are directly scheduled to one or more of the 5 second physical machines to complete the creation of the target cloud hosts.
In another case, if the resources of the 5 second physical machines are insufficient to complete the creation tasks of the 10 target cloud hosts, it is required to select 1 empty physical machine without creating a cloud host from the common physical machines to determine as the second physical machine, identify the second physical machine by using the first virtual ratio tag, and schedule the 10 cloud host creation tasks to one or more of the 6 second physical machines to complete the creation of the target cloud hosts.
Further, if the resources of the 6 second physical machines are still insufficient to complete the creation tasks of the 10 target cloud hosts, it is necessary to select 1 empty physical machine without creating a cloud host from the common physical machines again to determine as the second physical machine, and identify the second physical machine with the first virtual ratio tag until the obtained resources of the second physical machine can complete the creation tasks of the 10 target cloud hosts, so as to schedule each cloud host creation task into the obtained second physical machine.
In practical applications, the values of the second preset number and the first preset number may be the same or different, and this embodiment does not limit this.
In one implementation, in the case that there is no empty physical machine that does not create a cloud host and is not identified by the virtual ratio tag, a prompt message for the empty physical machine that does not create a cloud host and is not identified by the virtual ratio tag may also be output. It can be understood that there are no empty physical machines which are not created with cloud hosts and are not identified by the virtual ratio labels, that is, the number of ordinary physical machines in the public scheduling area is insufficient, so that the creation of the target cloud host fails, and therefore, outputting the prompt message can remind technicians of the shortage of resources in the public scheduling area, so that the technicians can adjust or supplement the resources.
In one implementation, to facilitate state management of a physical machine of a specified virtual ratio and a normal physical machine, the state of the physical machine can be further distinguished from whether the physical machine is identified by a virtual ratio tag or not and whether the physical machine has a cloud host or not.
Specifically, the cloud host creation method may further include:
determining the state of each physical machine according to whether the physical machine is identified by the virtual ratio tag at the current moment and whether the cloud host exists:
if the physical machine exists in the cloud host and is identified by the virtual comparison tag, the physical machine is in a first state;
if the physical machine does not have the cloud host and the time that the virtual ratio label is not deleted does not reach the preset time, the physical machine is in a second state;
if the physical machine does not create the cloud host and is not identified by the virtual ratio tag, the physical machine is in a third state;
and if the physical machine does not have the cloud host and the time that the virtual ratio label is not deleted reaches the preset time, deleting the virtual ratio label and determining the physical machine to be in a third state.
For convenience of recording the states of the physical machines, the three states may be respectively associated with a state value alloc _ stat, for example, a state value alloc _ stat corresponding to a first state is 1 to indicate that the physical machine is in a use state, a state value alloc _ stat corresponding to a second state is 2 to indicate that the physical machine is in a lock state, and a state value alloc _ stat corresponding to a third state is 0 to indicate that the physical machine is in an initialization state. In practical application, the scheduler may record and update the state of each physical machine, and when the state of a physical machine changes, update the state value of the physical machine to the state value corresponding to the changed state.
For example, initially, when physical machine a has no cloud host and is not identified by a virtual rate tag, physical machine a is in a third state; then, if the physical machine a is selected as a physical machine of a specified virtual ratio and is identified by a virtual ratio tag, the physical machine a is in a first state, at this time, the scheduler sets the state value of the physical machine a from 0 to 1, and the state value of the physical machine a is always 1 until the scheduler detects that no cloud host exists in the physical machine a; then, if it is detected that there is no cloud host in the physical machine a, the scheduler will set the state value of the physical machine a from 1 to 2, the physical machine A is in a second state, when no cloud host exists in the physical machine A and the virtual ratio label is not deleted, and the scheduler starts timing at the moment when the state value of the physical machine A is set to be 2 from 1, after the preset time is reached, the scheduler detects whether the cloud host exists in the physical machine A again, if the cloud host exists, setting the state value of the physical machine A to 1 from 2, indicating that the physical machine A can continue to be a physical machine with a specified virtual ratio, if the cloud host does not exist, deleting the virtual ratio tag of the physical machine A and setting the state value of the physical machine from 2 to 0, which means that the physical machine A is changed from the physical machine with the specified virtual ratio to the ordinary physical machine and returns to the public scheduling area from the specified area.
It can be seen that when the physical machine of the specified virtual ratio in the specified area is insufficient, the common physical machine in the public scheduling area is converted into the physical machine of the specified virtual ratio in a virtual ratio tag identification mode, and when the physical machine of the specified virtual ratio does not have a cloud host, the virtual ratio tag on the physical machine is deleted, so that the physical machine returns to the public scheduling area as the common physical machine again. The label-based physical machine resource dynamic management mode not only meets the requirement of a user for specifying the physical machine with a virtual ratio, but also realizes resource sharing of the physical machines in the specified area and the public scheduling area.
It should be noted that, after all the cloud hosts in the physical machine with the specified virtual ratio are deleted, the physical machine goes from the first state to the second state, where the second state is an intermediate transition stage, also called a label pre-separation state, at this time, the physical machine is in a locked state, and the scheduler cannot schedule the physical machine, that is, the scheduler does not schedule the cloud host creation task to the physical machine in the second state.
As will be understood by those skilled in the art, if the scheduler detects that there is no cloud host in a physical machine with a specified virtual ratio, the virtual ratio tag of the physical machine is immediately deleted, which may cause an error, because of the high concurrency of the cloud host creation request, and a situation where the scheduler schedules other cloud host creation tasks to the physical machine may occur in a short time, so setting the second state may avoid such a problem.
In the case that the scheduler records and updates the state of the physical machine, the determining whether there is at least one first physical machine identified by the first virtual ratio tag, where the number of cloud hosts in the first physical machine is smaller than the target virtual ratio may include:
obtaining a physical machine identified by a first virtual ratio tag, and determining the physical machine as a candidate first physical machine;
determining physical machines in a first state in the candidate first physical machines as first physical machines, wherein the number of cloud hosts in the first physical machines is smaller than a target virtual ratio;
judging whether at least one first physical machine exists or not;
the selecting, by the first preset number of empty physical machines that do not create cloud hosts and are not identified by the virtual ratio tag, an empty physical machine that is determined as a target physical machine may include:
and selecting the physical machines of the first preset number in the third state to be determined as target physical machines.
It can be understood that, since the physical machines in the first state and the second state are both in the state identified by the virtual ratio tag, the state of each candidate first physical machine needs to be determined first, and if the state is the first state, the candidate first physical machine may be determined as the first physical machine, and if the state is the second state, the candidate first physical machine in the second state may not be determined as the first physical machine because the physical machine in the second state is in the locked state and cannot be scheduled by the scheduler.
As can be seen from the above, in the cloud host creating method provided in this embodiment, when a creating request for a target cloud host carries a first virtual ratio tag, the user indicates that the user has a requirement for specifying a virtual ratio of a physical machine, if a first physical machine identified by the first virtual ratio tag exists and the number of cloud hosts in the first physical machine is less than the target virtual ratio, the first physical machine is determined as the target physical machine, and a target cloud host is created on the target physical machine, if there is no physical machine identified by the first virtual ratio tag or there is a physical machine identified by the first virtual ratio tag but the number of cloud hosts in the physical machine is equal to the target virtual ratio, a first preset number of empty physical machines which do not create a cloud host and are not identified by the virtual ratio tag are selected as the target physical machine, and after the target physical machine is identified by the first virtual ratio tag, and then creating a target cloud host on the target physical machine. Therefore, according to the scheme provided by the embodiment, for the creation request of the user with the virtual ratio requirement of the specified physical machine, the automatic matching of the virtual ratio can be realized without manual scheduling, and the cloud host is automatically created in the physical machine with the specified virtual ratio, so that errors are reduced.
Fig. 2 is a schematic flow chart of another cloud host creation method provided in an embodiment of the present invention, and on the basis of the embodiment shown in fig. 1, the creation request may further carry a first requirement tag, where the first requirement tag is used to identify a requirement of the user on a physical machine that creates a target cloud host;
correspondingly, the step of determining whether the creation request carries the first user tag in the step S102 may be:
s102a, judging whether the creating request carries a first virtual ratio label and a first requirement label;
the step of determining whether there is at least one first physical machine identified by the first virtual ratio tag in S103 may be:
s103a, judging whether at least one first physical machine identified by the first virtual ratio label and the first requirement label exists;
the step of selecting a first preset number of empty physical machines which do not create cloud hosts and are not identified by the virtual ratio tag to determine as the target physical machine in S105, and identifying the target physical machine by using the first virtual ratio tag may be:
s105a, selecting a first preset number of empty physical machines which do not create cloud hosts and are not identified by the virtual ratio label and the demand label, determining the empty physical machines as target physical machines, and identifying the target physical machines by the first virtual ratio label and the first demand label.
In practice, a user with a requirement for specifying the virtual ratio of a physical machine may wish to create a cloud host on a physical machine that specifies the virtual ratio and satisfies a particular requirement, wherein the physical machine satisfying the particular requirement may also be identified by a requirement tag. In practice, the physical machine of the specified virtual ratio identified by the virtual ratio tag may also be identified by a number of different types of demand tags.
For example, when a user creates a cloud host, not only the virtual ratio of a physical machine is specified to be 3, but also the user wishes to create the cloud host in a physical machine of a specific CPU type, at this time, the creation request may also carry a requirement tag for identifying the CPU type of the physical machine that created the cloud host, and when the first requirement tag is carried as the CPU type tag phy _ CPU _2680v4, it indicates that the cloud host to be created by the creation request must be created in a physical machine of which the CPU type is 2680v4 and the virtual ratio is 3, so that the physical machine of which the CPU type is 2680v4 may be identified by the virtual ratio tag ratio _3 and the CPU type tag phy _ CPU _2680v4 at the same time.
Or, when the user has more service types, the user also wants to create cloud hosts of the same service type in the same physical machine, and the physical machines of the specified virtual ratio may be divided according to the service types. For example, the creation request may also carry a requirement tag for identifying a service type of a physical machine that creates the cloud host, and when the carried first requirement tag is the service type tag sub _ user _ a1, it indicates that the cloud host to be created by the creation request must be created in the physical machine with the service type a 1. The physical machine of type a1 may be identified by both the virtual ratio label ratio _3 and the type of service label sub _ user _ a 1.
It should be noted that a physical machine identified by a virtual machine tag may be identified by a plurality of different types of demand tags, but may not be identified by a plurality of demand tags of the same type. For example, a physical machine with a CPU type 2680v4 may be identified by virtual ratio tag ratio _3, demand tag phy _ CPU _2680v4, and demand tag sub _ user _ a1 at the same time, but may not be identified by virtual ratio tag ratio _3, demand tag phy _ CPU _2680v4, demand tag phy _ CPU _2680v3, and demand tag sub _ user _ a1 at the same time, or may not be identified by virtual ratio tag ratio _3, demand tag phy _ CPU _2680v3, demand tag sub _ user _ a1, and demand tag sub _ user _ a2 at the same time. It is understood that phy _ cpu _2680v3 and phy _ cpu _2680v4 are requirement tags belonging to the same type, and sub _ user _ a1 and sub _ user _ a2 are requirement tags belonging to the same type.
In practical application, in addition to the CPU type tag and the service type tag in the above example, other types of requirement tags may be set according to the requirement of the user, and this embodiment does not limit the number of requirement tags carried by the creation request, and it is reasonable to carry multiple requirement tags simultaneously or only one requirement tag in the creation request.
In practical applications, the physical machine identified by the requirement tag can be managed by a data table. For example, when a physical machine is not identified by a requirement tag, the data table does not record the requirement tag corresponding to the physical machine, and when the physical machine is identified by a requirement tag, the data table records the user tag corresponding to the physical machine. As shown in the data table in table 1, the column of "service type tag" corresponding to the row where the physical machine PM _1 is located is labeled with the service type tag sub _ user _ a1, which indicates that the physical machine is identified by the service type tag sub _ user _ a1, and the column of "service type tag" corresponding to the row where the physical machine PM _3 is located is not labeled with a tag, which indicates that the physical machine is not identified by the service type tag. When judging whether a physical machine identified by the virtual ratio label ratio _3 and the CPU type label phy _ CPU _2680v4 exists, the physical machine identified as PM _1 meets the requirement by inquiring the data table. The data table may be stored in the scheduler, and after selecting an empty physical machine which does not create a cloud host and is not identified by the virtual ratio label and the service type label as a target physical machine, the scheduler stores the virtual ratio label ratio _3 and the service type label sub _ user _ a1 corresponding to the target physical machine into the data table, that is, the virtual ratio label ratio _3 and the service type label sub _ user _ a1 are used to identify the target physical machine.
TABLE 2
Figure BDA0001273536880000131
Figure BDA0001273536880000141
It can be understood that the virtual ratio tag identifies a requirement that the user has a specified physical machine virtual ratio, the requirement tag further identifies other requirements of the user on the physical machine for creating the cloud host, and here, the virtual ratio tag can be understood as a primary tag and the requirement tag as a secondary tag, and this hierarchical tag manner satisfies various requirements of the user on the physical machine, and is also convenient for quickly determining the physical machine satisfying the user requirements.
It can be understood that the physical machine is identified by a certain requirement label, the physical machine of the type can be isolated from other physical machines, manual scheduling is not needed when a creating request carries a certain requirement label, the scheduler can schedule the cloud host creating task to the physical machine identified by the requirement label, and the label-based isolation mode also reduces human intervention and lightens the workload of technical staff.
It can be understood that, if a first physical machine identified by a first virtual ratio tag and a first requirement tag currently exists, and the number of cloud hosts in the first physical machine is less than a target virtual ratio, the first physical machine may be directly used as a target physical machine, and a target cloud host may be created on the target physical machine; if the first physical machine identified by the first virtual ratio tag and the first requirement tag does not exist currently, or the physical machines identified by the first virtual ratio tag and the first requirement tag exist but the number of cloud hosts in the physical machines is equal to the target virtual ratio, a first preset number of empty physical machines which do not create cloud hosts and are not identified by the virtual ratio tag and the requirement tag can be selected from common physical machines to be determined as target physical machines, the target physical machines are identified by the first virtual ratio tag and the first requirement tag, and then the target cloud hosts are created on the determined target physical machines.
It should be noted that the empty physical machine that does not create a cloud host only indicates that there is no cloud host in the current physical machine, and does not limit whether the physical machine has created a cloud host, and the physical machine may be a physical machine that has never created a cloud host, or a physical machine that has been identified by a virtual ratio tag or a demand tag but is not identified by a virtual ratio tag or a demand tag.
Specifically, the step of creating the target cloud host on the target physical machine in S106 according to the creation request of the target cloud host may include:
determining a second physical machine for creating a target cloud host from the target physical machines;
aiming at each target cloud host in the creation request, creating a corresponding cloud host creation task;
and scheduling each cloud host creation task to one or more second physical machines to complete the creation of the target cloud host according to the resources required by each target cloud host and the resource condition of each target physical machine.
Specifically, the weight value of each target physical machine may be calculated according to the resource usage of the physical machine, a smaller weight value indicates more remaining resources of the physical machine, and then, according to the calculated weight value, a second physical machine that creates the target cloud host is determined from the target physical machines. The weight values of the physical machines may be: a ratio of the resource value used by the physical machine to the total resource value of the physical machine. For example, a physical machine with a weight value smaller than a preset weight value threshold may be randomly selected as the second physical machine, or a physical machine with a small weight value may be preferentially selected as the second physical machine according to the size of the weight value. When calculating the weight value, a certain resource of the physical machine, such as the remaining capacity of the disk, the memory, and the like, may be considered separately, or a combination of multiple resources may also be considered at the same time, which is not limited in this embodiment.
It is understood that one creation request may require creation of multiple target cloud hosts, one for each cloud host creation task. In this case, due to resource limitations of the physical machines, such as resources of a disk remaining capacity, a memory, and the like, it may be that resources of one second physical machine cannot meet requirements of multiple target cloud hosts, and therefore the multiple target cloud hosts need to be created in one or multiple second physical machines, and according to the resources required by each target cloud host and the resource condition of each second physical machine, the cloud host creation task is scheduled to one or multiple second physical machines to complete creation of all target cloud hosts.
Specifically, the step of scheduling each cloud host creation task to one or more second physical machines to complete creation of the target cloud host according to the resource required by each target cloud host and the resource condition of each second physical machine may include:
judging whether each cloud host creation task can be completed according to the resource condition of each second physical machine;
if yes, scheduling each cloud host creation task to one or more second physical machines to complete the creation of the target cloud host;
if not, selecting a second preset number of empty physical machines which do not create the cloud host and are not identified by the virtual ratio tags and the demand tags to determine as second physical machines, identifying the second physical machines by the first virtual ratio tags and the first demand tags, and then executing a step of scheduling each cloud host creation task to one or more second physical machines to complete creation of the target cloud host.
For example, currently, there are 5 second physical machines, one creation request needs to create 10 target cloud hosts, and if the resources of the 5 second physical machines can complete the creation tasks of the 10 target cloud hosts, the 10 cloud host creation tasks are directly scheduled to one or more of the 5 second physical machines to complete the creation of the target cloud hosts.
In another case, if the resources of the 5 second physical machines are insufficient to complete the creation tasks of the 10 target cloud hosts, it is required to select 1 empty physical machine without creating a cloud host from the common physical machines to determine as the second physical machine, identify the second physical machine by using the first virtual ratio tag, and schedule the 10 cloud host creation tasks to one or more of the 6 second physical machines to complete the creation of the target cloud hosts.
Further, if the resources of the 6 second physical machines are still insufficient to complete the creation tasks of the 10 target cloud hosts, it is necessary to select 1 empty physical machine without creating a cloud host from the common physical machines again to determine as the second physical machine, and identify the second physical machine with the first virtual ratio tag until the obtained resources of the second physical machine can complete the creation tasks of the 10 target cloud hosts, so as to schedule each cloud host creation task into the obtained second physical machine.
In practical applications, the values of the second preset number and the first preset number may be the same or different, and this embodiment does not limit this.
In one implementation, in the case that there is no empty physical machine that does not create a cloud host and is not identified by the virtual ratio tag and the requirement tag, a prompt message of the empty physical machine that does not create the cloud host and is not identified by the virtual ratio tag and the requirement tag may also be output. It can be understood that there is no empty physical machine which is not created with a cloud host and is not identified by the virtual ratio tag and the requirement tag, that is, the number of ordinary physical machines in the public scheduling area is insufficient, so that the creation of the target cloud host fails, and therefore, outputting the prompt message can remind a technician that the resources in the public scheduling area are insufficient, so that the technician can adjust or supplement the resources.
In one implementation, in order to facilitate state management of a physical machine with a specified virtual ratio and a common physical machine, the state of the physical machine can be further distinguished from the aspects of whether the physical machine is identified by a virtual ratio tag and a demand tag, and whether the physical machine has a cloud host.
Specifically, the cloud host creation method may further include:
determining the state of each physical machine according to whether the physical machine is identified by a virtual ratio tag and a demand tag at the current moment and whether a cloud host exists:
if the physical machine exists in the cloud host and is identified by the virtual comparison tag and the demand tag, the physical machine is in a first state;
if the physical machine does not have the cloud host and the time that the virtual comparison tag and the demand tag are not deleted does not reach the preset time, the physical machine is in a second state;
if the physical machine does not create the cloud host and is not identified by the virtual ratio tag and the demand tag, the physical machine is in a third state;
and if the physical machine does not have the cloud host and the time that the virtual ratio label and the demand label are not deleted reaches the preset time, deleting the virtual ratio label and the demand label and determining the physical machine to be in a third state.
In practical applications, different attributes, including fixed attributes and recyclable attributes, may be set for different tags. When all the cloud hosts in the physical machine are deleted, the label is not deleted; and a label with a recyclable attribute that is deleted when all cloud hosts in the physical machine are deleted. Tags with fixed attributes may be referred to as fixed tags and tags with recyclable attributes may be referred to as variable tags.
The label with fixed attributes is exemplified first: for each physical machine, since the CPU type of the physical machine is determined, the requirement tag of the CPU type of the physical machine may be set to a tag with a fixed attribute, for example, a physical machine with a CPU type of 2680v4, and after the physical machine is identified by the requirement tag phy _ CPU _2680v4, when no cloud host exists in the physical machine, the requirement tag phy _ CPU _2680v4 is not deleted. It will be appreciated that, in practice, if the requirement tag phy _ CPU _2680v4 of the physical machine is deleted, then if the requirement tag of the CPU type of the physical machine is needed again to identify the physical machine, the physical machine will still be identified by the requirement tag phy _ CPU _2680v 4. So for a fixed tag, it may not be deleted when there is no cloud host in the identified physical machine.
Further illustrating the tags with recyclable property: a physical machine may be identified by any virtual radio tag or any business type tag, and thus, the virtual radio tag and the business type tag may be set as tags for the recyclable attribute. For example, after a physical machine is identified by the virtual ratio label ratio _3, when no cloud host exists in the physical machine, the virtual ratio label ratio _3 is deleted, so that the subsequent physical machine may be identified by other virtual ratio labels ratio _4, or may be identified by the virtual ratio label ratio _3 again. Similarly, a physical machine is identified by the service type tag sub _ user _ a1, and when the service type tag sub _ user _ a1 is deleted, the physical machine may also be identified by another service type tag sub _ user _ a2, or may be identified again by the service type tag sub _ user _ a 1. So for a variable tag, when there is no cloud host in the identified physical machine, the tag should be deleted.
Therefore, when the cloud host does not exist in the physical machine identified by the two variable tags at the same time, both the two variable tags need to be deleted; and when the cloud host does not exist in the physical machine identified by the fixed label and the variable label, only the variable label is deleted, and the fixed label is not deleted. That is, in determining the state of the physical machine, only the variable tag may be considered regardless of whether it is identified by the fixed tag or whether the fixed tag is deleted.
For convenience of recording the states of the physical machines, the three states may be respectively associated with a state value alloc _ stat, for example, a state value alloc _ stat corresponding to a first state is 1 to indicate that the physical machine is in a use state, a state value alloc _ stat corresponding to a second state is 2 to indicate that the physical machine is in a lock state, and a state value alloc _ stat corresponding to a third state is 0 to indicate that the physical machine is in an initialization state. In practical application, the scheduler may record and update the state of each physical machine, and when the state of a physical machine changes, update the state value of the physical machine to the state value corresponding to the changed state.
For example, initially, when physical machine a has no cloud host and is not identified by the virtual ratio tag and the demand tag, physical machine a is in a third state; then, if the physical machine a is selected as a target physical machine and is identified by the virtual ratio tag and the requirement tag, the physical machine a is in a first state, at this time, the scheduler sets the state value of the physical machine a from 0 to 1, and the state value of the physical machine a is always 1 until the scheduler detects that no cloud host exists in the physical machine a; then, if it is detected that no cloud host exists in the physical machine a, the scheduler sets the state value of the physical machine a from 1 to 2, the physical machine a is in a second state, at this time, no cloud host exists in the physical machine a, and the virtual ratio tag and the requirement tag have not been deleted, and the scheduler starts to time at the time when the state value of the physical machine a is set from 1 to 2, and after reaching a preset time, the scheduler detects again whether a cloud host exists in the physical machine a, if a cloud host exists, sets the state value of the physical machine a from 2 to 1, indicating that the physical machine a can continue to be a physical machine with a specified virtual ratio, if no cloud host exists, deletes the virtual ratio tag and the requirement tag of the physical machine a and sets the state value of the physical machine from 2 to 0, indicating that the physical machine a is changed from the physical machine with the specified virtual ratio to a normal physical machine, from the designated area back to the common scheduling area.
It can be seen that when a specific physical machine of a certain type in the designated area is insufficient, the common physical machine in the public scheduling area is converted into a physical machine with a designated virtual ratio in a manner of a virtual ratio tag and a demand tag identifier, and when the physical machine with the designated virtual ratio does not have a cloud host, the virtual ratio tag and the demand tag on the physical machine are deleted and are returned to the public scheduling area as the common physical machine. The label-based physical machine resource dynamic management mode not only meets the requirement of a user for specifying the virtual ratio of the physical machine, but also realizes the resource sharing of the physical machine between the specified area and the public scheduling area.
It should be noted that, after all the cloud hosts in the physical machine with the specified virtual ratio are deleted, the physical machine is changed from the first state to the second state, where the second state is an intermediate transition phase, also called a label pre-separation state, and at this time, the physical machine is in a locked state, and the scheduler cannot schedule the physical machine, that is, the scheduler does not schedule the cloud host creation task to the physical machine in the second state.
As will be understood by those skilled in the art, if the scheduler detects that there is no cloud host in a physical machine with a specified virtual ratio, the virtual ratio tag and the demand tag of the physical machine are deleted immediately, which may cause an error, because of high concurrency of the cloud host creation request, a situation may occur in a short time when the scheduler schedules other cloud host creation tasks to the physical machine, and thus setting this second state may avoid such a problem.
In the case that the scheduler records and updates the state of the physical machine, the determining whether there is at least one first physical machine identified by the first virtual ratio tag and the first requirement tag at the same time, where the step of determining that the number of cloud hosts in the first physical machine is less than the target virtual ratio may include:
obtaining a physical machine identified by a first virtual ratio label and a first demand label at the same time, and determining the physical machine as a candidate first physical machine;
determining physical machines in a first state in the candidate first physical machines as first physical machines, wherein the number of cloud hosts in the first physical machines is smaller than a target virtual ratio;
judging whether at least one first physical machine exists or not;
the step of selecting the empty physical machines of which the first preset number of tables do not create the cloud host and are not identified by the virtual ratio tag and the demand tag as the target physical machines includes:
and selecting the physical machines of the first preset number in the third state to be determined as target physical machines.
It can be understood that, since the physical machines in the first state and the second state are both in the states identified by the virtual ratio tag and the requirement tag, the state of each candidate first physical machine needs to be determined first, and if the candidate first physical machine is in the first state, the candidate first physical machine may be determined as the first physical machine, and if the candidate first physical machine is in the second state, the candidate first physical machine in the second state may not be determined as the first physical machine because the physical machine in the second state is in the locked state and cannot be scheduled by the scheduler.
As can be seen from the above, in the solution provided in this embodiment, when the creation request for the target cloud host carries the first virtual ratio tag and the first requirement tag, it indicates that the user has a requirement for specifying the virtual ratio of the physical machine, and the user wishes to create the target cloud host on the physical machine meeting the specific requirement and specifying the virtual ratio, if there is a first physical machine identified by the first virtual ratio tag and the first requirement tag and the number of cloud hosts in the first physical machine is less than the target virtual ratio, determine the first physical machine as the target physical machine, and create the target cloud host on the target physical machine, if there is no physical machine identified by the first virtual ratio tag and the first requirement tag or there is a physical machine identified by the first virtual ratio tag and the first requirement tag but the number of cloud hosts in the physical machine is equal to the target virtual ratio, selecting a first preset number of empty physical machines which do not create cloud hosts and are not identified by the virtual ratio tags and the demand tags to determine as target physical machines, identifying the target physical machines by the first virtual ratio tags and the first demand tags, and then creating the target cloud hosts on the target physical machines. Therefore, according to the scheme provided by the embodiment, for the creation request of the user with the specified physical machine virtual ratio and other requirements, the cloud host can be automatically created on the specific physical machine in the physical machines with the specified virtual ratio without manual scheduling, and errors are reduced.
The following describes a method for creating a cloud host according to the embodiment shown in fig. 1.
Fig. 3 is a schematic diagram of grouping physical machines using tags in this embodiment.
As shown in fig. 3, there are 11 physical machines, which are host1 to host11, wherein the physical machines identified by tag1 include host1 to host4 and host9 to host11, and the physical machines identified by tag2 include host5 to host 11. If the 11 physical machines are grouped according to tags, as shown in fig. 3, the 11 physical machines may be divided into a tag1 tag packet, a tag2 tag packet, a tag1& tag2 combined tag packet, and a tag1| | | tag2 combined tag packet, where the tag1 tag packet includes physical machines host1 to host4 and host9 to host11, the tag2 tag packet includes physical machines host5 to host11, the tag1& tag2 combined tag packet includes physical machines host9 to host11, and the tag1| | | | tag2 combined tag packet includes physical machines host1 to host 11.
The tag is used for being transmitted into and attached to a physical machine when the cloud host is created, for example, a physical machine with a certain virtual ratio is specified when the cloud host is created for the first time, a virtual ratio tag corresponding to the virtual ratio is generated according to a certain naming rule, and the virtual ratio tag is attached to an empty physical machine which is not identified by the virtual ratio tag, so that the empty physical machine becomes a physical machine with the specified virtual ratio. For the naming rule of the tag, English letters, number combinations and _.
The combined label is only used when a user transmits parameters in a creation request for creating the cloud host, and for the naming rule of the combined label, "|" indicates that the cloud host can be scheduled to | | connected tag packet aggregation, "& &" indicates and indicates that the cloud host can be scheduled to & & connected tag packet aggregation, — indicates that the cloud host cannot be scheduled to the prefixed packet. The priority relations of the three connectors are as follows: - > & > |.
Fig. 4 is a schematic flow chart illustrating dynamic labeling of virtual ratio tags of the physical machine in this embodiment.
As shown in fig. 4, the scheduler receives a request from a user to create a cloud host on a physical machine with a specified virtual ratio, and the incoming parameters of the request include a virtual ratio TAG: SYS _ ratio _ n, which indicates that the cloud host is to be created in a grouping marked by the SYS _ ratio _ n label, and then enters a physical machine filtering stage to scan all physical machines, wherein the "all physical machines" refers to all physical machines identified by virtual ratio labels. For each physical machine, judging whether a virtual ratio label on the physical machine is a SYS _ ratio _ n label, if so, judging whether the number of cloud hosts on the physical machine is less than n, of course, setting other filtering conditions during filtering the physical machine, namely judging whether the physical machine meets other filters, if one physical machine meets all the conditions, judging that the physical machine meets the requirements, and if one physical machine does not meet any condition, judging that the physical machine does not meet the requirements. If the physical machines meeting the filtering conditions exist, a weight calculation link can be entered, the weight values of the physical machines meeting the filtering conditions are calculated, and the target physical machine is selected according to the weight values to create the cloud host. If the physical machine which does not meet the filtering condition does not exist, judging whether the public scheduling area has an empty physical machine which does not create the cloud host and is not identified by the virtual ratio label, if so, selecting an empty physical machine which does not create the cloud host and is not identified by the virtual ratio label, attaching the virtual ratio label SYS _ ratio _ n, dividing the physical machine into a grouping marked by the SYS _ ratio _ n label, and entering a physical machine filtering stage. Further, if the public scheduling area has no empty physical machines which do not create a cloud host and are not identified by the virtual ratio tag, the shortage of resources can be alarmed, so that technicians can adjust or supplement the resources.
Fig. 5 is a schematic flow chart illustrating dynamic de-tagging of virtual ratio tags of the physical machine in this embodiment.
As shown in fig. 5, for the physical machines identified by the virtual ratio label, when one cloud host in the physical machines is deleted, the scheduler may determine whether there is any cloud host on the physical machine, and if there is no cloud host in the physical machine, the virtual ratio label on the physical machine may be removed. In another case, the scheduler periodically scans all physical machines identified by virtual ratio labels by using a Garbage Collection (GC) mechanism, and when a certain physical machine is found to have no cloud host, the virtual ratio label on the physical machine can be removed.
Fig. 6 is a schematic flowchart of the tag separation logic of the physical machine in this embodiment.
As shown in fig. 6, for a physical machine identified by a virtual ratio tag, after a user deletes a cloud host, detecting a physical machine identified by a virtual ratio tag where the cloud host is located, or periodically scanning the physical machine identified by the virtual ratio tag by using a GC mechanism, determining whether a cloud host still exists in the physical machine, if not, setting an alloc _ stat value of the physical machine to 2, starting timing, determining again after a preset time whether a cloud host still exists in the physical machine, if so, resetting the alloc _ stat value of the physical machine to 1, indicating that the physical machine can continue to be a physical machine with a specified virtual ratio, and if not, setting the alloc _ stat value of the physical machine to 0, that is, deleting the virtual ratio tag of the physical machine, and returning the physical machine to a common scheduling area. In addition, if it is found that the alloc _ stat value does not match the state value corresponding to the current state of the physical machine in the course of updating the alloc _ stat value of the physical machine, an alarm may be issued, for example, when a cloud host does not exist in the physical machine and the alloc _ stat value is neither 1 nor 2, it is known that an error occurs in the alloc _ stat value.
Corresponding to the cloud host creation method, the embodiment of the invention also provides a cloud host creation device.
Corresponding to the method embodiment shown in fig. 1, fig. 7 is a schematic structural diagram of a cloud host creation apparatus according to an embodiment of the present invention, where the apparatus may include:
a receiving module 701, configured to receive a creation request for a target cloud host;
a first determining module 702, configured to determine whether the creation request carries a first virtual ratio tag, where the first virtual ratio tag is used to determine a target virtual ratio of a physical machine that creates the target cloud host, and a physical machine having the target virtual ratio is identified by the first virtual ratio tag; if the portable terminal is carried, the second judgment module 703 is triggered;
the second determining module 703 is configured to determine whether there is at least one first physical machine identified by the first virtual ratio tag, where the number of cloud hosts in the first physical machine is smaller than the target virtual ratio; if so, triggering a first determination module 704; if not, a second determination module 705 is triggered;
the first determining module 704 is configured to determine the at least one first physical machine as a target physical machine; a trigger creation module 706;
the second determining module 705 is configured to select a first preset number of empty physical machines that do not create a cloud host and are not identified by a virtual ratio tag to determine as a target physical machine, and identify the target physical machine by using the first virtual ratio tag; a trigger creation module 706;
the creating module 706 is configured to create the target cloud host on the target physical machine according to the creation request of the target cloud host.
As can be seen from the above, the cloud host creating apparatus provided in this embodiment indicates that, when a creating request for a target cloud host carries a first virtual ratio tag, a user has a requirement for specifying a virtual ratio of a physical machine, if there is a first physical machine identified by the first virtual ratio tag and the number of cloud hosts in the first physical machine is less than the target virtual ratio, the first physical machine is determined as the target physical machine, and a target cloud host is created on the target physical machine, if there is no physical machine identified by the first virtual ratio tag or there is a physical machine identified by the first virtual ratio tag but the number of cloud hosts in the physical machine is equal to the target virtual ratio, a first preset number of empty physical machines which do not create a cloud host and are not identified by the virtual ratio tag are selected as the target physical machine, and the target physical machine is identified by the first virtual ratio tag, and then creating a target cloud host on the target physical machine. Therefore, according to the scheme provided by the embodiment, for the creation request of the user with the virtual ratio requirement of the specified physical machine, the automatic matching of the virtual ratio can be realized without manual scheduling, and the cloud host is automatically created in the physical machine with the specified virtual ratio, so that errors are reduced.
Specifically, the creating module 706 may include:
a first determination sub-module (not shown in the figure) for determining a second physical machine which creates the target cloud host from the target physical machines;
a first creation sub-module (not shown in the figure) for creating a corresponding cloud host creation task for each target cloud host in the creation request;
and a second creating sub-module (not shown in the figure) for scheduling each cloud host creating task to one or more second physical machines to complete the creation of the target cloud host according to the resource required by each target cloud host and the resource condition of each second physical machine.
Specifically, the first determining sub-module may include:
a first calculating unit (not shown in the figure) for calculating a weight value of each target physical machine according to the resource usage of the physical machine, wherein a smaller weight value indicates more remaining resources of the physical machine;
a first determining unit (not shown in the figure) configured to determine, according to the weight value, a second physical machine that creates the target cloud host from the target physical machines.
Specifically, the second creating sub-module may include:
a first determining unit (not shown in the figure) configured to determine whether each cloud host creation task can be completed according to a resource condition of each second physical machine; if yes, triggering a first creating unit (not shown in the figure), and if not, triggering a second creating unit (not shown in the figure);
the first creation unit is used for scheduling each cloud host creation task to one or more second physical machines to complete creation of the target cloud host;
the second creating unit is used for selecting a second preset number of empty physical machines which do not create cloud hosts and are not identified by the virtual ratio tags to be determined as second physical machines, identifying the second physical machines by the first virtual ratio tags, and scheduling each cloud host creating task to one or more second physical machines to complete creation of the target cloud host.
Specifically, the apparatus may further include:
the first output module (not shown in the figure) is used for outputting a prompt message of the absence of the empty physical machine which does not create the cloud host and is not identified by the virtual ratio tag in the case that the empty physical machine which does not create the cloud host and is not identified by the virtual ratio tag does not exist.
Specifically, the apparatus may further include:
a third determining module (not shown in the figure), configured to determine, according to whether the physical machine is identified by the virtual comparison tag at the current time and whether a cloud host exists, a state of each physical machine:
if the physical machine exists in the cloud host and is identified by the virtual comparison tag, the physical machine is in a first state;
if the physical machine does not have the cloud host and the time that the virtual comparison tag is not deleted does not reach the preset time, the physical machine is in a second state;
if the physical machine does not create a cloud host and is not identified by the virtual ratio tag, the physical machine is in a third state;
if the physical machine does not have the cloud host and the time that the virtual ratio tag is not deleted reaches the preset time, deleting the virtual ratio tag and determining the physical machine to be in a third state;
the second determining module 703 includes:
a first obtaining sub-module (not shown in the figure) for obtaining the physical machine identified by the first virtual ratio tag, and determining the physical machine as a candidate first physical machine;
a second determining sub-module (not shown in the figure) configured to determine, as the first physical machine, a physical machine in a first state in the candidate first physical machines, where the number of cloud hosts in the first physical machine is smaller than the target virtual ratio;
a first determining submodule (not shown in the figure) for determining whether at least one first physical machine exists;
the second determining module 705 is specifically configured to:
and selecting a first preset number of physical machines in the third state to determine as target physical machines, and identifying the target physical machines by using the first virtual ratio labels.
Specifically, in an implementation manner, the creation request may further carry a first requirement tag, where the first requirement tag is used to identify a requirement of the user on a physical machine for creating the target cloud host;
correspondingly, the first determining module 702 may be specifically configured to:
judging whether the creating request carries a first virtual ratio label and a first demand label;
the second determining module 703 may be specifically configured to:
judging whether at least one first physical machine identified by the first virtual ratio label and the first demand label exists or not, wherein the number of cloud hosts in the first physical machine is smaller than the target virtual ratio;
the second determining 705 module may be specifically configured to:
selecting a first preset number of empty physical machines which do not create cloud hosts and are not identified by the virtual ratio tags and the demand tags to determine as target physical machines, and identifying the target physical machines by the first virtual ratio tags and the first demand tags.
Specifically, the creating module 706 may include:
a third determining sub-module (not shown in the figure) for determining a second physical machine for creating the target cloud host from the target physical machines;
a third creating sub-module (not shown in the figure) for creating a corresponding cloud host creating task for each target cloud host in the creating request;
and a fourth creating sub-module (not shown in the figure), configured to schedule, according to the resource required by each target cloud host and the resource condition of each target physical machine, each cloud host creating task to one or more second physical machines to complete creation of the target cloud host.
Specifically, the third determining sub-module includes:
a second calculating unit (not shown in the figure) for calculating a weight value of each target physical machine according to the resource usage of the physical machine, wherein a smaller weight value indicates more remaining resources of the physical machine;
a second determining unit (not shown in the figure) configured to determine, according to the weight value, a second physical machine that creates the target cloud host from the target physical machines.
Specifically, the fourth creating sub-module includes:
a second judging unit (not shown in the figure) for judging whether each cloud host creation task can be completed according to the resource condition of each second physical machine; if yes, triggering a third creating unit (not shown in the figure), and if not, triggering a fourth creating unit (not shown in the figure);
the third creating unit is used for scheduling each cloud host creating task to one or more second physical machines to complete the creation of the second cloud hosts;
the fourth creating unit is configured to select a second preset number of empty physical machines which do not create the cloud host and are not identified by the virtual ratio tag and the demand tag, determine the second physical machine as the second physical machine, identify the second physical machine by using the first virtual ratio tag and the first demand tag, and schedule each cloud host creating task to one or more second physical machines to complete creation of the target cloud host.
Specifically, the apparatus may further include:
and a second output module (not shown in the figure) for outputting a prompt message of the empty physical machine which does not create the cloud host and is not identified by the virtual ratio tag and the requirement tag when it is determined that the empty physical machine which does not create the cloud host and is not identified by the virtual ratio tag and the requirement tag does not exist.
Specifically, the apparatus may further include:
a fourth determining module (not shown in the figure), configured to determine the state of each physical machine according to whether the physical machine is identified by the virtual ratio tag and the demand tag at the current time and whether the cloud host exists:
if the physical machine exists in the cloud host and is identified by the virtual comparison tag and the demand tag, the physical machine is in a first state;
if the physical machine does not have the cloud host and the time that the virtual comparison tag and the demand tag are not deleted does not reach the preset time, the physical machine is in a second state;
if the physical machine does not create a cloud host and is not identified by the virtual ratio tag and the demand tag, the physical machine is in a third state;
if the physical machine does not have the cloud host and the time that the virtual ratio label and the demand label are not deleted reaches the preset time, deleting the virtual ratio label and the demand label, and determining the physical machine to be in a third state;
the second determining module 703 may include:
a second obtaining sub-module (not shown in the figure) for obtaining the physical machine identified by the first virtual ratio tag and the first requirement tag at the same time, and determining the physical machine as a candidate first physical machine;
a fourth determining sub-module (not shown in the figure), configured to determine, as the first physical machine, a physical machine in the first state in the candidate first physical machines, where the number of cloud hosts in the first physical machine is smaller than the target virtual ratio;
a second determining submodule (not shown in the figure) for determining whether at least one of the first physical machines exists;
the second determining module 705 may specifically be configured to:
and selecting a first preset number of physical machines in the third state to determine as target physical machines, and identifying the target physical machines by using the first virtual ratio labels and the first requirement labels.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, 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.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the apparatus embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (24)

1. A cloud host creation method, the method comprising:
receiving a creation request for a target cloud host;
judging whether the creating request carries a first virtual ratio label or not, wherein the first virtual ratio label is used for determining a target virtual ratio of a physical machine for creating the target cloud host, and the physical machine with the target virtual ratio is identified by the first virtual ratio label;
if the creation request carries the first virtual ratio label, judging whether at least one first physical machine identified by the first virtual ratio label exists, wherein the number of cloud hosts in the first physical machine is smaller than the target virtual ratio;
if the at least one first physical machine exists, determining the at least one first physical machine as a target physical machine;
if the virtual ratio labels do not exist, selecting a first preset number of empty physical machines which do not create cloud hosts and are not identified by the virtual ratio labels to determine as target physical machines, and identifying the target physical machines by the first virtual ratio labels;
and creating the target cloud host on the target physical machine according to the creation request of the target cloud host.
2. The method of claim 1, wherein the step of creating the target cloud host on the target physical machine according to the creation request of the target cloud host comprises:
determining a second physical machine for creating the target cloud host from the target physical machines;
aiming at each target cloud host in the creation request, creating a corresponding cloud host creation task;
and scheduling each cloud host creation task to one or more second physical machines to complete the creation of the target cloud host according to the resources required by each target cloud host and the resource condition of each second physical machine.
3. The method of claim 2, wherein the step of determining a second physical machine from the target physical machines that created the target cloud host comprises:
calculating the weight value of each target physical machine according to the resource use condition of the physical machine, wherein the smaller the weight value is, the more the residual resources of the physical machine are;
and determining a second physical machine for creating the target cloud host from the target physical machines according to the weight value.
4. The method according to claim 2, wherein the step of scheduling each cloud host creation task to one or more second physical machines according to the resources required by each target cloud host and the resource situation of each second physical machine to complete the creation of the target cloud host comprises:
judging whether each cloud host creation task can be completed according to the resource condition of each second physical machine;
if yes, scheduling each cloud host creation task to one or more second physical machines to complete the creation of the target cloud host;
if not, selecting a second preset number of empty physical machines which do not create the cloud host and are not identified by the virtual ratio tags to determine as second physical machines, identifying the second physical machines by the first virtual ratio tags, and then executing the step of scheduling each cloud host creation task to one or more second physical machines to complete creation of the target cloud host.
5. The method according to any one of claims 1-4, further comprising:
and in the case that no empty physical machine which does not create the cloud host and is not identified by the virtual ratio tag exists, outputting a prompt message of the empty physical machine which does not create the cloud host and is not identified by the virtual ratio tag.
6. The method of claim 1, further comprising:
determining the state of each physical machine according to whether the physical machine is identified by the virtual ratio tag at the current moment and whether a cloud host exists:
if the physical machine exists in the cloud host and is identified by the virtual comparison tag, the physical machine is in a first state;
if the physical machine does not have the cloud host and the time that the virtual comparison tag is not deleted does not reach the preset time, the physical machine is in a second state;
if the physical machine does not create a cloud host and is not identified by the virtual ratio tag, the physical machine is in a third state;
if the physical machine does not have the cloud host and the time that the virtual ratio tag is not deleted reaches the preset time, deleting the virtual ratio tag and determining the physical machine to be in a third state;
the step of judging whether at least one first physical machine identified by the first virtual ratio tag exists or not, wherein the number of cloud hosts in the first physical machine is smaller than the target virtual ratio, includes:
obtaining a physical machine identified by the first virtual ratio label, and determining the physical machine as a candidate first physical machine;
determining a physical machine in a first state in the candidate first physical machines as a first physical machine, wherein the number of cloud hosts in the first physical machine is smaller than the target virtual ratio;
judging whether at least one first physical machine exists or not;
the step of selecting a first preset number of empty physical machines which do not create cloud hosts and are not identified by the virtual ratio labels to determine as target physical machines comprises the following steps:
and selecting the physical machines of the first preset number in the third state to be determined as target physical machines.
7. The method according to claim 1, wherein the creation request further carries a first requirement tag, and the first requirement tag is used for identifying a requirement of a user on a physical machine for creating the target cloud host;
the step of judging whether the creation request carries a first virtual ratio label includes:
judging whether the creating request carries a first virtual ratio label and a first demand label;
the step of determining whether at least one first physical machine identified by the first virtual rate tag exists includes:
judging whether at least one first physical machine identified by the first virtual ratio label and the first demand label exists or not, wherein the number of cloud hosts in the first physical machine is smaller than the target virtual ratio;
the step of selecting a first preset number of empty physical machines which do not create cloud hosts and are not identified by the virtual ratio tags to determine as target physical machines, and identifying the target physical machines by the first virtual ratio tags includes:
selecting a first preset number of empty physical machines which do not create cloud hosts and are not identified by the virtual ratio tags and the demand tags to determine as target physical machines, and identifying the target physical machines by the first virtual ratio tags and the first demand tags.
8. The method of claim 7, wherein the step of creating the target cloud host on the target physical machine according to the creation request of the target cloud host comprises:
determining a second physical machine for creating the target cloud host from the target physical machines;
aiming at each target cloud host in the creation request, creating a corresponding cloud host creation task;
and scheduling each cloud host creation task to one or more second physical machines to complete the creation of the target cloud host according to the resources required by each target cloud host and the resource condition of each target physical machine.
9. The method of claim 8, wherein the step of determining a second physical machine from the target physical machines that created the target cloud host comprises:
calculating the weight value of each target physical machine according to the resource use condition of the physical machine, wherein the smaller the weight value is, the more the residual resources of the physical machine are;
and determining a second physical machine for creating the target cloud host from the target physical machines according to the weight value.
10. The method of claim 8, wherein the step of scheduling each cloud host creation task to one or more second physical machines according to the resources required by each target cloud host and the resource situation of each second physical machine to complete the creation of the target cloud host comprises:
judging whether each cloud host creation task can be completed according to the resource condition of each second physical machine;
if yes, executing the step of scheduling each cloud host creation task to one or more second physical machines to complete creation of the target cloud host;
if not, selecting a second preset number of empty physical machines which do not create the cloud host and are not identified by the virtual ratio tags and the demand tags to determine as second physical machines, identifying the second physical machines by the first virtual ratio tags and the first demand tags, and then executing the step of scheduling each cloud host creation task to one or more second physical machines to complete creation of the target cloud host.
11. The method according to any one of claims 7-10, further comprising:
and under the condition that the empty physical machine which does not create the cloud host and is not identified by the virtual ratio tag and the demand tag does not exist, outputting a prompt message of the empty physical machine which does not create the cloud host and is not identified by the virtual ratio tag and the demand tag.
12. The method of claim 7, further comprising:
determining the state of each physical machine according to whether the physical machine is identified by a virtual ratio tag and a demand tag at the current moment and whether a cloud host exists:
if the physical machine exists in the cloud host and is identified by the virtual comparison tag and the demand tag, the physical machine is in a first state;
if the physical machine does not have the cloud host and the time that the virtual comparison tag and the demand tag are not deleted does not reach the preset time, the physical machine is in a second state;
if the physical machine does not create a cloud host and is not identified by the virtual ratio tag and the demand tag, the physical machine is in a third state;
if the physical machine does not have the cloud host and the time that the virtual ratio label and the demand label are not deleted reaches the preset time, deleting the virtual ratio label and the demand label, and determining the physical machine to be in a third state;
the step of judging whether at least one first physical machine identified by the first virtual ratio label and the first demand label exists, wherein the number of cloud hosts in the first physical machine is smaller than the target virtual ratio, includes:
obtaining a physical machine identified by the first virtual ratio label and the first demand label at the same time, and determining the physical machine as a candidate first physical machine;
determining a physical machine in a first state in the candidate first physical machines as a first physical machine, wherein the number of cloud hosts in the first physical machine is smaller than the target virtual ratio;
judging whether at least one first physical machine exists or not;
the step of selecting a first preset number of empty physical machines which do not create cloud hosts and are not identified by the virtual ratio tags and the demand tags to determine as target physical machines comprises the following steps:
and selecting the physical machines of the first preset number in the third state to be determined as target physical machines.
13. An apparatus for creating a cloud host, the apparatus comprising:
the receiving module is used for receiving a creation request aiming at a target cloud host;
a first determining module, configured to determine whether the creation request carries a first virtual ratio tag, where the first virtual ratio tag is used to determine a target virtual ratio of a physical machine that creates the target cloud host, and a physical machine having the target virtual ratio uses the first virtual ratio tag identifier; if the mobile phone is carried, triggering a second judgment module;
the second judging module is configured to judge whether at least one first physical machine identified by the first virtual ratio tag exists, where the number of cloud hosts in the first physical machine is smaller than the target virtual ratio; if yes, triggering a first determination module; if not, triggering a second determination module;
the first determining module is used for determining the at least one first physical machine as a target physical machine; a trigger creation module;
the second determining module is used for selecting a first preset number of empty physical machines which do not create cloud hosts and are not identified by the virtual ratio tags to determine as target physical machines, and identifying the target physical machines by the first virtual ratio tags; a trigger creation module;
the creating module is used for creating the target cloud host on the target physical machine according to the creating request of the target cloud host.
14. The apparatus of claim 13, wherein the creation module comprises:
a first determining sub-module, configured to determine, from the target physical machines, a second physical machine that creates the target cloud host;
the first creating sub-module is used for creating a corresponding cloud host creating task for each target cloud host in the creating request;
and the second creation sub-module is used for scheduling each cloud host creation task to one or more second physical machines to complete the creation of the target cloud host according to the resources required by each target cloud host and the resource condition of each second physical machine.
15. The apparatus of claim 14, wherein the first determining submodule comprises:
the first calculation unit is used for calculating the weight value of each target physical machine according to the resource use condition of the physical machine, and the smaller the weight value is, the more the residual resources of the physical machine are;
and the first determining unit is used for determining a second physical machine for creating the target cloud host from the target physical machines according to the weight value.
16. The apparatus of claim 14, wherein the second creating sub-module comprises:
the first judging unit is used for judging whether each cloud host establishing task can be completed according to the resource condition of each second physical machine; if yes, triggering a first creating unit, and if not, triggering a second creating unit;
the first creation unit is used for scheduling each cloud host creation task to one or more second physical machines to complete creation of the target cloud host;
the second creating unit is used for selecting a second preset number of empty physical machines which do not create cloud hosts and are not identified by the virtual ratio tags to be determined as second physical machines, identifying the second physical machines by the first virtual ratio tags, and scheduling each cloud host creating task to one or more second physical machines to complete creation of the target cloud host.
17. The apparatus of any one of claims 13-16, further comprising:
the first output module is used for outputting a prompt message of the empty physical machine which does not create the cloud host and is not identified by the virtual ratio tag under the condition that the empty physical machine which does not create the cloud host and is not identified by the virtual ratio tag does not exist.
18. The apparatus of claim 17, further comprising:
a third determining module, configured to determine, according to whether the physical machine is identified by the virtual ratio tag at the current time and whether a cloud host exists, a state of each physical machine:
if the physical machine exists in the cloud host and is identified by the virtual comparison tag, the physical machine is in a first state;
if the physical machine does not have the cloud host and the time that the virtual comparison tag is not deleted does not reach the preset time, the physical machine is in a second state;
if the physical machine does not create a cloud host and is not identified by the virtual ratio tag, the physical machine is in a third state;
if the physical machine does not have the cloud host and the time that the virtual ratio tag is not deleted reaches the preset time, deleting the virtual ratio tag and determining the physical machine to be in a third state;
the second judging module includes:
the first obtaining submodule is used for obtaining the physical machine identified by the first virtual ratio tag and determining the physical machine as a candidate first physical machine;
a second determining submodule, configured to determine, as a first physical machine, a physical machine in a first state in the candidate first physical machines, where the number of cloud hosts in the first physical machine is smaller than the target virtual ratio;
the first judgment submodule is used for judging whether at least one first physical machine exists or not;
the second determining module is specifically configured to:
and selecting a first preset number of physical machines in the third state to determine as target physical machines, and identifying the target physical machines by using the first virtual ratio labels.
19. The apparatus according to claim 13, wherein the creation request further carries a first requirement tag, and the first requirement tag is used to identify a requirement of a user on a physical machine for creating the target cloud host;
the first judging module is specifically configured to:
judging whether the creating request carries a first virtual ratio label and a first demand label;
the second judgment module is specifically configured to:
judging whether at least one first physical machine identified by the first virtual ratio label and the first demand label exists or not, wherein the number of cloud hosts in the first physical machine is smaller than the target virtual ratio;
the second determining module is specifically configured to:
selecting a first preset number of empty physical machines which do not create cloud hosts and are not identified by the virtual ratio tags and the demand tags to determine as target physical machines, and identifying the target physical machines by the first virtual ratio tags and the first demand tags.
20. The apparatus of claim 19, wherein the creation module comprises:
a third determining sub-module, configured to determine, from the target physical machines, a second physical machine that creates the target cloud host;
a third creating sub-module, configured to create, for each target cloud host in the creation request, a corresponding cloud host creation task;
and the fourth creating sub-module is used for scheduling each cloud host creating task to one or more second physical machines to complete the creation of the target cloud host according to the resources required by each target cloud host and the resource condition of each target physical machine.
21. The apparatus of claim 20, wherein the third determining sub-module comprises:
the second calculation unit is used for calculating the weight value of each target physical machine according to the resource use condition of the physical machine, and the smaller the weight value is, the more the residual resources of the physical machine are;
and the second determining unit is used for determining a second physical machine for creating the target cloud host from the target physical machines according to the weight value.
22. The apparatus of claim 20, wherein the fourth create sub-module comprises:
the second judging unit is used for judging whether the cloud host establishing tasks can be completed or not according to the resource condition of each second physical machine; if yes, triggering a third creating unit, and if not, triggering a fourth creating unit;
the third creating unit is used for scheduling each cloud host creating task to one or more second physical machines to complete the creation of the target cloud host;
the fourth creating unit is configured to select a second preset number of empty physical machines which do not create the cloud host and are not identified by the virtual ratio tag and the demand tag, determine the second physical machine as the second physical machine, identify the second physical machine by using the first virtual ratio tag and the first demand tag, and schedule each cloud host creating task to one or more second physical machines to complete creation of the target cloud host.
23. The apparatus of any one of claims 19-22, further comprising:
and the second output module is used for outputting a prompt message of the empty physical machine which is not created with the cloud host and is not identified by the virtual ratio tag and the demand tag under the condition that the empty physical machine which is not created with the cloud host and is not identified by the virtual ratio tag and the demand tag is judged to be absent.
24. The apparatus of claim 19, further comprising:
a fourth determining module, configured to determine states of the physical machines according to whether the physical machine is identified by the virtual ratio tag and the demand tag at the current time and whether a cloud host exists:
if the physical machine exists in the cloud host and is identified by the virtual comparison tag and the demand tag, the physical machine is in a first state;
if the physical machine does not have the cloud host and the time that the virtual comparison tag and the demand tag are not deleted does not reach the preset time, the physical machine is in a second state;
if the physical machine does not create a cloud host and is not identified by the virtual ratio tag and the demand tag, the physical machine is in a third state;
if the physical machine does not have the cloud host and the time that the virtual ratio label and the demand label are not deleted reaches the preset time, deleting the virtual ratio label and the demand label, and determining the physical machine to be in a third state;
the second judging module includes:
the second obtaining submodule is used for obtaining the physical machine identified by the first virtual ratio label and the first demand label at the same time and determining the physical machine as a candidate first physical machine;
a fourth determining submodule, configured to determine, as the first physical machine, a physical machine in a first state in the candidate first physical machines, where the number of cloud hosts in the first physical machine is smaller than the target virtual ratio;
the second judgment submodule is used for judging whether at least one first physical machine exists or not;
the second determining module is specifically configured to:
and selecting a first preset number of physical machines in the third state to determine as target physical machines, and identifying the target physical machines by using the first virtual ratio labels and the first requirement labels.
CN201710256717.6A 2017-04-19 2017-04-19 Cloud host creation method and device Active CN108574718B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710256717.6A CN108574718B (en) 2017-04-19 2017-04-19 Cloud host creation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710256717.6A CN108574718B (en) 2017-04-19 2017-04-19 Cloud host creation method and device

Publications (2)

Publication Number Publication Date
CN108574718A CN108574718A (en) 2018-09-25
CN108574718B true CN108574718B (en) 2021-03-26

Family

ID=63575966

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710256717.6A Active CN108574718B (en) 2017-04-19 2017-04-19 Cloud host creation method and device

Country Status (1)

Country Link
CN (1) CN108574718B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109495555A (en) * 2018-11-01 2019-03-19 郑州云海信息技术有限公司 A kind of method and apparatus based on cloud platform creation cloud host
CN109660393B (en) * 2018-12-18 2022-03-22 郑州云海信息技术有限公司 Method and device for updating specification of cloud host
CN110795182B (en) * 2019-09-18 2024-09-13 平安科技(深圳)有限公司 Cloud host creation method and system
CN112188470B (en) * 2020-09-10 2022-08-12 中国联合网络通信集团有限公司 Method and device for determining privacy number platform

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102299929A (en) * 2011-09-15 2011-12-28 北京天地云箱科技有限公司 Access control method, system and device for virtual machine
CN104468803A (en) * 2014-12-12 2015-03-25 华为技术有限公司 Virtual data center resource mapping method and equipment
CN105453039A (en) * 2013-07-17 2016-03-30 赛门铁克公司 Systems and methods for instantly restoring virtual machines in high input/output load environments
CN106126345A (en) * 2016-06-30 2016-11-16 广东睿江云计算股份有限公司 There is internal memory control method and the system of the physical machine of cloudy main frame
CN106227582A (en) * 2016-08-10 2016-12-14 华为技术有限公司 Elastic telescopic method and system
CN106354544A (en) * 2016-08-24 2017-01-25 华为技术有限公司 Virtual machine creating method and system and host

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102299929A (en) * 2011-09-15 2011-12-28 北京天地云箱科技有限公司 Access control method, system and device for virtual machine
CN105453039A (en) * 2013-07-17 2016-03-30 赛门铁克公司 Systems and methods for instantly restoring virtual machines in high input/output load environments
CN104468803A (en) * 2014-12-12 2015-03-25 华为技术有限公司 Virtual data center resource mapping method and equipment
CN106126345A (en) * 2016-06-30 2016-11-16 广东睿江云计算股份有限公司 There is internal memory control method and the system of the physical machine of cloudy main frame
CN106227582A (en) * 2016-08-10 2016-12-14 华为技术有限公司 Elastic telescopic method and system
CN106354544A (en) * 2016-08-24 2017-01-25 华为技术有限公司 Virtual machine creating method and system and host

Also Published As

Publication number Publication date
CN108574718A (en) 2018-09-25

Similar Documents

Publication Publication Date Title
US11586673B2 (en) Data writing and reading method and apparatus, and cloud storage system
US10700947B2 (en) Life cycle management method and device for network service
CN108574718B (en) Cloud host creation method and device
CN109597853B (en) Business scene element serial number generation method, device, medium and computer equipment
CN113590386B (en) Disaster recovery method, system, terminal device and computer storage medium for data
US20160330208A1 (en) Method and apparatus for implementing document sharing between user groups
US11210284B2 (en) Method, system, apparatus, and computer-readable storage medium for sharing account resources
CN105760240A (en) Distributed task processing method and device
CN113312161A (en) Application scheduling method, platform and storage medium
US20180018363A1 (en) Time series data processing method and apparatus
CN111427670A (en) Task scheduling method and system
CN115114359A (en) User data processing method and device
CN107704550A (en) File migration method, apparatus and computer-readable recording medium
CN108574719B (en) Cloud host creation method and device
CN103377052A (en) Method and system for automatically downloading adaptive application programs on basis of file synchronization service
CN102902574A (en) Cooperative processing method and device of multiple information flow nodes
CN109697281A (en) The online method, apparatus and electronic equipment for merging document
CN115022198B (en) Resource information acquisition method, equipment and storage medium
CN108874798B (en) Big data sorting method and system
CN105760215A (en) Map-reduce model based job running method for distributed file system
EP3648423B1 (en) Resource allocation method and system
CN112685613A (en) Resource packet query method and device and information processing system
CN108092790B (en) Management method and device
CN108206933B (en) Video data acquisition method and device based on video cloud storage system
US11687269B2 (en) Determining data copy resources

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