CN115543539A - Virtual machine password resetting method, device and medium - Google Patents

Virtual machine password resetting method, device and medium Download PDF

Info

Publication number
CN115543539A
CN115543539A CN202211260160.0A CN202211260160A CN115543539A CN 115543539 A CN115543539 A CN 115543539A CN 202211260160 A CN202211260160 A CN 202211260160A CN 115543539 A CN115543539 A CN 115543539A
Authority
CN
China
Prior art keywords
virtual machine
identifier
snapshot
reconstructed
password
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211260160.0A
Other languages
Chinese (zh)
Inventor
李东世
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Inspur Jinan data Technology Co ltd
Original Assignee
Inspur Jinan data Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Inspur Jinan data Technology Co ltd filed Critical Inspur Jinan data Technology Co ltd
Priority to CN202211260160.0A priority Critical patent/CN115543539A/en
Publication of CN115543539A publication Critical patent/CN115543539A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/45Structures or tools for the administration of authentication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45562Creating, deleting, cloning virtual machine instances
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45575Starting, stopping, suspending or resuming virtual machine instances
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45587Isolation or security of virtual machine instances
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/21Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/2131Lost password, e.g. recovery of lost or forgotten passwords

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Stored Programmes (AREA)

Abstract

The application relates to the field of servers and discloses a method, a device and a medium for resetting a virtual machine password, which comprise the following steps: when a reconstruction instruction is detected, acquiring a reconstruction image file corresponding to the reconstruction instruction so as to reconstruct the virtual machine according to the reconstruction image file; judging whether the reconstructed image file is a virtual machine snapshot or not, and if the reconstructed image file is the virtual machine snapshot, modifying a first identifier of a virtual machine corresponding to the virtual machine snapshot to obtain the reconstructed snapshot, wherein the virtual machine has a first identifier and a second identifier, and the first identifier is a universal unique identification code; the second identifier is a unique identifier in the virtual machine platform. And creating a reconstructed virtual machine according to the reconstructed snapshot, and calling a virtual machine initialization process to reset the password of the reconstructed virtual machine. The first identifier and the second identifier are set inside the virtual machine, and the first identifier is modified when the reestablishment virtual machine is created by using the initial virtual machine image snapshot, so that the initialization process can run in the reestablishment virtual machine to reset the password.

Description

