CN117407092B - Device configuration changing method and device, electronic device and storage medium - Google Patents

Device configuration changing method and device, electronic device and storage medium Download PDF

Info

Publication number
CN117407092B
CN117407092B CN202311707477.9A CN202311707477A CN117407092B CN 117407092 B CN117407092 B CN 117407092B CN 202311707477 A CN202311707477 A CN 202311707477A CN 117407092 B CN117407092 B CN 117407092B
Authority
CN
China
Prior art keywords
configuration information
virtual machine
changed
change notification
configuration
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
CN202311707477.9A
Other languages
Chinese (zh)
Other versions
CN117407092A (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.)
Suzhou Metabrain Intelligent Technology Co Ltd
Original Assignee
Suzhou Metabrain Intelligent 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 Suzhou Metabrain Intelligent Technology Co Ltd filed Critical Suzhou Metabrain Intelligent Technology Co Ltd
Priority to CN202311707477.9A priority Critical patent/CN117407092B/en
Publication of CN117407092A publication Critical patent/CN117407092A/en
Application granted granted Critical
Publication of CN117407092B publication Critical patent/CN117407092B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • G06F9/4451User profiles; Roaming
    • 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

Abstract

The application discloses a device configuration changing method and device, electronic equipment and a storage medium, and relates to the technical field of computers. When equipment configuration changes occur, aggregating a plurality of changed configuration information, and constructing a change notification based on the aggregated configuration information; sending a change notification to the virtual machine so that the virtual machine analyzes the change notification to obtain a plurality of changed configuration information and processes the plurality of changed configuration information; receiving a response message of the virtual machine; after the virtual machine processes the changed configuration information, a response message is returned to the host machine. The method reduces the processing complexity of the front-end driver in the virtual machine for sensing the configuration change of the back-end driver in the host machine.

Description

