CN112817689A - Method and device for sorting virtual machines and electronic equipment - Google Patents

Method and device for sorting virtual machines and electronic equipment Download PDF

Info

Publication number
CN112817689A
CN112817689A CN202110028724.7A CN202110028724A CN112817689A CN 112817689 A CN112817689 A CN 112817689A CN 202110028724 A CN202110028724 A CN 202110028724A CN 112817689 A CN112817689 A CN 112817689A
Authority
CN
China
Prior art keywords
tag
virtual machine
virtual machines
label
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110028724.7A
Other languages
Chinese (zh)
Inventor
黄鹏涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Cloud Network Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud Network 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 filed Critical Beijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN202110028724.7A priority Critical patent/CN112817689A/en
Publication of CN112817689A publication Critical patent/CN112817689A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/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
    • 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/45595Network integration; Enabling network access in virtual machine instances

Abstract

The invention provides a method, a device and electronic equipment for sorting virtual machines, which respond to a label selection instruction and display a virtual machine list; in the virtual machine list, at least one part of virtual machines have label values of the selected labels contained in the label selection instruction; in response to a trigger instruction of a target tag in the selected tags, sorting the virtual machines in the virtual machine list based on the tag value of the target tag to obtain a sorting result; in the sorting result, virtual machines having the same tag value of the target tag are adjacently arranged. The method can set corresponding label values for labels of the virtual machines, display the label values in a virtual machine list, and sequence the virtual machines in the virtual machine list based on the label values.

Description