Virtual machine password resetting method, device and medium
Technical Field
The present application relates to the field of servers, and in particular, to a method, an apparatus, and a medium for resetting a virtual machine secret code.
Background
With the development of cloud computing technology, more and more users choose to upload data and services to a cloud computing platform, and currently, the virtual machines are generally managed through an OpenStack platform so as to provide cloud computing services for the users. The Cloud-Init is a setting process provided by the OpenStack platform, and is used for executing a virtual machine initialization setting task when a virtual machine is started for the first time after being created, and generating a running record under a fixed directory after the initialization setting task is executed, wherein the running record corresponds to a Universal Unique Identifier (UUID) of the virtual machine, and indicates that the Cloud-Init process has successfully run on the virtual machine corresponding to the UUID.
When the operating system of the virtual machine crashes and cannot be repaired, the initial image is generally selected to be used for recovering and rebuilding the virtual machine. In order to restore each attribute information of the virtual machine as much as possible, the initial image used is mostly a snapshot of the original virtual machine. Before and after the virtual machine is reconstructed, the UUIDs of the virtual machine are the same, the operation record of the Cloud-Init in the virtual machine corresponding to the UUIDs is stored in the reconstructed virtual machine system, and the Cloud-Init process cannot be executed again, so that the initialization setting of the virtual machine fails, and a user cannot reset the password of the virtual machine. When the user forgets the password of the virtual machine, the virtual machine cannot be started, and the normal work of the user is influenced.
Therefore, how to provide a method for resetting a virtual machine password to prevent the failure of initialization setting of the virtual machine and the failure of resetting the virtual machine password due to the incapability of executing the Cloud-Init process after the virtual machine is rebuilt and improve the reliability and the security of the virtual machine is a problem that needs to be solved by technical personnel in the field.
Disclosure of Invention
The application aims to provide a method, a device and a medium for resetting a virtual machine password, so as to prevent the failure of initialization setting of the virtual machine and the incapability of resetting the virtual machine password caused by the incapability of executing a Cloud-Init process after the virtual machine is rebuilt by using a virtual machine mirror image snapshot, and improve the reliability and the safety of the virtual machine.
In order to solve the above technical problem, the present application provides a method for resetting a virtual machine code, which is applied to a virtual machine under an OpenStack platform, and includes:
when a reconstruction instruction is detected, acquiring a reconstruction image file corresponding to the reconstruction instruction;
judging whether the reconstructed mirror image file is a virtual machine snapshot or not;
if the virtual machine snapshot is obtained, modifying a first identifier of an initial virtual machine corresponding to the virtual machine snapshot to obtain a reconstructed snapshot, wherein the initial virtual machine has the first identifier and a second identifier, the first identifier is a universal unique identifier of the initial virtual machine, and the second identifier is a unique identifier of the initial virtual machine in an OpenStack platform;
and creating a reconstructed virtual machine according to the reconstructed snapshot, and calling a virtual machine initialization process to reset the password of the reconstructed virtual machine.
Preferably, after the step of modifying the first identifier of the initial virtual machine corresponding to the virtual machine snapshot to obtain the rebuilt snapshot, the method further includes:
updating a first identifier in a relational database, wherein the relational database is a database storing the corresponding relation between the first identifier and the second identifier.
Preferably, the invoking the virtual machine initialization process to reset the password of the rebuilt virtual machine includes:
executing the Cloud-Init process to obtain a password resetting instruction input by a user;
and updating the password of the reestablished virtual machine according to the password resetting instruction.
Preferably, before the step of modifying the first identifier of the initial virtual machine corresponding to the virtual machine snapshot to obtain the rebuilt snapshot, the method further includes:
judging whether the nova database of the OpenStack platform comprises the second identifier or not;
and if the second identifier exists, executing the step of modifying the first identifier of the initial virtual machine corresponding to the virtual machine snapshot to obtain a reconstructed snapshot.
Preferably, after the step of determining whether the nova database of the OpenStack platform includes the second identifier, the method further includes:
if the second identifier does not exist, adding the second identifier into the nova database, wherein the initial value of the second identifier is the universal unique identification code;
and creating an interface function based on the second identifier so that the OpenStack platform can call the corresponding virtual machine through the second identifier.
Preferably, before the step of obtaining the reconstructed image file corresponding to the reconstruction instruction, the method further includes:
judging whether the current time meets a preset condition or not;
and if the preset condition is met, creating the virtual machine image snapshot for the initial virtual machine.
Preferably, after the step of updating the password for reconstructing the virtual machine according to the password resetting instruction, the method further includes:
judging whether a password resetting success signal generated by the Cloud-Init process is received within a threshold time;
and if the password resetting success signal is not acquired, sending early warning information to a manager.
In order to solve the above technical problem, the present application further provides a virtual machine password resetting device, which is applied to a virtual machine under an OpenStack platform, and includes:
the device comprises an acquisition module, a reconstruction module and a reconstruction module, wherein the acquisition module is used for acquiring a reconstruction image file corresponding to a reconstruction instruction when the reconstruction instruction is detected;
the judging module is used for judging whether the reconstructed mirror image file is a virtual machine snapshot or not;
a modification module, configured to modify a first identifier of an initial virtual machine corresponding to the virtual machine snapshot to obtain a reconstructed snapshot if the initial virtual machine is the virtual machine snapshot, where the initial virtual machine has the first identifier and a second identifier, the first identifier is a universal unique identifier of the initial virtual machine, and the second identifier is a unique identifier of the initial virtual machine in an OpenStack platform;
and the creating module is used for creating a reconstructed virtual machine according to the reconstructed snapshot and calling a virtual machine initialization process to reset the password of the reconstructed virtual machine.
In order to solve the above technical problem, the present application further provides a virtual machine password resetting apparatus, including a memory for storing a computer program;
and the processor is used for realizing the steps of the virtual secret code resetting method when the computer program is executed.
In order to solve the above technical problem, the present application further provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the steps of the virtual secret code resetting method.
The application provides a virtual machine code resetting method, which is applied to a virtual machine under an OpenStack platform and comprises the following steps: when a reconstruction instruction is detected, acquiring a reconstruction image file corresponding to the reconstruction instruction so as to reconstruct the virtual machine according to the reconstruction image file; judging whether the reconstructed mirror image file is a virtual machine snapshot or not, and if the reconstructed mirror image file is the virtual machine snapshot, modifying a first identifier of a virtual machine corresponding to the virtual machine snapshot to obtain the reconstructed snapshot, wherein the virtual machine has a first identifier and a second identifier, and the first identifier is a universal unique identifier of an initial virtual machine, so that a Cloud-Init program can run in the newly-built virtual machine after the first identifier is changed; the second identifier is a unique identifier of the initial virtual machine in the OpenStack platform, so that a user can call the virtual machine in the OpenStack platform through the second identifier. And creating a reconstructed virtual machine according to the reconstructed snapshot, and calling a virtual machine initialization process to reset the password of the reconstructed virtual machine. Therefore, the virtual machine code resetting method provided by the application enables the Cloud-Init process to run in the rebuilt virtual machine to reset the password by setting the first identifier and the second identifier inside the virtual machine and modifying the first identifier when the rebuilt virtual machine is created by using the initial virtual machine image snapshot.
In addition, the application also provides a virtual machine password resetting device and a virtual machine password resetting medium, which correspond to the method and have the same effects.
Drawings
In order to more clearly illustrate the embodiments of the present application, the drawings needed for the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings can be obtained by those skilled in the art without inventive effort.
Fig. 1 is a flowchart of a method for resetting a virtual machine secret code according to an embodiment of the present disclosure;
fig. 2 is a timing diagram of creating a virtual machine based on a snapshot according to an embodiment of the present disclosure;
fig. 3 is a structural diagram of a virtual machine password resetting apparatus according to an embodiment of the present disclosure;
fig. 4 is a structural diagram of a virtual machine password resetting apparatus according to another embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only some embodiments of the present application, and not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without any creative effort belong to the protection scope of the present application.
The core of the application is to provide a method, a device and a medium for resetting the virtual machine password, so as to prevent the failure of the initialization setting of the virtual machine and the failure of resetting the virtual machine password due to the fact that the Cloud-Init process cannot be executed after the virtual machine is reconstructed by using the original virtual machine mirror image snapshot, and improve the reliability and the safety of the virtual machine.
In the working process of the server, the user may forget the password of the virtual machine, and in order to prevent the problem, the user password may be reset in a manner of rebuilding the virtual machine. In order to preserve user data as much as possible, the virtual machine may be rebuilt using a mirror snapshot created by the user during use. However, resetting the virtual machine secret code requires starting the virtual machine initialization process, which cannot be executed in the virtual machine that has executed the process, resulting in a failure in resetting the virtual machine secret code. In order to solve the problem, the application provides a virtual machine code resetting method, which enables a virtual machine initialization process to run in a rebuilt virtual machine to reset a code by setting a first identifier and a second identifier inside the virtual machine and modifying the first identifier when the rebuilt virtual machine is created by using an initial virtual machine image snapshot. The first identifier is a universal unique identifier of the initial virtual machine, so that the Cloud-Init program can run in the newly-built virtual machine after the first identifier is changed; the second identifier is a unique identifier of the initial virtual machine in the OpenStack platform, so that a user can call the virtual machine in the OpenStack platform through the second identifier.
The technical scheme provided by the application is applied to a server running with an OpenStack platform, and it should be noted that the scheme is described by using a server architecture of an Intel platform, but the method is not limited to the server of the Intel platform and is not limited to a server system, and the method still has a general application value on server systems of other platforms or other computer systems.
In order that those skilled in the art will better understand the disclosure, the following detailed description will be given with reference to the accompanying drawings.
Fig. 1 is a flowchart of a method for resetting a virtual secret code according to an embodiment of the present disclosure, as shown in fig. 1, the method includes:
s10: and when the reconstruction instruction is detected, acquiring a reconstruction image file corresponding to the reconstruction instruction.
S11: and judging whether the reconstructed mirror image file is a virtual machine snapshot or not.
In specific implementation, when a reconstruction instruction sent by a user is detected, a virtual machine reconstruction process is started, and a reconstruction image file used for reconstructing the virtual machine is obtained. It can be understood that the reconstructed image file may be a blank image file corresponding to the initial virtual machine, or may be a virtual machine snapshot stored in the use process of the initial virtual machine.
It should be noted that, since the virtual machine initialization process used for resetting the password is a Cloud-Init process, after the initial task is completed, a running log which cannot be modified is generated under a specified directory in the virtual machine, and when the running log exists, the virtual machine cannot execute the Cloud-Init task again when being started again. In this embodiment, when the blank mirror image file is used to execute the virtual machine rebuilding task, the running log of the Cloud-Init task does not exist in the virtual machine system, and the password resetting process can be executed; when the virtual machine snapshot is used for executing the reconstruction task, the corresponding running log exists in the virtual machine system, and the password can be reset only by using the password resetting scheme provided by the application. Therefore, the reconstructed image file used by the reconstructed virtual machine needs to be judged to determine the subsequent flow.
S12: if the virtual machine snapshot is obtained, modifying a first identifier of an initial virtual machine corresponding to the virtual machine snapshot to obtain a reconstructed snapshot, wherein the initial virtual machine has the first identifier and a second identifier, the first identifier is a universal unique identifier of the initial virtual machine, and the second identifier is a unique identifier of the initial virtual machine in an OpenStack platform;
s13: and creating a reconstructed virtual machine according to the reconstructed snapshot, and calling a virtual machine initialization process to reset the password of the reconstructed virtual machine.
In the OpenStack system, in order to ensure that each virtual machine can be normally used, different unique identifiers need to be created for each virtual machine, and the running log of the Cloud-Init is a log file generated according to the unique identifiers. In order to solve the problem, an additional identifier (UID) is set in the virtual machine in the embodiment, wherein the first identifier is a Universally Unique Identifier (UUID) of the initial virtual machine, so that the Cloud-Init program can run in the newly-built virtual machine after the first identifier is changed; the second identifier is a Unique Identifier (UID) of the initial virtual machine in the OpenStack platform, so that a user can call the virtual machine in the OpenStack platform through the second identifier.
In a specific implementation, the first identifier is used to ensure that underlying applications and processes in the virtual machine system can be executed according to the first identifier, so as to ensure that the virtual machine can work normally. The second identifier is a unique identifier of the virtual machine in the OpenStack platform, and is used for a user or a manager to operate the virtual machine process through the OpenStack platform.
In specific implementation, the second identifier UID is used for uniquely identifying one virtual machine, when the virtual machine does not perform reconstruction operation, the value of the field and the first identifier UUID of the original field take the same value, at this time, two fields can simultaneously identify one virtual machine, and when the virtual machine performs reconstruction operation, the original first identifier UUID value is modified into a new UUID value, and the second identifier UID is unchanged, so that the virtual machine has the new UUID value after reconstruction, the virtual machine internally recognizes the new UUID value, the task of resetting the password can be normally performed, the resetting password can be successfully performed, and the function of resetting the password of the virtual machine in the reconstruction process is realized.
Fig. 2 is a timing diagram of creating a virtual machine based on a snapshot according to an embodiment of the present application, and as shown in fig. 2, a process of creating a virtual machine includes:
s20: acquiring a reconstruction instruction sent by a user, calling and determining a target virtual machine corresponding to the instruction according to a first identifier UUID in the user reconstruction instruction, and acquiring related information of the target virtual machine;
s21: and acquiring a target image required by the virtual machine reconstruction according to the reconstruction instruction, wherein the target image comprises a blank image and a virtual machine snapshot.
S22: updating an Instance table of the OpenStack platform;
s23: adding a UID field and a related interface function into an instance table;
s24: sending an RPC request to a Nova _ scheduler process to select a computing node for mounting and reconstructing a virtual machine;
s25: synchronizing the updated Instance table to the Nova _ computer process;
s26: acquiring a mirror image file corresponding to the first identifier UUID, and sending the mirror image file to a company for processing;
s27: updating a task list (task _ state) of the Nova _ computer process;
s28: destroying an instance table in a libvirt process;
s29: and updating a memory table (vm _ state) and a task table (task _ state) in the OpenStack platform database.
The embodiment provides a virtual machine code resetting method, which is applied to a virtual machine under an OpenStack platform and comprises the following steps: when a reconstruction instruction is detected, acquiring a reconstruction image file corresponding to the reconstruction instruction so as to reconstruct the virtual machine according to the reconstruction image file; judging whether the reconstructed mirror image file is a virtual machine snapshot or not, and if the reconstructed mirror image file is the virtual machine snapshot, modifying a first identifier of a virtual machine corresponding to the virtual machine snapshot to obtain the reconstructed snapshot, wherein the virtual machine has a first identifier and a second identifier, and the first identifier is a universal unique identifier of an initial virtual machine, so that a Cloud-Init program can run in the newly-built virtual machine after the first identifier is changed; the second identifier is a unique identifier of the initial virtual machine in the OpenStack platform, so that a user can call the virtual machine in the OpenStack platform through the second identifier. And creating a reconstructed virtual machine according to the reconstructed snapshot, and calling a virtual machine initialization process to reset the password of the reconstructed virtual machine. Therefore, the virtual machine code resetting method provided by the application enables the Cloud-Init process to run in the rebuilt virtual machine to reset the password by setting the first identifier and the second identifier inside the virtual machine and modifying the first identifier when the rebuilt virtual machine is created by using the initial virtual machine image snapshot.
As a preferred embodiment, before the step of modifying the first identifier of the initial virtual machine corresponding to the virtual machine snapshot to obtain the reconstructed snapshot, the method further includes:
judging whether a nova database of the OpenStack platform comprises a second identifier or not;
and if the second identifier exists, modifying the first identifier of the initial virtual machine corresponding to the virtual machine snapshot to acquire a rebuilt snapshot.
If the second identifier does not exist, adding the second identifier into the nova database if the second identifier does not exist, wherein the initial value of the second identifier is a universal unique identification code; and creating an interface function based on the second identifier so that the OpenStack platform can call the corresponding virtual machine through the second identifier. And is arranged at
As a preferred embodiment, after the step of modifying the first identifier of the initial virtual machine corresponding to the virtual machine snapshot to obtain the rebuilt snapshot, the method further includes:
and updating the first identifier in a relational database, wherein the relational database is a database for storing the corresponding relation between the first identifier and the second identifier.
In specific implementation, the OpenStack platform calls a virtual machine with a UUID corresponding to the UID through the UID to execute a task, so that the corresponding relationship between the UID and the UUID needs to be stored in a relational database to ensure that the virtual machine can work normally.
Further, the process of adding the second identifier UID to the virtual machine includes:
(1) And expanding the OpenStack nova database, and adding an UID field in an instances table of the OpenStack nova database, wherein the UID field is used for uniquely identifying one virtual machine, and the initial value of the UID field is the value of the first identifier UUID of the current virtual machine.
(2) And expanding the nova service data operation interface of the virtual machine to adapt the expanded instances table, and adding a new interface to the instances table to ensure that a user or a manager of the OpenStack platform can perform read-write operation on the table record through the UID field of the second identifier.
(3) Expanding the object item of the nova item, adding a new attribute second identifier UID in the Instance object class, and adding a corresponding interface get _ by _ UID, wherein the interface can ensure that a user or a manager UID of the OpenStack platform obtains the virtual machine Instance.
(4) Modifying the nova _ api service of the OpenStack to reconstruct the virtual machine interface, and adding the following processing logic in the original processing flow: and regenerating the UUID of the virtual machine, and writing the new UUID into the database for storage.
(5) And modifying the rest part of the reconstruction process, and modifying the logic for identifying the virtual machine by using the UUID into the new field UID.
(6) And modifying interfaces of inquiry, modification, deletion, pause, suspension, reset and the like of the virtual machine, and supporting a user to carry out the above operations on the virtual machine through the UID of the virtual machine.
(7) Modifying a virtual machine creation interface, taking a first identifier UUID of the virtual machine as a value of a second identifier UID when the virtual machine is created, storing the value of the first identifier UUID and the value of the second identifier UID in a database, keeping the same value of the first identifier UUID and the second identifier UID under the default condition, and modifying the value of the first identifier UUID to enable the value of the first identifier UUID and the value of the second identifier UID to be different when the virtual machine is reconstructed.
On the basis of the above embodiment, invoking the virtual machine initialization process to reset the password for rebuilding the virtual machine includes: executing the Cloud-Init process to obtain a password resetting instruction input by a user; and updating the password for rebuilding the virtual machine according to the password resetting instruction.
The Cloud-init is a tool developed specifically for the initialization of virtual machines in a Cloud environment that reads relevant data from various data sources and configures the virtual machines accordingly. Common data sources include: the method includes the following steps of providing metadata service, configDrive and the like of a cloud platform, wherein common configurations include: setting the hostname and hosts files of the virtual machine, setting the user name and password, updating the local cache of apt-get, adjusting the size of the file system and the like.
It should be noted that, in order to ensure the normal use of the password by the user, it is also necessary to determine whether the password is successfully reset. After the step of updating the password for reconstructing the virtual machine according to the password resetting instruction, the method further comprises the following steps: judging whether a password resetting success signal generated by the Cloud-Init process is received within the threshold time; and if the password resetting success signal is not acquired, sending early warning information to a manager.
It should be noted that, in order to prevent data loss during the process of using the virtual machine by the user, on the basis of the above embodiment, a snapshot needs to be created for each virtual machine in each backup cycle to backup data and files.
As a preferred embodiment, before the step of obtaining the rebuilt image file corresponding to the rebuilt instruction, the method further includes: judging whether the current time meets a preset condition or not; and if the preset conditions are met, creating a virtual machine image snapshot for the initial virtual machine. The backup period may be a fixed period set by a user, or may be a variable period determined according to a data variation or a service pressure (for example, when the data variation is greater than a threshold, or when the service pressure is higher than the threshold, in order to prevent a virtual machine from failing at this time and causing a large amount of data to be lost, a virtual machine snapshot needs to be created to backup the data).
In the foregoing embodiments, the virtual machine password resetting method is described in detail, and the present application also provides embodiments corresponding to the virtual machine password resetting apparatus. It should be noted that the present application describes the embodiments of the apparatus portion from two perspectives, one is from the perspective of the function module, and the other is from the perspective of the hardware.
Fig. 3 is a structural diagram of a virtual machine password resetting device according to an embodiment of the present disclosure, which is applied to a virtual machine under an OpenStack platform, and includes:
the obtaining module 10 is configured to obtain a reconstructed image file corresponding to a reconstruction instruction when the reconstruction instruction is detected;
the judging module 11 is configured to judge whether the reconstructed mirror image file is a virtual machine snapshot;
the modification module 12 is configured to modify a first identifier of an initial virtual machine corresponding to a virtual machine snapshot to obtain a reconstructed snapshot if the virtual machine snapshot is the virtual machine snapshot, where the initial virtual machine has the first identifier and a second identifier, the first identifier is a universal unique identifier of the initial virtual machine, and the second identifier is a unique identifier of the initial virtual machine in an OpenStack platform;
and the creating module 13 is configured to create a reconstructed virtual machine according to the reconstructed snapshot, and call a virtual machine initialization process to reset a password of the reconstructed virtual machine.
In addition, the virtual machine password resetting device provided by this embodiment further includes: the system comprises an identifier updating module, an identifier judging module, a database updating module, a snapshot creating module and an early warning module;
the identifier updating module is used for updating a first identifier in a relational database, wherein the relational database is used for storing the corresponding relation between the first identifier and a second identifier.
The identifier judging module is used for judging whether a nova database of the OpenStack platform comprises a second identifier; and if the second identifier exists, modifying the first identifier of the initial virtual machine corresponding to the virtual machine snapshot to acquire a rebuilt snapshot.
The database updating module is used for adding a second identifier into the nova database if the second identifier does not exist, and the initial value of the second identifier is a universal unique identification code; and creating an interface function based on the second identifier so that the OpenStack platform can call the corresponding virtual machine through the second identifier.
The snapshot creating module is used for judging whether the current time meets a preset condition or not; and if the preset conditions are met, creating a virtual machine image snapshot for the initial virtual machine.
The early warning module is used for judging whether a password resetting success signal generated by the Cloud-Init process is received within the threshold time; and if the password resetting success signal is not acquired, sending early warning information to a manager.
Since the embodiment of the apparatus portion and the embodiment of the method portion correspond to each other, please refer to the description of the embodiment of the method portion for the embodiment of the apparatus portion, and details are not repeated here.
This embodiment provides a virtual machine password resetting means, is applied to the virtual machine under the OpenStack platform, includes: when a reconstruction instruction is detected, acquiring a reconstruction image file corresponding to the reconstruction instruction so as to reconstruct the virtual machine according to the reconstruction image file; judging whether the reconstructed mirror image file is a virtual machine snapshot or not, and if the reconstructed mirror image file is the virtual machine snapshot, modifying a first identifier of a virtual machine corresponding to the virtual machine snapshot to obtain the reconstructed snapshot, wherein the virtual machine has a first identifier and a second identifier, and the first identifier is a universal unique identifier of an initial virtual machine, so that a Cloud-Init program can run in the newly-built virtual machine after the first identifier is changed; the second identifier is a unique identifier of the initial virtual machine in the OpenStack platform, so that a user can call the virtual machine in the OpenStack platform through the second identifier. And creating a reconstructed virtual machine according to the reconstructed snapshot, and calling a virtual machine initialization process to reset the password of the reconstructed virtual machine. Therefore, the virtual machine password resetting device provided by the application enables the Cloud-Init process to run in the rebuilt virtual machine to reset the password by setting the first identifier and the second identifier inside the virtual machine and modifying the first identifier when the rebuilt virtual machine is created by using the initial virtual machine image snapshot.
Fig. 4 is a structural diagram of a virtual machine password resetting device according to another embodiment of the present application, and as shown in fig. 4, the virtual machine password resetting device includes: a memory 20 for storing a computer program;
the processor 21, when executing the computer program, is configured to implement the steps of the virtual machine secret code resetting method according to the above-mentioned embodiment.
The server provided by the embodiment may include, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, or the like.
The processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The Processor 21 may be implemented in hardware using at least one of a Digital Signal Processor (DSP), a Field-Programmable Gate Array (FPGA), and a Programmable Logic Array (PLA). The processor 21 may also include a main processor and a coprocessor, where the main processor is a processor for Processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 21 may be integrated with a Graphics Processing Unit (GPU) which is responsible for rendering and drawing the content required to be displayed by the display screen. In some embodiments, the processor 21 may further include an Artificial Intelligence (AI) processor for processing computing operations related to machine learning.
The memory 20 may include one or more computer-readable storage media, which may be non-transitory. Memory 20 may also include high speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In this embodiment, the memory 20 is at least used for storing the computer program 201, wherein after being loaded and executed by the processor 21, the computer program can implement the relevant steps of the virtual secret code resetting method disclosed in any one of the foregoing embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202, data 203, and the like, and the storage manner may be a transient storage manner or a permanent storage manner. Operating system 202 may include, among others, windows, unix, linux, and the like. The data 203 may include, but is not limited to, a virtual machine image file, a first identifier, a second identifier, and the like.
In some embodiments, the virtual machine code reset may also include a display 22, an input-output interface 23, a communication interface 24, a power supply 25, and a communication bus 26.
Those skilled in the art will appreciate that the configuration shown in fig. 4 does not constitute a limitation of the virtual machine code resetting apparatus and may include more or fewer components than those shown.
The virtual machine password resetting device provided by the embodiment of the application comprises a memory and a processor, wherein when the processor executes a program stored in the memory, the following method can be realized:
when a reconstruction instruction is detected, acquiring a reconstruction image file corresponding to the reconstruction instruction;
judging whether the reconstructed mirror image file is a virtual machine snapshot or not;
if the virtual machine snapshot is obtained, modifying a first identifier of an initial virtual machine corresponding to the virtual machine snapshot to obtain a reconstructed snapshot, wherein the initial virtual machine has the first identifier and a second identifier, the first identifier is a universal unique identifier of the initial virtual machine, and the second identifier is a unique identifier of the initial virtual machine in an OpenStack platform;
and creating a reconstructed virtual machine according to the reconstructed snapshot, and calling a virtual machine initialization process to reset the password of the reconstructed virtual machine.
This embodiment provides a virtual machine password resetting means, is applied to the virtual machine under the OpenStack platform, includes: when a reconstruction instruction is detected, acquiring a reconstruction image file corresponding to the reconstruction instruction so as to reconstruct the virtual machine according to the reconstruction image file; judging whether the reconstructed mirror image file is a virtual machine snapshot or not, and if the reconstructed mirror image file is the virtual machine snapshot, modifying a first identifier of a virtual machine corresponding to the virtual machine snapshot to obtain the reconstructed snapshot, wherein the virtual machine has a first identifier and a second identifier, and the first identifier is a universal unique identifier of an initial virtual machine, so that a Cloud-Init program can run in the newly-built virtual machine after the first identifier is changed; the second identifier is a unique identifier of the initial virtual machine in the OpenStack platform, so that a user can call the virtual machine in the OpenStack platform through the second identifier. And creating a reconstructed virtual machine according to the reconstructed snapshot, and calling a virtual machine initialization process to reset the password of the reconstructed virtual machine. Therefore, the virtual machine password resetting device provided by the application can enable the Cloud-Init process to run in the reconstruction virtual machine to reset the password by setting the first identifier and the second identifier inside the virtual machine and modifying the first identifier when the reconstruction virtual machine is created by using the initial virtual machine image snapshot.
Finally, the application also provides a corresponding embodiment of the computer readable storage medium. The computer-readable storage medium has stored thereon a computer program which, when being executed by a processor, carries out the steps as set forth in the above-mentioned method embodiments.
It is to be understood that if the method in the above embodiments is implemented in the form of software functional units and sold or used as a stand-alone product, it can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium and executes all or part of the steps of the methods described in the embodiments of the present application, or all or part of the technical solutions. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The virtual machine secret code resetting method, device and medium provided by the present application are described in detail above. The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description. It should be noted that, for those skilled in the art, it is possible to make several improvements and modifications to the present application without departing from the principle of the present application, and such improvements and modifications also fall within the scope of the claims of the present application.
It should also be noted that, in this specification, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.