Device configuration changing method and device, electronic device and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a device configuration changing method and apparatus, an electronic device, and a storage medium.
Background
Virtio stands for virtualized IO (Input/Output) for implementing device paravirtualization, i.e. an operating system running in a virtual machine needs to load special drivers (kernel mode) and the virtual machine knows itself as a virtual machine. Paravirtualization based on virtio may improve device access performance compared to full virtualization based on full simulation. The part running in the virtual machine is called front-end drive, responsible for providing a unified interface for the virtual machine, and the part running in the host machine is called back-end drive, responsible for adapting to different physical hardware devices.
The front-end driver in the virtual machine needs to sense the configuration change of the back-end driver in the host, and in the related art, the processing complexity of the configuration change message is higher. Therefore, how to reduce the processing complexity of the front-end driver in the virtual machine to perceive the configuration change of the back-end driver in the host is a technical problem that needs to be solved by those skilled in the art.
Disclosure of Invention
The invention aims to provide a device configuration changing method and device, electronic equipment and storage medium, and the processing complexity of sensing configuration change of a back-end driver in a host machine by a front-end driver in a virtual machine is reduced.
In order to achieve the above object, the present application provides a device configuration changing method, which is applied to a host in a paravirtualized device, where the paravirtualized device includes the host and a virtual machine, and the method includes:
when equipment configuration changes occur, aggregating a plurality of changed configuration information, and constructing a change notification based on the aggregated configuration information;
sending the change notification to the virtual machine so that the virtual machine analyzes the change notification to obtain a plurality of changed configuration information and processes the plurality of changed configuration information;
receiving a response message of the virtual machine; and after the virtual machine finishes processing the plurality of changed configuration information, returning the response message to the host machine.
Wherein when the device configuration change occurs, before aggregating the plurality of changed configuration information, the method further comprises:
creating a first channel file; the first channel file is used for receiving a message sent to the host machine by the virtual machine;
receiving a communication establishment message sent by the virtual machine through the first channel file;
after the virtual machine creates a second channel file, receiving an identifier of the second channel file sent by the virtual machine through the first channel file, so as to establish a link with the virtual machine through the identifier; the second channel file is used for receiving a message sent to the virtual machine by the host machine.
Wherein sending the change notification to the virtual machine includes:
and sending the change notification to the virtual machine through the second channel file.
The receiving the response message of the virtual machine includes:
and receiving the response message of the virtual machine through the first channel file.
After receiving the communication establishment message sent by the virtual machine through the first channel file, the method further includes:
and negotiating whether the two parties support the processing equipment configuration change notification function or not with the virtual machine, wherein the change notification carries the configuration information function, and the change notification carries a plurality of configuration information functions.
And if the host machine and the virtual machine both support a processing equipment configuration change notification function, the virtual machine creates the second channel file.
If both the host and the virtual machine support the change notification to carry multiple configuration information functions, aggregating multiple changed configuration information when the device configuration change occurs, and constructing the change notification based on the aggregated configuration information, where the method includes:
when the equipment configuration is changed, judging whether a plurality of changed configuration information exists or not;
If yes, aggregating a plurality of changed configuration information, and constructing a change notification based on the aggregated configuration information;
if not, constructing a change notification based on the single changed configuration information.
If both the host and the virtual machine support the function of carrying configuration information in the change notification but do not support the function of carrying a plurality of configuration information in the change notification, the method further includes:
when the equipment configuration is changed, judging whether a plurality of changed configuration information exists or not;
if yes, the first changed configuration information is used as current configuration information, a change notification is constructed based on the current configuration information, a step of sending the change notification to the virtual machine is executed, after a response message corresponding to the current configuration information is received, the next changed configuration information of the current configuration information is re-determined to be the current configuration information, and the step of constructing the change notification based on the current configuration information is re-entered until a response message corresponding to the last changed configuration information is received;
if not, constructing a change notification based on the single changed configuration information, and executing the step of sending the change notification to the virtual machine.
Wherein the aggregating the plurality of changed configuration information includes:
and adding a configuration identifier at the tail part of each piece of changed configuration information, wherein the configuration identifier is used for describing whether the current changed configuration information has the subsequent changed configuration information or not.
If the current changed configuration information has the subsequent changed configuration information, the configuration identifier is further used for describing the type of the subsequent changed configuration information.
And the virtual machine processes the configuration information after the subsequent change according to the type of the configuration information after the subsequent change in the configuration identifier.
Wherein when the device configuration change occurs, before aggregating the plurality of changed configuration information, the method further comprises:
receiving initial configuration information of the paravirtualized device through the first channel file;
receiving shared memory queue address information of a data plane through the first channel file, and establishing a transmission channel of the data plane based on the shared memory queue address information;
and receiving a starting message through the first channel file, and starting the paravirtualized equipment.
To achieve the above object, the present application provides a device configuration changing apparatus, which is applied to a host machine in a paravirtualized device, where the paravirtualized device includes the host machine and a virtual machine, and the apparatus includes:
The construction module is used for aggregating a plurality of changed configuration information when the equipment configuration is changed, and constructing a change notification based on the aggregated configuration information;
the sending module is used for sending the change notification to the virtual machine so that the virtual machine analyzes the change notification to obtain a plurality of changed configuration information and processes the plurality of changed configuration information;
the receiving module is used for receiving the response message of the virtual machine; and after the virtual machine finishes processing the plurality of changed configuration information, returning the response message to the host machine.
Wherein, still include:
the link module is used for creating a first channel file; the first channel file is used for receiving a message sent to the host machine by the virtual machine; receiving a communication establishment message sent by the virtual machine through the first channel file; after the virtual machine creates a second channel file, receiving an identifier of the second channel file sent by the virtual machine through the first channel file, so as to establish a link with the virtual machine through the identifier; the second channel file is used for receiving a message sent to the virtual machine by the host machine.
Wherein, the sending module body is used for: and sending the change notification to the virtual machine through the second channel file.
The receiving module is specifically configured to: and receiving the response message of the virtual machine through the first channel file.
Wherein, still include:
the negotiation module is used for negotiating with the virtual machine whether the two parties support the function of processing equipment configuration change notification, the function of carrying configuration information in the change notification and the function of carrying a plurality of configuration information in the change notification.
And if the host machine and the virtual machine both support a processing equipment configuration change notification function, the virtual machine creates the second channel file.
If both the host and the virtual machine support the change notification to carry a plurality of configuration information functions, the construction module is specifically configured to: when the equipment configuration is changed, judging whether a plurality of changed configuration information exists or not; if yes, aggregating a plurality of changed configuration information, and constructing a change notification based on the aggregated configuration information; if not, constructing a change notification based on the single changed configuration information.
Wherein if both the host and the virtual machine support the function of carrying configuration information in the change notification but do not support the function of carrying a plurality of configuration information in the change notification, the apparatus further comprises:
The judging module is used for judging whether a plurality of changed configuration information exists when the equipment configuration is changed; if yes, the first changed configuration information is used as current configuration information, a change notification is constructed based on the current configuration information, a step of sending the change notification to the virtual machine is executed, after a response message corresponding to the current configuration information is received, the next changed configuration information of the current configuration information is re-determined to be the current configuration information, and the step of constructing the change notification based on the current configuration information is re-entered until a response message corresponding to the last changed configuration information is received; if not, constructing a change notification based on the single changed configuration information, and executing the step of sending the change notification to the virtual machine.
The construction module is specifically configured to: and adding a configuration identifier at the tail part of each piece of changed configuration information, wherein the configuration identifier is used for describing whether the current changed configuration information has the subsequent changed configuration information or not.
If the current changed configuration information has the subsequent changed configuration information, the configuration identifier is further used for describing the type of the subsequent changed configuration information.
And the virtual machine processes the configuration information after the subsequent change according to the type of the configuration information after the subsequent change in the configuration identifier.
Wherein, still include:
the device starting module is used for receiving initial configuration information of the paravirtualized device through the first channel file; receiving shared memory queue address information of a data plane through the first channel file, and establishing a transmission channel of the data plane based on the shared memory queue address information; and receiving a starting message through the first channel file, and starting the paravirtualized equipment.
To achieve the above object, the present application provides an electronic device, including:
a memory for storing a computer program;
and a processor for implementing the steps of the device configuration change method as described above when executing the computer program.
To achieve the above object, the present application provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the device configuration changing method as described above.
According to the scheme, the equipment configuration changing method is applied to a host machine in a paravirtualized equipment, the paravirtualized equipment comprises the host machine and a virtual machine, and the method comprises the following steps: when equipment configuration changes occur, aggregating a plurality of changed configuration information, and constructing a change notification based on the aggregated configuration information; sending the change notification to the virtual machine so that the virtual machine analyzes the change notification to obtain a plurality of changed configuration information and processes the plurality of changed configuration information; receiving a response message of the virtual machine; and after the virtual machine finishes processing the plurality of changed configuration information, returning the response message to the host machine.
According to the equipment configuration changing method, when the host machine at the back end changes equipment configuration, the changed configuration information is carried in the change notification sent to the virtual machine at the front end, and after the front end processing is completed, a response message is returned to the back end, so that the interaction times for acquiring the configuration information are reduced, and the problem of increased software logic complexity caused by message nesting processing or asynchronous message processing is avoided. In addition, the change notification carries a plurality of related changed configuration information, so that the number of message interaction is further reduced, and the processing overhead caused by batch change notification is reduced. Therefore, the device configuration changing method reduces the processing complexity of the front-end driver in the virtual machine for sensing the configuration change of the back-end driver in the host. The application also discloses a device configuration changing device, an electronic device and a computer readable storage medium, and the technical effects can be achieved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art. The accompanying drawings are included to provide a further understanding of the disclosure, and are incorporated in and constitute a part of this specification, illustrate the disclosure and together with the description serve to explain, but do not limit the disclosure. In the drawings:
FIG. 1 is a schematic diagram illustrating interactions between a front end and a back end in a paravirtualized device according to the related art;
FIG. 2 is a diagram illustrating interactions of front-end and back-end in a paravirtualized device in accordance with an example embodiment;
FIG. 3 is a flow chart illustrating a method of device configuration change according to an example embodiment;
FIG. 4 is a block diagram illustrating a device configuration change apparatus according to an example embodiment;
fig. 5 is a block diagram of an electronic device, according to an example embodiment.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. It will be apparent that the described embodiments are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application. In addition, in the embodiments of the present application, "first," "second," and the like are used to distinguish similar objects, and are not necessarily used to describe a particular order or sequence.
Virtio represents a virtualized IO for implementing device paravirtualization, i.e. an operating system running in a virtual machine needs to load a special driver (kernel mode) and the virtual machine knows itself as a virtual machine. Paravirtualization based on virtio may improve device access performance compared to full virtualization based on full simulation. The part running in the virtual machine is called front-end drive, responsible for providing a unified interface for the virtual machine, and the part running in the host machine is called back-end drive, responsible for adapting to different physical hardware devices. The Virtio front-end driver runs in a virtual machine, has different drivers for different types of devices, but interfaces that interact with the back-end driver are all unified. The virtio layer implements a virtual queue interface, and as a bridge for front-end and back-end communication, different types of devices use different numbers of virtual queues, such as a paravirtualized network card (virtio-net) uses two queues, one for receiving and the other for transmitting. The virtual-ring layer is a specific implementation of the virtual queue. The virtual back end driver operates in the host machine to realize logic of the virtual back end (kernel mode vhost), and mainly operates hardware equipment, for example, sends a read-write request to the bottom storage equipment to complete read-write operation of the virtual machine on the storage equipment.
Similarly, a virtio may be used between the container and the host, and in the user-state container, a user-state device, such as a user-state block device, is generated using the user-state virtio. The backend can also use a virtual backend (vhost-user) in a user mode, so that IO communication in a full user mode is realized on a data plane, and overhead generated by entering and exiting the kernel is avoided. However, on the control plane, after using the vhost-user, the front-end virtio-user and the back-end vhost-user are not the same process, and if the block device capacity and state of the back-end change, the front-end needs to sense.
In the related art, as shown in fig. 1, in the front-end and back-end establishment communication phase, both parties are negotiated to support the processing device configuration change message function, and a message channel for transmitting the configuration change is created. When the equipment configuration is changed, the rear end sends a change notification to the front end through the message channel and synchronously waits for a response, the front end sends a message to the rear end after receiving the notification, acquires the changed configuration information, and sends the response of the change notification to the rear end after receiving the changed configuration information. That is, the front end does not answer immediately after receiving the change notification, but does answer the back end after a round of message interaction for acquiring the configuration information, and since the back end is waiting synchronously, the back end needs to create another thread to respond to acquiring the configuration information. After creating a new thread, in order to avoid deadlock with the original thread when processing messages simultaneously, new logic needs to be added to avoid deadlock. Alternatively, an asynchronous message mechanism is used, and the front end and the back end asynchronously wait for the response, but newly introduce asynchronous processing logic, and the complexity of the processing of the virtio control plane message is increased.
Therefore, in the application, as shown in fig. 2, when the host machine at the back end changes the configuration of the device, the changed configuration information is carried in the change notification sent to the virtual machine at the front end, and after the front end processing is completed, a response message is returned to the back end, so that the interaction times for obtaining the configuration information are reduced, and the problem of increasing the logic complexity of software caused by message nesting processing or asynchronous message processing is avoided. In addition, the change notification carries a plurality of related changed configuration information, so that the number of message interaction is further reduced, and the processing overhead caused by batch change notification is reduced. Therefore, the device configuration changing method reduces the processing complexity of the front-end driver in the virtual machine for sensing the configuration change of the back-end driver in the host.
The embodiment of the application discloses a device configuration changing method, which reduces the processing complexity of the front-end driver in a virtual machine for sensing the configuration change of the back-end driver in a host machine.
Referring to fig. 3, a flowchart of a device configuration change method according to an exemplary embodiment is shown, and as shown in fig. 3, includes:
s101: when equipment configuration changes occur, aggregating a plurality of changed configuration information, and constructing a change notification based on the aggregated configuration information;
The embodiment is applied to a paravirtualized device, which comprises a host machine at the back end and a virtual machine at the front end, wherein an execution main body of the embodiment is the host machine at the back end, so that the virtual machine at the front end perceives configuration change in the host machine at the back end.
As a possible implementation manner, before aggregating the plurality of changed configuration information when the device configuration change occurs, the method further includes: creating a first channel file; the first channel file is used for receiving a message sent to the host machine by the virtual machine; receiving a communication establishment message sent by the virtual machine through the first channel file; after the virtual machine creates a second channel file, receiving an identifier of the second channel file sent by the virtual machine through the first channel file, so as to establish a link with the virtual machine through the identifier; the second channel file is used for receiving a message sent to the virtual machine by the host machine.
In an implementation, the back-end creates a first channel file for receiving messages sent from the front-end. The front end initiates a communication establishment message to the back end by writing a message into the first channel file, initiates negotiation, and confirms whether the two parties support the following functions: the support processing device configures the change notification function, the change notification carries the configuration information function, and the change notification carries a plurality of configuration information functions. If both sides support the configuration change function of the processing device, the front end creates a second channel file in the opposite direction, which is used for receiving the configuration change message sent by the back end, and sending the identifier of the second channel file, namely the file descriptor, to the back end through the first channel file. After receiving the identification of the second channel file, the rear end establishes a link with the front end.
When the device configuration is changed, if the host and the virtual machine both support the function of carrying a plurality of configuration information in the change notification, aggregating the plurality of changed configuration information, and constructing the change notification based on the aggregated configuration information, that is, the configuration information carried in the change notification may be one or more changed configuration information. For example, when the back-end storage pool fails, the back-end only needs to send a change notification based on the simultaneous change of all the block device states of the pool, and the back-end only carries all relevant block device configuration change information exported to the front-end.
As a preferred embodiment, the aggregating the plurality of changed configuration information includes: and adding a configuration identifier at the tail part of each piece of changed configuration information, wherein the configuration identifier is used for describing whether the current changed configuration information has the subsequent changed configuration information or not.
In a specific implementation, when the back end aggregates a plurality of configuration information, in order not to newly increase the configuration information structure, the plurality of configuration information are linked through a linking identifier, that is, an identifier is newly added at the tail of each configuration information to indicate whether the configuration information exists in the follow-up process, if the configuration information exists in the follow-up process after the current change, the configuration identifier is also used for describing the type of the configuration information after the follow-up process, and the type of the configuration information is used for guiding the front end to use corresponding processing logic to process, that is, in the follow-up step, the virtual machine processes the configuration information after the follow-up process according to the type of the configuration information after the follow-up process in the configuration identifier.
S102: sending the change notification to the virtual machine so that the virtual machine analyzes the change notification to obtain a plurality of changed configuration information and processes the plurality of changed configuration information;
in a specific implementation, the host machine sends a change notification to the virtual machine through the second channel file, and the virtual machine analyzes the change notification to obtain a plurality of changed configuration information and processes the plurality of changed configuration information.
S103: receiving a response message of the virtual machine; and after the virtual machine finishes processing the plurality of changed configuration information, returning the response message to the host machine.
In a specific implementation, after the virtual machine processes the plurality of changed configuration information, a response message is returned to the host machine through the first channel file, that is, the host machine receives the response message of the virtual machine through the first channel file.
According to the device configuration changing method, when the host machine at the back end changes the device configuration, the changed configuration information is carried in the change notification sent to the virtual machine at the front end, and after the front end processing is completed, a response message is returned to the back end, so that the interaction times for obtaining the configuration information are reduced, and the problem of increasing the logic complexity of software caused by message nesting processing or asynchronous message processing is avoided. In addition, the change notification carries a plurality of related changed configuration information, so that the number of message interaction is further reduced, and the processing overhead caused by batch change notification is reduced. Therefore, the device configuration changing method reduces the processing complexity of the front-end driver in the virtual machine for sensing the configuration change of the back-end driver in the host.
The embodiment of the application discloses a device configuration changing method, and compared with the previous embodiment, the embodiment further describes and optimizes a technical scheme. The method specifically comprises the following steps:
step 1: creating a first channel file; the first channel file is used for receiving a message sent to the host machine by the virtual machine; receiving a communication establishment message sent by the virtual machine through the first channel file; negotiating whether the two parties support the function of processing equipment configuration change notification or not with the virtual machine, wherein the change notification carries the function of configuration information, and the change notification carries a plurality of functions of configuration information; if both the host machine and the virtual machine support a processing device configuration change notification function, the virtual machine creates the second channel file, where the second channel file is used to receive a message sent by the host machine to the virtual machine; receiving an identifier of the second channel file sent by the virtual machine through the first channel file, and establishing a link with the virtual machine through the identifier;
in the communication establishment phase, the back end creates a first channel file for receiving the message sent by the front end. The front end initiates a communication establishment message to the back end by writing a message into the first channel file, initiates negotiation, and confirms whether the two parties support the following functions: the support processing device configures the change notification function, the change notification carries the configuration information function, and the change notification carries a plurality of configuration information functions. If both sides support the configuration change function of the processing device, the front end creates a second channel file in the opposite direction, which is used for receiving the configuration change message sent by the back end, and sending the identifier of the second channel file, namely the file descriptor, to the back end through the first channel file. After receiving the identification of the second channel file, the rear end establishes a link with the front end.
Step 2: receiving initial configuration information of the paravirtualized device through the first channel file; receiving shared memory queue address information of a data plane through the first channel file, and establishing a transmission channel of the data plane based on the shared memory queue address information; receiving a starting message through the first channel file, and starting the paravirtualized equipment;
in the equipment starting stage, the front end sends an acquisition configuration message to the back end through the first channel file to acquire the configuration of equipment. The front end sends the shared memory queue address information of the data plane to the back end through the first channel file, informs the back end to establish a transmission channel of the data plane, and completes initialization of the transmission channel. The front end sends a starting message to the back end through the first channel file to start the equipment.
Step 3: if the host and the virtual machine both support the function of carrying a plurality of configuration information in the change notification, when the equipment configuration is changed, judging whether a plurality of changed configuration information exists; if yes, enter step 4; if not, entering a step 5;
step 4: aggregating the plurality of changed configuration information, and constructing a change notification based on the aggregated configuration information; sending the change notification to the virtual machine so that the virtual machine analyzes the change notification to obtain a plurality of changed configuration information and processes the plurality of changed configuration information; receiving a response message of the virtual machine; after the virtual machine finishes processing the plurality of changed configuration information, returning the response message to the host machine;
Step 5: constructing a change notification based on the single changed configuration information; sending the change notification to the virtual machine so that the virtual machine analyzes the change notification to obtain changed configuration information and processes the changed configuration information; receiving a response message of the virtual machine; after the virtual machine finishes processing the changed configuration information, returning the response message to the host machine;
and if the two parties support the function of carrying the information in the change notification, if the two parties terminate, the two parties continue to confirm whether the two parties support the function of carrying the configuration information in the change notification and the function of carrying a plurality of configuration information in the change notification.
If both sides support the function of carrying multiple configuration information in the change notification, then determine whether there are multiple changed configuration information, for example, when the back-end storage pool fails, all the block device states based on the pool change simultaneously. If a plurality of changed configuration information exists, the back end aggregates the plurality of changed configuration information according to a change order, builds a change notification based on the aggregated configuration information, the back end sends the change notification to the front end through the second channel file, the front end obtains the plurality of changed configuration information by analyzing information carried in the change notification after receiving the change notification, the plurality of changed configuration information is sequentially processed, and the back end is responded through the first channel file after the plurality of changed configuration information is processed.
If the plurality of changed configuration information does not exist, the back end builds a change notification based on the single changed configuration information, the back end second channel file sends the change notification to the front end, and after the front end receives the change notification, the front end analyzes the information carried in the change notification to obtain the changed configuration information, processes the changed configuration information and responds to the back end through the first channel file.
Step 6: if both the host and the virtual machine support the function of carrying configuration information in the change notification but do not support the function of carrying a plurality of configuration information in the change notification, judging whether a plurality of changed configuration information exists when equipment configuration change occurs; if yes, enter step 7; if not, entering step 8;
step 7: the first changed configuration information is used as current configuration information, a change notification is constructed based on the current configuration information, and the change notification is sent to the virtual machine, so that the virtual machine analyzes the change notification to obtain the current configuration information, and the current configuration information is processed; after the processing of the current configuration information is completed, the virtual machine returns a response message corresponding to the current configuration information to the host machine; after receiving the response message corresponding to the current configuration information, re-determining the configuration information after the next change of the current configuration information as the current configuration information, and re-entering the step of constructing a change notification based on the current configuration information until receiving the response message corresponding to the last changed configuration information;
Step 8: constructing a change notification based on the single changed configuration information, and sending the change notification to the virtual machine so that the virtual machine analyzes the change notification to obtain the changed configuration information and processes the changed configuration information; receiving a response message of the virtual machine; and after the virtual machine finishes processing the changed configuration information, returning the response message to the host machine.
If both sides support the function of carrying configuration information in the change notification but do not support the function of carrying multiple configuration information in the change notification, whether multiple changed configuration information exists or not is judged, for example, when a back-end storage pool fails, the states of all the block devices based on the pool are changed simultaneously. If a plurality of changed configuration information exists, the back end takes the first changed configuration information as current configuration information, builds a change notification based on the current configuration information, sends the change notification to the front end through a second channel file, analyzes the change notification to obtain the current configuration information, processes the current configuration information, returns a response message corresponding to the current configuration information to the back end through the first channel file after the processing is completed, and re-determines the next changed configuration information of the current configuration information as the current configuration information after the back end receives the response message corresponding to the current configuration information, and re-enters the step of building the change notification based on the current configuration information until the back end receives the response message corresponding to the last changed configuration information.
In the process of processing the notification, further acquiring detailed configuration information or other related information is required, and then the response of the current notification must be completed first, and then the message is sent to acquire the configuration information. That is, after each round of message interaction is completed, the next round of message interaction can be initiated. The multithreading, deadlock prevention processing or asynchronous message processing logic caused by message interaction nesting is avoided, and the complexity of a control plane is reduced.
If the plurality of changed configuration information does not exist, the back end builds a change notification based on the single changed configuration information, the back end second channel file sends the change notification to the front end, and after the front end receives the change notification, the front end analyzes the information carried in the change notification to obtain the changed configuration information, processes the changed configuration information and responds to the back end through the first channel file.
The following describes a device configuration changing apparatus provided in an embodiment of the present application, where the device configuration changing apparatus is applied to a host in a paravirtualized device, where the paravirtualized device includes the host and a virtual machine, and the device configuration changing apparatus described below and the device configuration changing method described above may be referred to each other.
Referring to fig. 4, a block diagram of a device configuration changing apparatus according to an exemplary embodiment is shown, as shown in fig. 4, including:
a construction module 401, configured to aggregate a plurality of changed configuration information when a device configuration change occurs, and construct a change notification based on the aggregated configuration information;
a sending module 402, configured to send the change notification to the virtual machine, so that the virtual machine parses the change notification to obtain a plurality of changed configuration information, and processes the plurality of changed configuration information;
a receiving module 403, configured to receive a response message of the virtual machine; and after the virtual machine finishes processing the plurality of changed configuration information, returning the response message to the host machine.
According to the device configuration changing device, when the host machine at the back end changes the device configuration, the changed configuration information is carried in the change notification sent to the virtual machine at the front end, and after the front end processing is completed, a response message is returned to the back end, so that the interaction times for obtaining the configuration information are reduced, and the problem of increasing the logic complexity of software caused by message nesting processing or asynchronous message processing is avoided. In addition, the change notification carries a plurality of related changed configuration information, so that the number of message interaction is further reduced, and the processing overhead caused by batch change notification is reduced. Therefore, the device configuration changing device provided by the embodiment of the application reduces the processing complexity of the front-end driver in the virtual machine for sensing the configuration change of the back-end driver in the host machine.
On the basis of the above embodiment, as a preferred implementation manner, the method further includes:
the link module is used for creating a first channel file; the first channel file is used for receiving a message sent to the host machine by the virtual machine; receiving a communication establishment message sent by the virtual machine through the first channel file; after the virtual machine creates a second channel file, receiving an identifier of the second channel file sent by the virtual machine through the first channel file, so as to establish a link with the virtual machine through the identifier; the second channel file is used for receiving a message sent to the virtual machine by the host machine.
Based on the foregoing embodiment, as a preferred implementation manner, the sending module 402 is specifically configured to: and sending the change notification to the virtual machine through the second channel file.
On the basis of the above embodiment, as a preferred implementation manner, the receiving module 403 is specifically configured to: and receiving the response message of the virtual machine through the first channel file.
On the basis of the above embodiment, as a preferred implementation manner, the method further includes:
The negotiation module is used for negotiating with the virtual machine whether the two parties support the function of processing equipment configuration change notification, the function of carrying configuration information in the change notification and the function of carrying a plurality of configuration information in the change notification.
On the basis of the above embodiment, as a preferred implementation manner, if both the host machine and the virtual machine support a processing device configuration change notification function, the virtual machine creates the second channel file.
On the basis of the foregoing embodiment, as a preferred implementation manner, if both the host and the virtual machine support the change notification to carry multiple configuration information functions, the construction module 401 is specifically configured to: when the equipment configuration is changed, judging whether a plurality of changed configuration information exists or not; if yes, aggregating a plurality of changed configuration information, and constructing a change notification based on the aggregated configuration information; if not, constructing a change notification based on the single changed configuration information.
On the basis of the foregoing embodiment, as a preferred implementation manner, if both the host and the virtual machine support the function of carrying configuration information in the change notification but do not support the function of carrying multiple configuration information in the change notification, the apparatus further includes:
The judging module is used for judging whether a plurality of changed configuration information exists when the equipment configuration is changed; if yes, the first changed configuration information is used as current configuration information, a change notification is constructed based on the current configuration information, a step of sending the change notification to the virtual machine is executed, after a response message corresponding to the current configuration information is received, the next changed configuration information of the current configuration information is re-determined to be the current configuration information, and the step of constructing the change notification based on the current configuration information is re-entered until a response message corresponding to the last changed configuration information is received; if not, constructing a change notification based on the single changed configuration information, and executing the step of sending the change notification to the virtual machine.
On the basis of the above embodiment, as a preferred implementation manner, the building module 401 is specifically configured to: and adding a configuration identifier at the tail part of each piece of changed configuration information, wherein the configuration identifier is used for describing whether the current changed configuration information has the subsequent changed configuration information or not.
On the basis of the foregoing embodiment, as a preferred implementation manner, if the current changed configuration information includes the subsequent changed configuration information, the configuration identifier is further used to describe the type of the subsequent changed configuration information.
On the basis of the foregoing embodiment, as a preferred implementation manner, the virtual machine processes the configuration information after the subsequent modification according to the type of the configuration information after the subsequent modification in the configuration identifier.
On the basis of the above embodiment, as a preferred implementation manner, the method further includes:
the device starting module is used for receiving initial configuration information of the paravirtualized device through the first channel file; receiving shared memory queue address information of a data plane through the first channel file, and establishing a transmission channel of the data plane based on the shared memory queue address information; and receiving a starting message through the first channel file, and starting the paravirtualized equipment.
The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
Based on the hardware implementation of the program modules, and in order to implement the method of the embodiments of the present application, the embodiments of the present application further provide an electronic device, fig. 5 is a block diagram of an electronic device according to an exemplary embodiment, and as shown in fig. 5, the electronic device includes:
A communication interface 1 capable of information interaction with other devices such as network devices and the like;
and the processor 2 is connected with the communication interface 1 to realize information interaction with other devices and is used for executing the device configuration changing method provided by one or more technical schemes when running the computer program. And the computer program is stored on the memory 3.
Of course, in practice, the various components in the electronic device are coupled together by a bus system 4. It will be appreciated that the bus system 4 is used to enable connected communications between these components. The bus system 4 comprises, in addition to a data bus, a power bus, a control bus and a status signal bus. But for clarity of illustration the various buses are labeled as bus system 4 in fig. 5.
The memory 3 in the embodiment of the present application is used to store various types of data to support the operation of the electronic device. Examples of such data include: any computer program for operating on an electronic device.
It will be appreciated that the memory 3 may be either volatile memory or nonvolatile memory, and may include both volatile and nonvolatile memory. Wherein the nonvolatile Memory may be Read Only Memory (ROM), programmable Read Only Memory (PROM, programmable Read-Only Memory), erasable programmable Read Only Memory (EPROM, erasable Programmable Read-Only Memory), electrically erasable programmable Read Only Memory (EEPROM, electrically Erasable Programmable Read-Only Memory), magnetic random access Memory (FRAM, ferromagnetic random access Memory), flash Memory (Flash Memory), magnetic surface Memory, optical disk, or compact disk Read Only Memory (CD-ROM, compact Disc Read-Only Memory); the magnetic surface memory may be a disk memory or a tape memory. The volatile memory may be random access memory (RAM, random Access Memory), which acts as external cache memory. By way of example, and not limitation, many forms of RAM are available, such as static random access memory (SRAM, static Random Access Memory), synchronous static random access memory (SSRAM, synchronous Static Random Access Memory), dynamic random access memory (DRAM, dynamic Random Access Memory), synchronous dynamic random access memory (SDRAM, synchronous Dynamic Random Access Memory), double data rate synchronous dynamic random access memory (ddr SDRAM, double Data Rate Synchronous Dynamic Random Access Memory), enhanced synchronous dynamic random access memory (ESDRAM, enhanced Synchronous Dynamic Random Access Memory), synchronous link dynamic random access memory (SLDRAM, syncLink Dynamic Random Access Memory), direct memory bus random access memory (DRRAM, direct Rambus Random Access Memory). The memory 3 described in the embodiments of the present application is intended to comprise, without being limited to, these and any other suitable types of memory.
The method disclosed in the embodiments of the present application may be applied to the processor 2 or implemented by the processor 2. The processor 2 may be an integrated circuit chip with signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in the processor 2 or by instructions in the form of software. The processor 2 described above may be a general purpose processor, DSP, or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, or the like. The processor 2 may implement or perform the methods, steps and logic blocks disclosed in the embodiments of the present application. The general purpose processor may be a microprocessor or any conventional processor or the like. The steps of the method disclosed in the embodiments of the present application may be directly embodied in a hardware decoding processor or implemented by a combination of hardware and software modules in the decoding processor. The software modules may be located in a storage medium in the memory 3 and the processor 2 reads the program in the memory 3 to perform the steps of the method described above in connection with its hardware.
The processor 2 implements corresponding flows in the methods of the embodiments of the present application when executing the program, and for brevity, will not be described in detail herein.
In an exemplary embodiment, the present application also provides a storage medium, i.e. a computer storage medium, in particular a computer readable storage medium, for example comprising a memory 3 storing a computer program executable by the processor 2 for performing the steps of the method described above. The computer readable storage medium may be FRAM, ROM, PROM, EPROM, EEPROM, flash Memory, magnetic surface Memory, optical disk, CD-ROM, etc.
Those of ordinary skill in the art will appreciate that: all or part of the steps for implementing the above method embodiments may be implemented by hardware associated with program instructions, where the foregoing program may be stored in a computer readable storage medium, and when executed, the program performs steps including the above method embodiments; and the aforementioned storage medium includes: a removable storage device, ROM, RAM, magnetic or optical disk, or other medium capable of storing program code.
Alternatively, the integrated units described above may be stored in a computer readable storage medium if implemented in the form of software functional modules and sold or used as a stand-alone product. Based on such understanding, the technical solutions of the embodiments of the present application may be embodied in essence or a part contributing to the prior art in the form of a software product stored in a storage medium, including several instructions for causing an electronic device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a removable storage device, ROM, RAM, magnetic or optical disk, or other medium capable of storing program code.
The foregoing is merely specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily think about changes or substitutions within the technical scope of the present application, and the changes and substitutions are intended to be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (12)