Method and device for sorting virtual machines and electronic equipment
Technical Field
The present invention relates to the field of virtual machine technologies, and in particular, to a method and an apparatus for sorting virtual machines, and an electronic device.
Background
With the performance improvement of the OpenStack cluster, the number of virtual machines is gradually increased, and when the OpenStack manages a large-scale virtual machine, there is usually a need to sort and check the large-scale virtual machine.
Disclosure of Invention
The invention aims to provide a method and a device for sorting and sequencing virtual machines and electronic equipment, so as to accurately sort and check the virtual machines.
The invention provides a method for classifying and sequencing virtual machines, which comprises the following steps: responding to the instruction selected by the label, and displaying a virtual machine list; in the virtual machine list, at least one part of virtual machines have tag values of the selected tags contained in the tag selection instruction; in response to a trigger instruction of a target tag in the selected tags, sorting the virtual machines in the virtual machine list based on the tag value of the target tag to obtain a sorting result; and in the sequencing result, the virtual machines with the same label value of the target label are arranged adjacently.
Further, the preset attribute list comprises a plurality of labels; the step of displaying the virtual machine list in response to the tag selection instruction comprises: in response to the tag selection instruction, determining a selected tag from the plurality of tags included in the preset attribute list; generating and displaying the virtual machine list based on the selected tag; and the item of the virtual machine list comprises the selected label.
Further, a plurality of tag values are preset for the target tag; the step of, in response to the trigger instruction of the target tag in the selected tags, sorting the virtual machines in the virtual machine list based on the tag values of the target tag to obtain a sorting result includes: responding to a trigger instruction of a target label in the selected labels, and acquiring label values of the target label corresponding to at least one part of virtual machines; dividing virtual machines with the same tag value into a virtual machine set to obtain at least one virtual machine set; and sequencing the at least one virtual machine set in an ascending or descending manner according to the label values to obtain a sequencing result.
Further, after the step of sorting the at least one virtual machine set in an ascending or descending manner of the plurality of tag values to obtain a sorting result, the method further includes: arranging a virtual machine without a tag value of the target tag behind the sorting result.
Further, the virtual machine list further includes: a virtual machine that does not have the selected tag; the method further comprises the following steps: arranging the virtual machines without the selected label in the virtual machine list behind the virtual machines with the selected label.
Further, the method further comprises: responding to a virtual machine creating instruction, and creating a target virtual machine; in response to a tag adding instruction, adding at least one tag and a tag value of the at least one tag for the target virtual machine; saving the at least one tag and the tag value of the at least one tag.
Further, the method further comprises: deleting a specified tag and a tag value of the specified tag possessed by a specified virtual machine in response to a tag deletion instruction for the specified tag of the specified virtual machine.
The invention provides a device for classifying and sequencing virtual machines, which comprises: the display module is used for responding to the label selection instruction and displaying the virtual machine list; in the virtual machine list, at least one part of virtual machines have tag values of the selected tags contained in the tag selection instruction; the sorting module is used for responding to a trigger instruction of a target tag in the selected tags, sorting the virtual machines in the virtual machine list based on the tag value of the target tag, and obtaining a sorting result; and in the sequencing result, the virtual machines with the same label value of the target label are arranged adjacently.
The invention provides an electronic device, which comprises a processor and a memory, wherein the memory stores machine executable instructions capable of being executed by the processor, and the processor executes the machine executable instructions to realize the method for classifying and ordering the virtual machines.
The present invention provides a machine-readable storage medium storing machine-executable instructions which, when invoked and executed by a processor, cause the processor to implement any of the above methods of sorting virtual machines.
The invention provides a method, a device and electronic equipment for sorting virtual machines, which respond to a label selection instruction and display a virtual machine list; in the virtual machine list, at least one part of virtual machines have label values of the selected labels contained in the label selection instruction; in response to a trigger instruction of a target tag in the selected tags, sorting the virtual machines in the virtual machine list based on the tag value of the target tag to obtain a sorting result; in the sorting result, virtual machines having the same tag value of the target tag are adjacently arranged. The method can set corresponding label values for labels of the virtual machines, display the label values in a virtual machine list, and sequence the virtual machines in the virtual machine list based on the label values.
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, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a flowchart of a method for sorting virtual machines according to an embodiment of the present invention;
fig. 2 is a flowchart of another method for sorting virtual machines according to an embodiment of the present invention;
fig. 3 is a flowchart of another method for sorting virtual machines according to an embodiment of the present invention;
fig. 4 is a flowchart of a method for creating a virtual machine according to an embodiment of the present invention;
fig. 5 is a schematic diagram of creating a virtual machine according to an embodiment of the present invention;
FIG. 6 is a diagram of an attribute list provided by an embodiment of the present invention;
FIG. 7 is a virtual machine column representation according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of an apparatus for sorting virtual machines according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions of the present invention will be described clearly and completely with reference to the following embodiments, and it should be understood that the described embodiments are some, but not all, embodiments of the present invention. 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.
With the performance improvement of the OpenStack cluster, the number of virtual machines is gradually increased, and when the OpenStack manages large-scale virtual machines, there is a need to classify and view the virtual machines, such as: the method comprises the steps of maintaining and checking a virtual machine of a specified scene, a plurality of virtual machines deployed by each type of service, managing a plurality of types of services, checking the running state of the virtual machines of the plurality of types of services and the like. In the related art, OpenStack can perform sequencing view based on inherent attributes of the virtual machine, such as name, creation time or ID (Identity document), but this method cannot accurately classify large-scale virtual machines.
Based on this, the embodiment of the invention provides a method and a device for classifying and sequencing virtual machines, and electronic equipment.
In order to facilitate understanding of the embodiment, first, a method for sorting and sequencing virtual machines disclosed in the embodiment of the present invention is described in detail; as shown in fig. 1, the method comprises the steps of:
step S102, responding to a tag selection instruction, and displaying a virtual machine list; at least a part of the virtual machines in the virtual machine list have tag values of the selected tags contained in the tag selection instruction.
The label selection instruction can be understood as an instruction generated when a user selects a label; the virtual machine list usually includes related information corresponding to a plurality of virtual machines, such as names, operating states, types, or IP (Internet Protocol) addresses of the virtual machines; the number of the selected tags can be one or more, and the tags required to be selected can be selected according to actual screening requirements; the label value may be understood as a specific value corresponding to the selected label, and the label value may be used to mark the use of the virtual machine, etc.; for example, the selected tag is "sea starch", and the tag value may be "video service" or "audio service" or the like; in actual implementation, a user may select a tag from a preset list including multiple tags, for example, may select one or more tags from a preset attribute list, generate a corresponding tag selection instruction, and display a virtual machine list in response to the tag selection instruction, where the virtual machine list may include related information of multiple virtual machines, for example, related information corresponding to a large-scale virtual machine managed by OpenStack, and at least a part of the multiple virtual machines included in the virtual machine list has a tag value of the selected tag; for example, the list of virtual machines includes relevant information corresponding to 10 virtual machines, if the selected tag is "sea starch", two virtual machines have the selected tag of "sea starch", and tag values of the tags of the two virtual machines may be both "video services".
It should be noted that, by configuring OpenStack, a tag can be added to a virtual machine, and a function of selecting a specified tag from an attribute list of the virtual machine is implemented. After the virtual machine is tagged, the virtual machine with the designated tag can be displayed by selecting the designated tag.
Step S104, in response to a trigger instruction of a target tag in the selected tags, sorting the virtual machines in the virtual machine list based on the tag values of the target tag to obtain a sorting result; in the sorting result, virtual machines having the same tag value of the target tag are adjacently arranged.
The target tag can be a designated tag in the selected tags, if the number of the selected tags is one, the target tag is the selected tag, and if the number of the selected tags is more than one, the target tag can be any one tag in the selected tags; the trigger instruction may be an instruction generated when a user triggers the target tag; in actual implementation, after displaying the virtual machine list, a user may determine a target tag from the selected tags displayed in the virtual machine list according to actual needs, trigger the target tag, generate a corresponding trigger instruction, and in response to the trigger instruction, sort the virtual machines in the virtual machine list based on the tag values of the target tag, where in the virtual machine list, there may be multiple virtual machines having the same tag value of the target tag, and in the obtained sorting result, the multiple virtual machines having the same tag value of the target tag are adjacently arranged, for example, the virtual machine list includes related information corresponding to 10 virtual machines, if the target tag is "sea lake", there are three virtual machines having the target tag of "sea lake", and the tag values of the target tags of the three virtual machines are all "video services", in the virtual machine list, the three virtual machines with the labels of the video services are adjacent in front of and behind, and the other seven virtual machines are arranged in front of or behind the three virtual machines, namely, other virtual machines are not inserted among the three virtual machines.
The method for sorting and sequencing the virtual machines, provided by the embodiment of the invention, is used for responding to a label selection instruction and displaying a virtual machine list; in the virtual machine list, at least one part of virtual machines have label values of the selected labels contained in the label selection instruction; in response to a trigger instruction of a target tag in the selected tags, sorting the virtual machines in the virtual machine list based on the tag value of the target tag to obtain a sorting result; in the sorting result, virtual machines having the same tag value of the target tag are adjacently arranged. The method can set corresponding label values for labels of the virtual machines, display the label values in a virtual machine list, and sequence the virtual machines in the virtual machine list based on the label values.
The embodiment of the invention also provides another method for classifying and sequencing the virtual machines, which is realized on the basis of the method of the embodiment; in the method, a preset attribute list comprises a plurality of labels; the tag may also be referred to as a tag name, and may be set based on a specific use of the virtual machine, and the tags of different virtual machines may be different; taking OpenStack to manage a plurality of virtual machines as an example, the preset attribute list may include inherent attribute names of the plurality of virtual machines and tag names of the plurality of virtual machines, where the inherent attribute names may include names such as types, IP addresses, or creation time of the virtual machines; labels may include "sea lakes," "Fengtai," and the like; as shown in fig. 2, the method comprises the steps of:
step S202, responding to a label selecting instruction, and determining a selected label from a plurality of labels included in a preset attribute list.
In actual implementation, the selected tag can be determined from a plurality of tags included in the preset attribute list based on a tag selection instruction generated when the user selects the tag from the preset attribute list; for example, the selected tab determined from the list of preset attributes may include: type, IP address, operating system, creation time, and sea lake, etc.
Step S204, generating and displaying a virtual machine list based on the selected tag; the entries of the virtual machine list include the selected tag.
The table entry may also be referred to as a header, and the table entry may be set in a first row of the virtual machine list, so as to facilitate classification, viewing, sorting, and the like; after a selected tag is determined from a plurality of tags included in a preset attribute list, a virtual machine list can be generated based on the selected tag, the selected tag is included in an entry of the virtual machine list, and the virtual machine list is displayed; for example, the selected tags include type, IP address, operating system, creation time, and sea lake, and are included in the displayed entries of the virtual machine list.
Step S206, in response to a trigger instruction of a target tag in the selected tags, sorting the virtual machines in the virtual machine list based on the tag values of the target tag to obtain a sorting result; in the sorting result, virtual machines having the same tag value of the target tag are adjacently arranged.
The other method for sorting and sequencing virtual machines provided by the embodiment of the invention comprises the steps of firstly responding to a tag selection instruction, determining a selected tag from a plurality of tags included in a preset attribute list, then generating and displaying a virtual machine list based on the selected tag, responding to a trigger instruction of a target tag in the selected tag, and sorting the virtual machines in the virtual machine list based on a tag value of the target tag to obtain a sorting result; the method can determine the selected label from the preset attribute list and generate the virtual machine list containing the selected label, and the preset attribute list contains a plurality of labels, so that the proper selected label can be directly selected from the plurality of labels according to the classification requirement, and the flexibility and the convenience of classifying the virtual machines are improved.
The embodiment of the invention also provides another method for classifying and sequencing the virtual machines, which is realized on the basis of the method of the embodiment; in the method, a plurality of label values are preset for a target label; for example, taking the target tag as "sea lake", the tag value of the target tag of "sea lake" may include: video services, audio services or audio-video services, etc.; as shown in fig. 3, the method comprises the steps of:
step S302, responding to a label selection instruction, and displaying a virtual machine list; at least a part of the virtual machines in the virtual machine list have tag values of the selected tags contained in the tag selection instruction.
Step S304, responding to the trigger instruction of the target label in the selected labels, and acquiring the label values of the target labels corresponding to at least one part of virtual machines.
In actual implementation, after displaying the virtual machine list, a user may determine a target tag from the selected tags displayed in the virtual machine list according to actual requirements, trigger the target tag, generate a corresponding trigger instruction, and obtain tag values of the target tag corresponding to at least a part of virtual machines in response to the trigger instruction, where the tag values may include a plurality of tag values.
Step S306, dividing the virtual machines with the same label value into a virtual machine set to obtain at least one virtual machine set.
If the target tag is preset with a plurality of tag values, the virtual machines with the same tag value can be divided into a virtual machine set, that is, the tag values of the target tag are the same in the same virtual machine set, so that a plurality of virtual machine sets corresponding to the plurality of tag values preset by the target tag can be obtained; for example, taking the target tag as "sea lake", the tag value of the target tag of "sea lake" includes: the virtual machines with the tag values of the video service can be divided into one virtual machine set, the virtual machines with the tag values of the audio service can be divided into another virtual machine set, and therefore the two virtual machine sets corresponding to the two tag values can be obtained.
Step S308, at least one virtual machine set is sorted in an ascending or descending mode of the label values to obtain a sorting result.
In actual implementation, in order to make the sorting result of the virtual machine clearer and more convenient for a user to check, the obtained at least one virtual machine set can be sorted to obtain a sorting result; specifically, the tag values in at least one virtual machine set may be sorted in an ascending order or a descending order; for example, still taking the example that the target tag is "sea starch", and the tag value thereof includes two tag values of video service and audio service, if the virtual machine sets are sorted in an ascending order of tag values, the virtual machine set whose tag value is audio service may be arranged behind the virtual machine set whose tag value is video service; if the virtual machine sets are sorted in descending order of tag value, the virtual machine set tagged with a video service may be arranged behind the virtual machine set tagged with an audio service.
Here, the sorting manner may be various. For example, the sorting may be based on the number of virtual machines with the tag value, i.e., the set of virtual machines including more virtual machines is ranked in front and the set of virtual machines with fewer virtual machines is ranked behind. For example, the virtual machine sets may be sorted according to the importance of the tag values, that is, all the tag values may be sorted according to the importance, and after the virtual machine sets are divided, the virtual machine set corresponding to the tag value with high importance may be sorted in the front, and the virtual machine set corresponding to the tag value with low importance may be sorted in the back. Through the sorting mode, a user can find the required virtual machine more conveniently and quickly.
Step S310, arranging the virtual machine without the label value of the target label behind the sorting result.
In actual implementation, considering that there may be virtual machines having the target tag but not having the tag value of the target tag, it may also be understood that in this part of virtual machines, the tag value of the target tag is a null value; after the sorting result of the virtual machines having the tag values of the target tags is obtained, the virtual machines not having the tag values of the target tags may be arranged behind the sorting result.
According to another method for sorting and sequencing virtual machines provided by the embodiment of the invention, firstly, a virtual machine list is displayed in response to a tag selection instruction; responding to a trigger instruction of a target label in the selected labels, and acquiring label values of the target label corresponding to at least one part of virtual machines; then dividing the virtual machines with the same tag value into a virtual machine set to obtain at least one virtual machine set, and sequencing the at least one virtual machine set in an ascending or descending manner according to the plurality of tag values to obtain a sequencing result; and finally arranging the virtual machines without the label values of the target labels behind the sequencing result. According to the method, the virtual machines are divided into at least one virtual machine set, and the at least one virtual machine set is sequenced, so that the sequencing result of the virtual machines is clearer and more definite, and a user can find the required virtual machines more conveniently and quickly.
It should be noted that, in general, the list of virtual machines further includes: a virtual machine that does not have the selected tag; in this case, the virtual machines not having the selected tag in the virtual machine list may be arranged behind the virtual machine having the selected tag. In actual implementation, virtual machines without the selected tag may be included in the virtual machine list, for example, if the selected tag is "sea lake", the virtual machines may not have the tag of "sea lake", and the virtual machines without the tag of "sea lake" may be arranged behind the virtual machines with the tag of "sea lake".
The embodiment of the invention also provides a method for creating the virtual machine, which is realized on the basis of the method of the embodiment; as shown in fig. 4, the method includes the steps of:
step S402, in response to the virtual machine creation instruction, creates a target virtual machine.
The virtual machine creation instruction can be understood as an instruction generated when a user needs to create a new virtual machine and clicks a corresponding creation button; the target virtual machine can be understood as a new virtual machine which needs to be created by a user; in actual implementation, if a user needs to create a new target virtual machine, after clicking a corresponding creation button, a corresponding virtual machine creation instruction may be generated, and the target virtual machine is created in response to the virtual machine creation instruction.
Step S404, responding to the label adding instruction, and adding at least one label and a label value of the at least one label for the target virtual machine.
The tag adding instruction can be understood as an instruction generated when a user creates a new target virtual machine and inputs a corresponding tag and a tag value if the tag is required to be added to the target virtual machine; in actual implementation, when a target virtual machine is created, a tag can be selected and added in a creation interface, a required tag and a tag value of the tag are added to the target virtual machine, a plurality of tags and a plurality of tag values corresponding to the tags can be added to the target virtual machine, and the setting can be specifically carried out according to actual requirements; for example, a "sea lake" tag may be added to the target virtual machine, with the corresponding tag value being "video service", etc.
Step S406, saving the at least one tag and the tag value of the at least one tag.
When a tag and a tag value of the tag are added to the created target virtual machine, the tag and the tag value may be stored in a database, for example, taking OpenStack to manage multiple virtual machines, when a "sea starch" tag and a corresponding "video service" tag value are added to the target virtual machine, the added "sea starch" tag and "video service" tag value may be stored in a tag database table of OpenStack.
The method for creating the virtual machine, provided by the embodiment of the invention, is used for creating the target virtual machine in response to the virtual machine creation instruction. In response to the tag adding instruction, adding at least one tag and a tag value of the at least one tag for the target virtual machine; the at least one tag and the tag value of the at least one tag are saved. According to the method, the target virtual machine can be created according to actual requirements, the user-defined label and the label value can be added to the target virtual machine, and the flexibility and the convenience of classifying the virtual machine are improved.
In an alternative embodiment, if the tag of the virtual machine needs to be deleted, the specified tag and the tag value of the specified tag of the specified virtual machine may be deleted in response to a tag deletion instruction for the specified tag of the specified virtual machine.
The label deleting instruction can be understood as an instruction generated when a user clicks a corresponding deleting button when the user needs to delete the specified label of the specified virtual machine in the virtual machine list; the designated tag may be any one of tags of the designated virtual machine; in actual implementation, if a user needs to delete the designated tag of the designated virtual machine in the virtual machine list, after clicking a corresponding deletion button, a corresponding tag deletion instruction can be generated, and in response to the tag deletion instruction, the designated tag and the tag value of the designated tag of the designated virtual machine are deleted; for example, the virtual machine a in the virtual machine list has a "starchy" tag, and the tag value of the "starchy" tag is "video service", when the "starchy" tag of the virtual machine a needs to be deleted, the user may first click the "video service" tag value, then click the corresponding deletion button, so as to generate a corresponding tag deletion instruction, and in response to the tag deletion instruction, delete the "starchy" tag and the "video service" tag value of the virtual machine a. By the method, the user can flexibly select whether to delete the label of the virtual machine according to actual requirements, so that the virtual machine can be conveniently and accurately classified to check.
To further understand the above embodiments, a schematic diagram of creating a virtual machine as shown in fig. 5 is provided below; the method comprises the following steps of (1) creating basic information required to be selected or filled when the virtual machine is created, such as a charging mode, a host type, a host name and a label; wherein, the charging mode includes: according to the year, month, day and hour, a proper charging mode can be selected according to the actual requirement; the host type can be selected from a cloud host, a corresponding host name can be set on the basis of each virtual machine, a label name (corresponding to the label) and a corresponding label value can be input in a label column, and a plurality of label names and label values can be added to the created virtual machine according to actual requirements, for example, "sea lake" is filled in the label name, and "video service" is filled in the label value to mark the purpose of the virtual machine; the corresponding call api can be expressed as follows:
Figure BDA0002889797380000121
Figure BDA0002889797380000131
after adding a new tag name and a tag value, the tag name and the tag value can be stored in a database, in OpenStack, the tag name and the tag value are usually stored in a tag database table, and since the related art does not have a function of adding a custom tag to a virtual machine and sorting, the tag database table needs to be improved, for example, an existing tag database table shown in table 1 and an improved tag database table shown in table 2; table 1 only includes two contents, namely resource _ id and tag, and table 2 after improvement adds an item of value (corresponding to the above tag value) to table 1, and can save the name of the added "sea starch" tag into the tag item and save the "video service" tag value into the value item.
TABLE 1
resource_id tag
Uuid1 Tag1
TABLE 2
resource_id tag value
Uuid1 Tag1
Uuid2 Sea starch Video service
A schematic diagram of an attribute list as shown in fig. 6 and a virtual machine list representation intent as shown in fig. 7 are provided below; the table column in fig. 6 (corresponding to the preset attribute list) includes a plurality of tags, such as type, IP address, monitoring status, operating system, resource pool, virtualization type, etc., a user may view a virtual machine with a specific tag according to actual needs, and select a tag that needs to be viewed and sorted from the table column, so as to perform screening sorting on the virtual machine according to the selected tag, where the selected tag in fig. 6 includes: type, IP address, operating system, resource pool, virtualization type, creation time, and sea lake; according to the selected label in fig. 6, a virtual machine list as shown in fig. 7 is generated and displayed, the virtual machine list is illustrated by two virtual machines as an example, the entry of the virtual machine list includes the selected label in fig. 6, the virtual machine with the selected label is automatically displayed at the top of the virtual machine list, the virtual machines without the selected label are arranged backwards, taking the label of "sea lake" as an example, the virtual machine list is clicked to obtain the virtual machine with the label, and the virtual machine with the label is automatically displayed at the top of the virtual machine list, and by judging whether the label value of the label of "sea lake" is an empty value, it can be judged whether the label is used for the screening function or the sorting function, which does not affect the label screening function of native OpenStack, and enhances the new label sorting characteristic. For example, in the two virtual machines in the virtual machine list in fig. 7, the first virtual machine has a tag value of "sea lake", and the tag value is "video service"; the second virtual machine does not have the tag value of the tag "sea lake", and when "sea lake" in the virtual machine list entry is clicked in the generated virtual machine list, the virtual machines having the tag can be sorted.
The entry in the virtual machine list further includes an "operation" tag, and the "operation" tag can be used to perform operations such as removing the specified tag of the specified virtual machine, specifically, the specified virtual machine that needs to remove the specified tag can be selected by name, for example, by taking the example of removing the "starchy" tag of the first virtual machine and the corresponding "video service" tag value in fig. 7, the user can first click the "video service" tag value corresponding to the "starchy" tag of the first virtual machine, and then click the "delete" button under the "operation" tag corresponding to the first virtual machine, and then can remove the "starchy" tag and the "video service" tag value of the first virtual machine.
If multiple tabs are selected in the table column, the virtual machines may be grouped and categorized in turn according to the selected tabs, with the virtual machines with the selected tabs displayed at the top of the list of virtual machines.
The mode of carrying out categorised sequencing to the virtual machine, not only satisfy the tag function that OpenStack screened and looked over the virtual machine, but also have the function of looking over the virtual machine list based on the tag classification sequencing, the tag function of original OpenStack virtual machine has been strengthened and improved, the mode make full use of has OpenStack now and looks over the function of virtual machine based on the tag screening, realized adding self-defined label and can classify the sequencing to the virtual machine simultaneously, the tag function that makes the virtual machine has had two kinds of functions simultaneously, the virtual machine tag function of OpenStack has been enriched, the realization process is high-efficient. It should be noted that the function of adding the custom tag to the virtual machine and sorting the tag may be implemented separately, or may not be implemented based on the existing OpenStack tag function.
In the related art, the existing OpenStack version has no function of adding custom tags to a virtual machine and sequencing. In the application, whether the virtual machines with the same label and the same label value need to be screened and sorted or not can be selected according to actual requirements through self-defined labels, the application is more flexible, the virtual machines with the same label and the same label value can be checked, accurate classification checking of the virtual machines is realized, the virtual machines with various services are convenient to manage and deploy, the virtual machines with the selected labels and the virtual machines without the selected labels are displayed in a virtual machine list, wherein the virtual machines with the selected labels are displayed in the front of the virtual machine list, and the virtual machines without the selected labels are arranged backwards; for example, if the selected tag is aa, two virtual machines with the tag aa have tag values of aa1 for one service deployed by one virtual machine and aa2 for another service deployed by the other virtual machine, when the virtual machines in the virtual machine list are sorted by clicking the tag aa in the virtual machine list, the virtual machines with the tag values of aa1 and aa2 in question are displayed at the front of the virtual machine list, and the virtual machines without the tag values are arranged backwards, so that the virtual machines with different tag values under the tag can be distinguished, and the virtual machines with multiple types of services deployed by viewing and managing are identified.
An embodiment of the present invention provides a device for sorting and sequencing virtual machines, as shown in fig. 8, the device includes: a display module 80, configured to display a virtual machine list in response to the tag selection instruction; in the virtual machine list, at least one part of virtual machines have tag values of selected tags contained in the tag selection instruction; the sorting module 81 is configured to, in response to a trigger instruction of a target tag in the selected tags, sort the virtual machines in the virtual machine list based on a tag value of the target tag to obtain a sorting result; in the sorting result, virtual machines having the same tag value of the target tag are adjacently arranged.
The device for classifying and sequencing the virtual machines, provided by the embodiment of the invention, is used for responding to a label selection instruction and displaying a virtual machine list; in the virtual machine list, at least one part of virtual machines have label values of the selected labels contained in the label selection instruction; in response to a trigger instruction of a target tag in the selected tags, sorting the virtual machines in the virtual machine list based on the tag value of the target tag to obtain a sorting result; in the sorting result, virtual machines having the same tag value of the target tag are adjacently arranged. The device can set up corresponding label value for the label that the virtual machine has, shows this label value in the virtual machine list to can be based on this label value, sort the virtual machine in the virtual machine list, because the label value of the same label that different virtual machines have is probably the same, be convenient for look over the virtual machine that has same label value through the sequencing, and then can carry out accurate classification to the virtual machine and look over.
Further, the preset attribute list comprises a plurality of labels; the display module 80 is also used for: in response to a tag selection instruction, determining a selected tag from a plurality of tags included in a preset attribute list; generating and displaying a virtual machine list based on the selected tag; the entries of the virtual machine list include the selected tag.
Furthermore, a plurality of label values are preset in the target label; the sorting module 81 is further configured to: responding to a trigger instruction of a target label in the selected labels, and acquiring label values of the target label corresponding to at least one part of virtual machines; dividing virtual machines with the same tag value into a virtual machine set to obtain at least one virtual machine set; and sequencing at least one virtual machine set in an ascending or descending manner according to the label values to obtain a sequencing result.
Further, the sorting module 81 is further configured to: the virtual machines having no tag value of the target tag are arranged behind the sorted result.
Further, the virtual machine list further includes: a virtual machine that does not have the selected tag; the apparatus is also configured to: and arranging the virtual machines without the selected labels in the virtual machine list behind the virtual machines with the selected labels.
Further, the apparatus is further configured to: responding to a virtual machine creating instruction, and creating a target virtual machine; in response to the tag adding instruction, adding at least one tag and a tag value of the at least one tag for the target virtual machine; the at least one tag and the tag value of the at least one tag are saved.
Further, the apparatus is further configured to: in response to a tag deletion instruction for a specified tag of a specified virtual machine, the specified tag and a tag value of the specified tag possessed by the specified virtual machine are deleted.
The implementation principle and the generated technical effect of the device for sorting and sequencing virtual machines provided by the embodiment of the invention are the same as those of the method for sorting and sequencing virtual machines, and for brief description, reference may be made to the corresponding content in the method for sorting and sequencing virtual machines in the embodiment, where there is no mention in the embodiment of the device for sorting and sequencing virtual machines.
An embodiment of the present invention further provides an electronic device, which is shown in fig. 9 and includes a processor 130 and a memory 131, where the memory 131 stores machine executable instructions that can be executed by the processor 130, and the processor 130 executes the machine executable instructions to implement the above method for sorting and sorting virtual machines.
Further, the electronic device shown in fig. 9 further includes a bus 132 and a communication interface 133, and the processor 130, the communication interface 133, and the memory 131 are connected through the bus 132.
The Memory 131 may include a high-speed Random Access Memory (RAM) and may also include a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. The communication connection between the network element of the system and at least one other network element is realized through at least one communication interface 133 (which may be wired or wireless), and the internet, a wide area network, a local network, a metropolitan area network, and the like can be used. The bus 132 may be an ISA bus, PCI bus, EISA bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 9, but this does not indicate only one bus or one type of bus.
The processor 130 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 130. The Processor 130 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the device can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in the memory 131, and the processor 130 reads the information in the memory 131 and completes the steps of the method of the foregoing embodiment in combination with the hardware thereof.
The embodiment of the present invention further provides a machine-readable storage medium, where the machine-readable storage medium stores machine-executable instructions, and when the machine-executable instructions are called and executed by a processor, the machine-executable instructions cause the processor to implement the method for sorting and ordering virtual machines, and specific implementation may refer to method embodiments, and is not described herein again.
The method, the apparatus, and the computer program product of the electronic device for sorting and sequencing virtual machines provided in the embodiments of the present invention include a computer-readable storage medium storing a program code, where instructions included in the program code may be used to execute the method described in the foregoing method embodiments, and specific implementations may refer to the method embodiments and are not described herein again.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
Finally, it should be noted that: although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art will understand that the following embodiments are merely illustrative of the present invention, and not restrictive, and the scope of the present invention is not limited thereto: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present invention, and they should be construed as being included therein. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A method of categorically ordering virtual machines, the method comprising:
responding to the instruction selected by the label, and displaying a virtual machine list; in the virtual machine list, at least one part of virtual machines have tag values of the selected tags contained in the tag selection instruction;
in response to a trigger instruction of a target tag in the selected tags, sorting the virtual machines in the virtual machine list based on the tag value of the target tag to obtain a sorting result; and in the sequencing result, the virtual machines with the same label value of the target label are arranged adjacently.
2. The method of claim 1, wherein the preset attribute list includes a plurality of tags; the step of displaying the virtual machine list in response to the tag selection instruction comprises:
in response to the tag selection instruction, determining a selected tag from the plurality of tags included in the preset attribute list;
generating and displaying the virtual machine list based on the selected tag; and the item of the virtual machine list comprises the selected label.
3. The method of claim 1, wherein the target tag is preset with a plurality of tag values; the step of, in response to the trigger instruction of the target tag in the selected tags, sorting the virtual machines in the virtual machine list based on the tag values of the target tag to obtain a sorting result includes:
responding to a trigger instruction of a target label in the selected labels, and acquiring label values of the target label corresponding to at least one part of virtual machines;
dividing virtual machines with the same tag value into a virtual machine set to obtain at least one virtual machine set;
and sequencing the at least one virtual machine set in an ascending or descending manner according to the label values to obtain a sequencing result.
4. The method of claim 3, wherein after the step of sorting the at least one set of virtual machines in ascending or descending order of the plurality of tag values to obtain a sorting result, the method further comprises:
arranging a virtual machine without a tag value of the target tag behind the sorting result.
5. The method of claim 1, wherein the list of virtual machines further comprises: a virtual machine that does not have the selected tag; the method further comprises the following steps:
arranging the virtual machines without the selected label in the virtual machine list behind the virtual machines with the selected label.
6. The method of claim 1, further comprising:
responding to a virtual machine creating instruction, and creating a target virtual machine;
in response to a tag adding instruction, adding at least one tag and a tag value of the at least one tag for the target virtual machine;
saving the at least one tag and the tag value of the at least one tag.
7. The method of claim 1, further comprising:
deleting a specified tag and a tag value of the specified tag possessed by a specified virtual machine in response to a tag deletion instruction for the specified tag of the specified virtual machine.
8. An apparatus for sorting virtual machines, the apparatus comprising:
the display module is used for responding to the label selection instruction and displaying the virtual machine list; in the virtual machine list, at least one part of virtual machines have tag values of the selected tags contained in the tag selection instruction;
the sorting module is used for responding to a trigger instruction of a target tag in the selected tags, sorting the virtual machines in the virtual machine list based on the tag value of the target tag, and obtaining a sorting result; and in the sequencing result, the virtual machines with the same label value of the target label are arranged adjacently.
9. An electronic device comprising a processor and a memory, the memory storing machine executable instructions executable by the processor, the processor executing the machine executable instructions to implement the method of sorting virtual machines of any of claims 1-7.
10. A machine-readable storage medium having stored thereon machine-executable instructions which, when invoked and executed by a processor, cause the processor to implement the method of sorting virtual machines of any of claims 1 to 7.
CN202110028724.7A 2021-01-08 2021-01-08 Method and device for sorting virtual machines and electronic equipment Pending CN112817689A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110028724.7A CN112817689A (en) 2021-01-08 2021-01-08 Method and device for sorting virtual machines and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110028724.7A CN112817689A (en) 2021-01-08 2021-01-08 Method and device for sorting virtual machines and electronic equipment

