Disclosure of Invention
The invention aims to provide a method for realizing system stability when plugging and unplugging a physical network card, which ensures that the use state of the physical network card stored in an upper database is consistent with the actual use state of the current physical network card, effectively avoids damaging system data in the upper database when plugging and unplugging the physical network card, and enhances the stability of a virtualization system. The invention also aims to provide a system for realizing system stability when the physical network card is plugged in and pulled out.
In order to solve the above technical problem, the present invention provides a method for realizing system stability when plugging in and unplugging a physical network card, which is applied to a virtualization system comprising an upper database, a virtual machine and a physical network card, and comprises:
when a refreshing instruction sent by a user is received, judging whether the virtual machine and the physical network card are in a direct use relationship;
if yes, generating a prompt instruction for prompting the user to release the direct use relationship;
receiving a release instruction sent by a user, deleting the use state of the physical network card in the upper layer database according to the release instruction, and deleting the use relationship between the virtual machine and the physical network card in the configuration file of the virtual machine;
and after the removal is finished, refreshing the physical network card list through upper-layer logic.
Preferably, the process of determining whether the virtual machine and the physical network card are in a direct use relationship specifically includes:
judging whether the virtual machine uses a physical network card through a passthrough technology;
if yes, the process of deleting the usage relationship between the virtual machine and the physical network card in the configuration file of the virtual machine specifically includes:
and deleting Peripheral Component Interconnect (PCI) information of the physical network card in the virtual machine configuration file.
Preferably, the process of determining whether the virtual machine and the physical network card are in a direct use relationship specifically includes:
judging whether the virtual machine uses a physical network card through a single root virtualization sriov technology;
if yes, the process of deleting the usage relationship between the virtual machine and the physical network card in the configuration file of the virtual machine specifically includes:
and deleting the PCI information of the Virtual Function VF (Virtual Function) of the physical network card after the sriov technology is started in the Virtual machine configuration file.
In order to solve the above technical problem, the present invention further provides a system for achieving system stability when plugging and unplugging a physical network card, which is applied to a virtualization system including an upper database, a virtual machine, and a physical network card, and includes:
the receiving unit is used for judging whether the virtual machine and the physical network card are in a direct use relationship or not when a refreshing instruction sent by a user is received, and if so, the generating unit is triggered;
the generating unit is used for generating a prompt instruction for prompting a user to release the direct use relationship;
a release unit, configured to receive a release instruction sent by a user, delete the use state of the physical network card in the upper database according to the release instruction, and delete the use relationship between the virtual machine and the physical network card in the configuration file of the virtual machine;
and the refreshing unit is used for refreshing the physical network card list through upper-layer logic after the releasing is finished.
Preferably, the receiving unit is specifically configured to determine whether the virtual machine uses a physical network card through a passthrough technology;
if so, the removing unit is specifically configured to delete the peripheral interconnection standard PCI information of the physical network card in the virtual machine configuration file.
Preferably, the receiving unit is specifically configured to determine whether the virtual machine uses a physical network card through a single root virtualization sriov technology;
if so, the removing unit is specifically configured to delete the PCI information of the virtual function VF of the physical network card after the sriov technology is started in the virtual machine configuration file.
The invention provides a method for realizing system stability when plugging and unplugging a physical network card, which is applied to a virtualization system comprising an upper database, a virtual machine and the physical network card and comprises the steps of judging whether the virtual machine and the physical network card are in a direct use relationship or not when a refreshing instruction sent by a user is received; if yes, generating a prompt instruction for prompting the user to release the direct use relationship; receiving a release instruction sent by a user, deleting the use state of the physical network card in an upper layer database according to the release instruction, and deleting the use relationship between the virtual machine and the physical network card in the configuration file of the virtual machine; and after the removal is finished, refreshing the physical network card list through upper-layer logic.
Therefore, after receiving a refreshing instruction sent by a user, the invention prompts the user to release the direct use relationship between the current virtual machine and the physical network card, so that the use state of the physical network card stored in the upper layer database is consistent with the actual use state of the current physical network card.
The invention also provides a system for realizing system stability when the physical network card is plugged, which has the same beneficial effects as the method.
Detailed Description
The core of the invention is to provide a method for realizing system stability when plugging the physical network card, which ensures that the use state of the physical network card stored in the upper database is consistent with the actual use state of the current physical network card, effectively avoids damaging the system data in the upper database when plugging the physical network card, and enhances the stability of the virtualization system. The other core of the invention is to provide a system for realizing system stability when plugging and unplugging the physical network card.
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are 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.
Referring to fig. 1, fig. 1 is a flowchart of a method for implementing system stability when plugging in and unplugging a physical network card, which is applied to a virtualization system including an upper database, a virtual machine, and a physical network card, and includes:
step 1: when a refreshing instruction sent by a user is received, judging whether the virtual machine and the physical network card are in a direct use relationship;
specifically, the physical network card is used as a medium for communicating the virtualization system with a network outside the server, and when the virtual machine wants to communicate with the network outside the server, the physical network card in the physical host needs to be used, and a mode that the virtual machine directly uses the physical network card is adopted, that is, the virtual machine and the physical network card are in a direct use relationship, so that the performance of the virtualization system can be improved.
Step 2: if yes, generating a prompt instruction for prompting the user to release the direct use relationship;
specifically, if the virtual machine directly uses the physical network card, the user is prompted to release the direct use relationship. Specifically, the prompt instruction may be "there is a physical network card that is being used directly, please remove the use relationship, and then perform an operation of refreshing the network card list", and of course, the prompt instruction may also be other contents, and the present invention is not limited herein.
Therefore, misjudgment of the system when the actual use state of the physical network card is judged can be avoided, the accuracy of the system when the actual use state of the physical network card is judged after the physical network card is plugged is ensured, and effective guarantee is provided for ensuring that the actual use state of the physical network card is consistent with the use state of the physical network card stored in the upper database when the physical network card is plugged.
And step 3: receiving a release instruction sent by a user, deleting the use state of the physical network card in an upper layer database according to the release instruction, and deleting the use relationship between the virtual machine and the physical network card in the configuration file of the virtual machine;
specifically, after seeing the prompt instruction, if the user wants to refresh the physical network card list, the user needs to remove the direct use relationship between the virtual machine and the physical network card in advance before refreshing the physical network card list. Therefore, even if the use state of the physical network card is possibly changed after the physical network card is plugged in and pulled out, the use state of the physical network card stored in the upper database is not influenced, so that the information of the virtualization system in checking the use state of the physical network card stored in the upper database is accurate, and the use state of the physical network card stored in the upper database is consistent with the actual use state of the current physical network card.
And 4, step 4: and after the removal is finished, refreshing the physical network card list through upper-layer logic.
Specifically, the network card list is refreshed to enable the virtualization system to acquire the actual use state of the physical network card, the use state of the physical network card stored in the upper database is refreshed, and consistency of the previous data and the next data is guaranteed. The system data in the upper database are effectively prevented from being damaged when the physical network card is plugged, so that the stability of the virtualization system is enhanced.
Therefore, after receiving a refreshing instruction sent by a user, the invention prompts the user to release the direct use relationship between the current virtual machine and the physical network card, so that the use state of the physical network card stored in the upper layer database is consistent with the actual use state of the current physical network card.
On the basis of the above-described embodiment:
as a preferred embodiment, the process of determining whether the virtual machine and the physical network card are in a direct use relationship specifically includes:
judging whether the virtual machine uses a physical network card through a passthrough technology;
if yes, the process of deleting the use relationship between the virtual machine and the physical network card in the configuration file of the virtual machine specifically comprises the following steps:
and deleting the PCI information of the physical network card in the virtual machine configuration file.
Specifically, the passthrough technology is to directly pass through the physical network card to the virtual machine in the virtualization system for use, so that the virtual machine is connected to the network outside the server, and when the virtual machine directly uses the physical network card through the passthrough technology, since the request conversion is not required by the analog device, the access speed is high, and the I/O performance is greatly improved. When the passhrough technology is used, one virtual machine monopolizes one PCI slot, that is, one virtual machine corresponds to one physical network card, so that to release the direct use relationship of the virtual machines, the PCI information of the physical network card in the virtual machine configuration file needs to be deleted, and under the condition that the use state of the physical network card in the upper layer database is deleted, the use state of the physical network card stored in the upper layer database is not influenced because the use relationship of the virtual machine and the physical network card in the configuration file of the virtual machine is deleted even if the PCI information in the physical network card changes, and further, the use state of the physical network card stored in the upper layer database is consistent with the actual use state of the current physical network card.
As a preferred embodiment, the process of determining whether the virtual machine and the physical network card are in a direct use relationship specifically includes:
judging whether the virtual machine uses a physical network card through a single virtualization sriov technology;
if yes, the process of deleting the use relationship between the virtual machine and the physical network card in the configuration file of the virtual machine specifically comprises the following steps:
and deleting the PCI information of the virtual function VF of the physical network card after the sriov technology is started in the virtual machine configuration file.
Specifically, a Virtual machine using sriov technology can virtualize a PF (Physical Function) of a Physical network card into a plurality of VFs (Virtual functions), each of which is a Virtual network card formed by virtualizing the Physical network card, each of the Virtual network cards can be used by the Virtual machine in a transparent transmission manner, one Physical network card can be virtualized into a plurality of Virtual network cards, and one Virtual network card can correspond to one Virtual machine, that is, one Physical network card corresponds to a plurality of Virtual machines, so that removing the direct use relationship of the Virtual machine at this time requires deleting PCI information of the Virtual Function VF of the Physical network card after starting sriov technology in a Virtual machine configuration file, and in the case that the use state of the Physical network card in an upper layer database has been deleted, this can ensure that even if the change of the PCI information of the VF of the Physical network card starting sriov is done, the use relationship between the Virtual machine and the Physical network card in the configuration file of the Virtual machine has been deleted, therefore, the use state of the physical network card stored in the upper database is not affected, and the use state of the physical network card stored in the upper database is further ensured to be consistent with the actual use state of the current physical network card.
Of course, the virtual machine may directly use the physical network card through passthrough or sriov technology, or may directly use the physical network card through other technologies, which is not limited herein.
Referring to fig. 2, fig. 2 is a schematic structural diagram of a system for implementing system stability when plugging a physical network card provided by the present invention, including:
the virtual machine comprises a receiving unit 1, a generating unit 2 and a processing unit, wherein the receiving unit 1 is used for judging whether a virtual machine and a physical network card are in a direct use relationship when receiving a refreshing instruction sent by a user, and if so, the generating unit 2 is triggered;
a generating unit 2 for generating a prompt instruction for prompting a user to release the direct use relationship;
the release unit 3 is used for receiving a release instruction sent by a user, deleting the use state of the physical network card in the upper layer database according to the release instruction, and deleting the use relationship between the virtual machine and the physical network card in the configuration file of the virtual machine;
and the refreshing unit 4 is used for refreshing the physical network card list through upper-layer logic after the releasing is finished.
As a preferred embodiment, the receiving unit 1 is specifically configured to determine whether the virtual machine uses a physical network card through a passthrough technology;
if yes, the removing unit 3 is specifically configured to delete the peripheral interconnection standard PCI information of the physical network card in the virtual machine configuration file.
As a preferred embodiment, the receiving unit 1 is specifically configured to determine whether the virtual machine uses a physical network card through a single root virtualization sriov technology;
if so, the removing unit 3 is specifically configured to delete the PCI information of the virtual function VF of the physical network card after the sriov technology is started in the virtual machine configuration file.
For the description of the system for implementing system stability when plugging and unplugging a physical network card provided by the present invention, please refer to the above embodiments, which are not described herein again.
The invention also provides a system for realizing system stability when the physical network card is plugged, which has the same beneficial effects as the method.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.