1. A device configuration change method, applied to a host machine in a paravirtualized device, where the paravirtualized device includes the host machine and a virtual machine, the method comprising:
when equipment configuration changes occur, aggregating a plurality of changed configuration information, and constructing a change notification based on the aggregated configuration information;
sending the change notification to the virtual machine so that the virtual machine analyzes the change notification to obtain a plurality of changed configuration information and processes the plurality of changed configuration information;
receiving a response message of the virtual machine; after the virtual machine finishes processing the plurality of changed configuration information, returning the response message to the host machine;
wherein the aggregating the plurality of changed configuration information includes:
Adding a configuration identifier at the tail of each piece of changed configuration information, wherein the configuration identifier is used for describing whether the current changed configuration information has the subsequent changed configuration information, if the current changed configuration information has the subsequent changed configuration information, the configuration identifier is also used for describing the type of the subsequent changed configuration information, and the virtual machine processes the subsequent changed configuration information according to the type of the subsequent changed configuration information in the configuration identifier.
2. The device configuration change method according to claim 1, wherein when the device configuration change occurs, before aggregating the plurality of changed configuration information, further comprising:
creating a first channel file; the first channel file is used for receiving a message sent to the host machine by the virtual machine;
receiving a communication establishment message sent by the virtual machine through the first channel file;
after the virtual machine creates a second channel file, receiving an identifier of the second channel file sent by the virtual machine through the first channel file, so as to establish a link with the virtual machine through the identifier; the second channel file is used for receiving a message sent to the virtual machine by the host machine.
3. The device configuration change method of claim 2, wherein sending the change notification to the virtual machine comprises:
and sending the change notification to the virtual machine through the second channel file.
4. The device configuration change method according to claim 2, wherein the receiving the reply message of the virtual machine includes:
and receiving the response message of the virtual machine through the first channel file.
5. The device configuration changing method according to claim 2, wherein after receiving the communication establishment message sent by the virtual machine through the first channel file, the method further comprises:
and negotiating whether the two parties support the processing equipment configuration change notification function or not with the virtual machine, wherein the change notification carries the configuration information function, and the change notification carries a plurality of configuration information functions.
6. The device configuration change method according to claim 5, wherein if both the host and the virtual machine support a processing device configuration change notification function, the virtual machine creates the second channel file.
7. The device configuration change method according to claim 5, wherein if both the host and the virtual machine support a change notification to carry a plurality of configuration information functions, aggregating a plurality of changed configuration information when a device configuration change occurs, and constructing a change notification based on the aggregated configuration information, comprising:
When the equipment configuration is changed, judging whether a plurality of changed configuration information exists or not;
if yes, aggregating a plurality of changed configuration information, and constructing a change notification based on the aggregated configuration information;
if not, constructing a change notification based on the single changed configuration information.
8. The device configuration change method according to claim 5, wherein if both the host and the virtual machine support the configuration information function in the change notification but do not support the plurality of configuration information functions in the change notification, the method further comprises:
when the equipment configuration is changed, judging whether a plurality of changed configuration information exists or not;
if yes, the first changed configuration information is used as current configuration information, a change notification is constructed based on the current configuration information, a step of sending the change notification to the virtual machine is executed, after a response message corresponding to the current configuration information is received, the next changed configuration information of the current configuration information is re-determined to be the current configuration information, and the step of constructing the change notification based on the current configuration information is re-entered until a response message corresponding to the last changed configuration information is received;
If not, constructing a change notification based on the single changed configuration information, and executing the step of sending the change notification to the virtual machine.
9. The apparatus configuration change method according to claim 2, wherein when the apparatus configuration change occurs, before aggregating the plurality of changed configuration information, further comprising:
receiving initial configuration information of the paravirtualized device through the first channel file;
receiving shared memory queue address information of a data plane through the first channel file, and establishing a transmission channel of the data plane based on the shared memory queue address information;
and receiving a starting message through the first channel file, and starting the paravirtualized equipment.
10. A device configuration change apparatus, applied to a host machine in a paravirtualized device, the paravirtualized device including the host machine and a virtual machine, the apparatus comprising:
the construction module is used for aggregating a plurality of changed configuration information when the equipment configuration is changed, and constructing a change notification based on the aggregated configuration information;
the sending module is used for sending the change notification to the virtual machine so that the virtual machine analyzes the change notification to obtain a plurality of changed configuration information and processes the plurality of changed configuration information;
The receiving module is used for receiving the response message of the virtual machine; after the virtual machine finishes processing the plurality of changed configuration information, returning the response message to the host machine;
the construction module is specifically configured to: adding a configuration identifier at the tail of each piece of changed configuration information, wherein the configuration identifier is used for describing whether the current changed configuration information has the subsequent changed configuration information, if the current changed configuration information has the subsequent changed configuration information, the configuration identifier is also used for describing the type of the subsequent changed configuration information, and the virtual machine processes the subsequent changed configuration information according to the type of the subsequent changed configuration information in the configuration identifier.
11. An electronic device, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the device configuration change method according to any one of claims 1 to 9 when executing the computer program.
12. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the device configuration change method according to any of claims 1 to 9.
CN202311707477.9A 2023-12-13 2023-12-13 Device configuration changing method and device, electronic device and storage medium Active CN117407092B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311707477.9A CN117407092B (en) 2023-12-13 2023-12-13 Device configuration changing method and device, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311707477.9A CN117407092B (en) 2023-12-13 2023-12-13 Device configuration changing method and device, electronic device and storage medium