Publications (1)

Publication Number Publication Date
CN112817689A true CN112817689A (en) 2021-05-18

Family

ID=75868588

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110028724.7A Pending CN112817689A (en) 2021-01-08 2021-01-08 Method and device for sorting virtual machines and electronic equipment

Country Status (1)

Country Link
CN (1) CN112817689A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116405391A (en) * 2023-04-10 2023-07-07 长扬科技(北京)股份有限公司 OpenStack-based virtual machine node screening method, system and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116405391A (en) * 2023-04-10 2023-07-07 长扬科技(北京)股份有限公司 OpenStack-based virtual machine node screening method, system and storage medium

Similar Documents

Publication Publication Date Title
JP5661104B2 (en) Method and system for search using search engine indexing and index
US10579659B2 (en) Method, apparatus, electronic equipment and storage medium for performing screening and statistical operation on data
CN111917863B (en) Message pushing method and device, television equipment and computer storage medium
WO2019062079A1 (en) Tag library-based segmentation method for service objects, electronic device and storage medium
CN111597548B (en) Data processing method and device for realizing privacy protection
CN112817689A (en) Method and device for sorting virtual machines and electronic equipment
CN114640707A (en) Message asynchronous processing method and device, electronic equipment and storage medium
CN112559913B (en) Data processing method, device, computing equipment and readable storage medium
CN111475305B (en) Big data processing method and system based on cloud platform multithreading
CN110764705B (en) Data reading and writing method, device, equipment and storage medium
CN108628895B (en) Map data processing method and device
JP6994138B2 (en) Information management device and file management method
CN114443781A (en) Method and device for generating enterprise guarantee map
CN109739883B (en) Method and device for improving data query performance and electronic equipment
CN108737522B (en) Message processing method, device and system
CN113326064A (en) Method for dividing business logic module, electronic equipment and storage medium
CN112784159A (en) Content recommendation method and device, terminal equipment and computer readable storage medium
CN111143318A (en) Information processing method and device, electronic equipment and storage medium
CN111612548A (en) Information acquisition method and device, computer equipment and readable storage medium
CN110751204A (en) Data fusion method and device, storage medium and electronic device
CN116804936A (en) Information display method and device and electronic equipment
CN112819511B (en) Relationship display method and device of object execution strategy and electronic equipment
CN117240819B (en) Mail configuration method, device, equipment and computer readable storage medium
CN113852840B (en) Video rendering method, device, electronic equipment and storage medium
US20240078222A1 (en) Selective Addition of Datum to a Tree Data Structure

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