CN110798346A - Configuration method of newly added network card of Linux virtual machine and related components - Google Patents

Configuration method of newly added network card of Linux virtual machine and related components Download PDF

Info

Publication number
CN110798346A
CN110798346A CN201911026024.3A CN201911026024A CN110798346A CN 110798346 A CN110798346 A CN 110798346A CN 201911026024 A CN201911026024 A CN 201911026024A CN 110798346 A CN110798346 A CN 110798346A
Authority
CN
China
Prior art keywords
network card
configuration
virtual machine
thread
newly added
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.)
Granted
Application number
CN201911026024.3A
Other languages
Chinese (zh)
Other versions
CN110798346B (en
Inventor
翟辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Inspur Data Technology Co Ltd
Original Assignee
Beijing Inspur Data Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Inspur Data Technology Co Ltd filed Critical Beijing Inspur Data Technology Co Ltd
Priority to CN201911026024.3A priority Critical patent/CN110798346B/en
Publication of CN110798346A publication Critical patent/CN110798346A/en
Application granted granted Critical
Publication of CN110798346B publication Critical patent/CN110798346B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0813Configuration setting characterised by the conditions triggering a change of settings
    • H04L41/0816Configuration setting characterised by the conditions triggering a change of settings the condition being an adaptation, e.g. in response to network events
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0813Configuration setting characterised by the conditions triggering a change of settings
    • H04L41/082Configuration setting characterised by the conditions triggering a change of settings the condition being updates or upgrades of network functionality
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • H04L61/5014Internet protocol [IP] addresses using dynamic host configuration protocol [DHCP] or bootstrap protocol [BOOTP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Telephonic Communication Services (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application discloses a configuration method for a newly added network card of a Linux virtual machine, which comprises the following steps: monitoring the target virtual machine to judge whether a newly added network card device exists in the target virtual machine; if yes, determining a newly added network card device and a corresponding configuration thread; and calling a configuration thread to configure the newly-added network card equipment in the target virtual machine. According to the method, after the existence of the newly-added network card equipment is monitored, the newly-added network card equipment configuration program is operated in the Linux virtual machine and is used for automatically configuring the network card equipment, so that the problems that the network card is manually configured and is easy to cause low efficiency and make mistakes are solved, the difficulty of network card configuration is reduced, the efficiency of configuring the network card is improved, when a large number of virtual machines exist and the network card configuration needs to be carried out on the plurality of virtual machines, the overall configuration efficiency of the system can be obviously improved, and time and labor are saved. The application also provides a configuration device, equipment and a readable storage medium for the newly added network card of the Linux virtual machine, and the beneficial effects are achieved.

Description

Configuration method of newly added network card of Linux virtual machine and related components
Technical Field
The present application relates to the field of electronic technologies, and in particular, to a method, an apparatus, a device, and a readable storage medium for configuring a newly added network card of a Linux virtual machine.
Background
Currently, in a wide range of applications of virtualization technologies, a virtual machine is an important component of virtualization technologies, and as a virtual computer, the virtual machine can run various services like a physical computer. In the virtualization application, it is a common function to add a network card device to a Linux virtual machine without shutdown. However, the function can only add one available network card device for the Linux virtual machine, and if the virtual machine is required to be able to apply the network card, the network card needs to be configured inside the Linux virtual machine system.
The process of configuring the network card in the Linux virtual machine system is complicated, most users are not familiar with the configuration flow of the Linux network card, so that the newly-added network card cannot be used and the newly-added network card is wrong, and in addition, when the number of virtual machines is large, the network card configuration of the virtual machines is time-consuming and labor-consuming.
Therefore, how to reduce the difficulty of network card configuration and improve the maintenance efficiency of the Linux virtual machine is a technical problem to be solved by technical personnel in the field.
Disclosure of Invention
The method can realize automatic configuration of the newly added network card, reduce the complexity of network card configuration and improve the maintenance efficiency of the Linux virtual machine; another object of the present application is to provide a configuration apparatus and device for a Linux virtual machine with a newly added network card, and a readable storage medium.
In order to solve the above technical problem, the present application provides a configuration method for a newly added network card of a Linux virtual machine, including:
monitoring a target virtual machine to judge whether a newly added network card device exists in the target virtual machine;
if yes, determining the newly added network card equipment and a corresponding configuration thread;
and calling the configuration thread to configure the newly-added network card equipment in the target virtual machine.
Optionally, determining the newly added network card device and the corresponding configuration thread includes:
reading system type information of an operating system to which the target virtual machine belongs;
matching a network card configuration thread corresponding to the system type information as a target thread;
determining the newly added network card equipment;
and calling the target thread to configure the newly-added network card equipment in the target virtual machine.
Optionally, the configuring the thread includes: starting a configuration sub-thread and a DHCP setting sub-thread, and correspondingly calling the configuration thread to configure the newly added network card equipment in the target virtual machine, wherein the configuration thread comprises the following steps:
and calling the configuration thread to configure the newly-added network card equipment in the target virtual machine to obtain the starting-up self-starting network card equipment for acquiring the IP by the DHCP.
Optionally, after determining that the target virtual machine has the newly added network card device, the method further includes:
creating a network card configuration updating thread;
and calling the network card configuration updating thread to perform configuration updating setting on the newly added network card equipment.
Optionally, the network card configuration update thread includes: and if the IP newly increases the thread, correspondingly, the creating of the network card configuration updating thread comprises the following steps:
determining newly added IP information;
performing information organization on the newly added IP information in a preset format to generate network card configuration information in a specified format;
correspondingly, calling the network card configuration updating thread to perform configuration updating setting on the newly added network card device, including: and adding the network card configuration information into a network card configuration update file and storing the network card configuration information.
Optionally, the configuration method for the Linux virtual machine newly added network card further includes:
when a plurality of newly added IP information are determined to be obtained within a preset time interval, determining the acquisition time of each newly added IP information;
correspondingly, the determining the newly added IP information includes: and determining the newly added IP information with the latest acquisition time.
The application discloses configuration device of newly-increased network card of Linux virtual machine includes:
the monitoring unit is used for monitoring a target virtual machine so as to judge whether a newly added network card device exists in the target virtual machine; if yes, triggering a thread determining unit;
the thread determining unit is used for determining the newly added network card equipment and the corresponding configuration thread;
and the network card configuration unit is used for calling the configuration thread to configure the newly-added network card equipment in the target virtual machine.
Optionally, the configuration device for the Linux virtual machine newly added network card further includes: a configuration update unit that is triggered when the monitoring unit determines that the configuration update unit exists, the configuration update unit including:
the thread creating subunit is used for creating a network card configuration updating thread;
and the updating setting subunit is used for calling the network card configuration updating thread to perform configuration updating setting on the newly added network card device.
The application discloses configuration equipment of a Linux virtual machine newly-added network card, which comprises:
a memory for storing a program;
and the processor is used for realizing the steps of the configuration method of the newly added network card of the Linux virtual machine when the program is executed.
The application discloses a readable storage medium, wherein a program is stored on the readable storage medium, and the program realizes the steps of the configuration method of the Linux virtual machine newly added network card when being executed by a processor.
The configuration method for the newly added network card of the Linux virtual machine, provided by the application, comprises the following steps: monitoring the target virtual machine to judge whether a newly added network card device exists in the target virtual machine; if yes, determining a newly added network card device and a corresponding configuration thread; and calling a configuration thread to configure the newly-added network card equipment in the target virtual machine. According to the method, after the existence of the newly-added network card equipment is monitored, the newly-added network card equipment configuration program is operated in the Linux virtual machine and is used for automatically configuring the network card equipment, so that the problems that the network card is manually configured and is easy to cause low efficiency and make mistakes are solved, the difficulty of network card configuration is reduced, the efficiency of configuring the network card is improved, when a large number of virtual machines exist and the network card configuration needs to be carried out on the plurality of virtual machines, the overall configuration efficiency of the system can be obviously improved, and time and labor are saved.
The application also provides a configuration device and equipment of the newly added network card of the Linux virtual machine and a readable storage medium, which have the beneficial effects and are not described herein again.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a configuration method for a newly added network card of a Linux virtual machine according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating execution of a python main thread according to an embodiment of the present disclosure;
fig. 3 is a flowchart illustrating execution of a network card configuration update thread according to an embodiment of the present application;
fig. 4 is an execution flowchart of a configuration thread of a newly added network card according to an embodiment of the present application;
fig. 5 is a block diagram of a configuration apparatus for a newly added network card of a Linux virtual machine according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a configuration device for a Linux virtual machine add-on network card according to an embodiment of the present application.
Detailed Description
The core of the application is to provide a configuration method for the newly added network card of the Linux virtual machine, the method can realize the automatic configuration of the newly added network card, reduce the complexity of the configuration of the network card and improve the maintenance efficiency of the Linux virtual machine; the other core of the application is to provide a configuration device, equipment and a readable storage medium for the newly added network card of the Linux virtual machine.
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, 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, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Referring to fig. 1, fig. 1 is a flowchart of a configuration method for a Linux virtual machine add-on network card according to this embodiment; the method mainly comprises the following steps:
step s110, monitoring the target virtual machine to judge whether a newly added network card device exists in the target virtual machine;
in this step, the monitoring mode of the virtual machine is not limited, and specifically, the monitor of the pyudev library of Python may be used to monitor the update configuration file of one or more network card devices, and determine whether there is an update. In this embodiment, only the above implementation is described as an example, and other implementation manners are not described herein again.
Step s120, if the judgment is yes, determining a newly added network card device and a corresponding configuration thread;
if it is determined that the virtual machine does not exist, the processing method in this embodiment is not limited, and the step of jumping to the monitored target virtual machine as shown in fig. 1 may be performed for continuous monitoring, or a timer may be started, and the step of jumping to the monitored target virtual machine after a preset time interval is performed for continuous monitoring, and the like.
If the newly added network card equipment exists, the newly added network card equipment can be matched with the corresponding network card equipment in the Linux system through acquiring the information of the newly added network card, or the newly added network card equipment appointed by a user can be directly used as the current newly added network card equipment. The process of determining the configuration thread corresponding to the newly added network card device may directly call the configured configuration thread, or may be created after receiving the network card configuration request, which is not limited herein.
In general, there may be more than one Linux operating system type of a target virtual machine, and network card configuration processes of virtual machines under different types of Linux operating systems may be different, so as to increase an application range and set corresponding configuration threads for different operating system types to adapt to network card configuration processes of virtual machines under different types. Specifically, the process of determining the newly added network card device and the corresponding configuration thread may specifically include the following steps:
s121, reading system type information of an operating system to which the target virtual machine belongs;
s122, matching a network card configuration thread corresponding to the system type information as a target thread;
s123, determining a newly added network card device;
and s124, calling the target thread to configure the newly-added network card device in the target virtual machine.
Corresponding network card configuration is carried out according to different operating system types, automatic configuration under multiple system types can be achieved, and the application range is widened. S123 may be executed before or after any step before s124, and the execution order of s123 is not limited in this embodiment, and may be set according to actual needs. The specific implementation of s122 is not limited, and a thread for network card configuration (which may be used for configuration of a multi-operating system, that is, a general configuration thread) may be created, where the thread first reads the type of the Linux operating system, and then configures the Linux operating system according to the network card configuration mode of the operating system type; the configuration threads under each type may also be configured in advance, and after the current operating system type is determined, the corresponding configuration thread is called to perform network card configuration.
And step s130, calling a configuration thread to configure the newly-added network card device in the target virtual machine.
The configuration thread is obtained according to the configuration flow setting of the newly added network card and can be used for automatically configuring the newly added network card device, in this embodiment, the configuration thread capable of achieving automatic network card configuration is called to set the determined newly added network card device, so that automatic configuration of the newly added network card during the operation of the Linux virtual machine can be achieved, the complexity of network card configuration is reduced, and the network card configuration efficiency is improved.
Generally, the configuration process of the newly added network card may include two parts, i.e., a boot configuration and an IP setting, and optionally, the configuration thread may specifically include: the Configuration sub-thread is started up, and a DHCP (dynamic host Configuration Protocol) setting sub-thread is provided, and certainly, the Configuration thread may further include other types of setting sub-threads for implementing a response to different setting requirements of the newly added network card.
When the configuration thread specifically includes: starting up the configuration sub-thread and the DHCP setup sub-thread, and accordingly, calling the configuration thread in s130 to configure the newly added network card device in the target virtual machine, which may specifically be: and calling a configuration thread to configure the newly-added network card equipment in the target virtual machine to obtain the starting-up self-starting network card equipment for acquiring the IP by the DHCP.
It should be noted that, by default, the network card may be configured to boot and acquire IP by DHCP, so as to facilitate the invocation. Of course, other setting manners are also possible, and the present embodiment is not limited.
Based on the introduction, according to the configuration method for the newly added network card of the Linux virtual machine provided by the embodiment, after the existence of the newly added network card device is monitored, the newly added network card device configuration program is operated in the Linux virtual machine for automatically configuring the network card device, so that the problems that the network card is manually configured, the efficiency is low and errors are easy to occur are solved, the difficulty of configuring the network card is reduced, the efficiency of configuring the network card is improved, when a large number of virtual machines exist and the network card configuration needs to be performed on a plurality of virtual machines, the overall configuration efficiency of the system can be obviously improved, and time and labor are saved.
Based on the above embodiment, after the network card device is newly added, because the preset configuration of the network card device may not meet the subsequent long-term use requirement in the use process, in order to further implement the automatic configuration update of the newly added network card device so as to meet the use requirement of the user, and simultaneously improve the implementation efficiency, after it is determined that the newly added network card device exists in the target virtual machine, the following steps may be further performed:
s140, creating a network card configuration updating thread;
and s150, calling a network card configuration updating thread to perform configuration updating setting on the newly-added network card equipment.
The thread may update the network card configuration once at preset time intervals (for example, 5s) through the configuration file, where the configuration file is specially used for the configuration of the newly added network card of the present invention, and the updating of the general configuration information mainly includes updating of an IP, and of course, may further include other setting update types, which are not described in detail in this embodiment. Specifically, when the network card configuration update thread includes an IP adding thread, a specific configuration update process is as follows:
s141, determining newly added IP information;
in general, the new IP information may include: network card name, IP address, subnet mask, and gateway.
s142, organizing the newly added IP information in a preset format to generate network card configuration information in a specified format;
accordingly, s150 may specifically include: and adding the network card configuration information into the network card configuration update file and storing the network card configuration information.
If a newly added IP of a newly added network card is needed, only one row of newly added IP needs to be written in the configuration file in turn, namely, the name, the IP address, the subnet mask and the gateway (separated by a blank space), so that the complexity of the configuration of the network card is greatly reduced, the bits of the configuration update file of the network card are/etc/netconfig/ipupdate.
The network card configuration updating program can read the file at regular time and then make correct IP configuration according to the environment of the Linux operating system. The configuration format is, for example:
Dev:eth0 IP:192.168.1.2MASK:255.255.255.0GATEWAY:192.168.1.254
Dev:eth0 IP:192.168.2.2MASK:255.255.255.0GATEWAY:192.168.2.254
the IP configuration of the network card can be updated, development and expansion can be performed according to specific requirements of software, and network card configuration setting other than IP setting can be performed according to actual requirements without limitation.
Based on the IP configuration, before s141, the following steps may be further performed:
s160, when a plurality of newly added IP information is determined to be obtained within a preset time interval, determining the obtaining time of each newly added IP information;
accordingly, s141 specifically includes: and determining the newly added IP information with the latest acquisition time.
If repeated configuration occurs, the configuration is carried out according to the configuration row behind the configuration file, so that the configuration times are reduced, and the configuration efficiency is improved.
For better understanding of the foregoing embodiments, a specific implementation step is described in this embodiment, and other implementation steps based on the present application may refer to the description of this embodiment and are not described herein again.
A configuration method of a newly added network card of a Linux virtual machine is realized by running a Python process in the interior of the virtual machine, the main thread mainly comprises the steps of a network card configuration updating thread, newly added network card acquisition and network card configuration, and the configuration of the newly added network card is realized when the Linux virtual machine runs by the configuration method of the newly added network card of the Linux virtual machine, so that the complexity of network card configuration is reduced, and the network card configuration efficiency is improved. The specific implementation process is as follows:
as shown in fig. 2, for the execution flow of the python main thread, the main thread creates a configuration updating thread, the sub-thread runs independently for updating the configuration of the network card, and the specific execution process is as shown in fig. 3; in addition, after the main thread is created as the configuration updating thread, a new network card monitor is run, and the specific execution process is as shown in fig. 4.
Fig. 2 shows the startup of the python process (main process), after the main process is started, a network card configuration update thread is first created, and the execution process of the thread is as shown in fig. 3, which mainly includes the following contents:
a) reading a network card updating configuration file, judging whether the network card is updated, if the network card to be updated is updated, performing b), and if not, reading the updating configuration file and checking whether the network card is updated;
b) if the current Linux system is updated, checking the type of the current Linux system, and then updating the IP configuration of the network card according to the type of the corresponding Linux system;
c) after the IP configuration of the network card is updated, deleting the corresponding configuration item in the update configuration file, waiting for 5s, reading the update configuration file and checking whether the update exists;
and after the creation of the network card configuration updating thread is completed, monitoring the newly added network card, recording the configuration information of the network card when the newly added network card exists, then creating the newly added network card configuration thread, and continuing to enter the newly added network card for monitoring after the creation is completed. The execution process of the configuration thread of the newly added network card is as shown in fig. 4, and the specific process is as follows:
a) after a newly added network card configuration thread is created, judging the type of the current Linux operating system, and then carrying out default configuration on the newly added network card according to the type of the current Linux operating system;
b) and after the configuration is finished, finishing the thread execution.
In the configuration process of the Linux virtual machine newly-added network card introduced in this embodiment, a Python process is run inside the virtual machine, a main thread of the thread continuously and circularly uses a monitor of a Python pyudev library to monitor newly-added one or more network card devices, acquires information of the newly-added network card, matches the newly-added network card device with a corresponding network card device in a Linux system, and then configures the newly-added network card in the Linux operating system according to a network card configuration mode of an operating system type; in addition, a thread for updating the network card configuration can be created when the Python main process is started, the configuration file is specially used for the configuration of a newly added network card, and if an IP is newly added to the newly added network card, only one row of newly added IP is needed to be written in the configuration file, and the name, the IP address, the subnet mask and the gateway of the network card are sequentially written, so that the complexity of the network card configuration is greatly reduced, and the overall implementation efficiency is improved.
Referring to fig. 5, fig. 5 is a block diagram of a configuration apparatus for a Linux virtual machine add-on network card according to this embodiment; the apparatus may include: a monitoring unit 210, a thread determining unit 220, and a network card configuring unit 230. The configuration device for the Linux virtual machine newly added network card provided by the embodiment can be compared with the configuration method for the Linux virtual machine newly added network card.
The monitoring unit 210 is mainly configured to monitor a target virtual machine to determine whether a new network card device exists in the target virtual machine; if yes, triggering a thread determining unit;
the thread determining unit 220 is mainly used for determining a newly added network card device and a corresponding configuration thread;
the network card configuration unit 230 is mainly configured to invoke a configuration thread to configure a newly added network card device in a target virtual machine.
The configuration device for the Linux virtual machine newly added network card provided by the embodiment can realize automatic configuration of the newly added network card, reduce the complexity of network card configuration, and improve the maintenance efficiency of the Linux virtual machine.
The embodiment provides a configuration device for a new network card added to a Linux virtual machine, which includes: a memory and a processor.
Wherein, the memory is used for storing programs;
when the processor is used to execute the program, the steps of the configuration method for the Linux virtual machine newly added network card described in the above embodiments may be specifically described with reference to the description of the configuration method for the Linux virtual machine newly added network card.
Referring to fig. 6, a schematic structural diagram of a configuration device of the Linux virtual machine add-on card provided in this embodiment is shown, where the configuration device of the Linux virtual machine add-on card may generate a relatively large difference due to different configurations or performances, and may include one or more processors (CPUs) 322 (e.g., one or more processors) and a memory 332, and one or more storage media 330 (e.g., one or more mass storage devices) storing an application 342 or data 344. Memory 332 and storage media 330 may be, among other things, transient storage or persistent storage. The program stored on the storage medium 330 may include one or more modules (not shown), each of which may include a series of instructions operating on a data processing device. Further, the central processing unit 322 may be configured to communicate with the storage medium 330, and execute a series of instruction operations in the storage medium 330 on the configuration device 301 of the Linux virtual machine add-on card.
The configuration device 301 for the Linux virtual machine add-on card may also include one or more power sources 326, one or more wired or wireless network interfaces 350, one or more input/output interfaces 358, and/or one or more operating systems 341, such as Windows Server, Mac OS XTM, UnixTM, Linux, FreeBSDTM, etc.
The steps in the configuration method for the Linux virtual machine add-on network card described in fig. 1 above may be implemented by the structure of the configuration device for the Linux virtual machine add-on network card described in this embodiment.
The present embodiment discloses a readable storage medium, on which a program is stored, and the program, when being executed by a processor, implements the steps of the configuration method for the Linux virtual machine add-on network card described in the foregoing embodiments, which may specifically refer to the description of the configuration method for the Linux virtual machine add-on network card in the foregoing embodiments.
The readable storage medium may be a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and various other readable storage media capable of storing program codes.
The embodiments are described in a progressive manner in the specification, 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.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The configuration method, device, equipment and readable storage medium for the Linux virtual machine newly added network card provided by the application are introduced in detail above. The principles and embodiments of the present application are explained herein using specific examples, which are provided only to help understand the method and the core idea of the present application. It should be noted that, for those skilled in the art, it is possible to make several improvements and modifications to the present application without departing from the principle of the present application, and such improvements and modifications also fall within the scope of the claims of the present application.