Publications (2)

Publication Number Publication Date
CN117407092A CN117407092A (en) 2024-01-16
CN117407092B true CN117407092B (en) 2024-03-12

Family

ID=89489320

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311707477.9A Active CN117407092B (en) 2023-12-13 2023-12-13 Device configuration changing method and device, electronic device and storage medium

Country Status (1)

Country Link
CN (1) CN117407092B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105700826A (en) * 2015-12-31 2016-06-22 华为技术有限公司 Virtualization method and device
CN109426545A (en) * 2017-08-31 2019-03-05 阿里巴巴集团控股有限公司 A kind of data communications method and device
CN110928707A (en) * 2019-10-31 2020-03-27 北京浪潮数据技术有限公司 Data exchange method and related device for host machine and virtual machine
CN114499945A (en) * 2021-12-22 2022-05-13 天翼云科技有限公司 Intrusion detection method and device for virtual machine

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105700826A (en) * 2015-12-31 2016-06-22 华为技术有限公司 Virtualization method and device
CN109426545A (en) * 2017-08-31 2019-03-05 阿里巴巴集团控股有限公司 A kind of data communications method and device
CN110928707A (en) * 2019-10-31 2020-03-27 北京浪潮数据技术有限公司 Data exchange method and related device for host machine and virtual machine
CN114499945A (en) * 2021-12-22 2022-05-13 天翼云科技有限公司 Intrusion detection method and device for virtual machine

