Disclosure of Invention
Aiming at the technical problems in the prior art, the invention provides a starting method and a starting system of a physical host.
The technical scheme for solving the technical problems is as follows: a starting method of a physical host comprises the following steps:
the management node is in communication connection with the physical host, starts the physical host through PXE, and enters a first system of the physical host;
the block device server exports a first virtual host image file pre-stored in a memory into a first block device;
the management node remotely accesses the physical host and controls the physical host to establish communication connection with the first block device;
and the management node copies the data containing the first virtual host image file of the first block of equipment to a hard disk of the physical host, adaptively modifies the data, restarts the physical host and enters a second system of the physical host.
The invention has the beneficial effects that:
1. a cloud platform user can start the physical host by using the virtual host image file without preparing two sets of image libraries for the physical host and the virtual host, so that the storage space is saved, and the use and the maintenance are convenient.
2. Both the boot image and the virtual host image may be dynamically configured at deployment time.
On the basis of the technical scheme, the invention can be further improved as follows.
Further, the adapting comprises: and executing a remote command, connecting the hard disk on the physical host computer or remotely, and modifying the data content of the hard disk.
The invention also provides another starting method of the physical host, which comprises the following steps:
the management node is in communication connection with the physical host, starts the physical host through PXE, and enters a first system of the physical host;
the block device server adaptively modifies a first virtual host image file which is stored in a memory in advance;
the block device server exports the modified first virtual host image file into a first block device;
the management node remotely accesses the physical host and controls the physical host to establish communication connection with the first block device;
and the management node copies the data of the first block of equipment containing the modified first virtual host image file to a hard disk of the physical host, restarts the physical host and enters a second system of the physical host.
The invention has the beneficial effects that:
1. a cloud platform user can start the physical host by using the virtual host image file without preparing two sets of image libraries for the physical host and the virtual host, so that the storage space is saved, and the use and the maintenance are convenient.
2. Both the boot image and the virtual host image may be dynamically configured at deployment time.
On the basis of the technical scheme, the invention can be further improved as follows.
Further, the block device server adaptively modifies the first virtual host image file pre-stored in the memory, specifically including:
the method comprises the steps that a block device server connects a first virtual image file stored in a memory in advance to a second block device of the block device server;
mounting the second block device to a directory of the block device server;
and configuring the second piece of equipment.
The invention also provides another starting method of the physical host, which comprises the following steps:
the management node is in communication connection with the physical host, starts the physical host through PXE, and enters a first system of the physical host;
the method comprises the steps that a block device server takes a first virtual host image file stored in a memory in advance as a back-end image file to create a second virtual host image file, and adaptively modifies the second virtual host image file;
the block device server exports the modified second virtual host image file into a first block device;
the management node remotely accesses the physical host and controls the physical host to establish communication connection with the first block device;
and the management node copies the data of the first block of equipment containing the modified second virtual host image file to a hard disk of the physical host, restarts the physical host and enters a second system of the physical host.
The invention has the beneficial effects that:
1. a cloud platform user can start the physical host by using the virtual host image file without preparing two sets of image libraries for the physical host and the virtual host, so that the storage space is saved, and the use and the maintenance are convenient.
2. Both the boot image and the virtual host image may be dynamically configured at deployment time.
3. The first virtual host image file in the memory is not modified, so that the first virtual host image file can be repeatedly used, and the maintenance cost is reduced.
4. The second virtual host image file only records the difference part of the first virtual host image file serving as the back-end image file, and the occupied storage space is small.
On the basis of the technical scheme, the invention can be further improved as follows.
Further, adaptively modifying the second virtual host image file specifically includes:
connecting the second virtual host image file to a second block device of the block device server by the block device server;
mounting the second block device to a directory of the block device server;
and configuring the second piece of equipment.
Further, the starting the physical host by the PXE includes:
the management node connects the boot image file stored in the management node to a third piece of equipment of the management node;
mounting the third piece of equipment to a directory of the management node;
and executing the step of starting the physical host computer through the PXE based on the data of the third block device containing the starting image file.
Further, the method also includes:
the management node configuring the third block device;
and executing the step of starting the physical host computer through the PXE based on the data containing the boot image file of the configured third block device.
Further, the memory comprises a file server, a hard disk, an optical disk or a U disk.
In order to achieve the above object, the present invention further provides a system for starting a physical host, which is characterized by comprising a management node, a block device server, and a memory;
the block device server is used for exporting the first virtual host image file pre-stored in the memory into a first block device;
the management node is in communication connection with a physical host, and is configured to start the physical host through PXE, enter a first system of the physical host, and is further configured to remotely access the physical host, control establishment of communication connection between the physical host and the first block device, and also configured to copy data of the first block device, which contains the first virtual host image file, to a hard disk of the physical host, and adaptively modify, restart the physical host, and enter a second system of the physical host.
On the basis of the technical scheme, the invention can be further improved as follows.
Further, the adapting comprises: and executing a remote command, connecting the hard disk on the physical host computer or remotely, and modifying the data content of the hard disk.
The invention also provides another starting system of the physical host, which comprises a management node, a block device server and a memory;
the block device server is used for adaptively modifying a first virtual host image file which is stored in the memory in advance and exporting the modified first virtual host image file into a first block device;
the management node is in communication connection with a physical host, and is configured to start the physical host through PXE to enter a first system of the physical host, and is further configured to remotely access the physical host, control establishment of communication connection between the physical host and the first block device, and also configured to copy data of the first block device, which contains the modified first virtual host image file, to a hard disk of the physical host, restart the physical host, and enter a second system of the physical host.
Further, the block device server is specifically configured to connect the first virtual image file pre-stored in the memory to a second block device of the block device server, mount the second block device to a directory of the block device server, and configure the second block device.
The invention also provides another starting system of the physical host, which comprises a management node, a block device server and a memory;
the block device server is used for creating a second virtual host image file by taking a first virtual host image file which is stored in the memory in advance as a back-end image file, adaptively modifying the second virtual host image file and exporting the modified second virtual host image file into a first block device;
the management node is in communication connection with a physical host, and is configured to start the physical host through PXE to enter a first system of the physical host, and is further configured to remotely access the physical host, control the physical host to establish communication connection with the first block device, and is further configured to copy data of the first block device, which contains the modified second virtual host image file, to a hard disk of the physical host, restart the physical host, and enter a second system of the physical host.
Further, the block device server is specifically configured to connect the second virtual host image file to a second block device of the block device server, mount the second block device to a directory of the block device server, and configure the second block device.
Further, the management node is specifically configured to connect the boot image file stored in the management node to a third device of the management node, mount the third device to a directory of the management node, and boot a physical host through PXE based on the data of the third device that includes the boot image file.
Further, the management node is further configured to configure the third block device, and start a physical host through the PXE based on the data of the configured third block device, which contains the boot image file.
Further, the memory comprises a file server, a hard disk, an optical disk or a U disk.
Detailed Description
The principles and features of this invention are described below in conjunction with the following drawings, which are set forth by way of illustration only and are not intended to limit the scope of the invention.
Fig. 1 is a flowchart of a method for starting a physical host according to an embodiment of the present invention, as shown in fig. 1, the method includes the following steps:
101. the management node is in communication connection with the physical host, starts the physical host through PXE, and enters a first system of the physical host;
specifically, PXE (preboot execution environment) is the latest technology developed by Intel corporation, and includes a server side and a client side, in this embodiment, the client side is a physical host, the server side is a management node, and in a PXE starting mode, the management node may download an image from a remote server through a network, and thus start the physical host through the network.
Optionally, in this embodiment, as shown in fig. 2, the starting of the physical host over the PXE includes:
201. the management node connects the boot image file stored in the management node to a third piece of equipment of the management node;
specifically, the management node may connect the boot image file in the qcow2 format to a block device (block device) of the management node by executing the disk image export command qemu-nbd, so that the operation on the block device may be reflected in the boot image file.
202. Mounting the third piece of equipment to a directory of the management node;
203. and executing the step of starting the physical host computer through the PXE based on the data of the third block device containing the starting image file.
Optionally, in this embodiment, after the management node connects the boot image file stored in the management node to a third piece of equipment of the management node, the third piece of equipment is configured;
and executing the step of starting the physical host computer through the PXE based on the data containing the boot image file of the configured third block device.
Specifically, after the block device is mounted to the directory of the management node, the management node may modify the start-up image file as if the local file is operated. For example, by executing tune2fs commands to adjust file system UUID, configure SSH services, configure networks, etc., physical hosts that are booted via PXE after configuration can be accessed remotely.
102. The block device server exports a first virtual host image file pre-stored in a memory into a first block device;
specifically, for example, the block device server may export a hard disk image in qcow2 format to the block device by executing the nbd-server. The block device server is typically co-located with the memory and communicates with the management node. The first Block Device adopts a Network Block Device (Network Block Device).
Optionally, in this embodiment, the storage is a file server, a hard disk, an optical disk, a usb disk, or other storage media.
103. The management node remotely accesses the physical host and controls the physical host to establish communication connection with the first block device;
104. and the management node copies the data containing the first virtual host image file of the first block of equipment to a hard disk of the physical host, adaptively modifies the data, restarts the physical host and enters a second system of the physical host.
Specifically, the physical host and the virtual host have different implementation mechanisms, and they have great differences in hardware configuration, system configuration, and network configuration, so that the physical host cannot be directly compatible with the virtual host image file, and in step 104, after the first virtual host image file is adaptively modified, the physical host can be compatible with the virtual host image file.
Optionally, in this embodiment, the adaptive modifying includes: and executing a remote command, connecting the hard disk on the physical host computer or remotely, and modifying the data content of the hard disk.
Specifically, the adaptive modification includes the following two ways:
1. executing the remote command, updating the configuration or installation program on the physical host. For example, the management node accesses the physical host through the SSH service, and may implement expanding the file system storage space by executing fdisk, e2fsck, resize2fs, and other commands according to the hard disk space, loading the MegaRAID series SAS controller module into initramfs through draut command, adjusting the physical host time through date command, and the like.
2. The configuration or installation program is updated by remotely operating the physical hard disk. For example, the management node uses the ISCSI protocol to remotely connect a physical host hard disk and mount the physical host hard disk to a local directory, and then can modify the data of the physical host hard disk as operating a local file, thereby implementing configuration of a file system, a host login mode, a network and the like, and installation of programs of network bond configuration tools, such as ifenslave and zabbix agent monitoring service.
Because the virtual host image file is usually large, the original image file is copied on the physical host, and the image data is modified on the management node by executing a remote command or remotely operating a physical hard disk, so that the physical host resources are fully utilized, and the configuration flexibility is greatly improved.
After the modification is completed, the hard disk starts the physical host, and then the physical host can be started through the virtual host image file.
Optionally, as an embodiment of the present invention, fig. 3 is a flowchart of a starting method of another physical host provided in the embodiment of the present invention, and as shown in fig. 3, the method includes the following steps:
301. the management node is in communication connection with the physical host, starts the physical host through PXE, and enters a first system of the physical host;
specifically, PXE (preboot execution environment) is the latest technology developed by Intel corporation, and includes a server side and a client side, in this embodiment, the client side is a physical host, the server side is a management node, and in a PXE starting mode, the management node may download an image from a remote server through a network, and thus start the physical host through the network.
302. The block device server adaptively modifies a first virtual host image file which is stored in a memory in advance;
specifically, the adaptive modification mainly includes configuration of a file system, a host login mode, a network and the like of the first virtual host image file, and installation of programs such as an ifenslave and a zabbixagent monitoring service of a network bond configuration tool. The block device server is typically disposed at the management node, and the block device server is typically co-located with the memory and in communication with the management node.
303. The block device server exports the modified first virtual host image file into a first block device;
specifically, for example, the block device server may export a hard disk image in qcow2 format to the block device by executing the nbd-server.
304. The management node remotely accesses the physical host and controls the physical host to establish communication connection with the first block device;
305. and the management node copies the data of the first block of equipment containing the modified first virtual host image file to a hard disk of the physical host, restarts the physical host and enters a second system of the physical host.
Optionally, in this embodiment, as shown in fig. 4, the step 302 specifically includes:
401. the method comprises the steps that a block device server connects a first virtual image file stored in a memory in advance to a second block device of the block device server;
specifically, the block device server may connect the first virtual image file in the qcow2 format to a second block device (block device) of the block device server by executing the disk image export command qemu-nbd, so that the operation on the second block device may be reflected in the first virtual image file.
402. Mounting the second block device to a directory of the block device server;
403. and configuring the second piece of equipment.
Specifically, the configuration operation includes configuration of a file system, a host login method, a network and the like, and installation of programs such as network bond configuration tools, namely, an ifenslave and a zabbix agent monitoring service.
Optionally, as an embodiment of the present invention, fig. 5 is a flowchart of a starting method of another physical host provided in the embodiment of the present invention, and as shown in fig. 5, the method includes the following steps:
501. the management node is in communication connection with the physical host, starts the physical host through PXE, and enters a first system of the physical host;
specifically, PXE (preboot execution environment) is the latest technology developed by Intel corporation, and includes a server side and a client side, in this embodiment, the client side is a physical host, the server side is a management node, and in a PXE starting mode, the management node may download an image from a remote server through a network, and thus start the physical host through the network.
502. The method comprises the steps that a block device server takes a first virtual host image file stored in a memory in advance as a back-end image file to create a second virtual host image file, and adaptively modifies the second virtual host image file;
specifically, for example, the block device server creates the second virtual host image file by using the first virtual host image file as the backend image file through the disk mirroring tool qemu-img. The virtual host image file records only the portion of the difference from the backend image file. The block device server is typically disposed at the management node, and the block device server is typically co-located with the memory and in communication with the management node.
503. The block device server exports the modified second virtual host image file into a first block device;
specifically, for example, the block device server may export a hard disk image in qcow2 format to the block device by executing the nbd-server.
504. The management node remotely accesses the physical host and controls the physical host to establish communication connection with the first block device;
505. and the management node copies the data of the first block of equipment containing the modified second virtual host image file to a hard disk of the physical host, restarts the physical host and enters a second system of the physical host.
Optionally, in this embodiment, as shown in fig. 6, the adaptively modifying the second virtual host image file specifically includes:
601. the block device server connecting the second virtual image file to a second block device of the block device server;
specifically, the block device server may connect the second virtual image file in the qcow2 format to a second block device (block device) of the block device server by executing the disk image export command qemu-nbd, so that the operation on the second block device may be reflected in the second virtual image file.
602. Mounting the second block device to a directory of the block device server;
603. and configuring the second piece of equipment.
Specifically, the configuration operation includes configuration of a file system, a host login method, a network and the like, and installation of programs such as network bond configuration tools, namely, an ifenslave and a zabbix agent monitoring service.
Correspondingly, the present invention further provides a system for starting a physical host, as shown in fig. 7, the system includes a management node, a block device server, and a memory;
the block device server is configured to export a first virtual host image file pre-stored in the memory to the first block device.
The management node is in communication connection with a physical host, and is configured to start the physical host through PXE, and is further configured to remotely access the physical host, control establishment of communication connection between the physical host and a first block device, and copy data of the first block device, which contains the first virtual host image file, to a hard disk of the physical host, and adaptively modify and restart the physical host to enter a second system of the physical host.
Specifically, the block device server may export a hard disk image in qcow2 format to the block device by executing the nbd-server. The block device server is typically co-located with the memory and communicates with the management node. The first Block Device adopts a Network Block Device (Network Block Device).
Optionally, in this embodiment, as shown in fig. 8, the management node is specifically configured to connect the boot image file stored in the management node to a third block device of the management node, mount the third block device to a directory of the management node, and boot a physical host through PXE based on data of the third block device that includes the boot image file.
Optionally, in this embodiment, the management node is further configured to configure the third block device, and start a physical host over the PXE based on the data of the configured third block device, which includes the boot image file.
Specifically, after the block device is mounted to the directory of the management node, the management node may modify the start-up image file as if the local file is operated. For example, by executing tune2fs commands to adjust file system UUID, configure SSH services, configure networks, etc., a physical host may be remotely accessible after configuration, and if not, the physical host uses default configuration.
Optionally, in this embodiment, the memory includes a file server, a hard disk, an optical disk, or a usb disk.
Optionally, in this embodiment, the adaptive modification includes the following two ways:
1. executing the remote command, updating the configuration or installation program on the physical host. For example, the management node accesses the physical host through the SSH service, and may implement expanding the file system storage space by executing fdisk, e2fsck, resize2fs, and other commands according to the hard disk space, loading the MegaRAID series SAS controller module into initramfs through draut command, adjusting the physical host time through date command, and the like.
2. The configuration or installation program is updated by remotely operating the physical hard disk. For example, the management node uses the ISCSI protocol to remotely connect a physical host hard disk and mount the physical host hard disk to a local directory, and then can modify the data of the physical host hard disk as operating a local file, thereby implementing configuration of a file system, a host login mode, a network and the like, and installation of programs of network bond configuration tools, such as ifenslave and zabbix agent monitoring service.
Because the virtual host image file is usually large, the original image file is copied on the physical host, and the image data is modified on the management node by executing a remote command or remotely operating a physical hard disk, so that the physical host resources are fully utilized, and the configuration flexibility is greatly improved.
After the modification is completed, the hard disk starts the physical host, and then the physical host can be started through the virtual host image file.
As shown in fig. 7, another boot system of a physical host according to an embodiment of the present invention includes a management node, a block device server, and a memory;
the block device server is used for adaptively modifying a first virtual host image file which is stored in the memory in advance and exporting the modified first virtual host image file into a first block device;
the management node is in communication connection with a physical host, and is configured to start the physical host through PXE to enter a first system of the physical host, and is further configured to remotely access the physical host, control establishment of communication connection between the physical host and the first block device, and also configured to copy data of the first block device, which contains the modified first virtual host image file, to a hard disk of the physical host, restart the physical host, and enter a second system of the physical host.
Optionally, in this embodiment, as shown in fig. 9, the block device server is specifically configured to connect the first virtual image file pre-stored in the memory to a second block device of the block device server, mount the second block device to a directory of the block device server, and configure the second block device.
Optionally, in this embodiment, the management node is specifically configured to connect the boot image file stored in the management node to a third device of the management node, mount the third device to a directory of the management node, and start the physical host through the PXE based on the data of the third device, which includes the boot image file.
Optionally, in this embodiment, the management node is further configured to configure the third block device, and start a physical host over the PXE based on the data of the configured third block device, which includes the boot image file.
As shown in fig. 7, another boot system of a physical host according to an embodiment of the present invention includes a management node, a block device server, and a memory;
the block device server is used for creating a second virtual host image file by taking a first virtual host image file which is stored in the memory in advance as a back-end image file, adaptively modifying the second virtual host image file and exporting the modified second virtual host image file into a first block device;
the management node is in communication connection with a physical host, and is configured to start the physical host through PXE to enter a first system of the physical host, and is further configured to remotely access the physical host, control the physical host to establish communication connection with the first block device, and is further configured to copy data of the first block device, which contains the modified second virtual host image file, to a hard disk of the physical host, restart the physical host, and enter a second system of the physical host.
Optionally, in this embodiment, as shown in fig. 9, the block device server is specifically configured to connect the second virtual host image file to a second block device of the block device server, mount the second block device to a directory of the block device server, and configure the second block device.
Optionally, in this embodiment, the management node is specifically configured to connect the boot image file stored in the management node to a third device of the management node, mount the third device to a directory of the management node, and start the physical host through the PXE based on the data of the third device, which includes the boot image file.
Optionally, in this embodiment, the management node is further configured to configure the third block device, and start a physical host over the PXE based on the data of the configured third block device, which includes the boot image file.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.