Claims (10)

1. A configuration method for a newly added network card of a Linux virtual machine is characterized by comprising the following steps:
monitoring a target virtual machine to judge whether a newly added network card device exists in the target virtual machine;
if yes, determining the newly added network card equipment and a corresponding configuration thread;
and calling the configuration thread to configure the newly-added network card equipment in the target virtual machine.
2. The method for configuring a newly added network card of a Linux virtual machine according to claim 1, wherein determining the newly added network card device and the corresponding configuration thread comprises:
reading system type information of an operating system to which the target virtual machine belongs;
matching a network card configuration thread corresponding to the system type information as a target thread;
determining the newly added network card equipment;
and calling the target thread to configure the newly-added network card equipment in the target virtual machine.
3. The method for configuring a Linux virtual machine add-on card as claimed in claim 1, wherein said configuration thread comprises: starting a configuration sub-thread and a DHCP setting sub-thread, and correspondingly calling the configuration thread to configure the newly added network card equipment in the target virtual machine, wherein the configuration thread comprises the following steps:
and calling the configuration thread to configure the newly-added network card equipment in the target virtual machine to obtain the starting-up self-starting network card equipment for acquiring the IP by the DHCP.
4. The method for configuring the newly added network card for the Linux virtual machine according to any one of claims 1 to 3, further comprising, after determining that the newly added network card device exists in the target virtual machine:
creating a network card configuration updating thread;
and calling the network card configuration updating thread to perform configuration updating setting on the newly added network card equipment.
5. The method for configuring a new add-on network card for a Linux virtual machine as recited in claim 4, wherein the network card configuration update thread comprises: and if the IP newly increases the thread, correspondingly, the creating of the network card configuration updating thread comprises the following steps:
determining newly added IP information;
performing information organization on the newly added IP information in a preset format to generate network card configuration information in a specified format;
correspondingly, calling the network card configuration updating thread to perform configuration updating setting on the newly added network card device, including: and adding the network card configuration information into a network card configuration update file and storing the network card configuration information.
6. The method for configuring a Linux virtual machine add-on card as recited in claim 5, further comprising:
when a plurality of newly added IP information are determined to be obtained within a preset time interval, determining the acquisition time of each newly added IP information;
correspondingly, the determining the newly added IP information includes: and determining the newly added IP information with the latest acquisition time.
7. A configuration device for newly adding a network card to a Linux virtual machine is characterized by comprising:
the monitoring unit is used for monitoring a target virtual machine so as to judge whether a newly added network card device exists in the target virtual machine; if yes, triggering a thread determining unit;
the thread determining unit is used for determining the newly added network card equipment and the corresponding configuration thread;
and the network card configuration unit is used for calling the configuration thread to configure the newly-added network card equipment in the target virtual machine.
8. The apparatus for configuring a Linux virtual machine add-on card as recited in claim 7, further comprising: a configuration update unit that is triggered when the monitoring unit determines that the configuration update unit exists, the configuration update unit including:
the thread creating subunit is used for creating a network card configuration updating thread;
and the updating setting subunit is used for calling the network card configuration updating thread to perform configuration updating setting on the newly added network card device.
9. A configuration device for newly adding a network card to a Linux virtual machine is characterized by comprising:
a memory for storing a program;
a processor, configured to implement the steps of the configuration method for the Linux virtual machine add-on card according to any one of claims 1 to 6 when executing the program.
10. A readable storage medium, wherein the readable storage medium stores thereon a program, and the program, when executed by a processor, implements the steps of the method for configuring the Linux virtual machine add-on card according to any one of claims 1 to 6.
CN201911026024.3A 2019-10-25 2019-10-25 Configuration method of newly added network card of Linux virtual machine and related components Active CN110798346B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911026024.3A CN110798346B (en) 2019-10-25 2019-10-25 Configuration method of newly added network card of Linux virtual machine and related components

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911026024.3A CN110798346B (en) 2019-10-25 2019-10-25 Configuration method of newly added network card of Linux virtual machine and related components