Also Published As

Publication number Publication date
CN117407092A (en) 2024-01-16

Similar Documents

Publication Publication Date Title
EP3570175B1 (en) Method for implementing nvme over fabrics, terminal, server, and system
US10042664B2 (en) Device remote access method, thin client, and virtual machine
US9081703B2 (en) Method and apparatuses for facilitating sharing device connections between a host and client based on the power mode of the host
CN113067866B (en) Batch file transmission method and device between heterogeneous systems
CN111190842B (en) Direct memory access, processor, electronic device, and data transfer method
CN114201268B (en) Data processing method, device and equipment and readable storage medium
CN115934623B (en) Data processing method, device and medium based on remote direct memory access
CN110609755A (en) Message processing method, device, equipment and medium for cross-block chain node
CN112214334A (en) Micro-service calling method and device, electronic equipment and computer-readable storage medium
CN114900699A (en) Video coding and decoding card virtualization method and device, storage medium and terminal
CN112711550A (en) DMA automatic configuration module and SOC
CN117407092B (en) Device configuration changing method and device, electronic device and storage medium
CN111427806A (en) Method for sharing serial port by dual-core AMP system, storage medium and intelligent terminal
CN115904628A (en) IO virtualization data processing method and application based on vhost protocol
CN106845974B (en) Method and device for realizing point-to-point communication of near field communication
WO2018106392A1 (en) Technologies for multi-core wireless network data transmission
CN114139702A (en) Deep neural network training method, system, device, equipment and medium
JP2006085702A (en) Method for consoleless boot
CN111258653B (en) Atomic access and storage method, storage medium, computer equipment, device and system
CN112070995A (en) Method, device and system for realizing master-slave USB parallel mode of intelligent equipment
CN115599287A (en) Data processing method and device, electronic equipment and storage medium
CN107562686B (en) information processing method and device
CN113296876A (en) Equipment direct connection method, equipment and storage medium of virtual machine
US10402454B1 (en) Obtaining platform-specific information in a firmware execution environment
CN116719757A (en) Concurrent transaction method, device, equipment and readable storage medium

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