Claims (10)

1. A virtual machine code resetting method is applied to a virtual machine under an OpenStack platform, and comprises the following steps:
when a reconstruction instruction is detected, acquiring a reconstruction image file corresponding to the reconstruction instruction;
judging whether the reconstructed mirror image file is a virtual machine snapshot or not;
if the virtual machine snapshot is obtained, modifying a first identifier of an initial virtual machine corresponding to the virtual machine snapshot to obtain a reconstructed snapshot, wherein the initial virtual machine has the first identifier and a second identifier, the first identifier is a universal unique identifier of the initial virtual machine, and the second identifier is a unique identifier of the initial virtual machine in an OpenStack platform;
and creating a reconstructed virtual machine according to the reconstructed snapshot, and calling a virtual machine initialization process to reset the password of the reconstructed virtual machine.
2. The method for resetting the virtual machine code according to claim 1, wherein after the step of modifying the first identifier of the initial virtual machine corresponding to the virtual machine snapshot to obtain the rebuilt snapshot, the method further comprises:
updating a first identifier in a relational database, wherein the relational database is a database storing the corresponding relation between the first identifier and the second identifier.
3. The method of claim 1, wherein said invoking a virtual machine initialization process to reset the password of the rebuilt virtual machine comprises:
executing the Cloud-Init process to obtain a password resetting instruction input by a user;
and updating the password of the reconstructed virtual machine according to the password resetting instruction.
4. The method for resetting the virtual machine code according to claim 1, wherein before the step of modifying the first identifier of the initial virtual machine corresponding to the virtual machine snapshot to obtain the rebuilt snapshot, the method further comprises:
judging whether the nova database of the OpenStack platform comprises the second identifier or not;
and if the second identifier exists, executing the step of modifying the first identifier of the initial virtual machine corresponding to the virtual machine snapshot to obtain a reconstructed snapshot.
5. The method for resetting the virtual secret code according to claim 4, wherein after the step of determining whether the second identifier is included in the nova database of the OpenStack platform, the method further comprises:
if the second identifier does not exist, adding the second identifier into the nova database, wherein the initial value of the second identifier is the universal unique identification code;
and creating an interface function based on the second identifier so that the OpenStack platform can call the corresponding virtual machine through the second identifier.
6. The method for resetting the virtual machine code according to claim 1, wherein the step of obtaining the rebuilt image file corresponding to the rebuilt instruction further comprises, before the step of obtaining the rebuilt image file corresponding to the rebuilt instruction:
judging whether the current time meets a preset condition or not;
and if the preset condition is met, creating the virtual machine image snapshot for the initial virtual machine.
7. The method for resetting the virtual machine password according to claim 3, wherein the step of updating the password of the rebuilt virtual machine according to the password resetting instruction further comprises:
judging whether a password resetting success signal generated by the Cloud-Init process is received within a threshold time;
and if the password resetting success signal is not acquired, sending early warning information to a manager.
8. A virtual machine code resetting device is applied to a virtual machine under an OpenStack platform, and comprises:
the acquisition module is used for acquiring a reconstruction image file corresponding to a reconstruction instruction when the reconstruction instruction is detected;
the judging module is used for judging whether the reconstructed mirror image file is a virtual machine snapshot or not;
a modification module, configured to modify a first identifier of an initial virtual machine corresponding to the virtual machine snapshot to obtain a reconstructed snapshot if the initial virtual machine is the virtual machine snapshot, where the initial virtual machine has the first identifier and a second identifier, the first identifier is a universal unique identifier of the initial virtual machine, and the second identifier is a unique identifier of the initial virtual machine in an OpenStack platform;
and the creating module is used for creating a reconstructed virtual machine according to the reconstructed snapshot and calling a virtual machine initialization process to reset the password of the reconstructed virtual machine.
9. A virtual machine code resetting apparatus comprising a memory for storing a computer program;
a processor for implementing the steps of the virtual machine code resetting method according to any one of claims 1 to 7 when executing said computer program.
10. A computer-readable storage medium, characterized in that a computer program is stored thereon, which computer program, when being executed by a processor, carries out the steps of the virtual machine code resetting method according to any of the claims 1 to 7.
CN202211260160.0A 2022-10-14 2022-10-14 Virtual machine password resetting method, device and medium Pending CN115543539A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211260160.0A CN115543539A (en) 2022-10-14 2022-10-14 Virtual machine password resetting method, device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211260160.0A CN115543539A (en) 2022-10-14 2022-10-14 Virtual machine password resetting method, device and medium

