A method, device, apparatus and computer readable storage medium for shutting down
Patent Information
- Application Number
- CN202610968969.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-30
- Publication Date
- 2026-09-29
AI Technical Summary
[0004]有鉴于此,本发明的目的在于提供一种关机方法、装置、设备及计算机可读存储介质,解决了现有技术中裸金属设备的最终断电状态与逻辑资源状态不一致的问题
[0016]由上述技术方案可以看出,本发明通过响应于针对目标裸金属算力实例的停止请求,获取对应裸金属设备的电源控制信息和业务VLAN配置信息;当裸金属设备处于上电状态且未获取到关机完成信息时,根据电源控制信息向对应电源管理控制器发送软关机命令;维持目标裸金属算力实例所使用的网络链路的连通状态,直至满足预设释放条件时,根据业务VLAN配置信息释放网络链路;查询裸金属设备的电源状态,并根据查询结果确定是否执行资源回收。本发明的有益效果在于:本发明在接收到针对目标裸金属算力实例的停止请求后,并不立即拆除网络并回收资源,而是在裸金属设备处于上电状态且未获取到关机完成信息时优先发送软关机命令,并维持网络链路的连通状态直至满足预设释放条件,从而为裸金属设备提供了完整的软关机收尾窗口,避免了因过早断网导致关机失败的问题;同时,本发明在释放网络链路后通过查询裸金属设备的电源状态,并根据查询结果确定是否执行资源回收,确保只有在物理设备真正断电后才更新逻辑资源状态,从而解决了裸金属设备的最终断电状态与逻辑资源状态不一致的问题,提升了关机的可靠性与系统的一致性。
Smart Images

Figure CN122845407A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of bare metal computing power scheduling technology, and in particular to a shutdown method, apparatus, device, and computer-readable storage medium. Background Technology
[0002] In scenarios involving the shutdown and resource reclamation of bare-metal computing instances, upon receiving a shutdown request, the platform needs to power off the target bare-metal device and release its occupied network links and related resources. The current implementation rapidly releases the network and resources after the shutdown command is issued, but this method struggles to guarantee the consistency between the final power-off state of the bare-metal device and its logical resource state.
[0003] Therefore, ensuring the consistency between the final power-off state of bare metal devices and the state of logical resources is a technical problem that urgently needs to be solved. Summary of the Invention
[0004] In view of this, the purpose of the present invention is to provide a power-off method, apparatus, device and computer-readable storage medium, which solves the problem of inconsistency between the final power-off state and the logical resource state of bare metal devices in the prior art.
[0005] To solve the above-mentioned technical problems, the present invention provides a power-off method, comprising: In response to a stop request for the target bare metal computing instance, obtain the power control information and service VLAN configuration information of the bare metal device corresponding to the target bare metal computing instance; When the bare metal device is powered on and has not received shutdown completion information, a soft shutdown command is sent to the corresponding power management controller according to the power control information. Maintain the connectivity of the network link used by the target bare metal computing instance until the preset release condition is met, and then release the network link according to the service VLAN configuration information. Query the power status of the bare metal device, and determine whether to perform resource reclamation of the target bare metal computing instance based on the query results.
[0006] Optionally, the power status of the bare metal device is queried, and based on the query result, it is determined whether to perform resource reclamation of the target bare metal computing instance, including: The power status of the bare metal device is queried a preset number of times at preset time intervals; If the bare metal device is determined to be in a power-off state based on the results of the preset number of power status queries, then the resource reclamation operation of the target bare metal computing power instance is executed.
[0007] Optional, also includes: If the bare metal device is determined to be still powered on based on the results of the preset number of power status queries, a forced shutdown command is sent to the bare metal device, and the power status is confirmed at least once for the bare metal device. If the bare metal device is determined to be in a power-off state based on the results of at least one power status confirmation, then the resource reclamation operation of the target bare metal computing power instance is executed. If the bare metal device is determined to be still powered on based on the results of at least one power status confirmation, then a shutdown abnormality event is recorded.
[0008] Optionally, before performing the resource reclamation operation on the target bare metal computing instance, the method further includes: The consistency of the shutdown completion information on the client side corresponding to the target bare metal computing power instance with the power status confirmation result of the bare metal device is determined. If they match, then perform the resource reclamation operation. If there is a discrepancy, the resource reclamation operation will not be performed, the abnormal state will be retained, and the shutdown process event information will be recorded.
[0009] Optionally, the shutdown completion information includes at least one of the shutdown completion event reported by the client corresponding to the target bare metal computing power instance and the client's heartbeat timeout event.
[0010] Optionally, the network link used by the target bare metal computing instance is maintained until a preset release condition is met, and then the network link is released according to the service VLAN configuration information, including: Maintain the connectivity of the network link used by the target bare metal computing instance. When the preset waiting time is reached, release the network link according to the service VLAN configuration information. The preset waiting time is determined based on at least one of the following: the operating system shutdown time of the client machine corresponding to the target bare metal computing instance, the status reporting delay, and the shutdown script execution time.
[0011] Optional, also includes: When a shutdown command is sent to the bare metal device, a repeat command cooling control is set for the shutdown command of the same power port indicated by the power control information, so as to prevent the repeated issuance of the same type of shutdown command within a preset cooling time.
[0012] The present invention also provides a power-off device, comprising: The information acquisition module is used to acquire the power control information and service VLAN configuration information of the bare metal device corresponding to the target bare metal computing power instance in response to a stop request for the target bare metal computing power instance. The soft shutdown module is used to send a soft shutdown command to the corresponding power management controller according to the power control information when the bare metal device is in the power-on state and has not obtained shutdown completion information; The link release module is used to maintain the connectivity of the network link used by the target bare metal computing instance until the preset release conditions are met, and then release the network link according to the service VLAN configuration information. The resource recycling module is used to query the power status of the bare metal device and determine whether to perform resource recycling of the target bare metal computing power instance based on the query results.
[0013] The present invention also provides a power-off device, comprising: Memory, used to store computer programs; A processor for implementing the shutdown method described above when executing the computer program.
[0014] The present invention also provides a computer-readable storage medium storing computer-executable instructions, which, when loaded and executed by a processor, implement the shutdown method described above.
[0015] The present invention also provides a computer program product, including a computer program / instruction that, when executed by a processor, implements the steps of the shutdown method described above.
[0016] As can be seen from the above technical solution, the present invention, in response to a stop request for a target bare metal computing instance, obtains the power control information and service VLAN configuration information of the corresponding bare metal device; when the bare metal device is powered on and has not obtained shutdown completion information, it sends a soft shutdown command to the corresponding power management controller according to the power control information; it maintains the connectivity of the network link used by the target bare metal computing instance until the preset release conditions are met, and releases the network link according to the service VLAN configuration information; it queries the power status of the bare metal device and determines whether to perform resource reclamation based on the query results. The beneficial effects of this invention are as follows: Upon receiving a stop request for a target bare metal computing instance, this invention does not immediately dismantle the network and reclaim resources. Instead, it prioritizes sending a soft shutdown command while the bare metal device is powered on and has not yet obtained shutdown completion information, and maintains the network link connectivity until the preset release conditions are met. This provides a complete soft shutdown end window for the bare metal device, avoiding the problem of shutdown failure due to premature network disconnection. Simultaneously, after releasing the network link, this invention queries the power status of the bare metal device and determines whether to perform resource reclamation based on the query results. This ensures that the logical resource status is only updated after the physical device is truly powered off, thereby solving the problem of inconsistency between the final power-off state and the logical resource state of the bare metal device, improving the reliability of shutdown and the consistency of the system.
[0017] In addition, the present invention also provides a power-off device, an apparatus, and a computer-readable storage medium, which also have the above-mentioned beneficial effects. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0019] Figure 1 A flowchart of a shutdown method provided in an embodiment of the present invention; Figure 2 This is a schematic diagram illustrating the overall process of graceful shutdown and VLAN coordinated release for a bare-metal computing instance, as provided in an embodiment of the present invention. Figure 3 A timing diagram illustrating how soft shutdown takes precedence over delaying network connectivity window preservation, provided as an embodiment of the present invention; Figure 4 This is an example diagram of a process for multiple power status verifications and forced shutdown fallback after VLAN release, provided by an embodiment of the present invention. Figure 5This is a schematic diagram illustrating the collaborative relationship between customer shutdown events, power status confirmation, and resource recovery settlement, as provided in an embodiment of the present invention. Figure 6 This is a schematic diagram of a shutdown device provided in an embodiment of the present invention; Figure 7 This is a schematic diagram of a shutdown device provided in an embodiment of the present invention. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0021] Please refer to Figure 1 , Figure 1 A flowchart illustrating a shutdown method provided in an embodiment of the present invention. The method may include: S101: In response to a stop request for the target bare metal computing instance, obtain the power control information and service VLAN configuration information of the bare metal device corresponding to the target bare metal computing instance.
[0022] The steps in this embodiment can be performed by a designated electronic device, which may specifically be a server, a scheduling and management platform, a portable terminal, or other forms. A bare-metal computing instance refers to a computing power instance delivered to a user based on a physical bare-metal device, whereby the user exclusively possesses the computing, storage, and network resources of that physical device. The termination and reclamation of a bare-metal computing instance involves the power control of the physical device and the release of corresponding logical resources.
[0023] Upon receiving a stop request for a target bare-metal computing instance, the system first locates the scheduling record identifier and bare-metal device identifier corresponding to the instance. Based on this, it obtains the power control information of the corresponding bare-metal device and the service VLAN configuration information on the switch port. Power control information refers to the information used to perform power control on the bare-metal device. This may include the power device address, power control port (power port) identifier, power control protocol type, etc. Based on the power control information, a soft shutdown command or a forced shutdown command can be issued to the corresponding power device / power supply (referring to the power management controller on the bare-metal device), or the current power status of the bare-metal device can be queried. Service VLAN configuration information refers to the configuration information of the network links used by the target bare-metal computing instance. This may include switch port information and the virtual local area network (VLAN) information configured on that port. Releasing network links can be achieved by removing the corresponding VLAN configuration on the switch port.
[0024] S102: When the bare metal device is powered on and has not received shutdown completion information, a soft shutdown command is sent to the corresponding power management controller according to the power control information.
[0025] After obtaining power control information and service VLAN configuration information, the current power status of the bare metal device can be queried, and it can be checked whether shutdown completion information has been obtained. If the query result shows that the bare metal device is powered on and has not yet obtained shutdown completion information, it means that the device has not yet entered the normal shutdown process. In this case, a forced power-off is not immediately executed. Instead, a soft shutdown command is sent to the corresponding power management controller / power device based on the power control information to trigger its operating system to execute the normal shutdown process, allowing the service to gracefully exit. It is understandable that if the bare metal device is already powered off or has obtained shutdown completion information, there is no need to reissue the soft shutdown command, and it can directly enter the subsequent network link release and power status confirmation process. The soft shutdown command is the command used to trigger the bare metal device's operating system to execute the normal shutdown process.
[0026] Furthermore, in order to adapt to the shutdown status acquisition methods of different types of client machines, the shutdown completion information mentioned above may include at least one of the shutdown completion event reported by the client machine corresponding to the target bare metal computing power instance and the client machine's heartbeat timeout event.
[0027] It should be noted that a client machine refers to an operating system environment running on bare metal equipment and oriented towards user services, such as a diskless client machine using a diskless boot method. The client machine can have mechanisms such as remote session persistence, status reporting, heartbeat reporting, or shutdown script termination. Its normal shutdown depends on script execution, service status write-back, session exit, and heartbeat termination while maintaining network connectivity. In one possible implementation, the client machine can be a diskless client machine that can actively report a shutdown completion event during the normal shutdown process of the operating system. In another possible implementation, the client machine's heartbeat can be monitored. When the client machine's heartbeat times out, it can be inferred that the client machine has exited the running state, and thus the heartbeat timeout event can be used as shutdown completion information. The above two methods can be used individually or in combination, without specific limitations.
[0028] S103: Maintain the connectivity of the network link used by the target bare metal computing instance until the preset release conditions are met, and release the network link according to the service VLAN configuration information.
[0029] After sending the soft shutdown command, the network link / VLAN used by the target bare metal computing instance is not immediately released. Instead, the network link's connectivity is maintained until the preset release conditions are met. Within this network connectivity window, the client can complete shutdown cleanup actions such as executing the shutdown script, writing back service status, ending the session, and exiting the heartbeat. When the preset release conditions are met, the network link is released according to the service VLAN configuration information, for example, the VLAN configuration on the corresponding switch port can be removed. In other words, this embodiment changes the network link release action from being executed immediately after the shutdown action to being executed delayed after the soft shutdown, creating a coordinated timing sequence with sequential constraints between shutdown control and network resource release.
[0030] Furthermore, to ensure the network connectivity window length matches the actual needs of the customer's shutdown process, the aforementioned maintenance of the network link used by the target bare-metal computing instance until a preset release condition is met, followed by releasing the network link according to the service VLAN configuration information, can specifically include the following steps: maintaining the connectivity of the network link used by the target bare-metal computing instance, and releasing the network link according to the service VLAN configuration information when a preset waiting time is reached. The preset release condition can be reaching a preset waiting time. After sending the soft shutdown command, maintain the connectivity of the network link used by the target bare-metal computing instance (e.g., the VLAN configured on the corresponding switch port); when the preset waiting time is reached, release the network link according to the service VLAN configuration information. The preset waiting time is determined based on at least one of the following: the operating system shutdown time of the client machine corresponding to the target bare-metal computing instance, the status reporting latency, and the shutdown script execution time, ensuring that the waiting time covers the network connectivity window required for the customer's shutdown process.
[0031] S104: Query the power status of the bare metal device and determine whether to perform resource reclamation of the target bare metal computing instance based on the query results.
[0032] After releasing the network link, the system does not directly assume that the target bare metal device is shut down. Instead, it queries the power status of the bare metal device and determines whether to perform resource reclamation of the target bare metal computing instance based on the query results. That is, this embodiment postpones the final closing of successful resource reclamation until after the power outage confirmation, rather than immediately after issuing the shutdown command or releasing the network link, thereby ensuring that the logical resource status is consistent with the physical device status.
[0033] Furthermore, to improve the accuracy of shutdown completion determination and avoid misjudgments caused by relying on the results of a single interface call, the above-mentioned query of the power status of the bare metal device and determination of whether to perform resource reclamation of the target bare metal computing instance based on the query results may specifically include the following steps: Step 11: Perform a preset number of power status queries on the bare metal device at preset time intervals.
[0034] After releasing the network link, the power status of the target bare metal device can be queried a preset number of times at preset time intervals. For example, at least three status checks can be performed at fixed time intervals. Both the preset time interval and the preset number of checks can be configured according to the actual operating environment, and no specific limitations are made here.
[0035] Step 12: If the bare metal device is determined to be in a power-off state based on the results of the preset number of power status queries, then perform the resource reclamation operation of the target bare metal computing instance.
[0036] If multiple power status queries indicate that the target bare metal device has been powered off, then the graceful shutdown in this round can be considered successful. In this case, the resource reclamation operation of the target bare metal computing instance can be executed, thus completing the successful resource reclamation.
[0037] Furthermore, to provide a clear upgrade strategy and fallback control in case of a soft shutdown failure, and to ensure a successful shutdown in the end, the shutdown method may also include the following steps: Step 13: If the result of the power status query based on the preset number of times determines that the bare metal device is still powered on, then issue a forced shutdown command to the bare metal device and perform at least one power status confirmation on the bare metal device.
[0038] If the target bare metal device is still confirmed to be powered on after multiple power status checks, it indicates that the soft shutdown has failed. In this case, the abnormal event can be recorded, and a forced shutdown command can be issued to the power supply device / power management controller corresponding to the bare metal device as a fallback. Subsequently, at least one more power status check should be performed on the bare metal device. The forced shutdown command is a command used to directly cut off the power to the bare metal device.
[0039] Step 14: If the bare metal device is determined to be in a power-off state based on at least one power status confirmation, then perform the resource reclamation operation of the target bare metal computing instance.
[0040] If the power status confirmation result after a forced shutdown indicates that the device has been de-energized, then the shutdown event such as successful forced shutdown can be recorded, and the resource reclamation operation of the target bare metal computing instance can be initiated.
[0041] Step 15: If the bare metal device is determined to be still powered on based on at least one power status confirmation, then record the shutdown abnormal event.
[0042] If the device remains powered on after a forced shutdown, record the shutdown anomaly event, such as "still abnormal after forced shutdown," and retain the abnormal status for subsequent auditing, anomaly investigation, or manual intervention.
[0043] Furthermore, to more accurately determine whether the device has truly completed the shutdown process, the shutdown method may also include the following steps before performing resource reclamation operations on the target bare metal computing instance: Step 21: Perform a consistency check between the shutdown completion information on the client side corresponding to the target bare metal computing instance and the power status confirmation result of the bare metal device.
[0044] It can receive shutdown completion events reported by clients, or infer that a client has exited the running state based on its heartbeat timeout event. It can combine the shutdown completion information from the client side with the power status confirmation results from the power supply side to make a consistency judgment, rather than relying on a single piece of information from one side.
[0045] Step 22: If they match, perform the resource reclamation operation.
[0046] When the client-side event matches the power-side power failure result, the final resource reclamation is successfully completed.
[0047] Step 23: If there is a discrepancy, do not perform the resource reclamation operation, retain the abnormal state, and record the shutdown process event information.
[0048] If the two are inconsistent, for example, the client has reported that the shutdown is complete but the power status shows that the device is still powered on, or the power status shows that the power is off but the client's status has not been properly completed, then the resource reclamation operation will not be performed, the abnormal status will be retained and the shutdown process event information will be recorded, and the fallback shutdown or manual intervention process can continue to be performed.
[0049] Furthermore, in order to avoid the power supply equipment and shutdown process being interfered with by repeatedly issuing shutdown commands in a short period of time, the above shutdown method may also include the following steps: when sending a shutdown command to the bare metal equipment, set a repeat command cooling control for the shutdown command of the same power port indicated by the power control information, so as to prohibit the repeated issuance of the same type of shutdown command within a preset cooling time.
[0050] In one possible implementation, a record can be created for maintenance commands issued to the same power port as indicated by the power control information. Once a shutdown command of a certain type (e.g., a soft shutdown command or a forced shutdown command) is issued to that power port, if a request for the same type of shutdown command arises again within a preset cooling period, re-issuance is prohibited until the preset cooling period has expired. The preset cooling period can be configured based on the response characteristics of the power supply equipment and is not specifically limited here.
[0051] The shutdown method provided in this embodiment of the invention includes the following steps: S101: In response to a stop request for a target bare metal computing instance, obtain the power control information and service VLAN configuration information of the bare metal device corresponding to the target bare metal computing instance; S102: When the bare metal device is powered on and has not obtained shutdown completion information, send a soft shutdown command to the corresponding power management controller according to the power control information; S103: Maintain the connectivity of the network link used by the target bare metal computing instance until a preset release condition is met, and release the network link according to the service VLAN configuration information; S104: Query the power status of the bare metal device and determine whether to perform resource reclamation of the target bare metal computing instance based on the query result. This invention provides a complete soft shutdown end-of-life window for bare metal devices, avoiding issues such as interruption of customer shutdown scripts, failure of status write-back, or abnormal heartbeat end-of-life due to premature network disconnection. This improves the success rate of normal shutdown of bare metal computing instances in stop scenarios. At the same time, it ensures that the logical state is only updated after the physical device is truly powered off, solving the problem of inconsistency between the final power-off state and the logical resource state of bare metal devices, and improving shutdown reliability and system consistency.Furthermore, by using at least one of the shutdown completion events and heartbeat timeout events reported by the client as shutdown completion information, the system can utilize the client's active reporting channel to obtain the shutdown status, and passively infer the client's exit status through heartbeat timeout when the reporting channel is abnormal or the client lacks reporting capabilities. This improves the flexibility and reliability of obtaining shutdown completion information. Moreover, by performing a preset number of power status queries at preset time intervals after releasing the network link, and only performing resource reclamation operations when the device is determined to be powered off, the system avoids misjudgments caused by assuming the device is shut down based solely on a single successful shutdown command. This improves the accuracy of shutdown result determination and the determinism of the resource reclamation process, further preventing inconsistent states where resources have been released but the device is still operational. Furthermore, by employing a phased shutdown strategy that prioritizes soft shutdown and uses forced shutdown as a fallback, the system balances graceful business exit with deterministic platform shutdown, resolving the issue of devices remaining operational for extended periods when soft shutdown fails and requiring manual intervention. Simultaneously, by recording various shutdown events during the shutdown process, a system is constructed... A traceable shutdown coordination control link facilitates subsequent auditing and anomaly troubleshooting. Furthermore, a dual confirmation mechanism based on client-side events and power-side status double-checks whether bare metal devices have truly completed shutdown, improving the accuracy of shutdown result determination and preventing erroneous resource reclamation under inconsistent states, further reducing the risk of inconsistencies between logical and physical states. Additionally, by setting a repetitive command cooling control for shutdown commands on the same power port, interference to power equipment and disruption to the shutdown process caused by repeatedly issuing the same type of shutdown command within a short period are avoided, improving the reliability of shutdown command issuance and the controllability of the shutdown process. Moreover, by determining a preset waiting time based on at least one of the client's operating system shutdown time, status reporting latency, and shutdown script execution time, the network connectivity window reserved for the client matches its actual end-of-life needs. This ensures that the client can fully execute the shutdown script, write back the status, and terminate the heartbeat, while avoiding meaningless long-term occupation of network links, balancing shutdown elegance and network resource reclamation efficiency.
[0052] For a clearer understanding of this invention, please refer to the following details. Figure 2 , Figure 2 A flowchart illustrating a shutdown method provided in an embodiment of the present invention may specifically include: Upon receiving a stop request from a bare-metal computing instance, the platform first obtains the device identifier, scheduling record, power control information, and VLAN configuration corresponding to the target instance. Then, the platform queries the power status of the target bare-metal device and detects the client's shutdown completion event. If the device is powered on and has not yet received a shutdown completion signal, a soft shutdown command is sent to the corresponding power supply device / power management controller to trigger a normal operating system shutdown, avoiding an immediate forced power outage. Simultaneously, the platform maintains the VLAN connectivity used by the instance for a preset duration, reserving a network window for the client to execute shutdown scripts, write back status, and exit heartbeats. After the waiting window expires, the platform releases the target VLAN, closes the service link, and enters the shutdown result confirmation phase. During this phase, the platform queries the device's power status multiple times at fixed time intervals to verify whether the physical device is truly powered off. If multiple verifications confirm that the device is powered off, resource reclamation is successfully completed; if the device is still powered on, a forced shutdown command is issued as a fallback, and the power status is checked again after the forced shutdown, finally recording the shutdown result.
[0053] Figure 3 This invention provides a timing diagram illustrating the priority of soft shutdown over delaying network connectivity window retention, demonstrating the timing relationship between soft shutdown and network connectivity window retention. The control plane first sends a soft shutdown command to the corresponding power management controller, triggering the client to enter the operating system shutdown finalization phase. During this period, the client executes a shutdown script, completing operations such as status write-back and heartbeat exit, achieving graceful shutdown on the client side. Simultaneously, the control plane does not immediately release the network link but retains a preset VLAN connectivity window to ensure the client completes the aforementioned finalization work under network reachability conditions. Only after the waiting window expires does the control plane release the VLAN and enter the subsequent confirmation phase. After releasing the network link, the control plane further verifies the power status of the bare metal device, ultimately confirming that the device has been successfully powered off. The entire timing sequence embodies the collaborative control concept of prioritizing soft shutdown, delaying network disconnection, and post-event confirmation.
[0054] Figure 4This is a flowchart illustrating a process for multiple power status verifications and forced shutdown fallback after VLAN release, as provided in this embodiment of the invention. After a preset waiting period, the platform first releases the target VLAN, disconnects the service link, and formally enters the shutdown result confirmation stage. Subsequently, the platform performs multiple power status queries on the bare metal device at preset time intervals, confirming whether the device has truly been powered off through continuous verification. After each query, the system makes a judgment based on the result: if the device is confirmed to be powered off, a graceful shutdown is determined to be successful, resource reclamation is successfully completed, resource release is completed, and the success result is recorded; if the device is still powered on, it indicates that the soft shutdown has not taken effect, and a forced shutdown fallback is automatically executed to directly cut off the power. After the forced shutdown is executed, the process returns to the status verification stage to continue confirming the device's power status, ensuring the certainty of the final shutdown result. This process, through a closed-loop mechanism of multiple verifications, successful completion, forced shutdown upon failure, and continued confirmation after forced shutdown, ensures the final certainty of the physical device's power failure.
[0055] Figure 5 This diagram illustrates the collaborative relationship between client shutdown events, power status confirmation, and resource recovery termination, as provided in an embodiment of the present invention. First, the platform receives a shutdown event proactively reported by the client, or infers that the client has exited the running state based on a heartbeat timeout. Simultaneously, the platform confirms the power status of the bare metal device through multiple queries to determine if the physical device is truly powered off. Subsequently, the system compares the logical shutdown result on the client side with the actual power status on the device side to check for consistency. If the event and status are inconsistent, it indicates a discrepancy between the logical shutdown and the physical power failure; the system retains the abnormal state and continues to execute a forced shutdown or trigger a manual intervention process. If the event and status are consistent, the graceful shutdown is confirmed as successful, the system successfully terminates resource recovery, and ensures that the logical resource status and the physical device status remain ultimately consistent.
[0056] The power-off device provided in the embodiments of the present invention will be described below. The power-off device described below and the power-off method described above can be referred to in correspondence.
[0057] Please refer to the details. Figure 6 , Figure 6 This is a schematic diagram of a power-off device provided in an embodiment of the present invention. The power-off device may include: The information acquisition module 100 is used to acquire the power control information and service VLAN configuration information of the bare metal device corresponding to the target bare metal computing power instance in response to a stop request for the target bare metal computing power instance. The soft shutdown module 200 is used to send a soft shutdown command to the corresponding power management controller according to the power control information when the bare metal device is in the power-on state and has not obtained shutdown completion information. The link release module 300 is used to maintain the connectivity of the network link used by the target bare metal computing instance until the preset release conditions are met, and then release the network link according to the service VLAN configuration information. The resource recycling module 400 is used to query the power status of the bare metal device and determine whether to perform resource recycling of the target bare metal computing power instance based on the query result.
[0058] Furthermore, based on the above embodiments, the resource recycling module 400 may include: The status query unit is used to perform a preset number of power status queries on the bare metal device at preset time intervals; The recycling execution unit is used to perform resource recycling operations on the target bare metal computing power instance when the bare metal device is determined to be in a power-off state based on the result of the power status query of the preset number of times.
[0059] Furthermore, based on the above embodiments, the power-off device may further include: The forced shutdown module is used to issue a forced shutdown command to the bare metal device when the result of the power status query based on the preset number of times determines that the bare metal device is still in a powered-on state, and to perform at least one power status confirmation on the bare metal device; when the result of the at least one power status confirmation determines that the bare metal device is in a powered-off state, to perform a resource reclamation operation on the target bare metal computing power instance; and when the result of the at least one power status confirmation determines that the bare metal device is still in a powered-on state, to record a shutdown abnormal event.
[0060] Furthermore, based on the above embodiments, the power-off device may further include: The consistency judgment module is used to perform a consistency judgment between the shutdown completion information on the client side corresponding to the target bare metal computing power instance and the power status confirmation result of the bare metal device before executing the resource reclamation operation of the target bare metal computing power instance; if they are consistent, the resource reclamation operation is executed; if they are inconsistent, the resource reclamation operation is not executed, the abnormal state is retained and the shutdown process event information is recorded.
[0061] Furthermore, based on the above embodiments, the shutdown completion information may include at least one of the shutdown completion event reported by the client corresponding to the target bare metal computing power instance and the client's heartbeat timeout event.
[0062] Furthermore, based on the above embodiments, the link release module 300 may include: The release unit is used to maintain the connectivity of the network link used by the target bare metal computing instance. When a preset waiting time is reached, the network link is released according to the service VLAN configuration information. The preset waiting time is determined based on at least one of the following: the operating system shutdown time of the client machine corresponding to the target bare metal computing instance, the status reporting delay, and the shutdown script execution time.
[0063] Furthermore, based on the above embodiments, the power-off device may further include: The cooling control module is used to set up repeated command cooling control for the shutdown command of the same power port indicated by the power control information when a shutdown command is sent to the bare metal device, so as to prevent the repeated issuance of the same type of shutdown command within a preset cooling time.
[0064] It should be noted that the order of the modules and units in the above-mentioned shutdown device can be changed without affecting the logic.
[0065] The shutdown device provided in this embodiment of the invention includes an information acquisition module 100, which, in response to a stop request for a target bare-metal computing instance, acquires the power control information and service VLAN configuration information of the bare-metal device corresponding to the target bare-metal computing instance; a soft shutdown module 200, which, when the bare-metal device is powered on and has not acquired shutdown completion information, sends a soft shutdown command to the corresponding power management controller based on the power control information; a link release module 300, which maintains the connectivity of the network link used by the target bare-metal computing instance until a preset release condition is met, and releases the network link based on the service VLAN configuration information; and a resource reclamation module 400, which queries the power status of the bare-metal device and determines whether to perform resource reclamation of the target bare-metal computing instance based on the query result. This invention provides a complete soft shutdown end-of-life window for bare metal devices, avoiding issues such as interruption of customer shutdown scripts, failure of status write-back, or abnormal heartbeat end-of-life due to premature network disconnection. This improves the success rate of normal shutdown of bare metal computing instances in stop scenarios. At the same time, it ensures that the logical state is only updated after the physical device is truly powered off, solving the problem of inconsistency between the final power-off state and the logical resource state of bare metal devices, and improving shutdown reliability and system consistency.Furthermore, by using at least one of the shutdown completion events and heartbeat timeout events reported by the client as shutdown completion information, the system can utilize the client's active reporting channel to obtain the shutdown status, and passively infer the client's exit status through heartbeat timeout when the reporting channel is abnormal or the client lacks reporting capabilities. This improves the flexibility and reliability of obtaining shutdown completion information. Moreover, by performing a preset number of power status queries at preset time intervals after releasing the network link, and only performing resource reclamation operations when the device is determined to be powered off, the system avoids misjudgments caused by assuming the device is shut down based solely on a single successful shutdown command. This improves the accuracy of shutdown result determination and the determinism of the resource reclamation process, further preventing inconsistent states where resources have been released but the device is still operational. Furthermore, by employing a phased shutdown strategy that prioritizes soft shutdown and uses forced shutdown as a fallback, the system balances graceful business exit with the determinism of platform shutdown, resolving the issue of devices remaining operational for extended periods when soft shutdown fails and requiring manual intervention. Simultaneously, by recording various shutdown events during the shutdown process, a system is constructed... A traceable shutdown coordination control link is established, facilitating subsequent auditing and anomaly troubleshooting. Furthermore, a dual confirmation mechanism based on client-side events and power-side status provides a double check to determine whether the device has truly completed shutdown, improving the accuracy of shutdown result determination and preventing erroneous resource reclamation under inconsistent states, further reducing the risk of inconsistencies between logical and physical states. Additionally, by setting a repetitive command cooling control for shutdown commands on the same power port, interference to power equipment and disruption to the shutdown process caused by repeatedly issuing the same type of shutdown command within a short period are avoided, improving the reliability of shutdown command issuance and the controllability of the shutdown process. Moreover, by determining a preset waiting time based on at least one of the client's operating system shutdown time, status reporting latency, and shutdown script execution time, the network connectivity window reserved for the client matches its actual end-of-life needs. This ensures that the client can fully execute the shutdown script, write back the status, and terminate the heartbeat, while avoiding meaningless long-term occupation of network links, balancing shutdown elegance and network resource reclamation efficiency.
[0066] The shutdown device provided in the embodiments of the present invention will be described below. The shutdown device described below and the shutdown method described above can be referred to in correspondence.
[0067] Please refer to Figure 7 , Figure 7 A schematic diagram of a shutdown device provided in an embodiment of the present invention may include: Memory 10 is used to store computer programs; Processor 20 is used to execute computer programs to implement the shutdown method described above.
[0068] The memory 10, processor 20, and communication interface 31 all communicate with each other through the communication bus 32.
[0069] In this embodiment of the invention, the memory 10 is used to store one or more programs. The programs may include program code, which includes computer operation instructions. In this embodiment of the invention, the memory 10 may store programs for implementing the following functions: In response to a stop request for the target bare metal computing instance, obtain the power control information and service VLAN configuration information of the bare metal device corresponding to the target bare metal computing instance; When the bare metal device is powered on and has not received shutdown completion information, a soft shutdown command is sent to the corresponding power management controller according to the power control information. Maintain the connectivity of the network link used by the target bare metal computing instance until the preset release conditions are met, and then release the network link according to the service VLAN configuration information. Query the power status of bare metal devices and determine whether to perform resource reclamation of the target bare metal computing instance based on the query results.
[0070] In one possible implementation, the memory 10 may include a program storage area and a data storage area, wherein the program storage area may store the operating system and applications required for at least one function; and the data storage area may store data created during use.
[0071] Furthermore, memory 10 may include read-only memory and random access memory, providing instructions and data to the processor. A portion of the memory may also include NVRAM. The memory stores operating systems and operating instructions, executable modules, or data structures, or subsets thereof, or extended sets thereof, wherein the operating instructions may include various operating instructions for implementing various operations. The operating system may include various system programs for implementing various basic tasks and handling hardware-based tasks.
[0072] Processor 20 can be a central processing unit (CPU), an application-specific integrated circuit, a digital signal processor, a field-programmable gate array, or other programmable logic device. Processor 20 can be a microprocessor or any conventional processor. Processor 20 can call programs stored in memory 10.
[0073] Communication interface 31 can be an interface for the communication module, used to connect with other devices or systems.
[0074] Of course, it should be noted that, Figure 7The structure shown does not constitute a limitation on the power-off device in the embodiments of the present invention. In practical applications, the power-off device may include devices such as... Figure 7 More or fewer components as shown, or combinations of certain components.
[0075] It is understood that if the shutdown method in the above embodiments is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the current technology, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and executes all or part of the steps of the methods in the various embodiments of the present invention. The aforementioned storage medium includes: USB flash drive, mobile hard disk, read-only memory (ROM), random access memory (RAM), electrically erasable programmable ROM, register, hard disk, removable disk, CD-ROM, magnetic disk or optical disk, and other media capable of storing program code.
[0076] Based on this, embodiments of the present invention also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the shutdown method described above.
[0077] The following describes a computer program product provided by an embodiment of this application. The computer program product described below can be referred to in conjunction with other embodiments described herein.
[0078] A computer program product includes a computer program / instructions that, when executed by a processor, implement the steps of the aforementioned disclosed shutdown method.
[0079] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0080] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0081] Finally, it should be noted that in this document, relationships such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.
[0082] The foregoing has provided a detailed description of a shutdown method, apparatus, device, and computer-readable storage medium provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for shutting down a device, characterized in that, include: In response to a stop request for the target bare metal computing instance, obtain the power control information and service VLAN configuration information of the bare metal device corresponding to the target bare metal computing instance; When the bare metal device is powered on and has not received shutdown completion information, a soft shutdown command is sent to the corresponding power management controller according to the power control information. Maintain the connectivity of the network link used by the target bare metal computing instance until the preset release condition is met, and then release the network link according to the service VLAN configuration information. Query the power status of the bare metal device, and determine whether to perform resource reclamation of the target bare metal computing instance based on the query results.
2. The shutdown method according to claim 1, characterized in that, Query the power status of the bare metal device, and determine whether to perform resource reclamation of the target bare metal computing instance based on the query results, including: The power status of the bare metal device is queried a preset number of times at preset time intervals; If the bare metal device is determined to be in a power-off state based on the results of the preset number of power status queries, then the resource reclamation operation of the target bare metal computing power instance is executed.
3. The shutdown method according to claim 2, characterized in that, Also includes: If the bare metal device is determined to be still powered on based on the results of the preset number of power status queries, a forced shutdown command is sent to the bare metal device, and the power status is confirmed at least once for the bare metal device. If the bare metal device is determined to be in a power-off state based on the results of at least one power status confirmation, then the resource reclamation operation of the target bare metal computing power instance is executed. If the bare metal device is determined to be still powered on based on the results of at least one power status confirmation, then a shutdown abnormality event is recorded.
4. The shutdown method according to claim 3, characterized in that, Before performing the resource reclamation operation on the target bare metal computing instance, the following steps are also included: The consistency of the shutdown completion information on the client side corresponding to the target bare metal computing power instance with the power status confirmation result of the bare metal device is determined. If they match, then perform the resource reclamation operation. If there is a discrepancy, the resource reclamation operation will not be performed, the abnormal state will be retained, and the shutdown process event information will be recorded.
5. The shutdown method according to claim 1, characterized in that, The shutdown completion information includes at least one of the shutdown completion event reported by the client corresponding to the target bare metal computing power instance and the client's heartbeat timeout event.
6. The shutdown method according to any one of claims 1 to 5, characterized in that, Maintain the connectivity of the network link used by the target bare metal computing instance until a preset release condition is met, and then release the network link according to the service VLAN configuration information, including: Maintain the connectivity of the network link used by the target bare metal computing instance. When the preset waiting time is reached, release the network link according to the service VLAN configuration information. The preset waiting time is determined based on at least one of the following: the operating system shutdown time of the client machine corresponding to the target bare metal computing instance, the status reporting delay, and the shutdown script execution time.
7. The shutdown method according to claim 1, characterized in that, Also includes: When a shutdown command is sent to the bare metal device, a repeat command cooling control is set for the shutdown command of the same power port indicated by the power control information, so as to prevent the repeated issuance of the same type of shutdown command within a preset cooling time.
8. A power-off device, characterized in that, include: The information acquisition module is used to acquire the power control information and service VLAN configuration information of the bare metal device corresponding to the target bare metal computing power instance in response to a stop request for the target bare metal computing power instance. The soft shutdown module is used to send a soft shutdown command to the corresponding power management controller according to the power control information when the bare metal device is in the power-on state and has not obtained shutdown completion information; The link release module is used to maintain the connectivity of the network link used by the target bare metal computing instance until the preset release conditions are met, and then release the network link according to the service VLAN configuration information. The resource recycling module is used to query the power status of the bare metal device and determine whether to perform resource recycling of the target bare metal computing power instance based on the query results.
9. A shutdown device, characterized in that, include: Memory, used to store computer programs; A processor for implementing the shutdown method as described in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when loaded and executed by a processor, implement the shutdown method as described in any one of claims 1 to 7.