Publications (2)

Publication Number Publication Date
CN110798346A true CN110798346A (en) 2020-02-14
CN110798346B CN110798346B (en) 2022-11-04

Family

ID=69441328

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911026024.3A Active CN110798346B (en) 2019-10-25 2019-10-25 Configuration method of newly added network card of Linux virtual machine and related components

Country Status (1)

Country Link
CN (1) CN110798346B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113778626A (en) * 2021-08-31 2021-12-10 山石网科通信技术股份有限公司 Hot plug processing method and device for virtual network card, storage medium and processor

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW200726126A (en) * 2005-12-20 2007-07-01 Inventec Corp Network card auto-configuring system and method thereof
US20080043756A1 (en) * 2006-07-20 2008-02-21 Sun Microsystems, Inc. Method and system for network configuration for virtual machines
CN103731514A (en) * 2013-12-29 2014-04-16 国云科技股份有限公司 Virtual network management method
CN104270269A (en) * 2014-09-28 2015-01-07 深圳市共进电子股份有限公司 Method for automatically configuring network cards
CN105573791A (en) * 2015-12-15 2016-05-11 国云科技股份有限公司 Method for realizing network card hot plug by linux virtual machine
CN106789363A (en) * 2017-02-20 2017-05-31 郑州云海信息技术有限公司 A kind of method and device to virtual machine configuration network interface card
CN107707687A (en) * 2017-10-10 2018-02-16 郑州云海信息技术有限公司 A kind of method and apparatus of virtual machine IP address configuration
CN108206750A (en) * 2016-12-16 2018-06-26 北京国双科技有限公司 The configuration method and device of virtual machine network interface card
CN109039697A (en) * 2018-06-19 2018-12-18 新华三云计算技术有限公司 Virtual machine network card configuration method and device

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW200726126A (en) * 2005-12-20 2007-07-01 Inventec Corp Network card auto-configuring system and method thereof
US20080043756A1 (en) * 2006-07-20 2008-02-21 Sun Microsystems, Inc. Method and system for network configuration for virtual machines
CN103731514A (en) * 2013-12-29 2014-04-16 国云科技股份有限公司 Virtual network management method
CN104270269A (en) * 2014-09-28 2015-01-07 深圳市共进电子股份有限公司 Method for automatically configuring network cards
CN105573791A (en) * 2015-12-15 2016-05-11 国云科技股份有限公司 Method for realizing network card hot plug by linux virtual machine
CN108206750A (en) * 2016-12-16 2018-06-26 北京国双科技有限公司 The configuration method and device of virtual machine network interface card
CN106789363A (en) * 2017-02-20 2017-05-31 郑州云海信息技术有限公司 A kind of method and device to virtual machine configuration network interface card
CN107707687A (en) * 2017-10-10 2018-02-16 郑州云海信息技术有限公司 A kind of method and apparatus of virtual machine IP address configuration
CN109039697A (en) * 2018-06-19 2018-12-18 新华三云计算技术有限公司 Virtual machine network card configuration method and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113778626A (en) * 2021-08-31 2021-12-10 山石网科通信技术股份有限公司 Hot plug processing method and device for virtual network card, storage medium and processor