Publications (1)

Publication Number Publication Date
CN115543539A true CN115543539A (en) 2022-12-30

Family

ID=84735807

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211260160.0A Pending CN115543539A (en) 2022-10-14 2022-10-14 Virtual machine password resetting method, device and medium

Country Status (1)

Country Link
CN (1) CN115543539A (en)

Similar Documents

Publication Publication Date Title
US8738883B2 (en) Snapshot creation from block lists
WO2017049828A1 (en) Method, device and system for data processing based on linux
US9678680B1 (en) Forming a protection domain in a storage architecture
WO2017045491A1 (en) Method and system for upgrading sqlite3 embedded database
CN112596950B (en) Virtual machine data backup method, device, equipment and storage medium
CN110209525B (en) Operating system restoration method and device
CN107402839B (en) Method and system for backing up data
US20240095130A1 (en) Object data backup and recovery in clusters managing containerized applications
CN112596951A (en) NAS data disaster tolerance method, device, equipment and storage medium
CN105867962A (en) System upgrading method and device
US9805038B2 (en) Efficient conflict resolution among stateless processes
CN113672340A (en) Incremental backup method, system and device of virtual machine and readable storage medium
CN104461757A (en) Method and device for restoring virtual machines
CN112579361B (en) Backup data reconstruction method, device, equipment and storage medium
CN113641446A (en) Memory snapshot creating method, device and equipment and readable storage medium
CN106557354B (en) Method for setting attribute parameters of private image and computer equipment
CN111399999A (en) Computer resource processing method and device, readable storage medium and computer equipment
CN115543539A (en) Virtual machine password resetting method, device and medium
CN113609075B (en) Method, system, storage medium and equipment for creating snapshot
CN115174596A (en) Equipment remote copying method, device and medium
CN115098300A (en) Database backup method, disaster recovery method, device and equipment
CN114840362A (en) Cloud host recovery method, device and medium
KR101552580B1 (en) Method for system recovery including mobile device and backup supporting multi operation system
CN108509252B (en) Virtual machine starting device and method and host
CN112596954A (en) Data backup and reconstruction method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination