CN107783837B - Method and device for performing storage expansion and electronic equipment - Google Patents

Method and device for performing storage expansion and electronic equipment Download PDF

Info

Publication number
CN107783837B
CN107783837B CN201610797324.1A CN201610797324A CN107783837B CN 107783837 B CN107783837 B CN 107783837B CN 201610797324 A CN201610797324 A CN 201610797324A CN 107783837 B CN107783837 B CN 107783837B
Authority
CN
China
Prior art keywords
container
storing
mount
storage
extension
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.)
Active
Application number
CN201610797324.1A
Other languages
Chinese (zh)
Other versions
CN107783837A (en
Inventor
陈萌辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201610797324.1A priority Critical patent/CN107783837B/en
Publication of CN107783837A publication Critical patent/CN107783837A/en
Application granted granted Critical
Publication of CN107783837B publication Critical patent/CN107783837B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

A method, device and electronic equipment for storage expansion; the method for performing storage expansion comprises the following steps: after a container for storing expansion is started by a container engine, acquiring parameters of the storing expansion according to an instruction for storing expansion sent by the container engine; and the container for storing the extension mounts the storage resource visible to other containers in the mount namespace according to the parameter of the storage extension. The storage expansion is carried out in the form of the container, so that the container engine can control the process of the storage expansion.

Description

Method and device for performing storage expansion and electronic equipment
Technical Field
The present invention relates to the field of computers, and in particular, to a method and an apparatus for performing storage expansion, and an electronic device.
Background
The Docker is a Container engine constructed based on Linux resource isolation technologies such as cgroups, namespaces, and the like, and similarly, LXC (Linux Container) and the like are also provided. The container may be considered a plug-in that can execute a Linux process that only knows what it is informed about. The container is assigned its own IP address. Once an IP address is assigned, the container is referred to as a resource identifiable in the home network. By establishing the mapping relation of the container IP to the IP address which can access the public network in the host, the container can become an accessible independent device on the network.
In the related art, when the storage of a container is expanded, an application program is started outside a Docker, and Network storage is mapped into a directory on a host in a manner of FUSE (user space File System), NFS (Network File System), and the like, and then the directory is provided for other containers to use. Wherein the FUSE is used to mount certain network space to a local file system; NFS is used to enable sharing of resources between computers in a network over a TCP/IP network.
Since the storage expansion is performed by an application program other than Docker, the management (such as start, stop, etc.) is not controlled by Docker, and thus the life cycle of the storage expansion is independent of Docker. Because there is no account number of the host, the Docker on the host only has the authority to start the container on the host, and cannot directly start the application program on the host to perform storage expansion.
Disclosure of Invention
The application provides a method and a device for storage expansion and electronic equipment, which are used for storage expansion in a container mode, so that a container engine can control the process of storage expansion.
The technical scheme is as follows.
A method of memory expansion, comprising:
after a container for storing expansion is started by a container engine, acquiring parameters of the storing expansion according to an instruction for storing expansion sent by the container engine;
and the container for storing the extension mounts the storage resource visible to other containers in the mount namespace according to the parameter of the storage extension.
Optionally, the mounting, by the container for storing the extension, a storage resource visible to other containers in the mount namespace according to the parameter of the storage extension includes:
acquiring the identifier of the mount name space of the host where the container for storing the extension is located;
setting the identifier of the mount namespace for storing the extended container as the acquired identifier, and mounting storage resources in the mount namespace of the container by the extended container according to the parameters of the storage extension.
Optionally, the obtaining the identifier of the mount namespace of the host may include:
and acquiring the identifier of the mount namespace of the process No. 1 of the host.
Optionally, setting an identifier of the mount namespace for storing the extended container to the obtained identifier, where the mounting, by the container for storing the extended container according to the parameter of the storage extension, of the storage resource in the mount namespace of the container includes:
modifying the mount function called by the container for storing the extension into an updated mount function by setting LD _ PRELOAD; the container for storing the extension calls the updated mount function, and takes the parameters of the storing extension as the parameters of the updated mount function;
when the updated mount function is called, the following operations are performed:
setting the identifier of the mount namespace for storing the extended container to be the acquired identifier, and mounting storage resources in the mount namespace for storing the extended container.
Optionally, the mounting, by the container for storing the extension, a storage resource visible to other containers in the mount namespace according to the parameter of the storage extension includes:
and the container for storing the extension sets the attribute as the mounting storage resource on the shared mounting point in the mount namespace of the container according to the parameter of the storing extension.
A method of memory expansion, comprising:
when the container engine judges that storage expansion is needed, starting a container for storage expansion and sending an instruction for storage expansion to the container for storage expansion;
after the container for storing the extension is started by the container engine, acquiring parameters of the storing extension according to an instruction for storing the extension sent by the container engine;
and the container for storing the extension mounts the storage resource visible to other containers in the mount namespace according to the parameter of the storage extension.
Optionally, the mounting, by the container for storing the extension, a storage resource visible to other containers in the mount namespace according to the parameter of the storage extension includes:
acquiring the identifier of the mount name space of the host where the container for storing the extension is located;
setting the identifier of the mount namespace for storing the extended container as the acquired identifier, and mounting storage resources in the mount namespace of the container by the extended container according to the parameters of the storage extension.
Optionally, setting an identifier of the mount namespace for storing the extended container to the obtained identifier, where the mounting, by the container for storing the extended container according to the parameter of the storage extension, of the storage resource in the mount namespace of the container includes:
modifying the mount function called by the container for storing the extension into an updated mount function by setting LD _ PRELOAD; the container for storing the extension calls the updated mount function, and takes the parameters of the storing extension as the parameters of the updated mount function;
when the updated mount function is called, the following operations are performed:
setting the identifier of the mount namespace for storing the extended container to be the acquired identifier, and mounting storage resources in the mount namespace for storing the extended container.
An apparatus for performing storage expansion, provided in a container for storing expansion, comprising:
the acquisition module is used for acquiring storage expansion parameters according to storage expansion instructions sent by the container engine after the container for storage expansion is started by the container engine;
and the mounting module is used for mounting the storage resources visible to other containers in the mount name space according to the parameters of the storage extension.
Optionally, the mounting module mounts, according to the parameter of the storage extension, a storage resource visible to another container in the mount namespace, including:
acquiring the identifier of the mount name space of the host where the container for storing the extension is located;
setting the identifier of the mount namespace for storing the extended container as the acquired identifier, and mounting storage resources in the mount namespace for storing the extended container according to the parameters of the storage extension.
Optionally, setting the identifier of the mount namespace for storing the extended container to the obtained identifier, and according to the parameter of the storage extension, mounting the storage resource in the mount namespace for storing the extended container includes:
modifying the mount function called by the container for storing the extension into an updated mount function by setting LD _ PRELOAD; calling the updated mount function, and taking the parameters of the storage extension as the parameters of the updated mount function;
when the updated mount function is called, the following operations are performed:
setting the identifier of the mount namespace for storing the extended container to be the acquired identifier, and mounting storage resources in the mount namespace for storing the extended container.
An apparatus for performing storage expansion, comprising:
the system comprises a container engine module, a storage expansion module and a storage expansion module, wherein the container engine module is used for starting a container for storing expansion and sending an instruction for storing expansion to the container for storing expansion when storage expansion is needed;
the acquisition module is arranged in the container for storing the extension and used for acquiring the parameters of the storage extension according to the indication of the storage extension sent by the container engine after the container for storing the extension is started by the container engine;
and the mounting module is arranged in the container for storing the extension and is used for mounting the storage resource visible to other containers in the mount name space according to the parameter of the storage extension.
Optionally, the mounting module mounts, according to the parameter of the storage extension, a storage resource visible to another container in the mount namespace, including:
acquiring the identifier of the mount name space of the host where the container for storing the extension is located;
setting the identifier of the mount namespace for storing the extended container as the acquired identifier, and mounting storage resources in the mount namespace for storing the extended container according to the parameters of the storage extension.
Optionally, setting the identifier of the mount namespace for storing the extended container to the obtained identifier, and according to the parameter of the storage extension, mounting the storage resource in the mount namespace for storing the extended container includes:
setting LD _ PRELOAD, and modifying the mount function called by the container for storing the extension into an updated mount function; calling the updated mount function, and taking the parameters of the storage extension as the parameters of the updated mount function;
when the updated mount function is called, the following operations are performed:
setting the identifier of the mount namespace for storing the extended container to be the acquired identifier, and mounting storage resources in the mount namespace for storing the extended container.
An electronic device for memory expansion, comprising: a memory and a processor;
the memory is used for storing programs of the container engine and programs of the container for storing expansion; the processor is used for running the program of the container engine, and reading and executing the program of the container for performing storage expansion when the program of the container engine starts the container for performing storage expansion;
the program for the storage expansion container performs the following operations when read and executed by the processor:
acquiring parameters of storage expansion according to the indication of the storage expansion sent by the container engine;
and according to the parameters of the storage extension, mounting the storage resources visible to other containers in the mount name space.
The application includes the following advantages:
at least one embodiment of the application performs storage expansion in a container mode, and mounts storage resources on a host, so that a container engine can control the process of storage expansion.
In an implementation manner of the embodiment of the present application, by setting an identifier of a mount namespace of a container to be the same as that of a host, the container can mount a storage resource on the host for use by other containers.
In an implementation manner of the embodiment of the present application, a mount point of a mount namespace of a container is set to be shared, so that a storage resource mounted by the container can be used by other containers.
Of course, it is not necessary for any product to achieve all of the above-described advantages at the same time for the practice of the present application.
Drawings
FIG. 1 is a flowchart of a method for performing storage expansion according to a first embodiment;
FIG. 2 is a system architecture diagram of one implementation of an embodiment;
FIG. 3 is a flowchart of a method for performing storage expansion according to the second embodiment;
FIG. 4 is a schematic view of an apparatus for performing memory expansion according to a third embodiment;
FIG. 5 is a diagram showing an apparatus for performing memory expansion according to a fourth embodiment.
Detailed Description
The technical solutions of the present application will be described in more detail below with reference to the accompanying drawings and embodiments.
It should be noted that, if not conflicted, the embodiments and the features of the embodiments can be combined with each other and are within the scope of protection of the present application. Additionally, while a logical order is shown in the flow diagrams, in some cases, the steps shown or described may be performed in an order different than here.
In an embodiment, a method for performing storage expansion, as shown in fig. 1, includes S110 to S120:
s110, after a container for storing expansion is started by a container engine, acquiring parameters for storing expansion according to an instruction for storing expansion sent by the container engine;
and S120, mounting the storage resources which are visible to other containers in the mount namespace by the container for storing the extension according to the parameters for storing the extension.
In this embodiment, the function of performing storage expansion is designed as a container, and the container engine triggers the operation of the container, so that the container engine can control the process of performing storage expansion. When the container engine determines that the storage resource mounted in step S120 is no longer needed, or receives an instruction to delete the storage resource mounted in step S120, the container for storing the extension may be directly closed, or the container for storing the extension may be instructed to unload the corresponding storage resource; with this embodiment, the container engine can control the lifetime of the mounted storage resource.
The container for storing the extension may be stored in the host in advance, or the container engine may download and start the container for storing the extension from the network side when the storage extension is needed. The indication of performing storage expansion may be, but is not limited to, a request for creating a data volume, and the parameter of the storage expansion may be a request parameter carried in the request for creating the data volume.
The case where the container engine sends a request to create a data volume may include one or more of the following: the container engine sends a request for creating a data volume to a container for storage expansion when judging that the storage expansion is needed, and after receiving the request for creating the data volume sent by a user through a client or a webpage control interface and the like, the container engine forwards the request to the container for storage expansion.
In this embodiment, the storage resource may be a resource such as a storage space provided by a storage medium in a local or network. The parameters of the storage extension may include, but are not limited to, one or more of the following: the name, address, size, access rights, etc. of the storage resource.
In this embodiment, the container engine may be, but is not limited to, a Docker, and may also be another container engine constructed based on the Linux resource isolation technology.
In this embodiment, the host may refer to an electronic device, which includes at least a memory and a processor, and is used for storing and running the container, and may also be referred to as a host.
In this embodiment, after step S120, the method may further include notifying the container engine that the mounting of the container is completed by the container for storing the extension. After the container engine knows that the mount is completed, the container engine can operate the mounted storage resource, and can also return a response indicating that the data volume is successfully created to the user through a client or a webpage control interface and the like.
In this embodiment, the other containers may include containers other than the container for storing the extension in the host. The other containers may also include containers in other devices that have access to the host.
In one implementation, the step S120 may include:
acquiring the identifier of the mount name space of the host where the container for storing the extension is located;
setting the identifier of the mount namespace for storing the extended container as the acquired identifier, and mounting storage resources in the mount namespace of the container by the extended container according to the parameters of the storage extension.
In the related art, because mount namespaces of different containers are set to be isolated from each other, and when one container mounts a storage resource, the storage resource is mounted in the mount namespace of the container, the storage resource mounted by one container can only be used by the container, and other containers cannot see the storage resource. In the implementation manner, the identifier of the mount namespace for storing the extended container is set as the identifier of the mount namespace of the host, which is equivalent to enabling the extended container to enter the mount namespace of the host; the container for storing the extension mounts the storage resource in the mount namespace of the container, which is equivalent to mounting the storage resource in the mount namespace of the host (i.e. mounting the storage resource on the host), so that other containers can also see the storage resource mounted by the container for storing the extension.
A system architecture applying the implementation is shown in fig. 2, and after receiving a request for creating a data volume, a Docker running in a host starts a container for storing an extension in the host and forwards the request for creating the data volume to the container.
After receiving a request for creating a data volume, a container for storing an extension performs steps 201 to 203:
201. preparation of the storage extension is performed, such as obtaining request parameters from the request to create the data volume.
202. Entering the mount namespace of the host, namely: and setting the identification of the mount namespace for storing the extended container as the identification of the mount namespace of the host.
203. Mounting a storage resource in a mount namespace of a host, namely: and the container for storing the extension mounts the storage resource in the mount name space of the container according to the request parameter.
After the mounting is completed, the storage expansion of the Docker container is realized.
In one implementation, the obtaining the identifier of the mount namespace of the host may include:
and acquiring the identifier of the mount namespace of the process No. 1 of the host.
In the Linxu system, process No. 1 is created by calling a fork function, and an init function is the subject of process No. 1. Process number 1 was chosen because its mount namespace identification must be consistent with the host's mount namespace identification.
In other implementation manners, the identifier of the mount namespace of the host may also be obtained by other means, for example, the identifier of the mount namespace of the host is stored in a predetermined location, and the identifier of the mount namespace of the host can be read by going to the predetermined location as needed.
In one implementation manner, setting, as the obtained identifier, an identifier of a mount namespace used for storing an extended container, where, according to a parameter of the storage extension, mounting a storage resource in the mount namespace of the container may include:
modifying the mount function called by the container for storing the extension into an updated mount function by setting LD _ PRELOAD; the container for storing the extension calls the updated mount function, and takes the parameters of the storing extension as the parameters of the updated mount function;
when the updated mount function is called, the following operations are performed:
setting the identifier of the mount namespace for storing the extended container to be the acquired identifier, and mounting storage resources in the mount namespace for storing the extended container.
Wherein LD _ load is one such environmental variable: it may affect the linking of the program run time (Runtime linker) which allows to define a dynamically linked library that is loaded preferentially before the program runs. The function is mainly used for selectively loading the same function in different dynamic link libraries.
In this implementation, the mount function called by the container for storing the extension is the updated mount function, and therefore, after the call, the identifier of the mount namespace for storing the extension container is modified to the acquired identifier, and then the mount operation of the conventional mount function is performed, so that the storage resource is actually mounted in the mount namespace of the host. In this implementation, the setting of the LD _ load may be set manually or may be automatically completed in a system instruction manner.
In the implementation mode, the method is equivalent to replacing a mount function called by a container for storing extension in an LD-PRELOAD mode; the original calls of the container are all mount functions of the system in the host; in this implementation, the mount function called by the container for storing the extension is replaced with the updated mount function from the mount function of the system, and the updated mount function may set the identifier of the mount namespace for storing the extension as the acquired identifier, in addition to the function of the mount function of the system.
In other implementations, ways other than LD _ load may be used instead of the called mount function.
In one implementation, the step S120 may include:
and the container for storing the extension sets the attribute as the mounting storage resource on the shared mounting point in the mount namespace of the container according to the parameter of the storing extension.
Wherein, after the attribute of the mounting point is set to be shared, the mounted storage resource is visible to other containers. The setting of the mount point attribute may be done by, but is not limited to, a container for storing the extension; the container for storing the extension may set an attribute of at least one mount point in a mount namespace of the container to shared (shared) in advance, or may set an attribute of a mount point for mounting to shared when the storage resource needs to be mounted.
The second embodiment is a method for performing storage expansion, as shown in fig. 3, including S210 to S230:
s210, when the container engine judges that storage expansion is needed, starting a container for storage expansion and sending an instruction for storage expansion to the container for storage expansion;
s220, after the container for storing the extension is started by the container engine, acquiring parameters of the storing extension according to an instruction for storing the extension sent by the container engine;
and S230, mounting the storage resources which are visible to other containers in the mount namespace by the container for storing the extension according to the parameters of the storage extension.
In one implementation, the determining, by the container engine, that storage expansion is required may include:
the container engine receives a request to create a data volume.
In other implementation manners, the container engine may determine that storage expansion is required according to its own needs.
In one implementation, the mounting, by the container for storing the extension, a storage resource visible to other containers in the mount namespace according to the parameter of the storing extension may include:
acquiring the identifier of the mount name space of the host where the container for storing the extension is located;
setting the identifier of the mount namespace for storing the extended container as the acquired identifier, and mounting storage resources in the mount namespace of the container by the extended container according to the parameters of the storage extension.
Wherein, setting the identifier of the mount namespace for storing the extended container to the obtained identifier, where the mounting of the storage resource in the mount namespace of the container according to the parameter of the storage extension may include:
modifying the mount function called by the container for storing the extension into an updated mount function by setting LD _ PRELOAD; the container for storing the extension calls the updated mount function, and takes the parameters of the storing extension as the parameters of the updated mount function;
when the updated mount function is called, the following operations are performed:
setting the identifier of the mount namespace for storing the extended container to be the acquired identifier, and mounting storage resources in the mount namespace for storing the extended container.
In this embodiment, other implementation details of the operation performed for storing the extended container may be referred to in embodiment one.
In a third embodiment, an apparatus for performing storage expansion, which is provided in a container for storing expansion, as shown in fig. 4, includes:
an obtaining module 41, configured to obtain a parameter of storage expansion according to an instruction for storage expansion sent by a container engine after the container for storage expansion is started by the container engine;
and a mounting module 42, configured to mount, according to the parameter of the storage extension, a storage resource visible to another container in the mount namespace.
In one implementation, the mounting module, according to the parameter of the storage extension, mounting, in a mount namespace, a storage resource visible to other containers may include:
acquiring the identifier of the mount name space of the host where the container for storing the extension is located;
setting the identifier of the mount namespace for storing the extended container as the acquired identifier, and mounting storage resources in the mount namespace for storing the extended container according to the parameters of the storage extension.
In one implementation, the setting, as the obtained identifier, an identifier of a mount namespace used for storing an extended container, and according to a parameter of the storage extension, mounting a storage resource in the mount namespace used for storing the extended container may include:
modifying the mount function called by the container for storing the extension into an updated mount function by setting LD _ PRELOAD; calling the updated mount function, and taking the parameters of the storage extension as the parameters of the updated mount function;
when the updated mount function is called, the following operations are performed:
setting the identifier of the mount namespace for storing the extended container to be the acquired identifier, and mounting storage resources in the mount namespace for storing the extended container.
In this embodiment, the obtaining module and the mounting module respectively execute steps S110 and S120 in the first embodiment, and other implementation details of operations performed by the obtaining module and the mounting module may be referred to in the first embodiment.
In a fourth embodiment, an apparatus for performing storage expansion, as shown in fig. 5, includes:
the container engine module 51 is configured to, when it is determined that storage expansion is required, start a container for storage expansion and send an instruction for storage expansion to the container for storage expansion;
an obtaining module 52, disposed in the container for storing extensions, configured to obtain, after the container for storing extensions is started by the container engine, a parameter of storing extensions according to an instruction for storing extensions sent by the container engine;
and the mounting module 53 is arranged in the container for storing the extension, and is configured to mount a storage resource visible to other containers in the mount namespace according to the parameter for storing the extension.
In one implementation, the mounting module, according to the parameter of the storage extension, mounting, in a mount namespace, a storage resource visible to other containers may include:
acquiring the identifier of the mount name space of the host where the container for storing the extension is located;
setting the identifier of the mount namespace for storing the extended container as the acquired identifier, and mounting storage resources in the mount namespace for storing the extended container according to the parameters of the storage extension.
In one implementation, the setting, as the obtained identifier, an identifier of a mount namespace used for storing an extended container, and according to a parameter of the storage extension, mounting a storage resource in the mount namespace used for storing the extended container may include:
setting LD _ PRELOAD, and modifying the mount function called by the container for storing the extension into an updated mount function; calling the updated mount function, and taking the parameters of the storage extension as the parameters of the updated mount function;
when the updated mount function is called, the following operations are performed:
setting the identifier of the mount namespace for storing the extended container to be the acquired identifier, and mounting storage resources in the mount namespace for storing the extended container.
In this embodiment, the obtaining module and the mounting module respectively execute steps S110 and S120 in the first embodiment, and other implementation details of operations performed by the obtaining module and the mounting module may be referred to in the first embodiment; other implementation details of the container engine module 51 can be found in the description of the container engine in embodiment one.
In a fifth embodiment, an electronic device for performing storage expansion includes: a memory and a processor;
the memory is used for storing programs of the container engine and programs of the container for storing expansion; the processor is used for running the program of the container engine, and reading and executing the program of the container for performing storage expansion when the program of the container engine starts the container for performing storage expansion;
the program for the storage expansion container performs the following operations when read and executed by the processor:
acquiring parameters of storage expansion according to the indication of the storage expansion sent by the container engine;
and according to the parameters of the storage extension, mounting the storage resources visible to other containers in the mount name space.
In this embodiment, operations performed when the program for performing the storage expansion container is read and executed correspond to steps S110 and S120 in the first embodiment, and other implementation details of the operations performed when the program is read and executed may be referred to in the first embodiment; other implementation details of the container engine program can be found in the description of the container engine in embodiment one.
In a sixth embodiment, a method for performing storage expansion in a container service includes:
after the user selects the container service, a Docker or other container engine is installed on a host provided by the user, and the container engine is initialized and set, such as setting an address of a container downloaded by the container engine, a use authority of the container engine, and the like. The user is provided with an interface to the container engine, such as a client or web control interface, etc.
The container for storing the extension can be stored in advance on the host provided by the user, or the user can instruct the container engine to download the extension according to needs in the using process, or the container engine actively downloads the extension according to needs.
During downloading, the container engine may download the container for storing the extension at the corresponding address according to the set parameter, or request the device corresponding to the corresponding address to download the container for storing the extension. For example, various containers are stored by a container server, and the download address of the container engine is set as the address of the container server. When the container engine requests the download, the container server may transmit the saved image file of the corresponding container to the container engine.
When a user needs to perform storage expansion, a request for creating a data volume (or other instructions for indicating that the storage expansion is to be performed) can be sent to a container engine on a host through a client or a webpage control interface; and the container engine starts a container for storing the extension after receiving the request for creating the data volume, and if the container for storing the extension is not stored in the host, the container engine firstly downloads the container and then starts the container. The request to create the data volume is forwarded to the container for storage extensions after startup.
Container for storage extension the method according to the first embodiment mounts storage resources, thus implementing storage extension in the container service. The user can carry out storage expansion through the instruction, and the container engine can modify the storage resources through closing the container for storing the expansion or indicating the container for storing the expansion to unload the corresponding storage resources through the instruction when needed, so that the user can control the life cycle of the storage expansion by controlling the container engine.
It will be understood by those skilled in the art that all or part of the steps of the above methods may be implemented by instructing the relevant hardware through a program, and the program may be stored in a computer readable storage medium, such as a read-only memory, a magnetic or optical disk, and the like. Alternatively, all or part of the steps of the above embodiments may be implemented using one or more integrated circuits. Accordingly, each module/unit in the above embodiments may be implemented in the form of hardware, and may also be implemented in the form of a software functional module. The present application is not limited to any specific form of hardware or software combination.
There are, of course, many other embodiments of the invention that can be devised without departing from the spirit and scope thereof, and it will be apparent to those skilled in the art that various changes and modifications can be made herein without departing from the spirit and scope of the invention.

Claims (15)

1. A method of memory expansion, comprising:
after a container for storing expansion is started by a container engine, acquiring parameters of the storing expansion according to an instruction for storing expansion sent by the container engine;
and the container for storing the extension sets the identifier of the mount namespace of the container for storing the extension to be the same as the identifier of the mount namespace of the host according to the parameter of the storage extension, so that the storage resource visible to other containers is mounted in the mount namespace.
2. The method of claim 1, wherein the container for storing the extension sets the identifier of the mount namespace of the container for storing the extension to be the same as the identifier of the mount namespace of the host where the container is located according to the parameter of the storage extension, so that mounting the storage resource visible to other containers in the mount namespace comprises:
acquiring the identifier of the mount name space of the host where the container for storing the extension is located;
setting the identifier of the mount namespace for storing the extended container as the acquired identifier, and mounting storage resources in the mount namespace of the container by the extended container according to the parameters of the storage extension.
3. The method of claim 2, wherein the obtaining the identification of the mount namespace for the host comprises:
and acquiring the identifier of the mount namespace of the process No. 1 of the host.
4. The method according to claim 2, wherein the setting of the identifier of the mount namespace for storing the extended container to the obtained identifier, and the mounting of the storage resource in the mount namespace of the container according to the parameter of the storage extension comprises:
modifying the mount function called by the container for storing the extension into an updated mount function by setting LD _ PRELOAD; the container for storing the extension calls the updated mount function, and takes the parameters of the storing extension as the parameters of the updated mount function;
when the updated mount function is called, the following operations are performed:
setting the identifier of the mount namespace for storing the extended container to be the acquired identifier, and mounting storage resources in the mount namespace for storing the extended container.
5. The method of claim 1, wherein the container for the storage extension mounting storage resources visible to other containers in a mount namespace according to parameters of the storage extension comprises:
and the container for storing the extension sets the attribute as the mounting storage resource on the shared mounting point in the mount namespace of the container according to the parameter of the storing extension.
6. A method of memory expansion, comprising:
when the container engine judges that storage expansion is needed, starting a container for storage expansion and sending an instruction for storage expansion to the container for storage expansion;
after the container for storing the extension is started by the container engine, acquiring parameters of the storing extension according to an instruction for storing the extension sent by the container engine;
and the container for storing the extension sets the identifier of the mount namespace of the container for storing the extension to be the same as the identifier of the mount namespace of the host according to the parameter of the storage extension, so that the storage resource visible to other containers is mounted in the mount namespace.
7. The method of claim 6, wherein the container for storing the extension sets the identifier of the mount namespace of the container for storing the extension to be the same as the identifier of the mount namespace of the host where the container is located according to the parameter of the storage extension, so that mounting the storage resource visible to other containers in the mount namespace comprises:
acquiring the identifier of the mount name space of the host where the container for storing the extension is located;
setting the identifier of the mount namespace for storing the extended container as the acquired identifier, and mounting storage resources in the mount namespace of the container by the extended container according to the parameters of the storage extension.
8. The method according to claim 7, wherein setting the identifier of the mount namespace for storing the extended container to the obtained identifier, and the container for storing the extended container mounting the storage resource in the mount namespace of the container according to the parameter of the storage extension comprises:
modifying the mount function called by the container for storing the extension into an updated mount function by setting LD _ PRELOAD; the container for storing the extension calls the updated mount function, and takes the parameters of the storing extension as the parameters of the updated mount function;
when the updated mount function is called, the following operations are performed:
setting the identifier of the mount namespace for storing the extended container to be the acquired identifier, and mounting storage resources in the mount namespace for storing the extended container.
9. An apparatus for performing storage expansion, provided in a container for storing expansion, comprising:
the acquisition module is used for acquiring storage expansion parameters according to storage expansion instructions sent by the container engine after the container for storage expansion is started by the container engine;
and the mounting module is used for setting the identifier of the mount namespace used for storing the extended container to be the same as the identifier of the mount namespace of the host where the mount is located according to the parameters of the storage extension, so that the storage resources which are visible for other containers are mounted in the mount namespace.
10. The apparatus of claim 9, wherein the mounting module sets, according to the parameter of the storage extension, the identifier of the mount namespace for storing the extended container to be the same as the identifier of the mount namespace of the host where the extended container is located, so that mounting the storage resource visible to other containers in the mount namespace comprises:
acquiring the identifier of the mount name space of the host where the container for storing the extension is located;
setting the identifier of the mount namespace for storing the extended container as the acquired identifier, and mounting storage resources in the mount namespace for storing the extended container according to the parameters of the storage extension.
11. The apparatus of claim 10, wherein setting the identification of the mount namespace for storing the extended container to the obtained identification, wherein mounting storage resources in the mount namespace for storing the extended container according to the parameters of the storage extension comprises:
modifying the mount function called by the container for storing the extension into an updated mount function by setting LD _ PRELOAD; calling the updated mount function, and taking the parameters of the storage extension as the parameters of the updated mount function;
when the updated mount function is called, the following operations are performed:
setting the identifier of the mount namespace for storing the extended container to be the acquired identifier, and mounting storage resources in the mount namespace for storing the extended container.
12. An apparatus for performing storage expansion, comprising:
the system comprises a container engine module, a storage expansion module and a storage expansion module, wherein the container engine module is used for starting a container for storing expansion and sending an instruction for storing expansion to the container for storing expansion when storage expansion is needed;
the acquisition module is arranged in the container for storing the extension and used for acquiring the parameters of the storage extension according to the indication of the storage extension sent by the container engine after the container for storing the extension is started by the container engine;
and the mounting module is arranged in the container for storing the extension and used for setting the identifier of the mount namespace for storing the extension to be the same as the identifier of the mount namespace of the host computer where the mount namespace is located according to the parameter of the storage extension so as to mount the storage resource visible to other containers in the mount namespace.
13. The apparatus of claim 12, wherein the mounting module sets, according to the parameter of the storage extension, the identifier of the mount namespace for storing the extended container to be the same as the identifier of the mount namespace of the host where the extended container is located, so that mounting the storage resource visible to other containers in the mount namespace comprises:
acquiring the identifier of the mount name space of the host where the container for storing the extension is located;
setting the identifier of the mount namespace for storing the extended container as the acquired identifier, and mounting storage resources in the mount namespace for storing the extended container according to the parameters of the storage extension.
14. The apparatus of claim 13, wherein setting the identification of the mount namespace for storing the extended container to the obtained identification, wherein mounting storage resources in the mount namespace for storing the extended container according to the parameters of the storage extension comprises:
setting LD _ PRELOAD, and modifying the mount function called by the container for storing the extension into an updated mount function; calling the updated mount function, and taking the parameters of the storage extension as the parameters of the updated mount function;
when the updated mount function is called, the following operations are performed:
setting the identifier of the mount namespace for storing the extended container to be the acquired identifier, and mounting storage resources in the mount namespace for storing the extended container.
15. An electronic device for memory expansion, comprising: a memory and a processor;
the method is characterized in that: the memory is used for storing programs of the container engine and programs of the container for storing expansion; the processor is used for running the program of the container engine, and reading and executing the program of the container for performing storage expansion when the program of the container engine starts the container for performing storage expansion;
the program for the storage expansion container performs the following operations when read and executed by the processor:
acquiring parameters of storage expansion according to the indication of the storage expansion sent by the container engine;
and setting the identifier of the mount namespace used for storing the extended container to be the same as the identifier of the mount namespace of the host according to the parameters of the storage extension, so that the storage resources which are visible to other containers are mounted in the mount namespace.
CN201610797324.1A 2016-08-31 2016-08-31 Method and device for performing storage expansion and electronic equipment Active CN107783837B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610797324.1A CN107783837B (en) 2016-08-31 2016-08-31 Method and device for performing storage expansion and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610797324.1A CN107783837B (en) 2016-08-31 2016-08-31 Method and device for performing storage expansion and electronic equipment

Publications (2)

Publication Number Publication Date
CN107783837A CN107783837A (en) 2018-03-09
CN107783837B true CN107783837B (en) 2021-08-03

Family

ID=61451746

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610797324.1A Active CN107783837B (en) 2016-08-31 2016-08-31 Method and device for performing storage expansion and electronic equipment

Country Status (1)

Country Link
CN (1) CN107783837B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110276194B (en) * 2019-06-21 2021-06-15 联想(北京)有限公司 Information processing method, information processing apparatus, and electronic device
CN111163189B (en) * 2020-01-07 2020-09-15 上海道客网络科技有限公司 IP monitoring and recycling system and method based on network name space management and control

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102681899A (en) * 2011-03-14 2012-09-19 金剑 Virtual computing resource dynamic management system of cloud computing service platform
CN105556478A (en) * 2013-09-10 2016-05-04 赛门铁克公司 Systems and methods for protecting virtual machine data
CN105554015A (en) * 2015-12-31 2016-05-04 北京轻元科技有限公司 Management network and method for multi-tenant container cloud computing system
CN105653462A (en) * 2014-11-11 2016-06-08 杭州海康威视数字技术股份有限公司 Memory expansion method and device
CN105681217A (en) * 2016-04-27 2016-06-15 深圳市中润四方信息技术有限公司 Dynamic load balancing method and system for container cluster

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8898291B2 (en) * 2011-08-08 2014-11-25 International Business Machines Corporation Dynamically expanding computing resources in a networked computing environment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102681899A (en) * 2011-03-14 2012-09-19 金剑 Virtual computing resource dynamic management system of cloud computing service platform
CN105556478A (en) * 2013-09-10 2016-05-04 赛门铁克公司 Systems and methods for protecting virtual machine data
CN105653462A (en) * 2014-11-11 2016-06-08 杭州海康威视数字技术股份有限公司 Memory expansion method and device
CN105554015A (en) * 2015-12-31 2016-05-04 北京轻元科技有限公司 Management network and method for multi-tenant container cloud computing system
CN105681217A (en) * 2016-04-27 2016-06-15 深圳市中润四方信息技术有限公司 Dynamic load balancing method and system for container cluster

Also Published As

Publication number Publication date
CN107783837A (en) 2018-03-09

Similar Documents

Publication Publication Date Title
CN109547570B (en) Service registration method, device, registration center management equipment and storage medium
KR102204115B1 (en) Patch upgrade-based file processing method and device, terminal, and storage medium
JP5658283B2 (en) Application operating method, apparatus and system
CN107203419B (en) Method, device and system for calling among modules in application program
CN109558320B (en) System testing method, device, system, equipment and computer readable storage medium
CN107305553B (en) Method and system for dynamically jumping Hybrid page based on Hybrid App
CN105490860A (en) Method, device and system for deploying application program operation environment
CN105373396A (en) Method and device for updating plug-in in plug-in platform
CN110968331B (en) Method and device for running application program
CN108540509B (en) Processing method and device of terminal browser, server and intelligent terminal
CN107957837B (en) Method and device for generating shortcut of webpage application program and terminal equipment
CN102945182A (en) Application program updating method and device
CN105740027A (en) Application program updating method and device
CN104834541A (en) Function module mounting method, mounting system and mounting system updating method
CN108563472B (en) Service plug-in loading method and device based on multi-open application
CN113190282A (en) Android operating environment construction method and device
CN104765624B (en) Method and device for updating application program of virtual machine
CN107783837B (en) Method and device for performing storage expansion and electronic equipment
JP6560824B2 (en) How to manage packages in secure elements
CN106293790B (en) application program upgrading method and device based on Firefox operating system
CN112256351B (en) Method for realizing Feign component, method and device for calling micro-service
CN107179918B (en) Software processing method, device and system
CN112256295A (en) Application program updating method, device, equipment and storage medium
CN109144595B (en) Method and device for starting assembly based on plug-in framework
CN110704041A (en) Software development method and device

Legal Events

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