Also Published As

Publication number Publication date
CN110798346B (en) 2022-11-04

Similar Documents

Publication Publication Date Title
CN111756574B (en) Method, device and computer readable storage medium for remote batch updating firmware
CN110495136B (en) Hardware attribute discovery method and system of bare metal server
CN110719209B (en) Cluster network configuration method, system, equipment and readable storage medium
CN111669284B (en) OpenStack automatic deployment method, electronic device, storage medium and system
CN106549789B (en) Method and system for realizing server installation
CN113656147B (en) Cluster deployment method, device, equipment and storage medium
CN108809683B (en) Method and device for deploying cloud application system
CN112364897B (en) Distributed training method and device, storage medium and electronic equipment
CN106708573B (en) System and method for Hadoop cluster automatic installation
CN111273924A (en) Software updating method and device
CN110413328B (en) PXE function enabling method and device for network card port and related equipment
CN111475175B (en) Method, device and medium for installing and guiding operation system based on ARM server
CN110674095B (en) CTDB cluster expansion method, device and equipment and readable storage medium
CN110798346B (en) Configuration method of newly added network card of Linux virtual machine and related components
US11762666B2 (en) Methods and apparatus for hypervisor boot up
US9569315B2 (en) Modeling the topology of management servers in a distributed system
CN114995888A (en) Intelligent network card deployment method, device and medium
CN114866515A (en) IP address configuration method, device, electronic equipment and storage medium
WO2020113478A1 (en) Address information processing method and apparatus, electronic device, and storage medium
US11886171B2 (en) Streamlining the commission of network identifiers
CN111768129A (en) Delivery method, device, equipment and storage medium of proprietary cloud product
CN113656322B (en) Data processing method, device, electronic equipment and computer storage medium
CN111147400B (en) Method and device for command line configuration synchronization and electronic equipment
CN115268951A (en) Installation method, device, equipment and storage medium of operating system
CN111400113B (en) Complete machine self-checking method, device and system of computer system

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