WO2021184992A1 - Mirror image file uploading method, related device and computer storage medium - Google Patents

Mirror image file uploading method, related device and computer storage medium Download PDF

Info

Publication number
WO2021184992A1
WO2021184992A1 PCT/CN2021/075236 CN2021075236W WO2021184992A1 WO 2021184992 A1 WO2021184992 A1 WO 2021184992A1 CN 2021075236 W CN2021075236 W CN 2021075236W WO 2021184992 A1 WO2021184992 A1 WO 2021184992A1
Authority
WO
WIPO (PCT)
Prior art keywords
fragment
upload
sequence number
data packet
client
Prior art date
Application number
PCT/CN2021/075236
Other languages
French (fr)
Chinese (zh)
Inventor
孙思东
申思
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2021184992A1 publication Critical patent/WO2021184992A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/54Store-and-forward switching systems 
    • H04L12/56Packet switching systems
    • H04L12/5601Transfer mode dependent, e.g. ATM
    • H04L2012/5603Access techniques
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/90Buffering arrangements
    • H04L49/9057Arrangements for supporting packet reassembly or resequencing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services

Definitions

  • This application relates to the field of virtualization technology, and in particular to a method for uploading image files, related equipment, and computer storage media.
  • the mirroring service is presented in the form of a portal, so the user needs to complete the registration and upload of the mirroring through a browser.
  • the problem of file upload interruption or upload failure often occurs due to poor network environment, and the browser does not support file uploading in fragments, so when the user uploads a large image file through the browser and does not When it is successfully uploaded to the server, the large image file needs to be re-uploaded, which greatly reduces the upload efficiency of the large image file.
  • the embodiment of the application discloses a method for uploading a mirror file, related equipment, and a computer storage medium, which can effectively solve the problem that the browser does not support uploading large mirror files and the upload efficiency is low.
  • this application provides a method for uploading image files, which is applied to the client, including:
  • the data packet P 1 includes fragment S 1 and fragment sequence number I 1
  • the data packet P 2 contains the fragment S 2 and the fragment sequence number I 2
  • the data packet P n contains the fragment S n and the fragment sequence number I n
  • n is a positive integer, and n ⁇ m.
  • the method when n is less than m, the method further includes: when n is less than m, the method further includes: sending a resumable upload request to the upload proxy device to obtain The fragment sequence number I n , wherein the breakpoint resumable transmission request is used to request the fragment sequence number corresponding to the fragment where the breakpoint occurred; according to the fragment sequence number I n , the data packet P n+1 is sent to The upload agent device.
  • the sending of the data packets P 1 , P 2 ,..., P n to the upload agent device includes: using 1 thread to transfer the data packets P 1 , P 2 ,..., P l send to the upload agent device in parallel; use the l threads to send data packets P l+1 , P l+2 ,..., P 2 ⁇ l to the upload agent device in parallel; ...; use The l threads send data packets P n-l+1 , P n-l+2 ,..., P n to the upload agent device in parallel, where 1 ⁇ l ⁇ n/2, and l is positive Integer.
  • the target image file to be uploaded can be fragmented in the client, and then the fragments of the target image file can be sent to the upload agent device. Therefore, when the upload of the target image file is interrupted or failed during the upload process, the client can re-upload the target image file from the failed segment, thereby improving the upload efficiency of the target image file. Moreover, the client divides the target mirror file into fragments, and completes the upload of the target mirror file by uploading the fragments, thereby improving the upload success rate of the target mirror file. In addition, the client can also send segments of the target image file to the upload agent device in parallel, which can greatly improve the upload efficiency of the target image file.
  • this application provides another method for uploading image files, which is applied to uploading agent equipment, including:
  • the total number of fragments m and the fragments S 1 , S 2 ,..., S n are sent to the object storage device.
  • the method when n is less than m, after receiving the total number of fragments m sent by the client and the data packets P 1 , P 2 ,..., P n , the method further includes: receiving The data packets P n+2 , P n+3 ,..., P m sent by the client, and the fragments S n+2 , S n+3 ,..., S m are sent to the object A storage device, wherein the data packet P n+2 contains the fragment S n+2 and the fragment sequence number I n+2 , and the data packet P n+3 contains the fragment S n+3 and the fragment sequence number I n+3 ,...
  • the data packet P m includes the fragment S m and the fragment sequence number I m ; receiving the resumable transmission request sent by the client; according to the resuming transmission request, the fragment corresponding to the fragment where the breakpoint occurred
  • the sequence number I n is sent to the client; the data packet P n+1 sent by the client according to the fragment sequence number I n is received, and the data packet P n+1 is sent to the object storage device, For the object storage device to restore the target image file according to the fragments S 1 , S 2 ,..., S m , wherein the data packet P n+1 includes the fragment S n+1 and the fragment The slice number I n+1 .
  • the method further includes: receiving a resumable transmission request sent by the client; and according to the resuming transmission request, fragments of breakpoints will occur fragment corresponding to a number I n the client; client receives the remaining data packets from said sheet number data packet I n P n + 1 based on the resume start points and the The fragments corresponding to the remaining data packets are sent to the object storage device, so that the object storage device restores the target image file according to the fragments S 1 , S 2 ,..., S m, where: The remaining data packets include data packets P n+1 , P n+2 ,..., P m , and the data packet P n+1 includes a fragment S n+1 and a fragment sequence number I n+1 , The data packet P n+2 includes a fragment S n+2 and a fragment sequence number I n+2 , ..., the data packet P m includes a fragment S m and a fragment
  • the method further comprising: transmitting the data packet P is received in the client 1, the call management device to create the mirror image file corresponding to the target image identifier, and stores the image identification .
  • the method further includes: invoking the image management device to refresh the image status corresponding to the target image file.
  • the upload proxy device after the upload proxy device receives the fragments of the target mirror file sent by the client, it forwards the fragments to the object storage device, and the object storage device restores the fragments to the target mirror file, thereby realizing the target mirror file Upload.
  • the upload proxy device can send the fragment sequence number corresponding to the fragment that has the breakpoint to the client, so that the client can be based on the fragment that has the breakpoint. The corresponding segment sequence number continues to upload the target mirror file, thereby improving the upload efficiency and upload success rate of the mirror file.
  • this application provides a client, including:
  • the obtaining unit is used to obtain the target image file
  • the fragmentation processing unit is configured to fragment the target mirror file to obtain fragments S 1 , S 2 ,..., S m and a total fragment m, where m is a positive integer;
  • the sending unit is configured to send data packets P 1 , P 2 ,..., P n and the total number of fragments m to the upload agent device, where the data packet P 1 includes a fragment S 1 and a fragment
  • the sequence number I 1 the data packet P 2 contains the fragment S 2 and the fragment sequence number I 2 ,..., the data packet P n contains the fragment S n and the fragment sequence number I n , n is a positive integer, and n ⁇ m.
  • the sending unit is further configured to: send a resumable upload request to the upload proxy device to obtain the fragment sequence number I n , where the The breakpoint resume request is used to request the fragment sequence number corresponding to the fragment where the breakpoint occurred; according to the fragment sequence number I n , the data packet P n+1 is sent to the upload agent device.
  • the sending unit is specifically configured to: use 1 thread to send data packets P 1 , P 2 ,..., P 1 to the upload agent device in parallel; use the 1 thread , The data packets P l+1 , P l+2 ,..., P 2 ⁇ l are sent to the upload agent device in parallel; ...; using the l threads, the data packets P 1 , P 2 ,. .., P n is sent to the upload agent device in parallel, where 1 ⁇ l ⁇ n/2, and l is a positive integer.
  • the fragmentation processing unit divides the target mirror file into fragments, so as to realize that the client uploads the target mirror file in fragments.
  • the above-mentioned client can realize the resumable upload of the image file, which not only improves the upload efficiency of the target image file, but also improves the upload success rate of the target image file.
  • the sending unit can also implement concurrent uploading of fragments. Therefore, when the above-mentioned client is used to upload the mirror file, the upload efficiency of the target mirror file can be greatly improved.
  • this application provides an upload proxy device, which is characterized in that it includes:
  • the acquiring unit is used to receive the total number of fragments m and data packets P 1 , P 2 ,..., P n sent by the client, where the data packet P 1 includes the fragment S 1 and the fragment sequence number I 1 , and the data
  • the packet P 2 contains the fragment S 2 and the fragment sequence number I 2 ,...
  • the data packet P n contains the fragment S n and the fragment sequence number I n
  • the fragments S 1 , S 2 ,..., S m are said
  • the client fragments the target image file, m and n are both positive integers, and n ⁇ m;
  • the sending unit is configured to send the total number of fragments m and the fragments S 1 , S 2 ,..., S n to the object storage device.
  • the acquiring unit when n is less than m, after the acquiring unit receives the total number of fragments m sent by the client and the data packets P 1 , P 2 ,..., P n , the acquiring The unit is also used to receive data packets P n+2 , P n+3 ,...,P m sent by the client, and to fragment S n+2 ,S n+3 ,...,S m Sent to the object storage device, where the data packet P n+2 contains the fragment S n+2 and the fragment sequence number I n+2 , and the data packet P n+3 contains the fragment S n+3 and the fragment sequence number I n+3 ,..., the data packet P m includes the fragment S m and the fragment sequence number I m ; the acquiring unit is also used to receive a resumable transmission request sent by the client; the sending unit is also used to the HTTP request, the breakpoint will occur fragment corresponding to fragment I n number sent to the client; the
  • the acquiring unit is further configured to receive a resumable transmission request sent by the client; and the sending unit is further configured to resume transmission according to the resumable transmission request.
  • the obtaining unit is further configured to receive the client according to the fragment ID from the packet I n P n + 1 Start resuming the remaining data packets, and send the fragments corresponding to the remaining data packets to the object storage device for the object storage device according to the fragments S 1 , S 2 , ...,S m restores the target image file, wherein the remaining data packets include data packets P n+1 , P n+2 ,..., P m , and the data packets P n+1 Contains a fragment S n+1 and a fragment sequence number I n+1 , the data packet P n+2 contains a fragment S n+2 and a fragment sequence number I n
  • the apparatus further comprises a call progress recording unit and a unit, the unit calls for the data packet P is sent in the client 1 receives the call to create the target image management apparatus The mirror ID corresponding to the mirror file; the progress recording unit is used to save the mirror ID.
  • the calling unit is further configured to: call the mirror management device to refresh the mirror state corresponding to the target mirror file.
  • the sending unit forwards the fragments to the object storage device, so that the object storage device can be restored to the target mirror file according to the fragments, thereby realizing the target mirroring Upload of files.
  • the sending unit can send the segment sequence number corresponding to the segment where the breakpoint occurred to the client, so that the client can correspond to the segment where the breakpoint occurred Continue to upload the target image file with the segment serial number of the file, thereby improving the upload efficiency and upload success rate of the image file.
  • this application provides a mirror file upload system, characterized in that the system includes the client described in the third aspect, the upload proxy device described in the fourth aspect, an object storage device, and a mirroring service device, in,
  • the object storage device is used to receive the fragments S 1 , S 2 ,..., S m sent by the upload agent device, and to convert the fragments S 1 , S 2 ,..., S m Restore to the target image file;
  • the image management device is used to create an image identifier corresponding to the target image file
  • the mirror management device is also used to refresh the mirror status of the target mirror file.
  • the client divides the image file into fragments and sends the fragments to the upload proxy device.
  • the upload proxy device forwards the fragments to the object storage device, and the object storage device restores the fragments. It is the target mirror file to complete the upload of the target mirror file.
  • the image management device refreshes the image status of the target image file to determine whether the target image file is successfully uploaded. Therefore, the above-mentioned mirror file upload system can realize the resumable upload of the target mirror file and the concurrent upload of the target mirror files, which not only improves the upload efficiency of the target mirror file, but also improves the upload success rate of the target mirror file.
  • the present application provides a client, including a processor and a memory, and the processor executes the code in the memory to implement part or all of the steps described in the first aspect.
  • the present application provides an upload proxy device, including a processor and a memory, and the processor executes the code in the memory to implement part or all of the steps described in the second aspect.
  • this application provides a computer storage medium storing computer instructions; the computer instructions are used to implement part or all of the steps described in the first aspect.
  • this application provides a computer storage medium storing computer instructions; the computer instructions are used to implement part or all of the steps described in the second aspect.
  • Figure 1 is a schematic structural diagram of a cloud system provided by this application.
  • FIG. 2 is a schematic structural diagram of a specific cloud system provided by this application.
  • Figure 3 is a schematic diagram of the structure of a mirror file upload system provided by this application.
  • Figure 4 is a schematic diagram of a mirror upload interface provided by this application.
  • Figure 5 is a schematic diagram of a process for uploading a mirror file provided by this application.
  • Fig. 6 is a schematic diagram of a process for uploading a mirror file provided by this application.
  • FIG. 7 is a schematic structural diagram of a client provided by this application.
  • Fig. 8 is a schematic structural diagram of an upload proxy device provided by the present application.
  • FIG. 9 is a schematic structural diagram of another client provided by this application.
  • Fig. 10 is a schematic structural diagram of another upload proxy device provided by the present application.
  • FIG. 1 shows a schematic structural diagram of a cloud system.
  • the owner of the cloud system deploys the cloud computing infrastructure by himself, namely deploys computing resources (for example, servers) 110, deploys storage resources (for example, storage) 120, deploys network resources (for example, network cards) 130, and so on.
  • the owner of the public cloud (for example, an operator) virtualizes the computing resources, storage resources, and network resources of the cloud computing infrastructure, and provides corresponding services for cloud users (for example, users) to use.
  • operators can provide the following three services for users: cloud computing infrastructure as a service (infrastructure as a service, IaaS), platform as a service (platform as a service, PaaS), and software as a service (software as a service, SaaS).
  • cloud computing infrastructure as a service
  • IaaS infrastructure as a service
  • PaaS platform as a service
  • SaaS software as a service
  • the service IaaS provides to users is the utilization of cloud computing infrastructure, including processing, storage, network, and other basic computing resources, enabling users to deploy and run any software, including operating systems and applications. Users do not manage or control any cloud computing infrastructure, but can control the choice of operating system, storage space, deployment applications, and may also gain control of restricted network components (for example, firewalls, load balancers, etc.).
  • the service provided by PaaS to users is to deploy applications developed or acquired by users using development languages and tools provided by vendors (for example, Java, python, Net, etc.) to cloud computing infrastructure. Users do not need to manage or control the underlying cloud computing infrastructure, including networks, servers, operating systems, storage, etc., but users can control the deployed applications and may also control the configuration of the hosting environment for running applications.
  • development languages and tools for example, Java, python, Net, etc.
  • SaaS The services provided by SaaS to users are applications run by operators on cloud computing infrastructure. Users can access applications on cloud computing infrastructure on various devices through client interfaces (for example, browsers). Users do not need to manage or control any cloud computing infrastructure, including networks, servers, operating systems, storage, etc.
  • the cloud system of the present application includes: a cloud management platform 210 and an infrastructure 220.
  • the cloud management platform 210 provides cloud services for users by calling the infrastructure 220.
  • the cloud management platform 210 may be OpenStack, CloudStack, Hadoop, AWS (Amazon Web Service), etc., which is not specifically limited here.
  • the cloud management platform 210 may include a portal 211, a computing service 212, a storage service 213, a network service 214, and a management service 215.
  • the portal211 can provide users with access to cloud systems or cloud services.
  • the computing service 212 may be a component for deploying virtual machines and the like.
  • the storage service 213 may be used to provide components such as distributed and persistent virtual object storage.
  • the network service 214 may be a component for providing network topology management of network nodes.
  • the management service 215 may be a component for controlling other services.
  • the computing service 212 may be Nova
  • the storage service 213 may be Swift
  • Cinder the network service 214 may be Neutron
  • the management service 215 may be Glance, Nova, Horizon, Neutron, Keystone, and so on.
  • Glance is mainly responsible for the management of the metadata of various images provided in the cloud system, and provides users with image management services, which can specifically realize the registration, search and retrieval of virtual machine images, so as to facilitate users to choose virtual machines And install the operating system.
  • Glance's back-end storage supports docking with multiple storage types, such as Swift, simple storage service (S3), or container storage, etc.
  • Swift is the default object storage solution in OpenStack. Compared with other storage solutions (such as S3, container storage, etc.), Swift is easier to build on low-cost, standard hardware storage infrastructure, and Swift supports large object files (such as , Static large files and dynamic large files) upload in fragments.
  • the image file upload system may specifically include a client 310, an upload proxy device 320, an object storage device 330, and an image management device 340.
  • the object storage device 330 is a device deployed with Swift
  • the image management device 340 is a device deployed with Glance. Therefore, the object storage device 330 is referred to as Swift and the image management device 340 is referred to as Glance hereinafter.
  • the upload proxy device 320, the object storage device 330, and the image management device 340 may be deployed on one computing device, or may be deployed on different computing devices, which are not specifically limited here.
  • the mirror file is segmented at the client 310 first, and then the segments of the mirror file are sent to the upload proxy device 320, and the upload proxy device 320 receives the mirror file. After the file is fragmented, it is forwarded to Swift330, and Glance340 is called to refresh the status of the image.
  • the system can be used to upload the mirror file in fragments through the client. That is to say, when the upload of the mirror file is interrupted or failed during the upload process, the client can continue to upload the image from the breakpoint.
  • Mirror file without re-uploading the complete mirror file, which greatly improves the transmission efficiency of the mirror file and the upload success rate.
  • the client may receive the login request input by the user through the browser, and send the login request to the cloud management platform.
  • the login request carries the account number and password
  • the login request is used to request to log in to the mirror management system, which is provided by Glance.
  • the cloud management platform determines the login permission of the client according to the login request. If the client has the login permission, the mirror upload interface is displayed in the browser interface, as shown in Figure 4.
  • the image file to be uploaded includes a first image file, a second image file, and a third image file.
  • the method for uploading the image file provided in this application is described in detail below, which can be specifically divided into the following two situations.
  • FIG. 5 shows a schematic flowchart of a method for uploading a mirror file provided by the present application.
  • the mirror file upload method of this embodiment includes but is not limited to the following steps:
  • the client obtains the first image file.
  • the client determines whether the size of the first image file is greater than a preset threshold. If the size of the first image file is greater than the preset threshold, execute S102; if the size of the first image file is less than or equal to the preset threshold, the client sends the first image file to the upload agent device, and then the upload agent device forwards it Store for Swift.
  • Swift receives the first image file, the upload agent device calls the Glance interface to refresh the image status of the first image file.
  • the client receives the dragging instruction input by the user through the browser, and obtains the first image file according to the dragging instruction.
  • the image upload interface provides a file reading interface
  • the drag instruction is used to drag the first image file to the file reading interface.
  • the client determines the size of the first image file based on the file reading interface, and if the size of the first image file is greater than the preset threshold, execute S102.
  • the client can also receive other types of instructions (for example, selection instructions) input by the user through the browser, so as to obtain the first image file.
  • the client performs a fragmentation operation on the first mirror file according to the preset fragment size, and obtains the fragments S 1 , S 2 ,..., S m of the first mirror file and the total fragment m, where m Is a positive integer.
  • the client performs a fragmentation operation on the first mirror file according to a preset fragment size to obtain fragments S 1 , S 2 ,..., S m , and add to fragment S 1
  • the fragment sequence number I 1 , the fragment S 2 adds the fragment sequence number I 2 , ..., the fragment S m adds the fragment sequence number I m , thereby obtaining data packets P 1 , P 2 ,..., P m .
  • the data packet P 1 contains the fragment S 1 and the fragment sequence number I 1
  • the data packet P 2 contains the fragment S 2 and the fragment sequence number I 2
  • the data packet P m contains the fragment S m and the fragment sequence number I m .
  • fragment sequence numbers I 1 , I 2 ,..., I m are used to indicate the sequence of the fragments S 1 , S 2 ,..., S m , that is, the fragment S 1 is the first Fragment, the second fragment of the fragment S 2 ,..., the m-th fragment of the fragment S m.
  • the data packets P 1 , P 2 ,..., P m may also carry information such as the file name of the first image file and the size of the corresponding fragment, which is not specifically limited here.
  • the client sends the data packets P 1 , P 2 ,..., P m and the total number of fragments m to the upload agent device.
  • the client sends the data packets P 1 , P 2 ,..., P m to the upload agent device in sequence.
  • the client uses l threads to simultaneously send data packets P 1 , P 2 ,..., P l to the upload proxy device, and when the upload proxy device receives the data packets P 1 , P 2 After ,...,P l , the client uses the above l threads to simultaneously send the data packets P l+1 ,P l+2 ,...,P 2 ⁇ l to the upload agent device until the client sends the data
  • the packages P 1 , P 2 ,..., P m are all sent to the upload agent device. Among them, 1 ⁇ l ⁇ m/2, and l is a positive integer. It can be seen that the number of uploads and file data flow can be effectively reduced by means of sharding and concurrency.
  • the upload proxy device when the client sends a data packet to the upload proxy device for the first time (for example, data packet P1 or data packets P 1 , P 2 ,..., P l ), the upload proxy device The Glance interface is called to create mirror metadata, so as to obtain the identity document (ID) corresponding to the mirror metadata. Then, the upload agent device creates an empty object file named after the mirror ID according to the mirror ID.
  • the image metadata is used to describe the first image, which can specifically include the image ID of the first image, the size of the first image, the image status of the first image, and the image format of the first image (for example, qcow2 format, vhd format) and many more.
  • the image ID is used to identify the first image.
  • the upload agent device sends the total number of fragments m and the fragments D 1 , D 2 ,..., D m to Swift.
  • the upload proxy device will segment D 1 , D 2 ,... , D m is sent to Swift in turn.
  • the proxy device receives the upload data packet P after 1, the packet P 1 and the image ID, which is divided sheets S 1 is added to give a target segment prefix name N D 1, D 1 and then sent to the segment Swift.
  • the object name prefix N 1 1 corresponding to the segment ID and segment number includes mirror image D
  • D 1 corresponding to the segment number is the segment number fragment I 1.
  • the proxy device stores uploaded image segment ID and segment D 1 D 1 corresponding to the segment number in the segment record uploading.
  • the upload agent apparatus after receiving the data packet P 2, the data packet P 2 and the mirror ID, which is added slice S 2 N 2 to give the object name prefix segment D 2, D 2 and then sent to the segment Swift.
  • the object name prefix N 2 2 corresponding to the segment ID and segment number includes mirror image D
  • D 2 corresponding to the segment number is the segment number fragment I 2.
  • the proxy device stores uploaded image segment ID and segment D 2 D 2 corresponding to the segment number in the segment record uploading. ....
  • the upload agent device adds the object prefix name N m to the segment S m according to the data packet P m and the mirror ID to obtain the segment D m , and then sends the segment D m to Swift.
  • the object includes mirror image prefix name N m D m corresponding to the segment ID and segment number, segment D m corresponding to the segment number is fragment number I m.
  • the proxy device stores upload mirror segment D m D m corresponding to the segment ID and segment number of the segment in the upload history.
  • the object prefix name can be specifically expressed as the mirror ID-segment serial number
  • the format of the mirror ID can be set to the default storage format of Glance, such as xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxxxx
  • the segment serial number can also be set to the default Glance storage format.
  • Storage format, and the segment sequence number corresponds to the segment sequence number one to one.
  • the segment sequence number corresponding to the segment sequence number I 15 (00015) is 00015
  • the object prefix name N 15 can be expressed as xxxxxx-xxxx-xxxx-xxxxxxxxxxxxxx -00015.
  • the multipart upload record can be seen in Table 1.
  • the object prefix name corresponding to the segment S 1 is xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx-00001
  • the object prefix name corresponding to the segment S 2 is xxxxxxxx- xxxx-xxxx-xxxxxxxxxxxx-00002
  • the object prefix name corresponding to the fragment S m is xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx-m.
  • the client sends data packets P 1 , P 2 ,..., P l to the upload proxy device in parallel
  • P l+1 , P l+2 ,..., P 2 ⁇ l is sent to the upload agent device in parallel
  • the data packets P m-l+1 ,P m-l+2 ,...,P m are sent to the upload agent device in parallel
  • the upload agent device will be divided into pieces D 1 ,D 2 ,...,D l are sent to Swift in parallel, and the segments D l+1 ,D l+2 ,...,D 2 ⁇ l are sent to Swift in parallel
  • the segments D m -l+1 ,D m-l+2 ,...,D m are sent to Swift in parallel.
  • the upload agent device receives the data packets P 1 , P 2 ,..., P l , according to the data packets P 1 , P 2 ,..., P l and the mirror ID, they are respectively fragments S 1 , S 2 ,...,S l add object prefix names N 1 ,N 2 ,...,N l to get segments D 1 ,D 2 ,...,D l , and then segment D 1 ,D 2 ,...,D l is sent to Swift in parallel.
  • the object prefix name N 1 includes the mirror ID and the segment sequence number corresponding to the segment D 1 , and the segment sequence number corresponding to the segment D 1 is the segment sequence number I 1 ;
  • the object prefix name N 2 includes the mirror ID and the segment D 2 The corresponding segment sequence number, the segment sequence number corresponding to segment D 2 is the segment sequence number I 2 ;
  • the object prefix name N l includes the mirror ID and the segment sequence number corresponding to the segment D m, and the segment corresponding to the segment D l The segment sequence number is the fragment sequence number I l .
  • the upload agent device will save the mirror IDs and points of segments D 1 , D 2 ,..., D l in the segment upload record. Segment number corresponding to segment D 1 , D 2 ,..., D l. It should be understood that the upload proxy device sends the fragments S l+1 , S l+2 ,..., S 2 ⁇ l to Swift in parallel,..., the fragments S m-l+1 ,S m-l. The process of sending +2 ,...,S m to Swift in parallel is similar to the process of sending the fragments S 1 , S 2 ,..., S l to Swift in parallel by the uploading agent device, and will not be repeated here.
  • the above steps implement the process from the input stream of the upload proxy device to the output stream of Swift, that is, read the image file from the upload proxy device and write the image file to Swift, thus eliminating the need for local caching.
  • uploading the image file to Swift not only improves the upload efficiency of the image file, but also saves storage space.
  • Swift according to the received segment D 1, to give the object points sheets S 1 and the name prefix N 1; Swift according to the received segment D 2, to give the object slice S 2 and the prefix name N 2; ...; Swift D m in accordance with the received segments, and obtain a target fragment prefix name S m N m. Moreover, Swift can also obtain the mirror IDs of the segments S 1 , S 2 ,..., S m and the corresponding segment sequence numbers according to the object prefix names of the segments D 1 , D 2 ,...D m, thereby It is determined that the fragments S 1 , S 2 ,..., S m all belong to the fragments of the first mirror file.
  • the upload proxy device When Swift receives all the parts, that is, when the upload proxy device determines that the number of parts recorded in the multipart upload record is the same as the total number of fragments m, the upload proxy device sends the object file named with the mirror ID to Swift and sends Invoke the Swift interface to make Swift merge the fragments S 1 , S 2 ,..., S m of the first image file according to the segment number according to the object prefix names N 1 , N 2 ,..., N m, Thus, the first image file is obtained.
  • the upload proxy device obtains the upload progress of the first image file according to the multipart upload record and the total number of fragments m, and then calls the Glance interface to refresh the image status of the first image.
  • the mirror state includes the queued state, the saving state, the active state, and the killed state, and so on.
  • the queued state indicates that the image file is waiting to be uploaded;
  • the saving state indicates that the image file is being uploaded;
  • the active state indicates that the image file is uploaded and the image can be used at this time;
  • the killed state indicates that an error occurred during the upload of the image file.
  • the upload agent device determines the upload progress of the first mirror file according to the multipart upload record, and then calls the Glance interface to refresh the mirror status corresponding to the first mirror file. If the image ID of any one of the segments and its sequence number are not stored in the multipart upload record, it means that the upload progress of the first image file is 0, and the status of the first image is queued at this time. If the multipart upload record stores the image IDs of k segments and the corresponding k segment sequence numbers, it means that the upload progress of the first image file is k/m, and the state of the first image is the saving state at this time.
  • the multipart upload record stores m segment mirror IDs and their corresponding m segment sequence numbers, it means that the upload progress of the first mirror file is 100%, and the state of the first mirror at this time is the active state. If the upload process is interrupted or the upload fails, the status of the first image is killed at this time.
  • the upload proxy device calls the Glance interface to refresh the image state of the first image, and determines the first image file.
  • a mirror is in the available state, so that the registration of the first mirror is completed.
  • the client processes the first image file into 2663 fragments according to the preset fragment size, that is, fragments S 1 , S 2 ,..., S 2663 , Among them, the total number of fragments is 2,663, the size of fragments S 1 , S 2 ,..., S 2662 are all 50 MB, and the size of fragment S 2663 is 20 MB.
  • the client adds the fragment sequence numbers for the fragments S 1 , S 2 ,..., S 2663 in turn, and obtains data packets P 1 , P 2 ,..., P 2663 , where the fragment sequence number of the fragment S 1 is I 1 referred to as 00001, slice number S fragment denoted as I 2 2 00002, ...., slice S fragment number 2663 2663 is referred to as the I 02663.
  • the client sends the data packet P 1 and the total number of fragments to the upload proxy device.
  • the upload proxy device receives the data packet P 1 and calls the Glance interface to create mirror metadata, thereby obtaining the mirror ID (xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx) ), and then create a target object file named after the mirror ID based on the mirror ID.
  • the upload agent device adds the object prefix name N 1 (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx-00001) to the obtained segment S 1 according to the data packet P 1 and the mirror ID to obtain the segment D 1 , and then Segment D 1 is forwarded to Swift.
  • the upload agent device saves the mirror ID and segment serial number (00001) corresponding to segment D 1 in the segment upload record.
  • the client sends the data packet P 2 to the upload proxy device, and the upload proxy device adds the object prefix name N 2 (xxxxxxxx-xxxx-xxxx-xxxx) to the received segment S 2 according to the data packet P 2 and the mirror ID. -xxxxxxxxxxxx-00002) Obtain segment D 2 and forward segment D 2 to Swift.
  • the upload proxy device When Swift receives segment D 2 , the upload proxy device will upload the corresponding mirror ID and segment serial number of segment D 2 (00002 ) Is saved in the multipart upload record; ...; the client sends the data packet P 2663 to the upload proxy device, and the upload proxy device adds the object prefix name N 2663 to the received segment S 2663 according to the data packet P 2663 and the mirror ID (xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx-02663) Get segment D 2663 , and forward segment D 2663 to Swift.
  • the upload proxy device When Swift receives segment D 2663 , the upload proxy device will upload segment D 2663 to the corresponding The mirror ID and part number (02663) are saved in the part upload record.
  • the upload proxy device sends the target object file to Swift, and will call the Swift interface, so that Swift divides S 1 , S 2 ,... according to the object prefix name N 1 , N 2 ,..., N 2663. , S 2663 is merged into the first image file.
  • the upload agent device also periodically calls the Glance interface to refresh the image status of the first image according to the multipart upload record and the total number of fragments.
  • the upload proxy device refreshes the image status of the first image by calling the Glance interface, and obtains that the image status of the first image is available. , So as to complete the registration of the first mirror.
  • the client when there is no upload interruption or upload failure of the image file during the upload process, the client divides the image file into fragments, and sends the fragments of the image file to the upload agent device, and then the upload agent device
  • the segment corresponding to the segment is forwarded to Swift, so that Swift can merge the segments into a mirror file based on the received segment and the object prefix name.
  • the client can also send the fragments of the mirror file to the upload proxy device in parallel, and then the upload proxy device sends the fragments to Swift in parallel, thereby improving the upload efficiency of the mirror file.
  • FIG. 6 shows a schematic flowchart of a method for uploading a mirror file provided by the present application.
  • the mirror file upload method of this embodiment includes but is not limited to the following steps:
  • S201 The client sends a resumable upload request to the upload proxy device.
  • the resumable upload request carries the image ID corresponding to the first image file
  • the resume resumable upload request is used to request the segment sequence number corresponding to the segment at the breakpoint when the upload is interrupted or the upload fails.
  • the upload of a single fragment fails, for example, the upload agent device does not receive the fragment S n+1 .
  • the upload is interrupted, that is, the upload proxy device does not receive the fragments S n+1 , S n+2 ,..., S m .
  • 1 ⁇ n ⁇ m, and n is a positive integer.
  • the network when the client sends a data packet P n+1 to the upload agent device, the network is interrupted, the current network environment does not support the upload of the data packet, the upload agent device is abnormal, etc., so that the upload agent device The data packet P n+1 is not received.
  • the client sends a data packet P n+2 to the upload proxy device the network environment or the upload proxy device returns to normal, and the upload proxy device will be able to receive the data packets P n+2 , P n+3 ,... ,P m , in other words, the upload agent device receives the data packets P 1 , P 2 ,...,P n ,P n+2 ,P n+3 ,...,P m .
  • the upload proxy device when the client sends a data packet P n+1 to the upload agent device, the network is interrupted, the current network environment does not support the upload of the data packet, the upload agent device is abnormal, etc., so that the upload agent The device cannot receive the remaining data packets (P n+1 ,P n+2 ,...,P m ) starting from the data packet P n+1 .
  • the upload proxy device only receives the data packet P 1 , P 2 ,...,P n .
  • the upload proxy device sends the segment sequence number I n corresponding to the segment at the breakpoint to the client according to the request for resuming the transfer at the breakpoint.
  • the upload agent device after the upload agent device receives the resumable upload request, according to the image ID corresponding to the first image file, it calls the Glance interface to refresh the image status of the first image, thereby obtaining a file upload token (token ). Then, the upload proxy device sends the segment sequence number I n (segment sequence number) corresponding to the segment (segment) where the breakpoint occurred in the multipart upload record to the client according to the file upload token, so that the client can The sequence number I n starts from the data packet P n+1 and continues to transmit the remaining data packets.
  • the client transmits upload failures I n corresponding fragment packet to upload the proxy apparatus according to the fragment number
  • the proxy device transmits the upload by uploading fragment corresponding to the failed segments to Swift.
  • the client sends only upload proxy device according to the slice packet number I n P n + 1.
  • the data packet P n+1 includes a fragment S n+1 and a fragment sequence number I n+1 .
  • Upload proxy device after receiving the data packet P n + 1, the data packet P n + 1 and the image file ID of the first mirror, to slice the object S + 1 to add a prefix name n N n + 1 D n + segment obtained 1 , and then send segment D n+1 to Swift.
  • the object name prefix N n + 1 and the segment ID includes mirror image D n + 1 corresponding to the segment number
  • segment D n + 1 corresponding to the segment number is the slice number I n + 1.
  • the proxy device upload saved image D n + segment ID and segment D n 1 + 1 in a segment corresponding to the segment number of the record uploading.
  • the client sequentially sends data packets P n+1 , P n+2 ,..., P m to the upload proxy device according to the fragment sequence number I n .
  • the data packet P n+1 includes the fragment S n+1 and the fragment sequence number I n+1
  • the data packet P n+2 includes the fragment S n+2 and the fragment sequence number I n+2
  • the data packet P m includes the fragment S m and the fragment sequence number I m .
  • Upload proxy device after receiving the data packet P n + 1, the data packet P n + 1 and the image ID, add a prefix name for the object slice S n + 1 N n + 1 D to give the segment n + 1, then the points Segment D n+1 is sent to Swift.
  • the object prefix name N n + 1 and the segment ID includes mirror image D n + 1 corresponding to the segment number, segment D n + 1 corresponding to the segment number is the slice number I n + 1.
  • the proxy device upload saved image D n + segment ID and segment D n 1 + 1 in a segment corresponding to the segment number of the record uploading.
  • Upload proxy device after receiving the data packet P n + 2, the data packet P n + 2 and the image ID, add a prefix name for the object slice S n + 2 N n + 2 to give D segment n + 2, then the sub- Segment D n+2 is sent to Swift.
  • the object name prefix N n + 2 includes mirror image ID and segment D n + 2 corresponding to the segment number, segment D n + 2 corresponding to the segment number is the slice number I n + 2.
  • the proxy device upload saved image D n + segment ID and segment D n 2 + 2 corresponding to the segment number in the segment uploaded records. ....
  • the upload agent device After receiving the data packet P m , the upload agent device adds the object prefix name N m to the segment S m according to the data packet P m and the mirror ID to obtain the segment D m , and then sends the segment D m to Swift.
  • the object includes mirror image prefix name N m D m corresponding to the segment ID and segment number, segment D m corresponding to the segment number is fragment number I m.
  • the proxy device stores upload mirror segment D m D m corresponding to the segment ID and segment number of the segment in the upload history.
  • the client uses 1 thread to send the data packets P n+1 , P n+2 ,..., P n+1 to the upload agent device in parallel until the upload agent device receives Data packet P m .
  • the upload agent device receives the data packets P n+1 ,P n+2 ,...,P n+l , according to the data packets P n+1 ,P n+2 ,...,P n+l and mirroring ID, respectively add the object prefix name N n+1 ,N n+2 ,...,N n+l to the fragments S n+1 , S n+2 ,..., S n+l to get the score Segment D n+1 , D n+2 ,..., D n+l , and then send the segments D n+1 , D n+2 ,..., D n+l to Swift in parallel.
  • the object name prefix N n + 1 and the segment ID includes mirror image D n + 1 corresponding to the segment number, segment D n + 1 corresponding to the segment number is the slice number I n + 1; target name prefix N n +2 includes the mirror ID and the segment number corresponding to the segment D n+2 , the segment number corresponding to the segment D n+2 is the segment number I n+2 ; ...; the object prefix name N n+1 includes the mirror ID The segment sequence number corresponding to the segment D n+1 , and the segment sequence number corresponding to the segment D n+1 is the segment sequence number I n+1 .
  • the upload agent device will save the segments D n+1 , D n+2 , in the segment upload record respectively. .., D n + l mirrored segment ID and D n + 1, D n + 2, ..., D n + l corresponding to the segment number.
  • the segments D 1 , D 2 ,..., D n , D n+2 , D n are saved in Swift +3 ,...,D m .
  • the segments D 1 , D 2 ,..., D n , D n+2 , D n+3 ,..., D m are determined by the upload agent device according to the data packets P 1 , P 2 ,...
  • the segments D 1 , D 2 ,..., D n are saved in Swift before the client sends a resumable upload request to the upload proxy device.
  • the segments D 1 , D 2 ,..., D n are the segments S 1 , S 2 , and S 2 according to the data packets P 1 , P 2 ,..., P n and the mirror ID by the upload agent device.
  • ...,S n is obtained after adding object prefix names N 1 ,N 2 ,...,N n .
  • the upload agent device obtains the upload progress of the first image file according to the multipart upload record and the total number of fragments m, and then calls the Glance interface to refresh the image status of the first image.
  • the proxy component After Swift merges the fragments S 1 , S 2 ,..., S m into the first image file, the proxy component calls the Glance interface to refresh the image status of the first image, and determines the first image file.
  • the mirror is in a usable state, thereby completing the registration of the first mirror.
  • the upload proxy device can also call the Glance interface to refresh the mirror status of the first mirror.
  • the client browser processes the first image file into 2560 fragments according to the preset fragment size, that is, fragments S 1 , S 2 ,...,S 2560 .
  • the total number of fragments is 2560
  • the sizes of fragments S 1 , S 2 ,..., S 2560 are all 200 MB.
  • the browser adds the sequence numbers of the fragments to the fragments S 1 , S 2 ,..., S 2560 in turn to obtain data packets P 1 , P 2 ,..., P 2560 .
  • the fragment serial number I 1 of the fragment S 1 is recorded as 00001
  • the fragment serial number I 2 of the fragment S 2 is recorded as 00002,...
  • the fragment serial number I 2560 of the fragment S 2560 is recorded as 02560.
  • the client sends the data packet P 1 and the total number of fragments to the upload proxy device.
  • the upload proxy device receives the data packet P 1 and calls the Glance interface to create mirror metadata, thereby obtaining the mirror ID (xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxxxx) ), and then create a target object file named after the mirror ID based on the mirror ID.
  • the upload agent device After the upload agent device receives the data packet P 1 , it adds the object prefix name N 1 (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx-00001) to the segment S 1 according to the data packet P 1 and the mirror ID , thereby obtaining the segment D 1 , And send segment D 1 to Swift.
  • the upload proxy device When Swift receives segment D 1 , the upload proxy device saves the mirror ID corresponding to segment D 1 and its segment serial number (00001) in the segment upload record; the client will The data packet P 2 is sent to the upload agent device.
  • the upload agent device After the upload agent device receives the data packet P 2 , it adds the object prefix name N 2 (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxx) to the segment S 2 according to the data packet P 2 and the mirror ID -00002), so as to obtain segment D 2 and send segment D 2 to Swift.
  • the upload agent device saves the mirror ID corresponding to segment D 2 and its corresponding image ID in the segment upload record. Segment sequence number (00002); ...; the client sends the data packet P 2000 to the upload agent device.
  • the upload agent device After the upload agent device receives the data packet P 2000 , it adds the object prefix name for the segment S 2000 according to the data packet P 2000 and the mirror ID N 2000 (xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx-02000) to obtain segment D 2000 and send segment D 2000 to Swift.
  • the upload agent device uploads records in segment The mirror ID corresponding to segment D 2000 and its segment number (02000) are stored in it.
  • the client sends the data packet P 2001 to the upload agent device, the data packet P 2001 and the remaining data packets cannot be sent to the upload agent device due to a network interruption. When the network is restored, the client sends a resumable upload request to the upload agent device.
  • the upload proxy device sends the fragment sequence number I 2000 (02000) to the client according to the resumable upload request. Then, the client sends a data packet P 2001 to the upload proxy device according to the fragment sequence number I 2000. After the upload proxy device receives the data packet P 2001 , it adds the object prefix name N 2001 to the fragment S 2001 according to the data packet P 2001 and the mirror ID.
  • the upload agent device saves it in the segment upload record
  • the upload proxy device calls the Swift interface, so that Swift merges the fragments S 1 , S 2 ,..., S 2560 into the first image file according to the object prefix names N 1 , N 2 ,..., N 2560 .
  • the upload agent device also periodically calls the Glance interface to refresh the image status of the first image according to the multipart upload record and the total number of fragments.
  • the upload proxy device refreshes the first image's image status by calling the Glance interface, and gets the first image's image status as available. , So as to complete the registration of the first mirror.
  • the browser will re-upload the first image file to the upload proxy device, and then The upload proxy device forwards it to Swift for storage.
  • Swift receives the first image file again, the upload agent device calls the Glance interface to refresh the image status of the first image file.
  • the preset fragment size may be 50MB, 200MB, 60MB, 150MB, etc. in the foregoing embodiment, and there is no specific limitation here.
  • this embodiment does not provide data packets P 1 , P 2 ,...,P n-1 ,P n+1 ,...,P m P 1 ,P 2 ,...,P m ,
  • the definition and acquisition process of data packets P 1 , P 2 ,..., P n-1 , segment D 1 , D 2 ,..., D n-1 , D n+1 ,..., D The definition and acquisition process of m , segment D 1 , D 2 ,..., D n-1 are described in detail, and Swift does not merge the segments S 1 , S 2 ,..., S m into the first image file.
  • the client when the upload is interrupted or the upload fails during the upload process of the image file, the client sends a breakpoint resuming upload request to the upload proxy device to obtain the fragment sequence number corresponding to the fragment where the breakpoint occurred, thereby This allows the client to resend the failed upload fragments to the upload proxy device, thereby completing the image file upload process. It can be seen that the use of the above method can realize the resumable upload of the mirror file, and improve the upload success rate and upload efficiency of the mirror file.
  • the client can also send the fragments of the mirror file to the upload proxy device in parallel, and then the upload proxy device sends the fragments to Swift in parallel, thereby improving the upload efficiency of the mirror file.
  • the client 310 may be an entity on the user side for receiving or transmitting signals, such as a new generation UE (gUE), which may specifically include mobile phones, tablets, and personal digital assistants.
  • gUE new generation UE
  • PDA personal digital assistant
  • mobile internet device mobile internet device, MID
  • notebook computer smart wearable device (such as smart watch, smart bracelet), etc.
  • FIG. 7 is a schematic structural diagram of a client provided in this application.
  • the client 310 may include an acquiring unit 410, a fragment processing unit 420, and a sending unit 430. in,
  • the obtaining unit 410 is used to obtain the first image file.
  • the fragmentation processing unit 420 is configured to perform a fragmentation operation on the first mirror file according to the preset fragment size to obtain the fragments S 1 , S 2 ,..., S m of the first mirror file and the total fragment m, Among them, m is a positive integer.
  • the sending unit 430 is configured to send the data packets P 1 , P 2 ,..., P m and the total number of fragments m to the upload agent device.
  • the obtaining unit 410 is further configured to determine whether the size of the first image file is greater than a preset threshold after obtaining the first image file, and if the size of the first image file is greater than the preset threshold, The first mirror file 311 is sent to the fragmentation processing unit 420; if the size of the first mirror file is less than or equal to the preset threshold, the first mirror file is sent to the sending unit 430, and then the first mirror file is sent by the sending unit 430 Sent to the upload agent device.
  • the acquiring unit 410 may receive a drag instruction input by the user and acquire the first image file according to the drag instruction; the acquiring unit 410 may also receive a selection instruction input by the user, and according to the selection instruction Obtaining the first image file, etc., is not specifically limited here.
  • the fragmentation processing unit 420 is specifically configured to perform a fragmentation operation on the first mirror file according to a preset fragment size to obtain fragments S 1 , S 2 ,..., S m , and is added sheets S 1 sub-fragment No. I 1, S 2 is added slice slice number I 2, ..., S m slice add fragment number I m, to thereby obtain the data packet P 1, P 2, ..., P m .
  • the data packet P 1 contains the fragment S 1 and the fragment sequence number I 1
  • the data packet P 2 contains the fragment S 2 and the fragment sequence number I 2
  • the data packet P m contains the fragment S m and the fragment sequence number I m .
  • fragment sequence numbers I 1 , I 2 ,..., I m are used to indicate the sequence of the fragments S 1 , S 2 ,..., S m , that is, the fragment S 1 is the first Fragment, the second fragment of the fragment S 2 ,..., the m-th fragment of the fragment S m.
  • the sending unit 430 may send the data packets P 1 , P 2 ,..., P m to the uploader in sequence. Agent equipment.
  • the sending unit 430 uses l threads to simultaneously send the data packets P 1 , P 2 ,..., P l to the upload proxy device, and when the upload proxy device receives the data packets P 1 , P 2 ,..., P
  • the sending unit 430 uses the above l threads to send the data packets P l+1 , P l+2 ,..., P 2 ⁇ l to the upload agent device at the same time, until the sending unit 430 sends the data packets P 1 , P 2 ,..., P m are all sent to the upload agent device.
  • 1 ⁇ l ⁇ m/2, and l is a positive integer. It can be seen that the number of uploads and file data flow can be effectively reduced by means of sharding and
  • the transmission unit 430 it is also used to send a resumable upload request to the upload agent device to obtain the fragment sequence number I n , where the resumable upload request carries the mirror ID corresponding to the first mirror file, and the resume resumable upload request is used for request generation
  • the fragment sequence number corresponding to the fragment of the breakpoint; according to the fragment sequence number I n , the data packet P n+1 is sent to the upload agent device.
  • the sending unit 430 is also used to send the upload proxy device Send a breakpoint resume request to obtain the fragment sequence number I n .
  • the resumable transmission request carries the mirror ID corresponding to the first mirror file, and the resumable transmission request is used to request the fragment sequence number corresponding to the fragment where the breakpoint occurred; according to the fragment sequence number I n , the data packet P n+1 ,P n+2 ,...,P m are sent to the upload agent device.
  • the sending unit 430 may send the data packets P n+1 , P n+2 ,..., P m to the upload agent device in turn, and may also use the concurrent upload method to send the data packets P n+1 , P n+ 2 ,...,P m is sent to the upload agent device, please refer to S203 for details.
  • the fragmentation processing unit divides the mirror file into fragments, so that the client can upload the mirror file in fragments.
  • the sending unit can also implement concurrent uploading of fragments. Therefore, when the above-mentioned client is used to upload the mirror file, the upload efficiency of the target mirror file can be greatly improved.
  • the sending unit sends a resumable upload request to the upload proxy device to obtain the segment sequence number corresponding to the segment where the breakpoint occurred, so that the sending unit can The segment sequence number corresponding to the segment of the breakpoint sends the data packet corresponding to the segment that failed to upload to the upload agent device.
  • the resumable upload of the mirror file and the concurrent upload of the mirror file can be realized, which not only improves the upload efficiency of the mirror file, but also improves the upload success rate of the mirror file.
  • the upload proxy device provided in this application can be a software device or a hardware device.
  • the upload proxy device can be deployed separately in any environment (cloud environment, edge environment, terminal computing equipment, etc.) On the computing device, it can also be deployed on the same computing device as Swift and Glance; when the upload proxy device is a hardware device, the upload proxy device can be a computing device in any environment.
  • the unit modules inside the upload agent device can also be divided into multiple categories. Each module can be a software module, a hardware module, or a part of a software module and a part of a hardware module, which is not limited in this application.
  • FIG. 8 is an exemplary division manner.
  • the upload proxy device 320 may include an acquiring unit 510, a sending unit 520, a calling unit 530, and a progress recording unit 540. The functions of each functional unit are introduced below.
  • the acquiring unit 510 is configured to receive the total number of fragments m and data packets P 1 , P 2 ,..., P m sent by the client, where the data packet P 1 includes the fragment S 1 and the fragment sequence number I 1 , and the data
  • the packet P 2 contains the fragment S 2 and the fragment sequence number I 2 ,...
  • the data packet P m contains the fragment S m and the fragment sequence number I m
  • the fragments S 1 , S 2 ,..., S m are clients It is obtained by fragmenting the target image file, and m is a positive integer.
  • the sending unit 520 is configured to send the total number of fragments m and the fragments S 1 , S 2 ,..., S m to Swift.
  • Calling unit 530 is used when the data packet P is sent by a client 1, a first call Glance create a mirror image file corresponding to the ID.
  • the progress recording unit 540 is used to save the image ID of the first image file, the image size of the first image file, the size of the fragments S 1 , S 2 ,..., S m , and the fragment sequence numbers I 1 , I 2 ,... ..,I m .
  • the sending unit 520 before the sending unit 520 sends the fragments S 1 , S 2 ,..., S m to Swift, the sending unit 520 is also used to pair the fragments S 1 , S 2 ,... ,S m adds the corresponding object prefix name to obtain the segments D 1 , D 2 ,..., D m , and then sends the segments D 1 , D 2 ,..., D m to Swift.
  • sub-sheets S 1 object prefix name of the corresponding N 1 of includes mirror image ID and the fragment number I 1
  • slice S 2 corresponding to the object prefix name N 2 includes mirror image ID and slice number I 2, ..., slice S m
  • the corresponding object prefix name N m includes the mirror ID and the fragment sequence number I m .
  • Swift If Swift receives segment D 2 , it saves the mirror ID of segment D 2 and segment number I 2 in the progress recording unit 540 ;...;
  • the sending unit 520 adds the object prefix name N m to the segment S m to obtain the segment D m , and then sends the segment D m to Swift, and if Swift receives the segment D m , it is saved in the progress recording unit 540
  • the segment D m mirror ID and the segment sequence number I m .
  • the sending unit 520 when the uploading process of the first image file is not interrupted or the uploading fails, the sending unit 520 adds object prefixes to the segments S 1 , S 2 ,..., S 1 respectively. Name N 1 ,N 2 ,...,N l to get the segments D 1 , D 2 ,...,D l , and then send the segments D 1 , D 2 ,..., D l to Swift in parallel.
  • the upload proxy device sends the fragments S l+1 , S l+2 ,..., S 2 ⁇ l to Swift in parallel,..., the fragments S m-l+1 ,S m-l
  • the process of sending +2 ,...,S m to Swift in parallel is similar to the process of sending the fragments S 1 , S 2 ,..., S l to Swift in parallel by the uploading agent device, and will not be repeated here.
  • the acquiring unit 510 when the first slice of a single image file occurs during the upload process (e.g., data packets corresponding to P n + 1 corresponding to the fragment S n + 1) upload failures, i.e. acquiring unit
  • the acquiring unit 510 is also used to receive the client
  • the sending unit 520 is also used to send the segment sequence number I n saved in the progress recording unit 540 to the client for the sent request for resuming the transmission.
  • the acquiring unit 510 is further configured to receive the data packet P n+1 sent by the client according to the fragment sequence number I n
  • the sending unit 520 is further configured to add the object prefix name N n+1 to the fragment S n+1 to obtain the fragment Segment D n+1 and send segment D n+1 to Swift. If Swift receives the segment D n+1 , it saves the mirror ID of the segment D n+1 and the segment sequence number I n+1 in the progress recording unit 540. It should be understood that the failure to upload multiple fragments of the first image file during the upload process is similar to the failure to upload a single fragment, and will not be repeated here.
  • the obtaining unit 510 when the uploading of the first image file is interrupted during the uploading process (for example, the interruption occurs at the data packet P n+1 ), that is, the obtaining unit 510 only receives the transmission from the client.
  • the acquiring unit 510 is also used to receive a resumable transmission request sent by the client, and the sending unit 520 is also used to transfer the fragments stored in the progress recording unit 540 The sequence number I n is sent to the client.
  • the acquisition unit 510 for further receiving the remaining data packet fragment in accordance with the client ID from the packet I n P n + 1 starts continuous transmission (P n + 1, P n + 2, ..., P m ), the sending unit 520 is also used to add object prefix names N n+1 , N n+2 ,..., N m to the segments S n+1 , S n+2 ,..., S m to obtain the points Segment D n+1 , D n+2 ,..., D m , and send segments D n+1 , D n+2 ,..., D m to Swift.
  • call unit 530 is further configured to restore the first call Swift image file.
  • the calling unit 530 is also used to call Glance to refresh the mirroring state of the first mirror after Swift merges the fragments S 1 , S 2 , ..., S m into the first mirror file. It is determined that the first image is in an available state, so that the registration of the first image is completed.
  • the calling unit 530 may also call Glance in real time during the uploading process of the first mirror file to refresh the mirror status of the first mirror, which is not specifically limited here.
  • this embodiment does not elaborate on the specific process of the upload proxy device calling Swift to restore the first image file, nor the specific process of the upload proxy device calling Glance to refresh the image status of the first image.
  • the specific process of uploading the proxy device to send the segment corresponding to the segment has not been elaborated in detail.
  • the acquisition unit of the upload proxy device receives the data packet sent by the client, and can obtain the fragments of the mirror file, and then the sending unit forwards the fragments corresponding to the fragments to Swift, so that Swift can obtain the fragments according to the fragments.
  • Object prefix names and fragments so that the fragments can be restored to mirror files without local caching, and the target mirror file can be uploaded.
  • the sending unit can send the segment sequence number corresponding to the segment where the breakpoint occurred to the client, so that the client can correspond to the segment where the breakpoint occurred Continue to upload the failed fragments in the mirror file with the serial number of the fragment, thereby greatly improving the upload efficiency and upload success rate of the mirror file.
  • Figure 9 shows a schematic structural diagram of another client provided by this application.
  • the client 310 may specifically include a processor 610, a communication interface 620, and a memory 630. Wherein, the processor 610, the communication interface 620, and the memory 630 are coupled through the bus 640.
  • the processor 610 may be a central processing unit (CPU), a general-purpose processor, a digital signal processor (digital signal processor, DSP), an application specific integrated circuit (ASIC), a field programmable gate array ( field programmable gate array (FPGA) or other programmable logic device (programmable logic device, PLD), transistor logic device, hardware component, or any combination thereof.
  • the processor 610 may implement or execute various exemplary methods described in conjunction with the disclosure of the present application. Specifically, the processor 610 reads the program code stored in the memory 630, and cooperates with the communication interface 620 to execute part or all of the steps of S101-S103, S201, and S203.
  • the communication interface 620 can be a wired interface or a wireless interface for communicating with other modules or devices.
  • the wired interface can be an Ethernet interface, a controller area network interface, a local interconnect network (LIN), and a FlexRay interface.
  • the interface can be a cellular network interface or a wireless local area network interface.
  • the communication interface 620 may be connected to the upload proxy device 320 and so on.
  • the memory 630 may include volatile memory, such as random access memory (random access memory, RAM); the memory 630 may also include non-volatile memory, such as read only memory (ROM), flash memory, and hard disk. (hard disk drive, HDD) or solid state drive (solid state drive, SSD), the storage 630 may also include a combination of the above types of storage.
  • the memory 630 may store program codes and program data. Wherein, the program code is composed of the codes of some or all of the units in the client shown in FIG.
  • the program data is the data generated by the client in the process of running the program shown in Figure 7, for example, the fragments S 1 , S 2 ,..., S m , and the data packets P 1 , P 2 ,..., P m , the size of the image file, the number of fragments, and so on.
  • the bus 640 may be a controller area network (CAN) or other internal buses.
  • the bus 640 can be divided into an address bus, a data bus, a control bus, and so on. For ease of representation, only one thick line is used in FIG. 9 to represent it, but it does not mean that there is only one bus or one type of bus.
  • Fig. 10 shows a schematic structural diagram of another upload proxy device provided by the present application.
  • the upload proxy device 320 may specifically include a processor 710, a communication interface 720, and a memory 730. Wherein, the processor 710, the communication interface 720, and the memory 730 are coupled through a bus 740.
  • the processor 710 may be a CPU, a general-purpose processor, DSP, ASIC, FPGA or other PLD, transistor logic device, hardware component, or any combination thereof.
  • the processor 710 may implement or execute various exemplary methods described in conjunction with the disclosure of the present application. Specifically, the processor 710 reads the program code stored in the memory 730, and cooperates with the communication interface 720 to execute part or all of the steps of S103-S106 and S202-S205.
  • the communication interface 720 can be a wired interface or a wireless interface for communicating with other modules or devices.
  • the wired interface can be an Ethernet interface, a controller area network interface, LIN and FlexRay interface, and the wireless interface can be a cellular network interface or use a wireless LAN Interface, etc.
  • the communication interface 720 may be connected to the network device 750, and the network device 750 may include the client 310, Swift330, Glance340, and so on.
  • the memory 730 may include volatile memory, such as RAM; the memory 730 may also include non-volatile memory, such as ROM, flash memory, HDD, or SSD, and the memory 730 may also include a combination of the foregoing types of memory.
  • the memory 730 may store program codes and program data.
  • the program code is composed of the codes of some or all of the units in the upload proxy device shown in FIG. 8, for example, the code of the acquiring unit 510, the code of the sending unit 520, the code of the calling unit 530, and so on.
  • the program data is the data generated by the upload device in the process of running the program shown in Figure 8, for example, segment D 1 , D 2 ,..., D m , object prefix name N 1 , N 2 ,..., N m , upload records in parts, etc.
  • the bus 740 may be CAN or other internal buses.
  • the bus 740 can be divided into an address bus, a data bus, a control bus, and so on. For ease of representation, only one thick line is used to represent in FIG. 10, but it does not mean that there is only one bus or one type of bus.
  • This application also provides a computer storage medium.
  • the computer storage medium stores computer instructions.
  • the computer instructions are executed by hardware (such as a processor, etc.) to implement part or all of the steps (such as , S101-103, S201, S203).
  • This application also provides a computer storage medium.
  • the computer storage medium stores computer instructions.
  • the computer instructions are executed by hardware (such as a processor, etc.) to implement part or all of the steps performed by the upload agent device 320 in this application ( For example, S103-S106, S202-S205).
  • the above-mentioned embodiments it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof.
  • software it can be implemented wholly or partly in the form of a computer instruction product.
  • the above-mentioned computer instruction product includes one or more computer instructions.
  • the above-mentioned computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
  • the aforementioned computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • the aforementioned computer instructions can be transmitted from a website, computer, server, or data center through a wired (For example, coaxial cable, optical fiber, digital subscriber line) or wireless (for example, infrared, wireless, microwave, etc.) to transmit to another website site, computer, server or data center.
  • the foregoing computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or data center integrated with one or more available media.
  • the above-mentioned usable medium may be a magnetic medium (such as a floppy disk, a storage disk, a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as an SSD), etc.
  • the description of each embodiment has its own emphasis. For parts that are not described in detail in an embodiment, reference may be made to related descriptions of other embodiments.
  • the disclosed device may also be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components can be combined or integrated. To another system, or some features can be ignored or not implemented.
  • the displayed or discussed indirect coupling or direct coupling or communication connection between each other may be through some interfaces, indirect coupling or communication connection between devices or units, and may be in electrical or other forms.
  • the units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions in the embodiments of the present application.
  • the functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
  • the above integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium.
  • the technical solution of the present application essentially or the part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium.
  • a number of instructions are included to enable a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage media may include, for example, various media capable of storing program codes and data files, such as a U disk, a mobile hard disk, a read-only memory, a random access memory, a magnetic disk, or an optical disk.

Abstract

Provided in the present application are a mirror image file uploading method, a related device and a computer storage medium. The method comprises: acquiring a target mirror image file; performing slicing on the target mirror image file to obtain slices S1, S2,..., Sm, and the total number m of slices, wherein m is a positive integer; and sending data packets P1, P2,..., Pn and the total number m of slices to an upload agent device, wherein the data packet P1 includes the slice S1 and a slice sequence number I1, the data packet P2 includes the slice S2 and a slice sequence number I2, …, and the data packet Pn includes the slice Sn and a slice sequence number In, n is a positive integer, and n ≤ m.

Description

一种镜像文件的上传方法、相关设备及计算机存储介质Method for uploading mirror file, related equipment and computer storage medium 技术领域Technical field
本申请涉及虚拟化技术领域,尤其涉及一种镜像文件的上传方法、相关设备及计算机存储介质。This application relates to the field of virtualization technology, and in particular to a method for uploading image files, related equipment, and computer storage media.
背景技术Background technique
在云服务的应用场景下,镜像服务以门户网站(portal)的形式呈现,因此用户需要通过浏览器完成镜像的注册以及上传。在浏览器上传文件的过程中,经常出现由于网络环境较差而导致文件上传中断或者上传失败的问题,而且浏览器不支持文件的分片上传,因此当用户通过浏览器上传大镜像文件且未成功上传至服务器时,该大镜像文件需要重新进行上传,从而大大降低了大镜像文件的上传效率。In the application scenario of cloud services, the mirroring service is presented in the form of a portal, so the user needs to complete the registration and upload of the mirroring through a browser. In the process of uploading files in the browser, the problem of file upload interruption or upload failure often occurs due to poor network environment, and the browser does not support file uploading in fragments, so when the user uploads a large image file through the browser and does not When it is successfully uploaded to the server, the large image file needs to be re-uploaded, which greatly reduces the upload efficiency of the large image file.
目前,针对公有云的镜像服务,用户需要开通商业的对象存储服务并通过专用的工具(例如,Packer、OBS Browser)实现镜像文件的上传,这种方式需要用户在下载和学习该工具之后,才能进行镜像文件的上传,从而降低了易用性。针对私有云的镜像服务,企业需要部署专用的对象存储服务,因此通过这种方式将耗费较高的成本,并在一定程度上降低了易用性。At present, for public cloud mirroring services, users need to open commercial object storage services and upload mirror files through dedicated tools (for example, Packer, OBS Browser). This method requires users to download and learn the tools before they can Upload the image file, thereby reducing the ease of use. For private cloud mirroring services, enterprises need to deploy dedicated object storage services. Therefore, this method will consume a higher cost and reduce the ease of use to a certain extent.
发明内容Summary of the invention
本申请实施例公开了一种镜像文件的上传方法、相关设备及计算机存储介质,能够有效解决浏览器不支持上传大镜像文件以及上传效率低下的问题。The embodiment of the application discloses a method for uploading a mirror file, related equipment, and a computer storage medium, which can effectively solve the problem that the browser does not support uploading large mirror files and the upload efficiency is low.
第一方面,本申请提供了一种镜像文件上传方法,应用于客户端,包括:In the first aspect, this application provides a method for uploading image files, which is applied to the client, including:
获取目标镜像文件;Obtain the target image file;
对所述目标镜像文件进行分片,获得分片S 1,S 2,...,S m和分片总量m,其中,m为正整数; Fragmenting the target mirror file to obtain the fragments S 1 , S 2 ,..., S m and the total fragment m, where m is a positive integer;
将数据包P 1,P 2,...,P n和所述分片总量m发送给上传代理设备,其中,所述数据包P 1包含分片S 1和分片序号I 1,数据包P 2包含分片S 2和分片序号I 2,…,数据包P n包含分片S n以及分片序号I n,n为正整数,并且n≤m。 Send data packets P 1 , P 2 ,..., P n and the total number of fragments m to the upload agent device, where the data packet P 1 includes fragment S 1 and fragment sequence number I 1 , data The packet P 2 contains the fragment S 2 and the fragment sequence number I 2 ,..., the data packet P n contains the fragment S n and the fragment sequence number I n , n is a positive integer, and n≤m.
在一些可能的设计中,在n小于m的情况下,所述方法还包括:在n小于m的情况下,所述方法还包括:向所述上传代理设备发送断点续传请求,以获得所述分片序号I n,其中,所述断点续传请求用于请求发生断点的分片对应的分片序号;根据所述分片序号I n,将数据包P n+1发送给所述上传代理设备。 In some possible designs, when n is less than m, the method further includes: when n is less than m, the method further includes: sending a resumable upload request to the upload proxy device to obtain The fragment sequence number I n , wherein the breakpoint resumable transmission request is used to request the fragment sequence number corresponding to the fragment where the breakpoint occurred; according to the fragment sequence number I n , the data packet P n+1 is sent to The upload agent device.
在一些可能的设计中,所述将数据包P 1,P 2,...,P n发送给上传代理设备包括:利用l个线程,将数据包P 1,P 2,...,P l并行发送给所述上传代理设备;利用所述l个线程,将数据包P l+1,P l+2,...,P 2×l并行发送给所述上传代理设备;…;利用所述l个线程,将数据包P n-l+1,P n-l+2,...,P n并行发送给所述上传代理设备,其中,1≤l≤n/2,l是正整数。 In some possible designs, the sending of the data packets P 1 , P 2 ,..., P n to the upload agent device includes: using 1 thread to transfer the data packets P 1 , P 2 ,..., P l send to the upload agent device in parallel; use the l threads to send data packets P l+1 , P l+2 ,..., P 2×l to the upload agent device in parallel; ...; use The l threads send data packets P n-l+1 , P n-l+2 ,..., P n to the upload agent device in parallel, where 1≤l≤n/2, and l is positive Integer.
可以看出,利用上述方法可以在客户端中对待上传的目标镜像文件进行分片,然后将目标镜像文件的分片发送到上传代理设备。因此,当目标镜像文件在上传过程中出现 上传中断或者上传失败时,客户端可以从发送失败的分片处重新上传目标镜像文件,从而提高目标镜像文件的上传效率。而且,客户端将目标镜像文件进行分片,通过上传分片而完成目标镜像文件的上传,从而提高目标镜像文件的上传成功率。另外,客户端还可以将目标镜像文件的分片并行发送给上传代理设备,能够大大提升目标镜像文件的上传效率。It can be seen that by using the above method, the target image file to be uploaded can be fragmented in the client, and then the fragments of the target image file can be sent to the upload agent device. Therefore, when the upload of the target image file is interrupted or failed during the upload process, the client can re-upload the target image file from the failed segment, thereby improving the upload efficiency of the target image file. Moreover, the client divides the target mirror file into fragments, and completes the upload of the target mirror file by uploading the fragments, thereby improving the upload success rate of the target mirror file. In addition, the client can also send segments of the target image file to the upload agent device in parallel, which can greatly improve the upload efficiency of the target image file.
第二方面,本申请提供了另一种镜像文件的上传方法,应用于上传代理设备,包括:In the second aspect, this application provides another method for uploading image files, which is applied to uploading agent equipment, including:
接收客户端发送的分片总量m以及数据包P 1,P 2,...,P n,其中,数据包P 1包含分片S 1以及分片序号I 1,数据包P 2包含分片S 2和分片序号I 2,…,数据包P n包含分片S n以及分片序号I n,分片S 1,S 2,...,S m是所述客户端对目标镜像文件进行分片得到的,m和 n均为正整数,并且n≤m; Receive the total number of fragments m and data packets P 1 , P 2 ,..., P n sent by the client, where the data packet P 1 contains the fragment S 1 and the fragment sequence number I 1 , and the data packet P 2 contains the fragment The fragment S 2 and the fragment sequence number I 2 ,..., the data packet P n contains the fragment S n and the fragment sequence number I n , and the fragments S 1 , S 2 ,..., S m are the target mirror images of the client The file is obtained by fragmentation, m and n are both positive integers, and n≤m;
将所述分片总量m和分片S 1,S 2,...,S n发送给对象存储设备。 The total number of fragments m and the fragments S 1 , S 2 ,..., S n are sent to the object storage device.
在一些可能的设计中,在n小于m的情况下,在接收客户端发送的分片总量m以及数据包P 1,P 2,...,P n之后,所述方法还包括:接收所述客户端发送的数据包P n+2,P n+3,...,P m,并将分片S n+2,S n+3,...,S m发送给所述对象存储设备,其中,数据包P n+2包含分片S n+2以及分片序号I n+2,数据包P n+3包含分片S n+3以及分片序号I n+3,…,数据包P m包含分片S m以及分片序号I m;接收所述客户端发送的断点续传请求;根据所述断点续传请求,将发生断点的分片对应的分片序号I n发送给所述客户端;接收所述客户端根据所述分片序号I n发送的数据包P n+1,并将所述数据包P n+1发送给所述对象存储设备,以供所述对象存储设备根据所述分片S 1,S 2,...,S m还原所述目标镜像文件,其中,所述数据包P n+1包含分片S n+1以及分片序号I n+1In some possible designs, when n is less than m, after receiving the total number of fragments m sent by the client and the data packets P 1 , P 2 ,..., P n , the method further includes: receiving The data packets P n+2 , P n+3 ,..., P m sent by the client, and the fragments S n+2 , S n+3 ,..., S m are sent to the object A storage device, wherein the data packet P n+2 contains the fragment S n+2 and the fragment sequence number I n+2 , and the data packet P n+3 contains the fragment S n+3 and the fragment sequence number I n+3 ,... , The data packet P m includes the fragment S m and the fragment sequence number I m ; receiving the resumable transmission request sent by the client; according to the resuming transmission request, the fragment corresponding to the fragment where the breakpoint occurred The sequence number I n is sent to the client; the data packet P n+1 sent by the client according to the fragment sequence number I n is received, and the data packet P n+1 is sent to the object storage device, For the object storage device to restore the target image file according to the fragments S 1 , S 2 ,..., S m , wherein the data packet P n+1 includes the fragment S n+1 and the fragment The slice number I n+1 .
在一些可能的设计中,在n小于m的情况下,所述方法还包括:接收所述客户端发送的断点续传请求;根据所述断点续传请求,将发生断点的分片对应的分片序号I n发送给所述客户端;接收所述客户端根据所述分片序号I n从所述数据包P n+1开始续传的剩下的数据包,并将所述剩下的数据包对应的分片发送给所述对象存储设备,以供所述对象存储设备根据所述分片S 1,S 2,...,S m还原所述目标镜像文件,其中,所述剩下的数据包包括数据包P n+1,P n+2,...,P m,所述数据包P n+1包含分片S n+1以及分片序号I n+1,所述数据包P n+2包含分片S n+2以及分片序号I n+2,…,数据包P m包含分片S m以及分片序号I mIn some possible designs, when n is less than m, the method further includes: receiving a resumable transmission request sent by the client; and according to the resuming transmission request, fragments of breakpoints will occur fragment corresponding to a number I n the client; client receives the remaining data packets from said sheet number data packet I n P n + 1 based on the resume start points and the The fragments corresponding to the remaining data packets are sent to the object storage device, so that the object storage device restores the target image file according to the fragments S 1 , S 2 ,..., S m, where: The remaining data packets include data packets P n+1 , P n+2 ,..., P m , and the data packet P n+1 includes a fragment S n+1 and a fragment sequence number I n+1 , The data packet P n+2 includes a fragment S n+2 and a fragment sequence number I n+2 , ..., the data packet P m includes a fragment S m and a fragment sequence number Im .
在一些可能的设计中,所述方法还包括:在接收所述客户端发送的所述数据包P 1时,调用镜像管理设备创建所述目标镜像文件对应的镜像标识,并保存所述镜像标识。 In some possible designs, the method further comprising: transmitting the data packet P is received in the client 1, the call management device to create the mirror image file corresponding to the target image identifier, and stores the image identification .
在一些可能的设计中,所述方法还包括:调用所述镜像管理设备刷新所述目标镜像文件对应的镜像状态。In some possible designs, the method further includes: invoking the image management device to refresh the image status corresponding to the target image file.
上述方法中,上传代理设备接收到客户端发送的目标镜像文件的分片之后,并将分片转发给对象存储设备,再由对象存储设备将分片还原为目标镜像文件,从而实现目标镜像文件的上传。同时,当目标镜像文件在上传过程中出现上传中断或者上传失败时,上传代理设备可以将发生断点的分片对应的分片序号发送给客户端,使得客户端能够根据发生断点的分片对应的分片序号继续上传目标镜像文件,从而提高镜像文件的上传效率和上传成功率。In the above method, after the upload proxy device receives the fragments of the target mirror file sent by the client, it forwards the fragments to the object storage device, and the object storage device restores the fragments to the target mirror file, thereby realizing the target mirror file Upload. At the same time, when the upload of the target image file is interrupted or failed during the upload process, the upload proxy device can send the fragment sequence number corresponding to the fragment that has the breakpoint to the client, so that the client can be based on the fragment that has the breakpoint. The corresponding segment sequence number continues to upload the target mirror file, thereby improving the upload efficiency and upload success rate of the mirror file.
第三方面,本申请提供了一种客户端,包括:In the third aspect, this application provides a client, including:
获取单元,用于获取目标镜像文件;The obtaining unit is used to obtain the target image file;
分片处理单元,用于对所述目标镜像文件进行分片,获得分片S 1,S 2,...,S m和分片总量m,其中,m为正整数; The fragmentation processing unit is configured to fragment the target mirror file to obtain fragments S 1 , S 2 ,..., S m and a total fragment m, where m is a positive integer;
发送单元,用于将数据包P 1,P 2,...,P n和所述分片总量m发送给上传代理设备,其中,所述数据包P 1包含分片S 1和分片序号I 1,数据包P 2包含分片S 2和分片序号I 2,…,数据包P n包含分片S n以及分片序号I n,n为正整数,并且n≤m。 The sending unit is configured to send data packets P 1 , P 2 ,..., P n and the total number of fragments m to the upload agent device, where the data packet P 1 includes a fragment S 1 and a fragment The sequence number I 1 , the data packet P 2 contains the fragment S 2 and the fragment sequence number I 2 ,..., the data packet P n contains the fragment S n and the fragment sequence number I n , n is a positive integer, and n≤m.
在一些可能的设计中,在n小于m的情况下,所述发送单元还用于:向所述上传代理设备发送断点续传请求,以获得所述分片序号I n,其中,所述断点续传请求用于请求发生断点的分片对应的分片序号;根据所述分片序号I n,将数据包P n+1发送给所述上传代理设备。 In some possible designs, when n is less than m, the sending unit is further configured to: send a resumable upload request to the upload proxy device to obtain the fragment sequence number I n , where the The breakpoint resume request is used to request the fragment sequence number corresponding to the fragment where the breakpoint occurred; according to the fragment sequence number I n , the data packet P n+1 is sent to the upload agent device.
在一些可能的设计中,所述发送单元具体用于:利用l个线程,将数据包P 1,P 2,...,P l并行发送给所述上传代理设备;利用所述l个线程,将数据包P l+1,P l+2,...,P 2×l并行发送给所述上传代理设备;…;利用所述l个线程,将数据包P 1,P 2,...,P n并行发送给所述上传代理设备,其中,1≤l≤n/2,l是正整数。 In some possible designs, the sending unit is specifically configured to: use 1 thread to send data packets P 1 , P 2 ,..., P 1 to the upload agent device in parallel; use the 1 thread , The data packets P l+1 , P l+2 ,..., P 2×l are sent to the upload agent device in parallel; ...; using the l threads, the data packets P 1 , P 2 ,. .., P n is sent to the upload agent device in parallel, where 1≤l≤n/2, and l is a positive integer.
上述客户端中,分片处理单元通过对目标镜像文件进行分片,从而实现由客户端将目标镜像文件分片上传。当目标镜像文件在上传过程中出现上传中断或者上传失败时,利用上述客户端可以实现镜像文件的断点续传,不仅能够提高目标镜像文件的上传效率,还能够提高目标镜像文件的上传成功率。同时,发送单元还可以实现分片的并发上传,因此利用上述客户端上传镜像文件时,能够更大地提升目标镜像文件的上传效率。In the foregoing client, the fragmentation processing unit divides the target mirror file into fragments, so as to realize that the client uploads the target mirror file in fragments. When the upload of the target image file is interrupted or failed during the upload process, the above-mentioned client can realize the resumable upload of the image file, which not only improves the upload efficiency of the target image file, but also improves the upload success rate of the target image file. . At the same time, the sending unit can also implement concurrent uploading of fragments. Therefore, when the above-mentioned client is used to upload the mirror file, the upload efficiency of the target mirror file can be greatly improved.
第四方面,本申请提供了一种上传代理设备,其特征在于,包括:In a fourth aspect, this application provides an upload proxy device, which is characterized in that it includes:
获取单元,用于接收客户端发送的分片总量m以及数据包P 1,P 2,...,P n,其中,数据包P 1包含分片S 1以及分片序号I 1,数据包P 2包含分片S 2和分片序号I 2,…,数据包P n包含分片S n以及分片序号I n,分片S 1,S 2,...,S m是所述客户端对目标镜像文件进行分片得到的,m和 n均为正整数,并且n≤m; The acquiring unit is used to receive the total number of fragments m and data packets P 1 , P 2 ,..., P n sent by the client, where the data packet P 1 includes the fragment S 1 and the fragment sequence number I 1 , and the data The packet P 2 contains the fragment S 2 and the fragment sequence number I 2 ,..., the data packet P n contains the fragment S n and the fragment sequence number I n , the fragments S 1 , S 2 ,..., S m are said The client fragments the target image file, m and n are both positive integers, and n≤m;
发送单元,用于将所述分片总量m和分片S 1,S 2,...,S n发送给对象存储设备。 The sending unit is configured to send the total number of fragments m and the fragments S 1 , S 2 ,..., S n to the object storage device.
在一些可能的设计中,在n小于m的情况下,在所述获取单元接收客户端发送的分片总量m以及数据包P 1,P 2,...,P n之后,所述获取单元还用于接收所述客户端发送的数据包P n+2,P n+3,...,P m,并将分片S n+2,S n+3,...,S m发送给所述对象存储设备,其中,数据包P n+2包含分片S n+2以及分片序号I n+2,数据包P n+3包含分片S n+3以及分片序号I n+3,…,数据包P m包含分片S m以及分片序号I m;所述获取单元还用于接收所述客户端发送的断点续传请求;所述发送单元还用于根据所述断点续传请求,将发生断点的分片对应的分片序号I n发送给所述客户端;所述获取单元还用于接收所述客户端根据所述分片序号I n发送的数据包P n+1,并将所述数据包P n+1发送给所述对象存储设备,以供所述对象存储设备根据所述分片S 1,S 2,...,S m还原所述目标镜像文件,其中,所述数据包P n+1包含分片S n+1以及分片序号I n+1In some possible designs, when n is less than m, after the acquiring unit receives the total number of fragments m sent by the client and the data packets P 1 , P 2 ,..., P n , the acquiring The unit is also used to receive data packets P n+2 , P n+3 ,...,P m sent by the client, and to fragment S n+2 ,S n+3 ,...,S m Sent to the object storage device, where the data packet P n+2 contains the fragment S n+2 and the fragment sequence number I n+2 , and the data packet P n+3 contains the fragment S n+3 and the fragment sequence number I n+3 ,..., the data packet P m includes the fragment S m and the fragment sequence number I m ; the acquiring unit is also used to receive a resumable transmission request sent by the client; the sending unit is also used to the HTTP request, the breakpoint will occur fragment corresponding to fragment I n number sent to the client; the obtaining unit is further configured to receive a client I n accordance with the transmission sequence number fragment packet P n + 1, and the packet P + 1 to n transmitting the object storage device, for the object storage device according to the slice S 1, S 2, ..., S m Restore the target image file, where the data packet P n+1 includes a fragment S n+1 and a fragment sequence number I n+1 .
在一些可能的设计中,在n小于m的情况下,所述获取单元还用于接收所述客户端发送的断点续传请求;所述发送单元还用于根据所述断点续传请求,将发生断点的分片对应的分片序号I n发送给所述客户端;所述获取单元还用于接收所述客户端根据所述分片序号I n从所述数据包P n+1开始续传的剩下的数据包,并将所述剩下的数据包对应的分片发送给所述对象存储设备,以供所述对象存储设备根据所述分片S 1,S 2,...,S m还原所述目 标镜像文件,其中,所述剩下的数据包包括数据包P n+1,P n+2,...,P m,所述数据包P n+1包含分片S n+1以及分片序号I n+1,所述数据包P n+2包含分片S n+2以及分片序号I n+2,…,数据包P m包含分片S m以及分片序号I mIn some possible designs, when n is less than m, the acquiring unit is further configured to receive a resumable transmission request sent by the client; and the sending unit is further configured to resume transmission according to the resumable transmission request. , the fragment corresponding to the occurrence of a breakpoint fragment I n number sent to the client; the obtaining unit is further configured to receive the client according to the fragment ID from the packet I n P n + 1 Start resuming the remaining data packets, and send the fragments corresponding to the remaining data packets to the object storage device for the object storage device according to the fragments S 1 , S 2 , ...,S m restores the target image file, wherein the remaining data packets include data packets P n+1 , P n+2 ,..., P m , and the data packets P n+1 Contains a fragment S n+1 and a fragment sequence number I n+1 , the data packet P n+2 contains a fragment S n+2 and a fragment sequence number I n+2 ,..., the data packet P m contains a fragment S m and the fragment sequence number I m .
在一些可能的设计中,所述设备还包括调用单元和进度记录单元,所述调用单元用于,在接收所述客户端发送的所述数据包P 1时,调用镜像管理设备创建所述目标镜像文件对应的镜像标识;所述进度记录单元用于,保存所述镜像标识。 In some possible designs, the apparatus further comprises a call progress recording unit and a unit, the unit calls for the data packet P is sent in the client 1 receives the call to create the target image management apparatus The mirror ID corresponding to the mirror file; the progress recording unit is used to save the mirror ID.
在一些可能的设计中,所述调用单元还用于:调用所述镜像管理设备刷新所述目标镜像文件对应的镜像状态。In some possible designs, the calling unit is further configured to: call the mirror management device to refresh the mirror state corresponding to the target mirror file.
可以看出,获取单元接收到客户端发送的目标镜像文件的分片之后,由发送单元将分片转发给对象存储设备,使得对象存储设备能够根据分片还原为目标镜像文件,从而实现目标镜像文件的上传。而且,当目标镜像文件在上传过程中出现上传中断或者上传失败时,发送单元可以将发生断点的分片对应的分片序号发送给客户端,使得客户端能够根据发生断点的分片对应的分片序号继续上传目标镜像文件,从而提高镜像文件的上传效率和上传成功率。It can be seen that after the acquiring unit receives the fragments of the target mirror file sent by the client, the sending unit forwards the fragments to the object storage device, so that the object storage device can be restored to the target mirror file according to the fragments, thereby realizing the target mirroring Upload of files. Moreover, when the upload of the target image file is interrupted or failed during the upload process, the sending unit can send the segment sequence number corresponding to the segment where the breakpoint occurred to the client, so that the client can correspond to the segment where the breakpoint occurred Continue to upload the target image file with the segment serial number of the file, thereby improving the upload efficiency and upload success rate of the image file.
第五方面,本申请提供了一种镜像文件上传系统,其特征在于,所述系统包括第三方面所述的客户端、第四方面所述的上传代理设备、对象存储设备以及镜像服务设备,其中,In a fifth aspect, this application provides a mirror file upload system, characterized in that the system includes the client described in the third aspect, the upload proxy device described in the fourth aspect, an object storage device, and a mirroring service device, in,
所述对象存储设备用于接收所述上传代理设备发送的所述分片S 1,S 2,...,S m,并将所述分片S 1,S 2,...,S m还原为所述目标镜像文件; The object storage device is used to receive the fragments S 1 , S 2 ,..., S m sent by the upload agent device, and to convert the fragments S 1 , S 2 ,..., S m Restore to the target image file;
所述镜像管理设备用于创建所述目标镜像文件对应的镜像标识;The image management device is used to create an image identifier corresponding to the target image file;
所述镜像管理设备还用于刷新所述目标镜像文件的镜像状态。The mirror management device is also used to refresh the mirror status of the target mirror file.
上述镜像文件上传系统中,客户端通过对镜像文件进行分片,并将分片发送给上传代理设备,再由上传代理设备将分片转发至对象存储设备,并由对象存储设备将分片还原为目标镜像文件,从而完成目标镜像文件的上传。同时,在目标镜像文件的上传过程中,镜像管理设备通过刷新目标镜像文件的镜像状态,从而确定该目标镜像文件是否上传成功。因此,利用上述镜像文件上传系统可以实现目标镜像文件的断点续传和分片并发上传,不仅能够提高目标镜像文件的上传效率,还能够提高目标镜像文件的上传成功率。In the above-mentioned image file upload system, the client divides the image file into fragments and sends the fragments to the upload proxy device. The upload proxy device forwards the fragments to the object storage device, and the object storage device restores the fragments. It is the target mirror file to complete the upload of the target mirror file. At the same time, during the uploading of the target image file, the image management device refreshes the image status of the target image file to determine whether the target image file is successfully uploaded. Therefore, the above-mentioned mirror file upload system can realize the resumable upload of the target mirror file and the concurrent upload of the target mirror files, which not only improves the upload efficiency of the target mirror file, but also improves the upload success rate of the target mirror file.
第六方面,本申请提供了一种客户端,包括处理器和存储器,所述处理器执行所述存储器中的代码以实现如第一方面所述的部分或者全部步骤。In a sixth aspect, the present application provides a client, including a processor and a memory, and the processor executes the code in the memory to implement part or all of the steps described in the first aspect.
第七方面,本申请提供了一种上传代理设备,包括处理器和存储器,所述处理器执行所述存储器中的代码以实现如第二方面所述的部分或全部步骤。In a seventh aspect, the present application provides an upload proxy device, including a processor and a memory, and the processor executes the code in the memory to implement part or all of the steps described in the second aspect.
第八方面,本申请提供了一种计算机存储介质,存储有计算机指令;所述计算机指令用于实现如第一方面所述的部分或者全部步骤。In an eighth aspect, this application provides a computer storage medium storing computer instructions; the computer instructions are used to implement part or all of the steps described in the first aspect.
第九方面,本申请提供了一种计算机存储介质,存储有计算机指令;所述计算机指令用于实现如第二方面所述的部分或者全部步骤。In a ninth aspect, this application provides a computer storage medium storing computer instructions; the computer instructions are used to implement part or all of the steps described in the second aspect.
附图说明Description of the drawings
为了更清楚地说明本申请实施例的技术方案,下面将对实施例描述中所需要使用的 附图作简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the technical solutions of the embodiments of the present application more clearly, the following will briefly introduce the drawings needed in the description of the embodiments. Obviously, the drawings in the following description are some embodiments of the present application. For those of ordinary skill in the art, without creative work, other drawings can be obtained from these drawings.
图1是本申请提供的一种云系统的结构示意图;Figure 1 is a schematic structural diagram of a cloud system provided by this application;
图2是本申请提供的一种具体的云系统的结构示意图;Figure 2 is a schematic structural diagram of a specific cloud system provided by this application;
图3是本申请提供的一种镜像文件上传系统的结构示意图;Figure 3 is a schematic diagram of the structure of a mirror file upload system provided by this application;
图4是本申请提供的一种镜像上传界面的示意图;Figure 4 is a schematic diagram of a mirror upload interface provided by this application;
图5是本申请提供的一种镜像文件上传的流程示意图;Figure 5 is a schematic diagram of a process for uploading a mirror file provided by this application;
图6是本申请提供的一种镜像文件上传的流程示意图;Fig. 6 is a schematic diagram of a process for uploading a mirror file provided by this application;
图7是本申请提供的一种客户端的结构示意图;FIG. 7 is a schematic structural diagram of a client provided by this application;
图8是本申请提供的一种上传代理设备的结构示意图;Fig. 8 is a schematic structural diagram of an upload proxy device provided by the present application;
图9是本申请提供的另一种客户端的结构示意图;FIG. 9 is a schematic structural diagram of another client provided by this application;
图10是本申请提供的另一种上传代理设备的结构示意图。Fig. 10 is a schematic structural diagram of another upload proxy device provided by the present application.
具体实施方式Detailed ways
参见图1,图1示出了一种云系统的结构示意图。云系统的拥有者自己部署云计算基础设施,即部署计算资源(例如,服务器)110、部署存储资源(例如,存储器)120以及部署网络资源(例如,网卡)130等等。公有云的拥有者(例如,运营商)将云计算基础设施的计算资源、存储资源、网络资源进行虚拟化,并提供相应的服务给云的使用者(例如,用户)使用。其中,运营商可以提供以下三种服务给用户使用:云计算基础设施即服务(infrastructure as a service,IaaS)、平台即服务(platform as a service,PaaS)以及软件即服务(software as a service,SaaS)。Refer to Figure 1, which shows a schematic structural diagram of a cloud system. The owner of the cloud system deploys the cloud computing infrastructure by himself, namely deploys computing resources (for example, servers) 110, deploys storage resources (for example, storage) 120, deploys network resources (for example, network cards) 130, and so on. The owner of the public cloud (for example, an operator) virtualizes the computing resources, storage resources, and network resources of the cloud computing infrastructure, and provides corresponding services for cloud users (for example, users) to use. Among them, operators can provide the following three services for users: cloud computing infrastructure as a service (infrastructure as a service, IaaS), platform as a service (platform as a service, PaaS), and software as a service (software as a service, SaaS).
IaaS提供给用户的服务是对云计算基础设施的利用,包括处理、存储、网络以及其它基本的计算资源,使得用户能够部署和运行任意软件,包括操作系统和应用程序。用户不管理或控制任何云计算基础设施,但能控制操作系统的选择、储存空间、部署应用,也有可能获得有限制的网络组件(例如,防火墙,负载均衡器等)的控制。The service IaaS provides to users is the utilization of cloud computing infrastructure, including processing, storage, network, and other basic computing resources, enabling users to deploy and run any software, including operating systems and applications. Users do not manage or control any cloud computing infrastructure, but can control the choice of operating system, storage space, deployment applications, and may also gain control of restricted network components (for example, firewalls, load balancers, etc.).
PaaS提供给用户的服务是把用户采用供应商提供的开发语言和工具(例如,Java、python、Net等)开发的或收购的应用程序部署到云计算基础设施上。用户不需要管理或控制底层的云计算基础设施,包括网络、服务器、操作系统、存储等,但用户能控制部署的应用程序,也可能控制运行应用程序的托管环境配置。The service provided by PaaS to users is to deploy applications developed or acquired by users using development languages and tools provided by vendors (for example, Java, python, Net, etc.) to cloud computing infrastructure. Users do not need to manage or control the underlying cloud computing infrastructure, including networks, servers, operating systems, storage, etc., but users can control the deployed applications and may also control the configuration of the hosting environment for running applications.
SaaS提供给用户的服务是运营商运行在云计算基础设施上的应用程序,用户可以在各种设备上通过客户端界面(例如,浏览器),访问云计算基础设施上的应用程序。用户不需要管理或控制任何云计算基础设施,包括网络、服务器、操作系统、存储等等。The services provided by SaaS to users are applications run by operators on cloud computing infrastructure. Users can access applications on cloud computing infrastructure on various devices through client interfaces (for example, browsers). Users do not need to manage or control any cloud computing infrastructure, including networks, servers, operating systems, storage, etc.
因此,用户可以利用运营商提供的服务运行自己的业务,例如,深度学习、人工智能以及大数据等等。Therefore, users can use the services provided by operators to run their own businesses, such as deep learning, artificial intelligence, and big data.
参见图2,图2示出了一种具体的云系统的示意图。本申请的云系统包括:云管理平台210和基础设施220。其中,云管理平台210通过调用基础设施220,从而为用户提供云服务,云管理平台210可以是OpenStack、CloudStack、Hadoop、AWS(Amazon Web Service)等等,此处不作具体限定。Refer to Figure 2, which shows a schematic diagram of a specific cloud system. The cloud system of the present application includes: a cloud management platform 210 and an infrastructure 220. Among them, the cloud management platform 210 provides cloud services for users by calling the infrastructure 220. The cloud management platform 210 may be OpenStack, CloudStack, Hadoop, AWS (Amazon Web Service), etc., which is not specifically limited here.
云管理平台210可以包括protal211、计算服务212、存储服务213、网路服务214以及管理服务215。其中,protal211可以提供给用户访问云系统或者云服务的入口。计算服务212可以是用于部署虚拟机等等的组件。存储服务213可以用于提供分布式、持续虚拟对象存储等等的组件。网络服务214可以是用于提供了对网络节点的网络拓扑管理的组件。管理服务215可以是用于对其他服务进行控制的组件。The cloud management platform 210 may include a portal 211, a computing service 212, a storage service 213, a network service 214, and a management service 215. Among them, the portal211 can provide users with access to cloud systems or cloud services. The computing service 212 may be a component for deploying virtual machines and the like. The storage service 213 may be used to provide components such as distributed and persistent virtual object storage. The network service 214 may be a component for providing network topology management of network nodes. The management service 215 may be a component for controlling other services.
以云管理平台210为OpenStack为例,计算服务212可以是Nova,存储服务213可以是Swift、Cinder,网络服务214可以是Neutron,管理服务215可以是Glance、Nova、Horizon、Neutron以及Keystone等等。其中,Glance主要负责对云系统中提供的各类镜像的元数据进行管理,并为用户提供镜像管理服务,具体可实现虚拟机镜像的注册、查找以及检索等功能,从而方便用户为虚拟机选择并安装操作系统。而且,Glance的后端存储支持对接多种存储类型,例如,Swift、简单存储服务(simple storage service,S3)或者容器存储等等。Swift作为OpenStack中默认的对象存储方案,相较于其他存储方案(如,S3、容器存储等),Swift更容易构筑在低成本、标准硬件存储基础设施之上,而且Swift支持大对象文件(如,静态大文件和动态大文件)的分片上传。Taking the cloud management platform 210 as OpenStack as an example, the computing service 212 may be Nova, the storage service 213 may be Swift, Cinder, the network service 214 may be Neutron, and the management service 215 may be Glance, Nova, Horizon, Neutron, Keystone, and so on. Among them, Glance is mainly responsible for the management of the metadata of various images provided in the cloud system, and provides users with image management services, which can specifically realize the registration, search and retrieval of virtual machine images, so as to facilitate users to choose virtual machines And install the operating system. Moreover, Glance's back-end storage supports docking with multiple storage types, such as Swift, simple storage service (S3), or container storage, etc. Swift is the default object storage solution in OpenStack. Compared with other storage solutions (such as S3, container storage, etc.), Swift is easier to build on low-cost, standard hardware storage infrastructure, and Swift supports large object files (such as , Static large files and dynamic large files) upload in fragments.
因此,本申请采用Swift作为Glance的后端存储以负责存储通过客户端浏览器上传的镜像文件。具体参见图3所示,图3示出了本申请涉及的一种镜像文件上传系统。镜像文件上传系统具体可以包括客户端310、上传代理设备320、对象存储设备330以及镜像管理设备340。在本申请中,对象存储设备330为部署有Swift的设备,镜像管理设备340为部署有Glance的设备,因此以下将对象存储设备330称为Swift,镜像管理设备340称为Glance。上传代理设备320、对象存储设备330和镜像管理设备340可以部署在一个计算设备上,也可以部署在不同的计算设备上,此处不作具体限定。Therefore, this application uses Swift as the back-end storage of Glance to store image files uploaded through the client browser. For details, refer to FIG. 3, which shows a mirror file upload system related to this application. The image file upload system may specifically include a client 310, an upload proxy device 320, an object storage device 330, and an image management device 340. In this application, the object storage device 330 is a device deployed with Swift, and the image management device 340 is a device deployed with Glance. Therefore, the object storage device 330 is referred to as Swift and the image management device 340 is referred to as Glance hereinafter. The upload proxy device 320, the object storage device 330, and the image management device 340 may be deployed on one computing device, or may be deployed on different computing devices, which are not specifically limited here.
在本申请中,当用户通过客户端310上传镜像文件时,首先在客户端310对镜像文件进行分片操作,然后将镜像文件的分片发送到上传代理设备320,上传代理设备320接收到镜像文件的分片之后,将其转发至Swift330中,并调用Glance340刷新该镜像的状态。可以看出,利用该系统能够实现通过客户端分片上传镜像文件,也就是说,当镜像文件在上传过程中出现上传中断或者上传失败的情况时,客户端可以从断点位置处继续上传该镜像文件,而不需要重新上传完整的镜像文件,从而大大提升镜像文件的传输效率以及上传成功率。In this application, when a user uploads a mirror file through the client 310, the mirror file is segmented at the client 310 first, and then the segments of the mirror file are sent to the upload proxy device 320, and the upload proxy device 320 receives the mirror file. After the file is fragmented, it is forwarded to Swift330, and Glance340 is called to refresh the status of the image. It can be seen that the system can be used to upload the mirror file in fragments through the client. That is to say, when the upload of the mirror file is interrupted or failed during the upload process, the client can continue to upload the image from the breakpoint. Mirror file, without re-uploading the complete mirror file, which greatly improves the transmission efficiency of the mirror file and the upload success rate.
下面将基于图3示出的镜像文件上传系统对本申请展开详细的描述。Hereinafter, the application will be described in detail based on the mirror file upload system shown in FIG. 3.
在本申请具体的实施例中,在客户端向上传代理设备发送待上传的镜像文件之前,客户端可以通过浏览器接收用户输入的登录请求,并将登录请求发送给云管理平台。其中,登录请求携带了账号和密码,登录请求用于请求登录镜像管理系统,镜像管理系统由Glance提供。然后,云管理平台根据登录请求确定客户端的登录权限,若客户端具有登录权限,则浏览器界面中显示镜像上传界面,如图4所示。以图4为例,待上传的镜像文件包括第一镜像文件、第二镜像文件和第三镜像文件。下面以第一镜像文件为例,对本申请提供的镜像文件的上传方法进行详细介绍,具体可分为以下两种情况。In a specific embodiment of the present application, before the client sends the image file to be uploaded to the upload agent device, the client may receive the login request input by the user through the browser, and send the login request to the cloud management platform. Among them, the login request carries the account number and password, and the login request is used to request to log in to the mirror management system, which is provided by Glance. Then, the cloud management platform determines the login permission of the client according to the login request. If the client has the login permission, the mirror upload interface is displayed in the browser interface, as shown in Figure 4. Taking FIG. 4 as an example, the image file to be uploaded includes a first image file, a second image file, and a third image file. Taking the first image file as an example, the method for uploading the image file provided in this application is described in detail below, which can be specifically divided into the following two situations.
首先,介绍第一镜像文件在上传过程中未发生上传中断或者上传失败的情况。如图5所示,图5示出了本申请提供的一种镜像文件的上传方法的流程示意图。本实施方式的镜像文件上传方法包括但不限于如下步骤:First, introduce the situation that the uploading process of the first image file did not occur interruption or upload failure. As shown in FIG. 5, FIG. 5 shows a schematic flowchart of a method for uploading a mirror file provided by the present application. The mirror file upload method of this embodiment includes but is not limited to the following steps:
S101、客户端获取第一镜像文件。S101. The client obtains the first image file.
在本申请具体的实施例中,客户端获取第一镜像文件之后,判断第一镜像文件的大小是否大于预设阈值。若第一镜像文件的大小大于预设阈值,则执行S102;若第一镜像文件的大小小于或者等于预设阈值,则客户端将第一镜像文件发送给上传代理设备,再由上传代理设备转发给Swift进行存储。当Swift接收到第一镜像文件时,上传代理设备调用Glance接口刷新第一镜像文件的镜像状态。In a specific embodiment of the present application, after obtaining the first image file, the client determines whether the size of the first image file is greater than a preset threshold. If the size of the first image file is greater than the preset threshold, execute S102; if the size of the first image file is less than or equal to the preset threshold, the client sends the first image file to the upload agent device, and then the upload agent device forwards it Store for Swift. When Swift receives the first image file, the upload agent device calls the Glance interface to refresh the image status of the first image file.
在一更具体的实施例中,客户端通过浏览器接收用户输入的拖拽指令,并根据拖拽指令获取第一镜像文件。其中,镜像上传界面提供了文件读取接口,拖拽指令用于将第一镜像文件拖拽到文件读取接口。客户端基于文件读取接口确定第一镜像文件的大小,若第一镜像文件的大小大于预设阈值,则执行S102。另外,客户端还可以通过浏览器接收用户输入的其他类型指令(如,选择指令),从而获取第一镜像文件。In a more specific embodiment, the client receives the dragging instruction input by the user through the browser, and obtains the first image file according to the dragging instruction. Among them, the image upload interface provides a file reading interface, and the drag instruction is used to drag the first image file to the file reading interface. The client determines the size of the first image file based on the file reading interface, and if the size of the first image file is greater than the preset threshold, execute S102. In addition, the client can also receive other types of instructions (for example, selection instructions) input by the user through the browser, so as to obtain the first image file.
S102、客户端根据预设分片大小对第一镜像文件进行分片操作,得到第一镜像文件的分片S 1,S 2,...,S m以及分片总量m,其中,m是正整数。 S102. The client performs a fragmentation operation on the first mirror file according to the preset fragment size, and obtains the fragments S 1 , S 2 ,..., S m of the first mirror file and the total fragment m, where m Is a positive integer.
在本申请具体的实施例中,客户端根据预设分片大小对第一镜像文件进行分片操作,得到分片S 1,S 2,...,S m,并为分片S 1添加分片序号I 1,分片S 2添加分片序号I 2,…,分片S m添加分片序号I m,从而得到数据包P 1,P 2,...,P m。其中,数据包P 1包含分片S 1以及分片序号I 1,数据包P 2包含分片S 2以及分片序号I 2,…,数据包P m包含分片S m以及分片序号I m。其中,分片序号I 1,I 2,...,I m用于表示分片S 1,S 2,...,S m的先后顺序,也就是说,分片S 1是第1个分片,分片S 2第2个分片,…,分片S m第m个分片。 In a specific embodiment of this application, the client performs a fragmentation operation on the first mirror file according to a preset fragment size to obtain fragments S 1 , S 2 ,..., S m , and add to fragment S 1 The fragment sequence number I 1 , the fragment S 2 adds the fragment sequence number I 2 , ..., the fragment S m adds the fragment sequence number I m , thereby obtaining data packets P 1 , P 2 ,..., P m . Among them, the data packet P 1 contains the fragment S 1 and the fragment sequence number I 1 , the data packet P 2 contains the fragment S 2 and the fragment sequence number I 2 ,..., the data packet P m contains the fragment S m and the fragment sequence number I m . Among them, the fragment sequence numbers I 1 , I 2 ,..., I m are used to indicate the sequence of the fragments S 1 , S 2 ,..., S m , that is, the fragment S 1 is the first Fragment, the second fragment of the fragment S 2 ,..., the m-th fragment of the fragment S m.
需要说明的,数据包P 1,P 2,...,P m中还可以携带第一镜像文件的文件名称以及对应分片的大小等信息,此处不作具体限定。 It should be noted that the data packets P 1 , P 2 ,..., P m may also carry information such as the file name of the first image file and the size of the corresponding fragment, which is not specifically limited here.
S103、客户端将数据包P 1,P 2,...,P m和分片总量m发送给上传代理设备。 S103. The client sends the data packets P 1 , P 2 ,..., P m and the total number of fragments m to the upload agent device.
在一种可能的实施例中,客户端将数据包P 1,P 2,...,P m依次发送给上传代理设备。 In a possible embodiment, the client sends the data packets P 1 , P 2 ,..., P m to the upload agent device in sequence.
在另一可能的实施例中,客户端使用l个线程同时将数据包P 1,P 2,...,P l发送给上传代理设备,当上传代理设备接收到数据包P 1,P 2,...,P l之后,客户端再使用上述l个线程同时将数据包P l+1,P l+2,...,P 2×l发送给上传代理设备,直至客户端将数据包P 1,P 2,...,P m全部发送给上传代理设备。其中,1≤l≤m/2,l是正整数。可以看出,通过分片并发的方式可以有效地减少上传次数以及文件数据流。 In another possible embodiment, the client uses l threads to simultaneously send data packets P 1 , P 2 ,..., P l to the upload proxy device, and when the upload proxy device receives the data packets P 1 , P 2 After ,...,P l , the client uses the above l threads to simultaneously send the data packets P l+1 ,P l+2 ,...,P 2×l to the upload agent device until the client sends the data The packages P 1 , P 2 ,..., P m are all sent to the upload agent device. Among them, 1≤l≤m/2, and l is a positive integer. It can be seen that the number of uploads and file data flow can be effectively reduced by means of sharding and concurrency.
在本申请具体的实施例中,当客户端第一次向上传代理设备发送数据包时(例如,数据包 P1或者数据包P 1,P 2,...,P l)时,上传代理设备调用Glance接口创建镜像元数据,从而获取镜像元数据对应的镜像标识(identity document,ID)。然后,上传代理设备根据镜像ID,创建一个以镜像ID命名的空的对象文件。其中,镜像元数据用于描述第一镜像,具体可以包括第一镜像的镜像ID、第一镜像的大小、第一镜像的镜像状态以及第一镜像的镜像格式(例如,qcow2格式、vhd格式)等等。镜像ID用于标识第一镜像。 In the specific embodiment of this application, when the client sends a data packet to the upload proxy device for the first time (for example, data packet P1 or data packets P 1 , P 2 ,..., P l ), the upload proxy device The Glance interface is called to create mirror metadata, so as to obtain the identity document (ID) corresponding to the mirror metadata. Then, the upload agent device creates an empty object file named after the mirror ID according to the mirror ID. Among them, the image metadata is used to describe the first image, which can specifically include the image ID of the first image, the size of the first image, the image status of the first image, and the image format of the first image (for example, qcow2 format, vhd format) and many more. The image ID is used to identify the first image.
S104、上传代理设备将分片总量m和分段D 1,D 2,...,D m发送至Swift。 S104. The upload agent device sends the total number of fragments m and the fragments D 1 , D 2 ,..., D m to Swift.
在一种可能的实施例中,若客户端将数据包P 1,P 2,...,P m依次发送给上传代理设备,则上传代理设备将分段D 1,D 2,...,D m依次发送给Swift。 In a possible embodiment, if the client sends data packets P 1 , P 2 ,..., P m to the upload proxy device in turn, the upload proxy device will segment D 1 , D 2 ,... , D m is sent to Swift in turn.
具体的,上传代理设备接收到数据包P 1之后,根据数据包P 1和镜像ID,为分片S 1添加对象前缀名称N 1得到分段D 1,然后将分段D 1发送到Swift。其中,对象前缀名称N 1包 括镜像ID和分段D 1对应的分段序号,分段D 1对应的分段序号是分片序号I 1。若Swift接收到分段D 1,则上传代理设备在分段上传记录中保存分段D 1的镜像ID以及分段D 1对应的分段序号。同样的,上传代理设备接收到数据包P 2之后,根据数据包P 2和镜像ID,为分片S 2添加对象前缀名称N 2得到分段D 2,然后将分段D 2发送到Swift。其中,对象前缀名称N 2包括镜像ID和分段D 2对应的分段序号,分段D 2对应的分段序号是分片序号I 2。若Swift接收到分段D 2,则上传代理设备在分段上传记录中保存分段D 2的镜像ID以及分段D 2对应的分段序号。…。上传代理设备接收到数据包P m之后,根据数据包P m和镜像ID,为分片S m添加对象前缀名称N m得到分段D m,然后将分段D m发送到Swift。其中,对象前缀名称N m包括镜像ID和分段D m对应的分段序号,分段D m对应的分段序号是分片序号I m。若Swift接收到分段D m,则上传代理设备在分段上传记录中保存分段D m的镜像ID以及分段D m对应的分段序号。 Specifically, the proxy device receives the upload data packet P after 1, the packet P 1 and the image ID, which is divided sheets S 1 is added to give a target segment prefix name N D 1, D 1 and then sent to the segment Swift. Wherein the object name prefix N 1 1 corresponding to the segment ID and segment number includes mirror image D, D 1 corresponding to the segment number is the segment number fragment I 1. When the segments are received Swift D 1, the proxy device stores uploaded image segment ID and segment D 1 D 1 corresponding to the segment number in the segment record uploading. Also, the upload agent apparatus, after receiving the data packet P 2, the data packet P 2 and the mirror ID, which is added slice S 2 N 2 to give the object name prefix segment D 2, D 2 and then sent to the segment Swift. Wherein the object name prefix N 2 2 corresponding to the segment ID and segment number includes mirror image D, D 2 corresponding to the segment number is the segment number fragment I 2. When the segments are received Swift D 2, the proxy device stores uploaded image segment ID and segment D 2 D 2 corresponding to the segment number in the segment record uploading. …. After receiving the data packet P m , the upload agent device adds the object prefix name N m to the segment S m according to the data packet P m and the mirror ID to obtain the segment D m , and then sends the segment D m to Swift. Wherein the object includes mirror image prefix name N m D m corresponding to the segment ID and segment number, segment D m corresponding to the segment number is fragment number I m. When the segments are received Swift D m, the proxy device stores upload mirror segment D m D m corresponding to the segment ID and segment number of the segment in the upload history.
其中,对象前缀名称可具体表示为镜像ID-分段序号,镜像ID的格式可以设置为Glance默认的存储格式,例如xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,分段序号也可以设置为Glance默认的存储格式,且分段序号与分片序号一一对应,例如分片序号I 15(00015)对应的分段序号为00015,因此对象前缀名称N 15可表示为xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-00015。分段上传记录可参见表1,从表1中可以看出分片S 1对应的对象前缀名称为xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-00001,分片S 2对应的对象前缀名称为xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-00002,…,分片S m对应的对象前缀名称为xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-m。 Among them, the object prefix name can be specifically expressed as the mirror ID-segment serial number, the format of the mirror ID can be set to the default storage format of Glance, such as xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, and the segment serial number can also be set to the default Glance storage format. Storage format, and the segment sequence number corresponds to the segment sequence number one to one. For example , the segment sequence number corresponding to the segment sequence number I 15 (00015) is 00015, so the object prefix name N 15 can be expressed as xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -00015. The multipart upload record can be seen in Table 1. From Table 1, it can be seen that the object prefix name corresponding to the segment S 1 is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-00001, and the object prefix name corresponding to the segment S 2 is xxxxxxxx- xxxx-xxxx-xxxx-xxxxxxxxxxxx-00002,..., the object prefix name corresponding to the fragment S m is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-m.
表1.分段上传记录Table 1. Multipart upload record
Figure PCTCN2021075236-appb-000001
Figure PCTCN2021075236-appb-000001
在另一种可能的实施例中,若客户端将数据包P 1,P 2,...,P l并行发送给上传代理设备,将P l+1,P l+2,...,P 2×l并行发送给上传代理设备,…,将数据包P m-l+1,P m-l+2,...,P m并行发送给上传代理设备,则上传代理设备将分段D 1,D 2,...,D l并行发送给Swift,将分段D l+1,D l+2,...,D 2×l并行发送给Swift,…,将分段D m-l+1,D m-l+2,...,D m并行发送给Swift。 In another possible embodiment, if the client sends data packets P 1 , P 2 ,..., P l to the upload proxy device in parallel, P l+1 , P l+2 ,..., P 2×l is sent to the upload agent device in parallel,..., the data packets P m-l+1 ,P m-l+2 ,...,P m are sent to the upload agent device in parallel, then the upload agent device will be divided into pieces D 1 ,D 2 ,...,D l are sent to Swift in parallel, and the segments D l+1 ,D l+2 ,...,D 2×l are sent to Swift in parallel,..., the segments D m -l+1 ,D m-l+2 ,...,D m are sent to Swift in parallel.
具体的,上传代理设备接收到数据包P 1,P 2,...,P l之后,根据数据包P 1,P 2,...,P l和镜像ID,分别为分片S 1,S 2,...,S l添加对象前缀名称N 1,N 2,...,N l得到分段D 1,D 2,...,D l,然后将分段D 1,D 2,...,D l并行发送到Swift。其中,对象前缀名称N 1包括镜像ID和分段D 1对应的分段序号,分段D 1对应的分段序号是分片序号I 1;对象前缀名称N 2包括镜像ID和分段D 2对应的分段序号,分段D 2对应的分段序号是分片序号I 2;…;对象前缀名称N l包括镜像ID和分段D m对应的分段序号,分段D l对应的分段序号是分片序号I l。若Swift接收到分段D 1,D 2,...,D l,则上传代理设备在分段上传记录中分别保存分段D 1,D 2,...,D l的镜像ID以及分段D 1,D 2,...,D l对应的分段序号。应理解,上传代理设备将分片S l+1,S l+2,...,S 2×l并行发 送给Swift的过程,…,将分片S m-l+1,S m-l+2,...,S m并行发送给Swift的过程与上传代理设备将分片S 1,S 2,...,S l并行发送给Swift的过程类似,此处不再展开具体赘述。 Specifically, after the upload agent device receives the data packets P 1 , P 2 ,..., P l , according to the data packets P 1 , P 2 ,..., P l and the mirror ID, they are respectively fragments S 1 , S 2 ,...,S l add object prefix names N 1 ,N 2 ,...,N l to get segments D 1 ,D 2 ,...,D l , and then segment D 1 ,D 2 ,...,D l is sent to Swift in parallel. Among them, the object prefix name N 1 includes the mirror ID and the segment sequence number corresponding to the segment D 1 , and the segment sequence number corresponding to the segment D 1 is the segment sequence number I 1 ; the object prefix name N 2 includes the mirror ID and the segment D 2 The corresponding segment sequence number, the segment sequence number corresponding to segment D 2 is the segment sequence number I 2 ; ...; the object prefix name N l includes the mirror ID and the segment sequence number corresponding to the segment D m, and the segment corresponding to the segment D l The segment sequence number is the fragment sequence number I l . If Swift receives segments D 1 , D 2 ,..., D l , the upload agent device will save the mirror IDs and points of segments D 1 , D 2 ,..., D l in the segment upload record. Segment number corresponding to segment D 1 , D 2 ,..., D l. It should be understood that the upload proxy device sends the fragments S l+1 , S l+2 ,..., S 2×l to Swift in parallel,..., the fragments S m-l+1 ,S m-l The process of sending +2 ,...,S m to Swift in parallel is similar to the process of sending the fragments S 1 , S 2 ,..., S l to Swift in parallel by the uploading agent device, and will not be repeated here.
可以看出,上述步骤实现了从上传代理设备的输入流到Swift的输出流的过程,也就是从上传代理设备中读取镜像文件,并将镜像文件写入到Swift,从而在无需本地缓存的情况下,将镜像文件上传到Swift,不仅提高镜像文件的上传效率,还节省存储空间。It can be seen that the above steps implement the process from the input stream of the upload proxy device to the output stream of Swift, that is, read the image file from the upload proxy device and write the image file to Swift, thus eliminating the need for local caching. In this case, uploading the image file to Swift not only improves the upload efficiency of the image file, but also saves storage space.
S105、Swift根据对象前缀名称N 1,N 2,...,N m,将分片S 1,S 2,...,S m合并为第一镜像文件。 S105. Swift merges the fragments S 1 , S 2 ,..., S m into the first image file according to the object prefix names N 1 , N 2 ,..., N m.
在本申请具体的实施例中,Swift根据接收到的分段D 1,得到分片S 1以及对象前缀名称N 1;Swift根据接收到的分段D 2,得到分片S 2以及对象前缀名称N 2;…;Swift根据接收到的分段D m,得到分片S m以及对象前缀名称N m。而且,Swift根据分段D 1,D 2,...D m的对象前缀名称,还可以获得分片S 1,S 2,...,S m的镜像ID以及对应的分段序号,从而确定分片S 1,S 2,...,S m都属于第一镜像文件的分片。当Swift接收到所有的分段,也就是上传代理设备确定分段上传记录中记录的分段数量与分片总量m相同时,上传代理设备向Swift发送以镜像ID命名的对象文件,并将调用Swift接口,使得Swift根据对象前缀名称N 1,N 2,...,N m,将第一镜像文件的分片S 1,S 2,...,S m按照分段序号进行合并,从而得到第一镜像文件。 In the particular application of the present embodiment, Swift according to the received segment D 1, to give the object points sheets S 1 and the name prefix N 1; Swift according to the received segment D 2, to give the object slice S 2 and the prefix name N 2; ...; Swift D m in accordance with the received segments, and obtain a target fragment prefix name S m N m. Moreover, Swift can also obtain the mirror IDs of the segments S 1 , S 2 ,..., S m and the corresponding segment sequence numbers according to the object prefix names of the segments D 1 , D 2 ,...D m, thereby It is determined that the fragments S 1 , S 2 ,..., S m all belong to the fragments of the first mirror file. When Swift receives all the parts, that is, when the upload proxy device determines that the number of parts recorded in the multipart upload record is the same as the total number of fragments m, the upload proxy device sends the object file named with the mirror ID to Swift and sends Invoke the Swift interface to make Swift merge the fragments S 1 , S 2 ,..., S m of the first image file according to the segment number according to the object prefix names N 1 , N 2 ,..., N m, Thus, the first image file is obtained.
S106、上传代理设备根据分段上传记录和分片总量m,获取第一镜像文件的上传进度,然后调用Glance接口刷新第一镜像的镜像状态。S106. The upload proxy device obtains the upload progress of the first image file according to the multipart upload record and the total number of fragments m, and then calls the Glance interface to refresh the image status of the first image.
其中,镜像状态包括queued状态、saving状态、active状态以及killed状态等等。queued状态表示等待上传镜像文件;saving状态表示镜像文件正在被上传;active状态表示镜像文件上传完毕,此时镜像可以使用;killed状态表示镜像文件上传过程中发生错误。Among them, the mirror state includes the queued state, the saving state, the active state, and the killed state, and so on. The queued state indicates that the image file is waiting to be uploaded; the saving state indicates that the image file is being uploaded; the active state indicates that the image file is uploaded and the image can be used at this time; the killed state indicates that an error occurred during the upload of the image file.
在本申请具体的实施例中,上传代理设备根据分段上传记录确定第一镜像文件的上传进度,然后调用Glance接口对第一镜像文件对应的镜像状态进行刷新。若分段上传记录中未存储有任一个分段的镜像ID及其分段序号,则表示第一镜像文件的上传进度为0,此时第一镜像的状态为queued。若分段上传记录中存储有k个分段的镜像ID及其对应的k个分段序号,则表示第一镜像文件的上传进度为k/m,此时第一镜像的状态为saving状态。若分段上传记录中存储有m个分段的镜像ID及其对应的m个分段序号,则表示第一镜像文件的上传进度为100%,此时第一镜像的状态为active状态。若上传过程发生中断或者上传失败,此时第一镜像的状态为killed状态。In a specific embodiment of the present application, the upload agent device determines the upload progress of the first mirror file according to the multipart upload record, and then calls the Glance interface to refresh the mirror status corresponding to the first mirror file. If the image ID of any one of the segments and its sequence number are not stored in the multipart upload record, it means that the upload progress of the first image file is 0, and the status of the first image is queued at this time. If the multipart upload record stores the image IDs of k segments and the corresponding k segment sequence numbers, it means that the upload progress of the first image file is k/m, and the state of the first image is the saving state at this time. If the multipart upload record stores m segment mirror IDs and their corresponding m segment sequence numbers, it means that the upload progress of the first mirror file is 100%, and the state of the first mirror at this time is the active state. If the upload process is interrupted or the upload fails, the status of the first image is killed at this time.
在本申请具体的实施例中,当Swift将分片S 1,S 2,...,S m合并为第一镜像文件之后,上传代理设备调用Glance接口刷新第一镜像的镜像状态,确定第一镜像处于可用状态,从而完成第一镜像的注册。 In the specific embodiment of this application, after Swift merges the fragments S 1 , S 2 ,..., S m into the first image file, the upload proxy device calls the Glance interface to refresh the image state of the first image, and determines the first image file. A mirror is in the available state, so that the registration of the first mirror is completed.
举例说明,假设第一镜像文件的大小为130GB,预设分片大小为50兆字节(megabyte,MB)。当文件读取接口接收到第一镜像文件之后,客户端根据预设分片大小,将第一镜像文件处理为2663个分片,即分片S 1,S 2,...,S 2663,其中,分片总量为2663个,分片S 1,S 2,...,S 2662的大小均为50MB,分片S 2663的大小为20MB。客户端为分片S 1,S 2,...,S 2663依次添加分片序号,得到数据包P 1,P 2,...,P 2663,其中,分片S 1的分片序号I 1记为00001,分片S 2的分片序号I 2记为00002,….,分片S 2663的分片序号I 2663记为02663。客户端将数据包P 1和分片总量发送给上传代理设备,上传代理设备接收数据包P 1并调用Glance接口以创建镜像元数据,从而获取镜像ID(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx),然后根据镜 像ID创建一个以镜像ID命名的目标对象文件。之后,上传代理设备根据数据包P 1和镜像ID,为获取到的分片S 1添加对象前缀名称N 1(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-00001)得到分段D 1,并将分段D 1转发到Swift中。当Swift接收到分段D 1,上传代理设备将分段D 1对应的镜像ID和分段序号(00001)保存在分段上传记录中。类似的,客户端将数据包P 2发送给上传代理设备,上传代理设备根据数据包P 2和镜像ID,对接收到的分片S 2添加对象前缀名称N 2(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-00002)得到分段D 2,并将分段D 2转发到Swift中,当Swift接收到分段D 2,则上传代理设备将分段D 2对应的镜像ID和分段序号(00002)保存在分段上传记录中;…;客户端将数据包P 2663发送给上传代理设备,上传代理设备根据数据包P 2663和镜像ID,对接收到的分片S 2663添加对象前缀名称N 2663(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-02663)得到分段D 2663,并将分段D 2663转发到Swift中,当Swift接收到分段D 2663,则上传代理设备将分段D 2663对应的镜像ID和分段序号(02663)保存在分段上传记录中。此时,上传代理设备向Swift发送目标对象文件,并将调用Swift接口,使得Swift根据对象前缀名称N 1,N 2,...,N 2663,将分片S 1,S 2,...,S 2663合并为第一镜像文件。另外,上传代理设备在第一镜像文件的上传过程中还根据分段上传记录和分片总量,定期调用Glance接口刷新第一镜像的镜像状态。在Swift将分片S 1,S 2,...,S 2663合并为第一镜像文件之后,上传代理设备通过调用Glance接口刷新第一镜像的镜像状态,得到第一镜像的镜像状态为可用状态,从而完成第一镜像的注册。 For example, suppose that the size of the first image file is 130 GB, and the preset fragment size is 50 megabytes (MB). After the file reading interface receives the first image file, the client processes the first image file into 2663 fragments according to the preset fragment size, that is, fragments S 1 , S 2 ,..., S 2663 , Among them, the total number of fragments is 2,663, the size of fragments S 1 , S 2 ,..., S 2662 are all 50 MB, and the size of fragment S 2663 is 20 MB. The client adds the fragment sequence numbers for the fragments S 1 , S 2 ,..., S 2663 in turn, and obtains data packets P 1 , P 2 ,..., P 2663 , where the fragment sequence number of the fragment S 1 is I 1 referred to as 00001, slice number S fragment denoted as I 2 2 00002, ...., slice S fragment number 2663 2663 is referred to as the I 02663. The client sends the data packet P 1 and the total number of fragments to the upload proxy device. The upload proxy device receives the data packet P 1 and calls the Glance interface to create mirror metadata, thereby obtaining the mirror ID (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) ), and then create a target object file named after the mirror ID based on the mirror ID. After that, the upload agent device adds the object prefix name N 1 (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-00001) to the obtained segment S 1 according to the data packet P 1 and the mirror ID to obtain the segment D 1 , and then Segment D 1 is forwarded to Swift. When Swift receives segment D 1 , the upload agent device saves the mirror ID and segment serial number (00001) corresponding to segment D 1 in the segment upload record. Similarly, the client sends the data packet P 2 to the upload proxy device, and the upload proxy device adds the object prefix name N 2 (xxxxxxxx-xxxx-xxxx-xxxx) to the received segment S 2 according to the data packet P 2 and the mirror ID. -xxxxxxxxxxxx-00002) Obtain segment D 2 and forward segment D 2 to Swift. When Swift receives segment D 2 , the upload proxy device will upload the corresponding mirror ID and segment serial number of segment D 2 (00002 ) Is saved in the multipart upload record; ...; the client sends the data packet P 2663 to the upload proxy device, and the upload proxy device adds the object prefix name N 2663 to the received segment S 2663 according to the data packet P 2663 and the mirror ID (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-02663) Get segment D 2663 , and forward segment D 2663 to Swift. When Swift receives segment D 2663 , the upload proxy device will upload segment D 2663 to the corresponding The mirror ID and part number (02663) are saved in the part upload record. At this point, the upload proxy device sends the target object file to Swift, and will call the Swift interface, so that Swift divides S 1 , S 2 ,... according to the object prefix name N 1 , N 2 ,..., N 2663. , S 2663 is merged into the first image file. In addition, during the uploading process of the first image file, the upload agent device also periodically calls the Glance interface to refresh the image status of the first image according to the multipart upload record and the total number of fragments. After Swift merges the fragments S 1 , S 2 ,..., S 2663 into the first image file, the upload proxy device refreshes the image status of the first image by calling the Glance interface, and obtains that the image status of the first image is available. , So as to complete the registration of the first mirror.
上述方法中,当镜像文件在上传过程中未发生上传中断或者上传失败的情况时,客户端通过对镜像文件进行分片,并将镜像文件的分片发送给上传代理设备,再由上传代理设备将分片对应的分段转发给Swift,使得Swift可以根据接收到分段,按照对象前缀名称将分片合并为镜像文件。可以看出,利用上述方法可以实现利用镜像文件的分片代替镜像文件进行上传,从而提高镜像文件的上传成功率。另外,客户端还可以将镜像文件的分片并行发送给上传代理设备,再由上传代理设备将分片并行发送给Swift,从而提供镜像文件的上传效率。In the above method, when there is no upload interruption or upload failure of the image file during the upload process, the client divides the image file into fragments, and sends the fragments of the image file to the upload agent device, and then the upload agent device The segment corresponding to the segment is forwarded to Swift, so that Swift can merge the segments into a mirror file based on the received segment and the object prefix name. It can be seen that by using the above method, it is possible to use the fragments of the mirror file to replace the mirror file for upload, thereby improving the upload success rate of the mirror file. In addition, the client can also send the fragments of the mirror file to the upload proxy device in parallel, and then the upload proxy device sends the fragments to Swift in parallel, thereby improving the upload efficiency of the mirror file.
在客户端向上传代理设备发送第一镜像文件的分片时,可能由于网络原因或者上传代理设备异常等情况导致上传代理设备无法完整接收到第一镜像文件的所有分片S 1,S 2,...,S m。那么,接下来将以第一镜像文件在上传过程中出现上传中断或者单个分片上传失败为例,介绍本申请提供的镜像文件上传方法。如图6所示,图6示出了本申请提供的一种镜像文件的上传方法的流程示意图。本实施方式的镜像文件上传方法包括但不限于如下步骤: When the client sends the fragments of the first image file to the upload proxy device, the upload proxy device may not be able to completely receive all the fragments S 1 , S 2 of the first image file due to network reasons or abnormalities of the upload proxy device, etc. ...,S m . Then, next, taking the upload interruption of the first image file during the upload process or the upload failure of a single segment as an example, the method for uploading the image file provided in this application will be introduced. As shown in FIG. 6, FIG. 6 shows a schematic flowchart of a method for uploading a mirror file provided by the present application. The mirror file upload method of this embodiment includes but is not limited to the following steps:
S201、客户端向上传代理设备发送断点续传请求。S201: The client sends a resumable upload request to the upload proxy device.
其中,断点续传请求中携带了第一镜像文件对应的镜像ID,断点续传请求用于请求发生上传中断或者上传失败时断点处分片对应的分片序号。Wherein, the resumable upload request carries the image ID corresponding to the first image file, and the resume resumable upload request is used to request the segment sequence number corresponding to the segment at the breakpoint when the upload is interrupted or the upload fails.
在本申请具体的实施例中,客户端上传第一镜像文件的分片时出现单个分片上传失败的情况,例如,上传代理设备未接收到分片S n+1。或者,客户端上传第一镜像文件的分片时出现上传中断的情况,即上传代理设备未接收到分片S n+1,S n+2,...,S m。其中,1≤n<m,n是正整数。 In the specific embodiment of the present application, when the client uploads the fragments of the first mirror file, the upload of a single fragment fails, for example, the upload agent device does not receive the fragment S n+1 . Or, when the client uploads the fragments of the first image file, the upload is interrupted, that is, the upload proxy device does not receive the fragments S n+1 , S n+2 ,..., S m . Among them, 1≤n<m, and n is a positive integer.
在一种可能的实施例中,当客户端向上传代理设备发送数据包P n+1时,出现网络中断、 当前网络环境不支持数据包的上传、上传代理设备异常等情况,使得上传代理设备未接收到数据包P n+1。当客户端向上传代理设备发送数据包P n+2时,网络环境或者上传代理设备等恢复正常,此时上传代理设备将可以接收到数据包P n+2,P n+3,...,P m,换句话说,上传代理设备接收到数据包P 1,P 2,...,P n,P n+2,P n+3,...,P mIn a possible embodiment, when the client sends a data packet P n+1 to the upload agent device, the network is interrupted, the current network environment does not support the upload of the data packet, the upload agent device is abnormal, etc., so that the upload agent device The data packet P n+1 is not received. When the client sends a data packet P n+2 to the upload proxy device, the network environment or the upload proxy device returns to normal, and the upload proxy device will be able to receive the data packets P n+2 , P n+3 ,... ,P m , in other words, the upload agent device receives the data packets P 1 , P 2 ,...,P n ,P n+2 ,P n+3 ,...,P m .
在另一种可能的实施例中,当客户端向上传代理设备发送数据包P n+1时,出现网络中断、当前网络环境不支持数据包的上传、上传代理设备异常等情况,使得上传代理设备无法接收到从数据包P n+1开始的剩下的数据包(P n+1,P n+2,...,P m),此时上传代理设备仅接收到数据包P 1,P 2,...,P nIn another possible embodiment, when the client sends a data packet P n+1 to the upload agent device, the network is interrupted, the current network environment does not support the upload of the data packet, the upload agent device is abnormal, etc., so that the upload agent The device cannot receive the remaining data packets (P n+1 ,P n+2 ,...,P m ) starting from the data packet P n+1 . At this time, the upload proxy device only receives the data packet P 1 , P 2 ,...,P n .
S202、上传代理设备根据断点续传请求,向客户端发送断点处分片对应的分片序号I n S202. The upload proxy device sends the segment sequence number I n corresponding to the segment at the breakpoint to the client according to the request for resuming the transfer at the breakpoint.
在本申请具体的实施例中,上传代理设备接收到断点续传请求之后,根据第一镜像文件对应的镜像ID,调用Glance接口刷新第一镜像的镜像状态,从而获得文件上传令牌(token)。然后,上传代理设备根据文件上传token将分段上传记录中的发生断点的分片(分段)对应的分片序号I n(分段序号)发送给客户端,使得客户端可以根据分片序号I n从数据包P n+1开始续传的剩下的数据包。 In the specific embodiment of this application, after the upload agent device receives the resumable upload request, according to the image ID corresponding to the first image file, it calls the Glance interface to refresh the image status of the first image, thereby obtaining a file upload token (token ). Then, the upload proxy device sends the segment sequence number I n (segment sequence number) corresponding to the segment (segment) where the breakpoint occurred in the multipart upload record to the client according to the file upload token, so that the client can The sequence number I n starts from the data packet P n+1 and continues to transmit the remaining data packets.
S203、客户端根据分片序号I n向上传代理设备发送上传失败的分片对应的数据包,并由上传代理设备将上传失败的分片对应的分段发送给Swift。 S203, the client transmits upload failures I n corresponding fragment packet to upload the proxy apparatus according to the fragment number, the proxy device transmits the upload by uploading fragment corresponding to the failed segments to Swift.
在一种可能的实施例中,客户端根据分片序号I n仅向上传代理设备发送数据包P n+1。其中,数据包P n+1包括分片S n+1和分片序号I n+1。上传代理设备接收到数据包P n+1之后,根据数据包P n+1和第一镜像文件的镜像ID,为分片S n+1添加对象前缀名称N n+1得到分段D n+1,然后将分段D n+1发送给Swift。其中,对象前缀名称N n+1包括镜像ID和分段D n+1对应的分段序号,分段D n+1对应的分段序号是分片序号I n+1。若Swift接收到分段D n+1,则上传代理设备在分段上传记录中保存分段D n+1的镜像ID以及分段D n+1对应的分段序号。 In one possible embodiment, the client sends only upload proxy device according to the slice packet number I n P n + 1. Among them, the data packet P n+1 includes a fragment S n+1 and a fragment sequence number I n+1 . Upload proxy device after receiving the data packet P n + 1, the data packet P n + 1 and the image file ID of the first mirror, to slice the object S + 1 to add a prefix name n N n + 1 D n + segment obtained 1 , and then send segment D n+1 to Swift. Wherein the object name prefix N n + 1 and the segment ID includes mirror image D n + 1 corresponding to the segment number, segment D n + 1 corresponding to the segment number is the slice number I n + 1. When the segments are received Swift D n + 1, the proxy device upload saved image D n + segment ID and segment D n 1 + 1 in a segment corresponding to the segment number of the record uploading.
在另一种可能的实施例中,客户端根据分片序号I n向上传代理设备依次发送数据包P n+1,P n+2,...,P m。其中,数据包P n+1包括分片S n+1和分片序号I n+1,数据包P n+2包括分片S n+2和分片序号I n+2,…,数据包P m包括分片S m和分片序号I m。上传代理设备接收到数据包P n+1之后,根据数据包P n+1和镜像ID,为分片S n+1添加对象前缀名称N n+1得到分段D n+1,然后将分段D n+1发送给Swift。其中,对象前缀名称N n+1包括镜像ID和分段D n+1对应的分段序号,分段D n+1对应的分段序号是分片序号I n+1。若Swift接收到分段D n+1,则上传代理设备在分段上传记录中保存分段D n+1的镜像ID以及分段D n+1对应的分段序号。上传代理设备接收到数据包P n+2之后,根据数据包P n+2和镜像ID,为分片S n+2添加对象前缀名称N n+2得到分段D n+2,然后将分段D n+2发送给Swift。其中,对象前缀名称N n+2包括镜像ID和分段D n+2对应的分段序号,分段D n+2对应的分段序号是分片序号I n+2。若Swift接收到分段D n+2,则上传代理设备在分段上传记录中保存分段D n+2的镜像ID以及分段D n+2对应的分段序号。…。上传代理设备接收到数据包P m之后,根据数据包P m和镜像ID,为分片S m添加对象前缀名称N m得到分段D m,然后将分段D m发送到Swift。其中,对象前缀名称N m包括镜像ID和分段D m对应的分段序号,分段D m对应的分段序号是分片序号I m。若Swift接收到分段D m,则上传代理设备在分段上传记录中保存分段D m的镜像ID以及分段D m对应的分段序号。 In another possible embodiment, the client sequentially sends data packets P n+1 , P n+2 ,..., P m to the upload proxy device according to the fragment sequence number I n . Among them, the data packet P n+1 includes the fragment S n+1 and the fragment sequence number I n+1 , and the data packet P n+2 includes the fragment S n+2 and the fragment sequence number I n+2 ,..., the data packet P m includes the fragment S m and the fragment sequence number I m . Upload proxy device after receiving the data packet P n + 1, the data packet P n + 1 and the image ID, add a prefix name for the object slice S n + 1 N n + 1 D to give the segment n + 1, then the points Segment D n+1 is sent to Swift. Wherein the object prefix name N n + 1 and the segment ID includes mirror image D n + 1 corresponding to the segment number, segment D n + 1 corresponding to the segment number is the slice number I n + 1. When the segments are received Swift D n + 1, the proxy device upload saved image D n + segment ID and segment D n 1 + 1 in a segment corresponding to the segment number of the record uploading. Upload proxy device after receiving the data packet P n + 2, the data packet P n + 2 and the image ID, add a prefix name for the object slice S n + 2 N n + 2 to give D segment n + 2, then the sub- Segment D n+2 is sent to Swift. Wherein the object name prefix N n + 2 includes mirror image ID and segment D n + 2 corresponding to the segment number, segment D n + 2 corresponding to the segment number is the slice number I n + 2. When the segments are received Swift D n + 2, the proxy device upload saved image D n + segment ID and segment D n 2 + 2 corresponding to the segment number in the segment uploaded records. …. After receiving the data packet P m , the upload agent device adds the object prefix name N m to the segment S m according to the data packet P m and the mirror ID to obtain the segment D m , and then sends the segment D m to Swift. Wherein the object includes mirror image prefix name N m D m corresponding to the segment ID and segment number, segment D m corresponding to the segment number is fragment number I m. When the segments are received Swift D m, the proxy device stores upload mirror segment D m D m corresponding to the segment ID and segment number of the segment in the upload history.
在另一种可能的实施例中,客户端利用l个线程将数据包P n+1,P n+2,...,P n+l并行发送给上传代理设备,直至上传代理设备接收到数据包P m。上传代理设备接收到数据包P n+1,P n+2,...,P n+l之后,根据数据包P n+1,P n+2,...,P n+l和镜像ID,分别为分片S n+1,S n+2,...,S n+l添加对象前缀名称N n+1,N n+2,...,N n+l,从而得到分段D n+1,D n+2,...,D n+l,然后将分段D n+1,D n+2,...,D n+l并行发送给Swift。其中,对象前缀名称N n+1包括镜像ID和分段D n+1对应的分段序号,分段D n+1对应的分段序号是分片序号I n+1;对象前缀名称N n+2包括镜像ID和分段D n+2对应的分段序号,分段D n+2对应的分段序号是分片序号I n+2;…;对象前缀名称N n+l包括镜像ID和分段D n+l对应的分段序号,分段D n+l对应的分段序号是分片序号I n+l。若Swift接收到分段D n+1,D n+2,...,D n+l,则上传代理设备在分段上传记录中分别保存分段D n+1,D n+2,...,D n+l的镜像ID以及分段D n+1,D n+2,...,D n+l对应的分段序号。 In another possible embodiment, the client uses 1 thread to send the data packets P n+1 , P n+2 ,..., P n+1 to the upload agent device in parallel until the upload agent device receives Data packet P m . After the upload agent device receives the data packets P n+1 ,P n+2 ,...,P n+l , according to the data packets P n+1 ,P n+2 ,...,P n+l and mirroring ID, respectively add the object prefix name N n+1 ,N n+2 ,...,N n+l to the fragments S n+1 , S n+2 ,..., S n+l to get the score Segment D n+1 , D n+2 ,..., D n+l , and then send the segments D n+1 , D n+2 ,..., D n+l to Swift in parallel. Wherein the object name prefix N n + 1 and the segment ID includes mirror image D n + 1 corresponding to the segment number, segment D n + 1 corresponding to the segment number is the slice number I n + 1; target name prefix N n +2 includes the mirror ID and the segment number corresponding to the segment D n+2 , the segment number corresponding to the segment D n+2 is the segment number I n+2 ; ...; the object prefix name N n+1 includes the mirror ID The segment sequence number corresponding to the segment D n+1 , and the segment sequence number corresponding to the segment D n+1 is the segment sequence number I n+1 . If Swift receives the segments D n+1 , D n+2 ,..., D n+l , the upload agent device will save the segments D n+1 , D n+2 , in the segment upload record respectively. .., D n + l mirrored segment ID and D n + 1, D n + 2, ..., D n + l corresponding to the segment number.
S204、Swift将分片S 1,S 2,...,S m合并为第一镜像文件。 S204. Swift merges the fragments S 1 , S 2 ,..., S m into the first image file.
在一种可能的实施例中,在客户端向上传代理设备发送断点续传请求之前,Swift中保存了分段D 1,D 2,...,D n,D n+2,D n+3,...,D m。其中,分段D 1,D 2,...,D n,D n+2,D n+3,...,D m是由上传代理设备根据数据包P 1,P 2,...,P n,P n+2,P n+3,...,P m和镜像ID,分别为分片S 1,S 2,...,S n,S n+2,S n+3,...,S m添加对象前缀名称N 1,N 2,...,N n,N n+2,N n+3,...,N m之后得到的。当Swift接收到分段D n之后,Swift根据分段D 1,D 2,...,D n,D n+1,D n+2,...,D m的对象前缀名称N 1,N 2,...,N n,N n+1,N n+2,...,N m,将分片S 1,S 2,...,S m合并为第一镜像文件。 In a possible embodiment, before the client sends a resumable upload request to the upload proxy device, the segments D 1 , D 2 ,..., D n , D n+2 , D n are saved in Swift +3 ,...,D m . Among them, the segments D 1 , D 2 ,..., D n , D n+2 , D n+3 ,..., D m are determined by the upload agent device according to the data packets P 1 , P 2 ,... ,P n ,P n+2 ,P n+3 ,...,P m and the mirror ID, which are respectively the fragments S 1 , S 2 ,..., S n , S n+2 , S n+3 ,...,S m is obtained after adding object prefix names N 1 ,N 2 ,...,N n ,N n+2 ,N n+3 ,...,N m . When Swift receives the segment D n , Swift according to the segment D 1 , D 2 ,..., D n , D n+1 , D n+2 ,..., D m object prefix name N 1 , N 2 ,...,N n ,N n+1 ,N n+2 ,...,N m , merge the slices S 1 , S 2 ,..., S m into the first image file.
在另一种可能的实施例中,在客户端向上传代理设备发送断点续传请求之前,Swift中保存了分段D 1,D 2,...,D n。其中,分段D 1,D 2,...,D n是由上传代理设备根据数据包P 1,P 2,...,P n和镜像ID,分别为分片S 1,S 2,...,S n添加对象前缀名称N 1,N 2,...,N n之后得到的。当Swift接收到分段D n+1,D n+2,...,D m之后,Swift根据分段D 1,D 2,...,D n,D n+1,D n+2,...,D m的对象前缀名称N 1,N 2,...,N n,N n+1,N n+2,...,N m,将分片S 1,S 2,...,S m合并为第一镜像文件。 In another possible embodiment, the segments D 1 , D 2 ,..., D n are saved in Swift before the client sends a resumable upload request to the upload proxy device. Among them, the segments D 1 , D 2 ,..., D n are the segments S 1 , S 2 , and S 2 according to the data packets P 1 , P 2 ,..., P n and the mirror ID by the upload agent device. ...,S n is obtained after adding object prefix names N 1 ,N 2 ,...,N n . When Swift receives the segments D n+1 , D n+2 ,...,D m , Swift according to the segments D 1 , D 2 ,..., D n , D n+1 , D n+2 ,...,D m object prefix name N 1 ,N 2 ,...,N n ,N n+1 ,N n+2 ,...,N m , S 1 ,S 2 , ..., S m is merged into the first image file.
S205、上传代理设备根据分段上传记录和分片总量m,获取第一镜像文件的上传进度,然后调用Glance接口刷新第一镜像的镜像状态。S205. The upload agent device obtains the upload progress of the first image file according to the multipart upload record and the total number of fragments m, and then calls the Glance interface to refresh the image status of the first image.
在本申请具体的实施例中,当Swift将分片S 1,S 2,...,S m合并为第一镜像文件之后,代理组件调用Glance接口刷新第一镜像的镜像状态,确定第一镜像处于可用状态,从而完成第一镜像的注册。另外,在断点续传上传失败的分片的过程中,上传代理设备也可以调用Glance接口刷新第一镜像的镜像状态。 In the specific embodiment of this application, after Swift merges the fragments S 1 , S 2 ,..., S m into the first image file, the proxy component calls the Glance interface to refresh the image status of the first image, and determines the first image file. The mirror is in a usable state, thereby completing the registration of the first mirror. In addition, during the process of resuming the uploading of the failed fragments, the upload proxy device can also call the Glance interface to refresh the mirror status of the first mirror.
举例说明,假设第一镜像文件的大小为500GB,预设分片大小为200MB。当文件读取接口接收到第一镜像文件之后,客户端浏览器根据预设分片大小,将第一镜像文件处理为2560个分片,即分片S 1,S 2,...,S 2560。其中,分片总量为2560个,分片S 1,S 2,...,S 2560的大小均为200MB。浏览器为分片S 1,S 2,...,S 2560依次添加分片序号,得到数据包P 1,P 2,...,P 2560。其中,分片S 1的分片序号I 1记为00001,分片S 2的分片序号I 2记为00002,….,分片S 2560的分片序号I 2560记为02560。客户端将数据包P 1和分片总量发送给上传代理设备,上传代理设备接收数据包P 1并调用Glance接口以创建镜像元数据,从而获取镜像ID(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx),然后根据镜像ID创建一个以镜像ID命名的目标对象文件。上传代理设备接收到数据包P 1之后,根据数据包P 1和镜像ID为分片S 1添加对象前缀名称N 1(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-00001),从而得到分段D 1,并将分段D 1发送给Swift,当Swift接收到分段D 1,上传代理设备在分段上传记录中 保存分段D 1对应的镜像ID及其分段序号(00001);客户端将数据包P 2发送给上传代理设备,上传代理设备接收到数据包P 2之后,根据数据包P 2和镜像ID为分片S 2添加对象前缀名称N 2(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-00002),从而得到分段D 2,并将分段D 2发送给Swift,当Swift接收到分段D 2,上传代理设备在分段上传记录中保存分段D 2对应的镜像ID及其分段序号(00002);…;客户端将数据包P 2000发送给上传代理设备,上传代理设备接收到数据包P 2000之后,根据数据包P 2000和镜像ID为分片S 2000添加对象前缀名称N 2000(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-02000),从而得到分段D 2000,并将分段D 2000发送给Swift,当Swift接收到分段D 2000,上传代理设备在分段上传记录中保存分段D 2000对应的镜像ID及其分段序号(02000)。当客户端向上传代理设备发送数据包P 2001时,由于网络中断导致数据包P 2001以及剩下的数据包无法发送给上传代理设备。当网络恢复时,客户端向上传代理设备发送断点续传请求。上传代理设备根据断点续传请求,向客户端发送分片序号I 2000(02000)。然后,客户端根据分片序号I 2000向上传代理设备发送数据包P 2001,上传代理设备接收到数据包P 2001之后,根据数据包P 2001和镜像ID为分片S 2001添加对象前缀名称N 2001(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-02001),从而得到分段D 2001,并将分段D 2001发送给Swift,当Swift接收到分段D 2001,上传代理设备在分段上传记录中保存分段D 2001对应的镜像ID及其分段序号(02001);…;客户端向上传代理设备发送数据包P 2560,上传代理设备接收到数据包P 2560之后,根据数据包P 2560和镜像ID为分片S 2560添加对象前缀名称N 2560(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-02560),从而得到分段D 2560,并将分段D 2560发送给Swift,当Swift接收到分段D 2560,上传代理设备在分段上传记录中保存分段D 2560对应的镜像ID及其分段序号(02560)。此时,上传代理设备调用Swift接口,使得Swift根据对象前缀名称N 1,N 2,...,N 2560,将分片S 1,S 2,...,S 2560合并为第一镜像文件。另外,上传代理设备在第一镜像文件的上传过程中还根据分段上传记录和分片总量,定期调用Glance接口刷新第一镜像的镜像状态。在Swift将分片S 1,S 2,...,S 2560合并为第一镜像文件之后,上传代理设备通过调用Glance接口刷新第一镜像的镜像状态,得到第一镜像的镜像状态为可用状态,从而完成第一镜像的注册。 For example, suppose that the size of the first image file is 500GB, and the preset fragment size is 200MB. After the file reading interface receives the first image file, the client browser processes the first image file into 2560 fragments according to the preset fragment size, that is, fragments S 1 , S 2 ,...,S 2560 . Among them, the total number of fragments is 2560, and the sizes of fragments S 1 , S 2 ,..., S 2560 are all 200 MB. The browser adds the sequence numbers of the fragments to the fragments S 1 , S 2 ,..., S 2560 in turn to obtain data packets P 1 , P 2 ,..., P 2560 . Among them, the fragment serial number I 1 of the fragment S 1 is recorded as 00001, the fragment serial number I 2 of the fragment S 2 is recorded as 00002,..., and the fragment serial number I 2560 of the fragment S 2560 is recorded as 02560. The client sends the data packet P 1 and the total number of fragments to the upload proxy device. The upload proxy device receives the data packet P 1 and calls the Glance interface to create mirror metadata, thereby obtaining the mirror ID (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) ), and then create a target object file named after the mirror ID based on the mirror ID. After the upload agent device receives the data packet P 1 , it adds the object prefix name N 1 (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-00001) to the segment S 1 according to the data packet P 1 and the mirror ID , thereby obtaining the segment D 1 , And send segment D 1 to Swift. When Swift receives segment D 1 , the upload proxy device saves the mirror ID corresponding to segment D 1 and its segment serial number (00001) in the segment upload record; the client will The data packet P 2 is sent to the upload agent device. After the upload agent device receives the data packet P 2 , it adds the object prefix name N 2 (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) to the segment S 2 according to the data packet P 2 and the mirror ID -00002), so as to obtain segment D 2 and send segment D 2 to Swift. When Swift receives segment D 2 , the upload agent device saves the mirror ID corresponding to segment D 2 and its corresponding image ID in the segment upload record. Segment sequence number (00002); ...; the client sends the data packet P 2000 to the upload agent device. After the upload agent device receives the data packet P 2000 , it adds the object prefix name for the segment S 2000 according to the data packet P 2000 and the mirror ID N 2000 (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-02000) to obtain segment D 2000 and send segment D 2000 to Swift. When Swift receives segment D 2000 , the upload agent device uploads records in segment The mirror ID corresponding to segment D 2000 and its segment number (02000) are stored in it. When the client sends the data packet P 2001 to the upload agent device, the data packet P 2001 and the remaining data packets cannot be sent to the upload agent device due to a network interruption. When the network is restored, the client sends a resumable upload request to the upload agent device. The upload proxy device sends the fragment sequence number I 2000 (02000) to the client according to the resumable upload request. Then, the client sends a data packet P 2001 to the upload proxy device according to the fragment sequence number I 2000. After the upload proxy device receives the data packet P 2001 , it adds the object prefix name N 2001 to the fragment S 2001 according to the data packet P 2001 and the mirror ID. (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-02001), to get segment D 2001 , and send segment D 2001 to Swift, when Swift receives segment D 2001 , the upload agent device saves it in the segment upload record The mirror ID corresponding to segment D 2001 and its segment serial number (02001); ...; the client sends a data packet P 2560 to the upload proxy device, and the upload proxy device receives the data packet P 2560 according to the data packet P 2560 and the mirror ID S 2560 is added to slice the object name prefix N 2560 (xxxxxxxxxxxx-xxxxxxxx-xxxxxxxxxxxx -02560), to obtain a D segment 2560, and 2560 to send Swift D segment, the segment is received when Swift D 2560 , The upload agent device saves the mirror ID corresponding to the segment D 2560 and its segment serial number (02560) in the segment upload record. At this point, the upload proxy device calls the Swift interface, so that Swift merges the fragments S 1 , S 2 ,..., S 2560 into the first image file according to the object prefix names N 1 , N 2 ,..., N 2560 . In addition, during the uploading process of the first image file, the upload agent device also periodically calls the Glance interface to refresh the image status of the first image according to the multipart upload record and the total number of fragments. After Swift merges the fragments S 1 , S 2 ,..., S 2560 into the first image file, the upload proxy device refreshes the first image's image status by calling the Glance interface, and gets the first image's image status as available. , So as to complete the registration of the first mirror.
应理解,当第一镜像文件的大小小于或者等于预设阈值,且第一镜像文件在上传过程中出现上传中断或者上传失败时,浏览器将重新上传第一镜像文件至上传代理设备,再由上传代理设备转发给Swift进行存储。当Swift重新接收到第一镜像文件时,上传代理设备调用Glance接口刷新第一镜像文件的镜像状态。It should be understood that when the size of the first image file is less than or equal to the preset threshold, and the upload of the first image file is interrupted or failed during the upload process, the browser will re-upload the first image file to the upload proxy device, and then The upload proxy device forwards it to Swift for storage. When Swift receives the first image file again, the upload agent device calls the Glance interface to refresh the image status of the first image file.
需要说明的,预设分片大小可以是上述实施例中的50MB、200MB,也可以是60MB、150MB等等,此处不作具体限定。It should be noted that the preset fragment size may be 50MB, 200MB, 60MB, 150MB, etc. in the foregoing embodiment, and there is no specific limitation here.
为了简便陈述,本实施例并没有对数据包P 1,P 2,...,P n-1,P n+1,...,P m P 1,P 2,...,P m、数据包P 1,P 2,...,P n-1的定义和获取过程、分段D 1,D 2,...,D n-1,D n+1,...,D m、分段D 1,D 2,...,D n-1的定义和获取过程进行详细说明,也没有对Swift将分片S 1,S 2,…,S m合并为第一镜像文件的具体过程、上传代理设备调用Glance接口刷新镜像状态的过程进行详细描述,还没有对分段上传记录进行详细描述等等,具体可参见S101-S106及其相关实施例,此处不再展开赘述。本实施例仅介绍了单个分片上传失败的应用场景,类似的上述方法还可以应用于多个分片上传失败的应用场景,此处不再进行赘述。另外,上述两个实施例中仅仅详细介绍了 第一镜像文件的上传方法,在实际应用中,第二镜像文件和第三镜像文件等等的上传方法与第一镜像文件的上传过程类似,此处不再展开赘述。 For the sake of simplicity, this embodiment does not provide data packets P 1 , P 2 ,...,P n-1 ,P n+1 ,...,P m P 1 ,P 2 ,...,P m , The definition and acquisition process of data packets P 1 , P 2 ,..., P n-1 , segment D 1 , D 2 ,..., D n-1 , D n+1 ,..., D The definition and acquisition process of m , segment D 1 , D 2 ,..., D n-1 are described in detail, and Swift does not merge the segments S 1 , S 2 ,..., S m into the first image file. The specific process of the upload agent device calling the Glance interface to refresh the mirror status is described in detail, and the multipart upload record has not been described in detail. For details, please refer to S101-S106 and related embodiments, which will not be repeated here. . This embodiment only introduces an application scenario where the upload of a single part fails, and the similar above-mentioned method can also be applied to an application scenario where the upload of multiple parts fails, which will not be repeated here. In addition, in the above two embodiments, only the upload method of the first image file is described in detail. In actual applications, the upload method of the second image file, the third image file, etc. is similar to the upload process of the first image file. I won't expand the details here again.
上述方法中,当镜像文件在上传过程中发生上传中断或者上传失败的情况时,客户端通过向上传代理设备发送断点续传请求,从而获取发生断点的分片对应的分片序号,从而使得客户端可以将上传失败的分片重新发送给上传代理设备,从而完成镜像文件的上传过程。可以看出,利用上述方法可以实现镜像文件的断点续传,提高镜像文件的上传成功率以及上传效率。另外,客户端还可以将镜像文件的分片并行发送给上传代理设备,再由上传代理设备将分片并行发送给Swift,从而提供镜像文件的上传效率。In the above method, when the upload is interrupted or the upload fails during the upload process of the image file, the client sends a breakpoint resuming upload request to the upload proxy device to obtain the fragment sequence number corresponding to the fragment where the breakpoint occurred, thereby This allows the client to resend the failed upload fragments to the upload proxy device, thereby completing the image file upload process. It can be seen that the use of the above method can realize the resumable upload of the mirror file, and improve the upload success rate and upload efficiency of the mirror file. In addition, the client can also send the fragments of the mirror file to the upload proxy device in parallel, and then the upload proxy device sends the fragments to Swift in parallel, thereby improving the upload efficiency of the mirror file.
结合上述图1至图6以及相关实施例,下面将以第一镜像文件的上传过程为例,详细阐述本申请实施例涉及的相关装置。With reference to the foregoing Figures 1 to 6 and related embodiments, the following will take the uploading process of the first image file as an example to describe in detail the related devices involved in the embodiments of the present application.
在本申请实施例中,客户端310可以是用户侧的一种用于接收或发射信号的实体,如新一代用户设备(new generation UE,gUE),具体可以包括手机、平板电脑、个人数字助理(personal digital assistant,PDA)、移动互联网设备(mobile internet device,MID)、笔记本电脑、智能穿戴设备(如智能手表、智能手环)等等,本申请实施例不作限定。具体请参见图7,图7是本申请提供的一种客户端的结构示意图。客户端310可以包括获取单元410、分片处理单元420以及发送单元430。其中,In this embodiment of the application, the client 310 may be an entity on the user side for receiving or transmitting signals, such as a new generation UE (gUE), which may specifically include mobile phones, tablets, and personal digital assistants. (personal digital assistant, PDA), mobile internet device (mobile internet device, MID), notebook computer, smart wearable device (such as smart watch, smart bracelet), etc., which are not limited in the embodiment of this application. Please refer to FIG. 7 for details. FIG. 7 is a schematic structural diagram of a client provided in this application. The client 310 may include an acquiring unit 410, a fragment processing unit 420, and a sending unit 430. in,
获取单元410用于获取第一镜像文件。The obtaining unit 410 is used to obtain the first image file.
分片处理单元420用于根据预设分片大小对第一镜像文件进行分片操作,得到第一镜像文件的分片S 1,S 2,...,S m以及分片总量m,其中,m是正整数。 The fragmentation processing unit 420 is configured to perform a fragmentation operation on the first mirror file according to the preset fragment size to obtain the fragments S 1 , S 2 ,..., S m of the first mirror file and the total fragment m, Among them, m is a positive integer.
发送单元430用于将数据包P 1,P 2,...,P m和分片总量m发送给上传代理设备。 The sending unit 430 is configured to send the data packets P 1 , P 2 ,..., P m and the total number of fragments m to the upload agent device.
在本申请具体的实施例中,获取单元410还用于在获取第一镜像文件之后,判断第一镜像文件的大小是否大于预设阈值,若第一镜像文件的大小大于预设阈值,则将第一镜像文件311发送到分片处理单元420;若第一镜像文件的大小小于或者等于预设阈值,则将第一镜像文件发送到发送单元430,然后再由发送单元430将第一镜像文件发送到上传代理设备。In a specific embodiment of the present application, the obtaining unit 410 is further configured to determine whether the size of the first image file is greater than a preset threshold after obtaining the first image file, and if the size of the first image file is greater than the preset threshold, The first mirror file 311 is sent to the fragmentation processing unit 420; if the size of the first mirror file is less than or equal to the preset threshold, the first mirror file is sent to the sending unit 430, and then the first mirror file is sent by the sending unit 430 Sent to the upload agent device.
在一更具体的实施例中,获取单元410可以通过接收用户输入的拖拽指令,并根据拖拽指令获取第一镜像文件;获取单元410还可以通过接收用户输入的选择指令,并根据选择指令获取第一镜像文件等等,此处不作具体限定。In a more specific embodiment, the acquiring unit 410 may receive a drag instruction input by the user and acquire the first image file according to the drag instruction; the acquiring unit 410 may also receive a selection instruction input by the user, and according to the selection instruction Obtaining the first image file, etc., is not specifically limited here.
在本申请具体的实施例中,分片处理单元420具体用于根据预设分片大小对第一镜像文件进行分片操作,得到分片S 1,S 2,...,S m,并为分片S 1添加分片序号I 1,分片S 2添加分片序号I 2,…,分片S m添加分片序号I m,从而得到数据包P 1,P 2,...,P m。其中,数据包P 1包含分片S 1以及分片序号I 1,数据包P 2包含分片S 2以及分片序号I 2,…,数据包P m包含分片S m以及分片序号I m。其中,分片序号I 1,I 2,...,I m用于表示分片S 1,S 2,...,S m的先后顺序,也就是说,分片S 1是第1个分片,分片S 2第2个分片,…,分片S m第m个分片。 In a specific embodiment of the present application, the fragmentation processing unit 420 is specifically configured to perform a fragmentation operation on the first mirror file according to a preset fragment size to obtain fragments S 1 , S 2 ,..., S m , and is added sheets S 1 sub-fragment No. I 1, S 2 is added slice slice number I 2, ..., S m slice add fragment number I m, to thereby obtain the data packet P 1, P 2, ..., P m . Among them, the data packet P 1 contains the fragment S 1 and the fragment sequence number I 1 , the data packet P 2 contains the fragment S 2 and the fragment sequence number I 2 ,..., the data packet P m contains the fragment S m and the fragment sequence number I m . Among them, the fragment sequence numbers I 1 , I 2 ,..., I m are used to indicate the sequence of the fragments S 1 , S 2 ,..., S m , that is, the fragment S 1 is the first Fragment, the second fragment of the fragment S 2 ,..., the m-th fragment of the fragment S m.
在一种可能的实施例中,当第一镜像文件在上传过程中未发生上传中断或者上传失败时,发送单元430可以将数据包P 1,P 2,...,P m依次发送给上传代理设备。或者,发送单元430使用l个线程同时将数据包P 1,P 2,...,P l发送给上传代理设备,当上传代理设备接收到数据包P 1,P 2,...,P l之后,发送单元430再使用上述l个线程同时将数据包P l+1,P l+2,...,P 2×l发送给上传代理设备,直至发送单元430将数据包P 1,P 2,...,P m全部发送给上传代理设备。其中, 1≤l≤m/2,l是正整数。可以看出,通过分片并发的方式可以有效地减少上传次数以及文件数据流。 In a possible embodiment, when the upload is not interrupted or the upload fails during the uploading process of the first image file, the sending unit 430 may send the data packets P 1 , P 2 ,..., P m to the uploader in sequence. Agent equipment. Alternatively, the sending unit 430 uses l threads to simultaneously send the data packets P 1 , P 2 ,..., P l to the upload proxy device, and when the upload proxy device receives the data packets P 1 , P 2 ,..., P After l , the sending unit 430 uses the above l threads to send the data packets P l+1 , P l+2 ,..., P 2×l to the upload agent device at the same time, until the sending unit 430 sends the data packets P 1 , P 2 ,..., P m are all sent to the upload agent device. Among them, 1≤l≤m/2, and l is a positive integer. It can be seen that the number of uploads and file data flow can be effectively reduced by means of sharding and concurrency.
在另一种可能的实施例中,当第一镜像文件在上传过程中出现单个分片(例如数据包对应P n+1对应的分片S n+1)上传失败的情况时,发送单元430还用于向上传代理设备发送断点续传请求,以获得分片序号I n,其中,断点续传请求中携带了第一镜像文件对应的镜像ID,断点续传请求用于请求发生断点的分片对应的分片序号;根据分片序号I n,将数据包P n+1发送给上传代理设备。应理解,第一镜像文件在上传过程中出现多个分片上传失败的情况与出现单个分片上传失败的情况类似,此处不再展开赘述。 In another possible embodiment, when the first slice of a single image file occurs during the upload process (e.g., data packets corresponding to P n + 1 corresponding to the fragment S n + 1) fails to upload, the transmission unit 430 It is also used to send a resumable upload request to the upload agent device to obtain the fragment sequence number I n , where the resumable upload request carries the mirror ID corresponding to the first mirror file, and the resume resumable upload request is used for request generation The fragment sequence number corresponding to the fragment of the breakpoint; according to the fragment sequence number I n , the data packet P n+1 is sent to the upload agent device. It should be understood that the failure to upload multiple fragments of the first image file during the upload process is similar to the failure to upload a single fragment, and will not be repeated here.
在另一种可能的实施例中,当第一镜像文件在上传过程中出现上传中断的情况(例如,在数据包P n+1处发生中断)时,发送单元430还用于向上传代理设备发送断点续传请求,以获得分片序号I n。其中,断点续传请求中携带了第一镜像文件对应的镜像ID,断点续传请求用于请求发生断点的分片对应的分片序号;根据分片序号I n,将数据包P n+1,P n+2,...,P m发送给上传代理设备。其中,发送单元430可以将数据包P n+1,P n+2,...,P m依次发送给上传代理设备,还可以采用并发上传的方式将数据包P n+1,P n+2,...,P m发送给上传代理设备,具体请参见S203。 In another possible embodiment, when the uploading of the first image file is interrupted during the uploading process (for example, the interruption occurs at the data packet P n+1 ), the sending unit 430 is also used to send the upload proxy device Send a breakpoint resume request to obtain the fragment sequence number I n . Among them, the resumable transmission request carries the mirror ID corresponding to the first mirror file, and the resumable transmission request is used to request the fragment sequence number corresponding to the fragment where the breakpoint occurred; according to the fragment sequence number I n , the data packet P n+1 ,P n+2 ,...,P m are sent to the upload agent device. Wherein, the sending unit 430 may send the data packets P n+1 , P n+2 ,..., P m to the upload agent device in turn, and may also use the concurrent upload method to send the data packets P n+1 , P n+ 2 ,...,P m is sent to the upload agent device, please refer to S203 for details.
上述客户端中,分片处理单元通过对镜像文件进行分片,从而实现由客户端将镜像文件分片上传。而且,发送单元还可以实现分片的并发上传,因此利用上述客户端上传镜像文件时,能够更大地提升目标镜像文件的上传效率。另外,当镜像文件在上传过程中出现上传中断或者上传失败时,发送单元通过向上传代理设备发送断点续传请求,获得发生断点的分片对应的分片序号,使得发送单元能够根据发生断点的分片对应的分片序号向上传代理设备发送上传失败的分片对应的数据包。可以看出,利用上述客户端上传镜像文件时,可以实现镜像文件的断点续传以及分片并发上传,不仅能够提高镜像文件的上传效率,还能够提高镜像文件的上传成功率。In the above client, the fragmentation processing unit divides the mirror file into fragments, so that the client can upload the mirror file in fragments. Moreover, the sending unit can also implement concurrent uploading of fragments. Therefore, when the above-mentioned client is used to upload the mirror file, the upload efficiency of the target mirror file can be greatly improved. In addition, when the upload of the mirror file is interrupted or failed during the upload process, the sending unit sends a resumable upload request to the upload proxy device to obtain the segment sequence number corresponding to the segment where the breakpoint occurred, so that the sending unit can The segment sequence number corresponding to the segment of the breakpoint sends the data packet corresponding to the segment that failed to upload to the upload agent device. It can be seen that when using the above-mentioned client to upload the mirror file, the resumable upload of the mirror file and the concurrent upload of the mirror file can be realized, which not only improves the upload efficiency of the mirror file, but also improves the upload success rate of the mirror file.
本申请提供的上传代理设备可以是软件装置也可以是硬件装置,当上传代理设备为软件装置时,上传代理设备可以单独部署在任意环境(云环境、边缘环境、终端计算设备等)中的一个计算设备上,也可以与Swift、Glance部署在同一个计算设备上;当上传代理设备为硬件设备时,上传代理设备可以是任意环境中的一个计算设备。上传代理设备内部的单元模块也可以有多种划分,各个模块可以是软件模块,也可以是硬件模块,也可以部分是软件模块部分是硬件模块,本申请不对其进行限制。图8为一种示例性的划分方式,如图8所示,上传代理设备320可以包括获取单元510、发送单元520、调用单元530以及进度记录单元540。下面分别介绍每个功能单元的功能。The upload proxy device provided in this application can be a software device or a hardware device. When the upload proxy device is a software device, the upload proxy device can be deployed separately in any environment (cloud environment, edge environment, terminal computing equipment, etc.) On the computing device, it can also be deployed on the same computing device as Swift and Glance; when the upload proxy device is a hardware device, the upload proxy device can be a computing device in any environment. The unit modules inside the upload agent device can also be divided into multiple categories. Each module can be a software module, a hardware module, or a part of a software module and a part of a hardware module, which is not limited in this application. FIG. 8 is an exemplary division manner. As shown in FIG. 8, the upload proxy device 320 may include an acquiring unit 510, a sending unit 520, a calling unit 530, and a progress recording unit 540. The functions of each functional unit are introduced below.
获取单元510用于接收客户端发送的分片总量m以及数据包P 1,P 2,...,P m,其中,数据包P 1包含分片S 1以及分片序号I 1,数据包P 2包含分片S 2和分片序号I 2,…,数据包P m包含分片S m以及分片序号I m,分片S 1,S 2,...,S m是客户端对目标镜像文件进行分片得到的,m为正整数。 The acquiring unit 510 is configured to receive the total number of fragments m and data packets P 1 , P 2 ,..., P m sent by the client, where the data packet P 1 includes the fragment S 1 and the fragment sequence number I 1 , and the data The packet P 2 contains the fragment S 2 and the fragment sequence number I 2 ,..., the data packet P m contains the fragment S m and the fragment sequence number I m , and the fragments S 1 , S 2 ,..., S m are clients It is obtained by fragmenting the target image file, and m is a positive integer.
发送单元520用于将分片总量m和分片S 1,S 2,...,S m发送给Swift。 The sending unit 520 is configured to send the total number of fragments m and the fragments S 1 , S 2 ,..., S m to Swift.
调用单元530用于在接收客户端发送的数据包P 1时,调用Glance创建第一镜像文件对应的镜像ID。 Calling unit 530 is used when the data packet P is sent by a client 1, a first call Glance create a mirror image file corresponding to the ID.
进度记录单元540用于保存第一镜像文件的镜像ID、第一镜像文件的镜像大小、分 片S 1,S 2,...,S m的大小以及分片序号I 1,I 2,...,I mThe progress recording unit 540 is used to save the image ID of the first image file, the image size of the first image file, the size of the fragments S 1 , S 2 ,..., S m , and the fragment sequence numbers I 1 , I 2 ,... ..,I m .
在本申请具体的实施例中,发送单元520在向Swift发送分片S 1,S 2,...,S m之前,发送单元520还用于对分片S 1,S 2,...,S m添加对应的对象前缀名称,从而得到分段D 1,D 2,...,D m,然后将分段D 1,D 2,...,D m发送给Swift。其中,分片S 1对应的对象前缀名称N 1包括镜像ID和分片序号I 1,分片S 2对应的对象前缀名称N 2包括镜像ID和分片序号I 2,…,分片S m对应的对象前缀名称N m包括镜像ID和分片序号I mIn a specific embodiment of the present application, before the sending unit 520 sends the fragments S 1 , S 2 ,..., S m to Swift, the sending unit 520 is also used to pair the fragments S 1 , S 2 ,... ,S m adds the corresponding object prefix name to obtain the segments D 1 , D 2 ,..., D m , and then sends the segments D 1 , D 2 ,..., D m to Swift. Wherein the sub-sheets S 1 object prefix name of the corresponding N 1 of includes mirror image ID and the fragment number I 1, slice S 2 corresponding to the object prefix name N 2 includes mirror image ID and slice number I 2, ..., slice S m The corresponding object prefix name N m includes the mirror ID and the fragment sequence number I m .
在一种可能的实施例中,当第一镜像文件在上传过程中未发生上传中断或者上传失败时,发送单元520为分片S 1添加对象前缀名称N 1得到分段D 1,然后将分段D 1发送到Swift,若Swift接收到分段D 1,则在进度记录单元540的中保存分段D 1的镜像ID和分片序号I 1;发送单元520为分片S 2添加对象前缀名称N 2得到分段D 2,然后将分段D 2发送到Swift,若Swift接收到分段D 2,则在进度记录单元540的中保存分段D 2的镜像ID和分片序号I 2;…;发送单元520为分片S m添加对象前缀名称N m得到分段D m,然后将分段D m发送到Swift,若Swift接收到分段D m,则在进度记录单元540中保存分段D m镜像ID和分片序号I mIn one possible embodiment, when the first upload interrupted or failed to upload the image file does not occur during upload, the transmitting unit 520 for the sub-object prefix added sheets S 1 N 1 to give the name of the segment D 1, and then the points The segment D 1 is sent to Swift. If Swift receives the segment D 1 , the mirror ID of the segment D 1 and the segment sequence number I 1 are stored in the progress recording unit 540; the sending unit 520 adds an object prefix to the segment S 2 Name N 2 gets segment D 2 , and then sends segment D 2 to Swift. If Swift receives segment D 2 , it saves the mirror ID of segment D 2 and segment number I 2 in the progress recording unit 540 ;...; The sending unit 520 adds the object prefix name N m to the segment S m to obtain the segment D m , and then sends the segment D m to Swift, and if Swift receives the segment D m , it is saved in the progress recording unit 540 The segment D m mirror ID and the segment sequence number I m .
在另一种可能的实施例中,当第一镜像文件在上传过程中未发生上传中断或者上传失败时,发送单元520分别为分片S 1,S 2,...,S l添加对象前缀名称N 1,N 2,...,N l得到分段D 1,D 2,...,D l,然后将分段D 1,D 2,...,D l并行发送到Swift。若Swift接收到分段D 1,D 2,...,D l,则在进度记录单元540中分别保存分段D 1,D 2,...,D l的镜像ID以及分段D 1,D 2,...,D l对应的分片序号I 1,I 2,...,I l。应理解,上传代理设备将分片S l+1,S l+2,...,S 2×l并行发送给Swift的过程,…,将分片S m-l+1,S m-l+2,...,S m并行发送给Swift的过程与上传代理设备将分片S 1,S 2,...,S l并行发送给Swift的过程类似,此处不再展开具体赘述。 In another possible embodiment, when the uploading process of the first image file is not interrupted or the uploading fails, the sending unit 520 adds object prefixes to the segments S 1 , S 2 ,..., S 1 respectively. Name N 1 ,N 2 ,...,N l to get the segments D 1 , D 2 ,...,D l , and then send the segments D 1 , D 2 ,..., D l to Swift in parallel. If Swift receives the segments D 1 , D 2 ,..., D l , the mirror IDs of the segments D 1 , D 2 ,..., D l and the segment D 1 are respectively saved in the progress recording unit 540 ,D 2 ,...,D l corresponding to the fragment sequence numbers I 1 ,I 2 ,...,I l . It should be understood that the upload proxy device sends the fragments S l+1 , S l+2 ,..., S 2×l to Swift in parallel,..., the fragments S m-l+1 ,S m-l The process of sending +2 ,...,S m to Swift in parallel is similar to the process of sending the fragments S 1 , S 2 ,..., S l to Swift in parallel by the uploading agent device, and will not be repeated here.
在另一种可能的实施例中,当第一镜像文件在上传过程中出现单个分片(例如数据包对应P n+1对应的分片S n+1)上传失败的情况,也就是获取单元510仅仅接收到客户端发送的数据包P 1,P 2,...,P n,P n+2,P n+3,...,P m时,获取单元510还用于接收客户端发送的断点续传请求,发送单元520还用于将进度记录单元540中保存的分片序号I n发送给客户端。之后,获取单元510还用于接收客户端根据分片序号I n发送的数据包P n+1,发送单元520还用于为分片S n+1添加对象前缀名称N n+1,得到分段D n+1,并将分段D n+1发送给Swift。若Swift接收到分段D n+1,则在进度记录单元540中保存分段D n+1的镜像ID和分片序号I n+1。应理解,第一镜像文件在上传过程中出现多个分片上传失败的情况与出现单个分片上传失败的情况类似,此处不再展开赘述。 In another possible embodiment, when the first slice of a single image file occurs during the upload process (e.g., data packets corresponding to P n + 1 corresponding to the fragment S n + 1) upload failures, i.e. acquiring unit When 510 only receives the data packets P 1 , P 2 ,..., P n , P n+2 , P n+3 ,..., P m sent by the client, the acquiring unit 510 is also used to receive the client The sending unit 520 is also used to send the segment sequence number I n saved in the progress recording unit 540 to the client for the sent request for resuming the transmission. After that, the acquiring unit 510 is further configured to receive the data packet P n+1 sent by the client according to the fragment sequence number I n , and the sending unit 520 is further configured to add the object prefix name N n+1 to the fragment S n+1 to obtain the fragment Segment D n+1 and send segment D n+1 to Swift. If Swift receives the segment D n+1 , it saves the mirror ID of the segment D n+1 and the segment sequence number I n+1 in the progress recording unit 540. It should be understood that the failure to upload multiple fragments of the first image file during the upload process is similar to the failure to upload a single fragment, and will not be repeated here.
在另一种可能的实施例中,当第一镜像文件在上传过程中出现上传中断(例如,在数据包P n+1处发生中断)的情况,也就是获取单元510仅仅接收到客户端发送的数据包P 1,P 2,...,P n时,获取单元510还用于接收客户端发送的断点续传请求,发送单元520还用于将进度记录单元540中保存的分片序号I n发送给客户端。之后,获取单元510还用于接收客户端根据分片序号I n从数据包P n+1开始续传的剩下的数据包(P n+1,P n+2,...,P m),发送单元520还用于为分片S n+1,S n+2,...,S m添加对象前缀名称N n+1,N n+2,...,N m,得到分段D n+1,D n+2,...,D m,并将分段D n+1,D n+2,...,D m发送给Swift。若Swift接收到分段D n+1,D n+2,...,D m,则在进度记录单元540中分别保存分段D n+1,D n+2,...,D m对应的镜像ID和分片序号I n+1,I n+2,...,I mIn another possible embodiment, when the uploading of the first image file is interrupted during the uploading process (for example, the interruption occurs at the data packet P n+1 ), that is, the obtaining unit 510 only receives the transmission from the client. When the data packets P 1 , P 2 ,..., P n are included, the acquiring unit 510 is also used to receive a resumable transmission request sent by the client, and the sending unit 520 is also used to transfer the fragments stored in the progress recording unit 540 The sequence number I n is sent to the client. After that, the acquisition unit 510 for further receiving the remaining data packet fragment in accordance with the client ID from the packet I n P n + 1 starts continuous transmission (P n + 1, P n + 2, ..., P m ), the sending unit 520 is also used to add object prefix names N n+1 , N n+2 ,..., N m to the segments S n+1 , S n+2 ,..., S m to obtain the points Segment D n+1 , D n+2 ,..., D m , and send segments D n+1 , D n+2 ,..., D m to Swift. If Swift receives the segments D n+1 , D n+2 ,..., D m , the segments D n+1 , D n+2 ,..., D m are respectively saved in the progress recording unit 540 Corresponding mirror IDs and fragment sequence numbers I n+1 , I n+2 ,...,I m .
在本申请具体的实施例中,在Swift接收到分段D m之后,也就是进度记录单元540保存有分段D 1,D 2,...,D m的镜像ID和对应的分片序号I 1,I 2,...,I m之后,调用单元530还用于调用Swift还原第一镜像文件。 In the specific embodiment of the present application, after Swift receives the segment D m , that is, the progress recording unit 540 saves the mirror IDs of the segments D 1 , D 2 ,..., D m and the corresponding segment sequence numbers. I 1, I 2, ..., then I m, call unit 530 is further configured to restore the first call Swift image file.
在本申请具体的实施例中,调用单元530还用于在Swift将分片S 1,S 2,...,S m合并为第一镜像文件之后,调用Glance刷新第一镜像的镜像状态,以确定第一镜像处于可用状态,从而完成第一镜像的注册。另外,调用单元530还可以在第一镜像文件的上传过程中实时调用Glance刷新第一镜像的镜像状态,此处不作具体限定。 In the specific embodiment of the present application, the calling unit 530 is also used to call Glance to refresh the mirroring state of the first mirror after Swift merges the fragments S 1 , S 2 , ..., S m into the first mirror file. It is determined that the first image is in an available state, so that the registration of the first image is completed. In addition, the calling unit 530 may also call Glance in real time during the uploading process of the first mirror file to refresh the mirror status of the first mirror, which is not specifically limited here.
为了简便陈述,本实施例中并没有对上传代理设备调用Swift还原第一镜像文件的具体过程进行详细阐述,也没有对上传代理设备调用Glance刷新第一镜像的镜像状态的具体过程进行详细阐述,还没有上传代理设备发送分片对应的分段的具体过程进行详细阐述,具体请参见图5-图6以及S103-S106、S202-S205的部分或者全部步骤,此处不再展开赘述。For the sake of simplicity, this embodiment does not elaborate on the specific process of the upload proxy device calling Swift to restore the first image file, nor the specific process of the upload proxy device calling Glance to refresh the image status of the first image. The specific process of uploading the proxy device to send the segment corresponding to the segment has not been elaborated in detail. For details, please refer to Figure 5-Figure 6 and some or all of the steps of S103-S106 and S202-S205, which will not be repeated here.
可以看出,该上传代理设备的获取单元接收到客户端发送的数据包,可以得到镜像文件的分片,然后由发送单元将分片对应的分段转发给Swift,使得Swift能够根据分段得到对象前缀名称和分片,从而在无需本地缓存的基础上将分片还原为镜像文件,实现目标镜像文件的上传。而且,当目标镜像文件在上传过程中出现上传中断或者上传失败时,发送单元可以将发生断点的分片对应的分片序号发送给客户端,使得客户端能够根据发生断点的分片对应的分片序号继续上传镜像文件中上传失败的分片,从而大大提高镜像文件的上传效率和上传成功率。It can be seen that the acquisition unit of the upload proxy device receives the data packet sent by the client, and can obtain the fragments of the mirror file, and then the sending unit forwards the fragments corresponding to the fragments to Swift, so that Swift can obtain the fragments according to the fragments. Object prefix names and fragments, so that the fragments can be restored to mirror files without local caching, and the target mirror file can be uploaded. Moreover, when the upload of the target image file is interrupted or failed during the upload process, the sending unit can send the segment sequence number corresponding to the segment where the breakpoint occurred to the client, so that the client can correspond to the segment where the breakpoint occurred Continue to upload the failed fragments in the mirror file with the serial number of the fragment, thereby greatly improving the upload efficiency and upload success rate of the mirror file.
如图9所示,图9示出了本申请提供的另一种客户端的结构示意图。客户端310具体可以包括处理器610、通信接口620和存储器630。其中,处理器610、通信接口620以及存储器630通过总线640进行耦合。As shown in Figure 9, Figure 9 shows a schematic structural diagram of another client provided by this application. The client 310 may specifically include a processor 610, a communication interface 620, and a memory 630. Wherein, the processor 610, the communication interface 620, and the memory 630 are coupled through the bus 640.
处理器610可以是中央处理器(central processing unit,CPU),通用处理器、数字信号处理器(digital signal processor,DSP)、专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field programmable gate array,FPGA)或者其他可编程逻辑器件(programmable logic device,PLD)、晶体管逻辑器件、硬件部件或者其任意组合。处理器610可以实现或执行结合本申请公开内容所描述的各种示例性的方法。具体的,处理器610读取存储器630中存储的程序代码,并与通信接口620配合执行S101-S103、S201、S203的部分或者全部步骤。The processor 610 may be a central processing unit (CPU), a general-purpose processor, a digital signal processor (digital signal processor, DSP), an application specific integrated circuit (ASIC), a field programmable gate array ( field programmable gate array (FPGA) or other programmable logic device (programmable logic device, PLD), transistor logic device, hardware component, or any combination thereof. The processor 610 may implement or execute various exemplary methods described in conjunction with the disclosure of the present application. Specifically, the processor 610 reads the program code stored in the memory 630, and cooperates with the communication interface 620 to execute part or all of the steps of S101-S103, S201, and S203.
通信接口620可以为有线接口或无线接口,用于与其他模块或设备进行通信,有线接口可以是以太接口、控制器局域网络接口、局域互联网络(local interconnect network,LIN)以及FlexRay接口,无线接口可以是蜂窝网络接口或使用无线局域网接口等。具体的,通信接口620可以与上传代理设备320等等。The communication interface 620 can be a wired interface or a wireless interface for communicating with other modules or devices. The wired interface can be an Ethernet interface, a controller area network interface, a local interconnect network (LIN), and a FlexRay interface. The interface can be a cellular network interface or a wireless local area network interface. Specifically, the communication interface 620 may be connected to the upload proxy device 320 and so on.
存储器630可以包括易失性存储器,例如随机存取存储器(random access memory,RAM);存储器630也可以包括非易失性存储器,例如只读存储器(read only memory,ROM)、快闪存储器、硬盘(hard disk drive,HDD)或固态硬盘(solid state drive,SSD),存储器630还可以包括上述种类的存储器的组合。存储器630可以存储有程序代码以及程序数据。其中,程序代码由图7示出的客户端中的部分或者全部单元的代码组成,例如,获取单元410的代码、分片处理单元420的代码以及发送单元430的代码等等。程序数 据由图7示出的客户端在运行程序的过程中产生的数据,例如,分片S 1,S 2,...,S m、数据包P 1,P 2,...,P m、镜像文件的大小、以及分片数量等等。 The memory 630 may include volatile memory, such as random access memory (random access memory, RAM); the memory 630 may also include non-volatile memory, such as read only memory (ROM), flash memory, and hard disk. (hard disk drive, HDD) or solid state drive (solid state drive, SSD), the storage 630 may also include a combination of the above types of storage. The memory 630 may store program codes and program data. Wherein, the program code is composed of the codes of some or all of the units in the client shown in FIG. The program data is the data generated by the client in the process of running the program shown in Figure 7, for example, the fragments S 1 , S 2 ,..., S m , and the data packets P 1 , P 2 ,..., P m , the size of the image file, the number of fragments, and so on.
总线640可以是控制器局域网络(controller area network,CAN)或其他实现内部总线。总线640可以分为地址总线、数据总线、控制总线等。为了便于表示,图9中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The bus 640 may be a controller area network (CAN) or other internal buses. The bus 640 can be divided into an address bus, a data bus, a control bus, and so on. For ease of representation, only one thick line is used in FIG. 9 to represent it, but it does not mean that there is only one bus or one type of bus.
如图10所示,图10示出了本申请提供的另一种上传代理设备的结构示意图。上传代理设备320具体可以包括处理器710、通信接口720和存储器730。其中,处理器710、通信接口720以及存储器730通过总线740进行耦合。As shown in Fig. 10, Fig. 10 shows a schematic structural diagram of another upload proxy device provided by the present application. The upload proxy device 320 may specifically include a processor 710, a communication interface 720, and a memory 730. Wherein, the processor 710, the communication interface 720, and the memory 730 are coupled through a bus 740.
处理器710可以是CPU,通用处理器、DSP、ASIC、FPGA或者其他PLD、晶体管逻辑器件、硬件部件或者其任意组合。处理器710可以实现或执行结合本申请公开内容所描述的各种示例性的方法。具体的,处理器710读取存储器730中存储的程序代码,并与通信接口720配合执行S103-S106、S202-S205的部分或者全部步骤。The processor 710 may be a CPU, a general-purpose processor, DSP, ASIC, FPGA or other PLD, transistor logic device, hardware component, or any combination thereof. The processor 710 may implement or execute various exemplary methods described in conjunction with the disclosure of the present application. Specifically, the processor 710 reads the program code stored in the memory 730, and cooperates with the communication interface 720 to execute part or all of the steps of S103-S106 and S202-S205.
通信接口720可以为有线接口或无线接口,用于与其他模块或设备进行通信,有线接口可以是以太接口、控制器局域网络接口、LIN以及FlexRay接口,无线接口可以是蜂窝网络接口或使用无线局域网接口等。具体的,通信接口720可以与网络设备750连接,网络设备750可以包括客户端310、Swift330以及Glance340等等。The communication interface 720 can be a wired interface or a wireless interface for communicating with other modules or devices. The wired interface can be an Ethernet interface, a controller area network interface, LIN and FlexRay interface, and the wireless interface can be a cellular network interface or use a wireless LAN Interface, etc. Specifically, the communication interface 720 may be connected to the network device 750, and the network device 750 may include the client 310, Swift330, Glance340, and so on.
存储器730可以包括易失性存储器,例如RAM;存储器730也可以包括非易失性存储器,例如ROM、快闪存储器、HDD或SSD,存储器730还可以包括上述种类的存储器的组合。存储器730可以存储有程序代码以及程序数据。其中,程序代码由图8示出的上传代理设备中的部分或者全部单元的代码组成,例如,获取单元510的代码、发送单元520的代码以及调用单元530的代码等等。程序数据由图8示出的上传设备在运行程序的过程中产生的数据,例如,分段D 1,D 2,...,D m、对象前缀名称N 1,N 2,...,N m、分段上传记录等等。 The memory 730 may include volatile memory, such as RAM; the memory 730 may also include non-volatile memory, such as ROM, flash memory, HDD, or SSD, and the memory 730 may also include a combination of the foregoing types of memory. The memory 730 may store program codes and program data. The program code is composed of the codes of some or all of the units in the upload proxy device shown in FIG. 8, for example, the code of the acquiring unit 510, the code of the sending unit 520, the code of the calling unit 530, and so on. The program data is the data generated by the upload device in the process of running the program shown in Figure 8, for example, segment D 1 , D 2 ,..., D m , object prefix name N 1 , N 2 ,..., N m , upload records in parts, etc.
总线740可以是CAN或其他实现内部总线。总线740可以分为地址总线、数据总线、控制总线等。为了便于表示,图10中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The bus 740 may be CAN or other internal buses. The bus 740 can be divided into an address bus, a data bus, a control bus, and so on. For ease of representation, only one thick line is used to represent in FIG. 10, but it does not mean that there is only one bus or one type of bus.
本申请还提供了一种计算机存储介质,上述计算机存储介质存储有计算机指令,上述计算机指令被硬件(例如处理器等)执行,以实现本申请中由客户端310执行的部分或全部步骤(例如,S101-103、S201、S203)。This application also provides a computer storage medium. The computer storage medium stores computer instructions. The computer instructions are executed by hardware (such as a processor, etc.) to implement part or all of the steps (such as , S101-103, S201, S203).
本申请还提供了一种计算机存储介质,上述计算机存储介质存储有计算机指令,上述计算机指令被硬件(例如处理器等)执行,以实现本申请中由上传代理设备320中执行部分或全部步骤(例如,S103-S106、S202-S205)。This application also provides a computer storage medium. The computer storage medium stores computer instructions. The computer instructions are executed by hardware (such as a processor, etc.) to implement part or all of the steps performed by the upload agent device 320 in this application ( For example, S103-S106, S202-S205).
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机指令产品的形式实现。上述计算机指令产品包括一个或多个计算机指令。在计算机上加载和执行上述计算机指令指令时,全部或部分地产生按照本申请实施例所述的流程或功能。上述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。上述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,上述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(如,同轴 电缆、光纤、数字用户线)或无线(如,红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。上述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。上述可用介质可以是磁性介质,(如,软盘、存储盘、磁带)、光介质(如,DVD)、或者半导体介质(如,SSD))等。在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the above-mentioned embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented by software, it can be implemented wholly or partly in the form of a computer instruction product. The above-mentioned computer instruction product includes one or more computer instructions. When the foregoing computer instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The above-mentioned computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The aforementioned computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the aforementioned computer instructions can be transmitted from a website, computer, server, or data center through a wired (For example, coaxial cable, optical fiber, digital subscriber line) or wireless (for example, infrared, wireless, microwave, etc.) to transmit to another website site, computer, server or data center. The foregoing computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or data center integrated with one or more available media. The above-mentioned usable medium may be a magnetic medium (such as a floppy disk, a storage disk, a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as an SSD), etc. In the above-mentioned embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in an embodiment, reference may be made to related descriptions of other embodiments.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置,也可以通过其它的方式实现。例如以上所描述的装置实施例仅是示意性的,例如所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可结合或者可以集成到另一个系统,或一些特征可以忽略或不执行。另一点,所显示或讨论的相互之间的间接耦合或者直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed device may also be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components can be combined or integrated. To another system, or some features can be ignored or not implemented. In addition, the displayed or discussed indirect coupling or direct coupling or communication connection between each other may be through some interfaces, indirect coupling or communication connection between devices or units, and may be in electrical or other forms.
上述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者,也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本申请实施例的方案的目的。The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions in the embodiments of the present application.
另外,在本申请各实施例中的各功能单元可集成在一个处理单元中,也可以是各单元单独物理存在,也可以是两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, the functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
上述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可为个人计算机、服务器或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质例如可包括:U盘、移动硬盘、只读存储器、随机存取存储器、磁碟或光盘等各种可存储程序代码和数据文件的介质。If the above integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, the technical solution of the present application essentially or the part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium. A number of instructions are included to enable a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media may include, for example, various media capable of storing program codes and data files, such as a U disk, a mobile hard disk, a read-only memory, a random access memory, a magnetic disk, or an optical disk.
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。The above are only specific implementations of this application, but the protection scope of this application is not limited to this. Anyone familiar with the technical field can easily think of various equivalents within the technical scope disclosed in this application. Modifications or replacements, these modifications or replacements shall be covered within the protection scope of this application. Therefore, the protection scope of this application shall be subject to the protection scope of the claims.

Claims (21)

  1. 一种镜像文件上传方法,应用于客户端,其特征在于,包括:A method for uploading a mirror file, applied to a client, is characterized in that it includes:
    获取目标镜像文件;Obtain the target image file;
    对所述目标镜像文件进行分片,获得分片S 1,S 2,...,S m和分片总量m,其中,m为正整数; Fragmenting the target mirror file to obtain the fragments S 1 , S 2 ,..., S m and the total fragment m, where m is a positive integer;
    将数据包P 1,P 2,...,P n和所述分片总量m发送给上传代理设备,其中,所述数据包P 1包含分片S 1和分片序号I 1,数据包P 2包含分片S 2和分片序号I 2,…,数据包P n包含分片S n以及分片序号I n,n为正整数,并且n≤m。 Send data packets P 1 , P 2 ,..., P n and the total number of fragments m to the upload agent device, where the data packet P 1 includes fragment S 1 and fragment sequence number I 1 , data The packet P 2 contains the fragment S 2 and the fragment sequence number I 2 ,..., the data packet P n contains the fragment S n and the fragment sequence number I n , n is a positive integer, and n≤m.
  2. 根据权利要求1所述的方法,其特征在于,在n小于m的情况下,所述方法还包括:向所述上传代理设备发送断点续传请求,以获得所述分片序号I n,其中,所述断点续传请求用于请求发生断点的分片对应的分片序号; The method according to claim 1, characterized in that, in the case where n is smaller than m, the method further comprising: sending the upload request to the HTTP proxy device to obtain the I the fragment number n, Wherein, the request for resuming transmission with a breakpoint is used to request the fragment sequence number corresponding to the fragment where the breakpoint occurred;
    根据所述分片序号I n,将数据包P n+1发送给所述上传代理设备。 According to the fragment sequence number I n , the data packet P n+1 is sent to the upload proxy device.
  3. 根据权利要求2所述的方法,其特征在于,所述将数据包P 1,P 2,...,P n发送给上传代理设备包括: The method according to claim 2, wherein the sending the data packets P 1 , P 2 ,..., P n to the upload agent device comprises:
    利用l个线程,将数据包P 1,P 2,...,P l并行发送给所述上传代理设备;利用所述l个线程,将数据包P l+1,P l+2,...,P 2×l并行发送给所述上传代理设备;…;利用所述l个线程,将数据包P n-l+1,P n-l+2,...,P n并行发送给所述上传代理设备,其中,1≤l≤n/2,l是正整数。 Using l threads, the data packets P 1 , P 2 ,..., P l are sent to the upload agent device in parallel; using the l threads, the data packets P l+1 , P l+2 ,. .., P 2×l is sent to the upload agent device in parallel; ...; Using the l threads, the data packets P n-l+1 , P n-l+2 ,..., P n are sent in parallel For the upload agent device, where 1≤l≤n/2, and l is a positive integer.
  4. 一种镜像文件的上传方法,应用于上传代理设备,其特征在于,包括:A method for uploading a mirror file, which is applied to an upload agent device, and is characterized in that it includes:
    接收客户端发送的分片总量m以及数据包P 1,P 2,...,P n,其中,数据包P 1包含分片S 1以及分片序号I 1,数据包P 2包含分片S 2和分片序号I 2,…,数据包P n包含分片S n以及分片序号I n,分片S 1,S 2,...,S m是所述客户端对目标镜像文件进行分片得到的,m和 n均为正整数,并且n≤m; Receive the total number of fragments m and data packets P 1 , P 2 ,..., P n sent by the client, where the data packet P 1 contains the fragment S 1 and the fragment sequence number I 1 , and the data packet P 2 contains the fragment The fragment S 2 and the fragment sequence number I 2 ,..., the data packet P n contains the fragment S n and the fragment sequence number I n , and the fragments S 1 , S 2 ,..., S m are the target mirror images of the client The file is obtained by fragmentation, m and n are both positive integers, and n≤m;
    将所述分片总量m和分片S 1,S 2,...,S n发送给对象存储设备。 The total number of fragments m and the fragments S 1 , S 2 ,..., S n are sent to the object storage device.
  5. 根据权利要求4所述的方法,其特征在于,在n小于m的情况下,在接收客户端发送的分片总量m以及数据包P 1,P 2,...,P n之后,所述方法还包括: The method according to claim 4, wherein when n is less than m, after receiving the total number of fragments m sent by the client and the data packets P 1 , P 2 ,..., P n , The method also includes:
    接收所述客户端发送的数据包P n+2,P n+3,...,P m,并将分片S n+2,S n+3,...,S m发送给所述对象存储设备,其中,数据包P n+2包含分片S n+2以及分片序号I n+2,数据包P n+3包含分片S n+3以及分片序号I n+3,…,数据包P m包含分片S m以及分片序号I mReceive data packets P n+2 , P n+3 ,..., P m sent by the client, and send the fragments S n+2 , S n+3 ,..., S m to the An object storage device, where the data packet P n+2 contains the fragment S n+2 and the fragment sequence number I n+2 , and the data packet P n+3 contains the fragment S n+3 and the fragment sequence number I n+3 , ..., the data packet P m includes the fragment S m and the fragment sequence number I m ;
    接收所述客户端发送的断点续传请求;Receiving a resumable transmission request sent by the client;
    根据所述断点续传请求,将发生断点的分片对应的分片序号I n发送给所述客户端; Sending the fragment sequence number I n corresponding to the fragment where the breakpoint occurred to the client according to the request for resuming the transmission of the breakpoint;
    接收所述客户端根据所述分片序号I n发送的数据包P n+1,并将所述数据包P n+1发送给所述对象存储设备,以供所述对象存储设备根据所述分片S 1,S 2,...,S m还原所述目标镜像文件,其中,所述数据包P n+1包含分片S n+1以及分片序号I n+1Receive the data packet P n+1 sent by the client according to the fragment sequence number I n , and send the data packet P n+1 to the object storage device, so that the object storage device can according to the The fragments S 1 , S 2 ,..., S m restore the target image file, where the data packet P n+1 includes a fragment S n+1 and a fragment sequence number I n+1 .
  6. 根据权利要求4所述的方法,其特征在于,在n小于m的情况下,所述方法还包括:The method according to claim 4, characterized in that, when n is less than m, the method further comprises:
    接收所述客户端发送的断点续传请求;Receiving a resumable transmission request sent by the client;
    根据所述断点续传请求,将发生断点的分片对应的分片序号I n发送给所述客户端; Sending the fragment sequence number I n corresponding to the fragment where the breakpoint occurred to the client according to the request for resuming the transmission of the breakpoint;
    接收所述客户端根据所述分片序号I n从所述数据包P n+1开始续传的剩下的数据包,并将所述剩下的数据包对应的分片发送给所述对象存储设备,以供所述对象存储设备根据所述分片S 1,S 2,...,S m还原所述目标镜像文件,其中,所述剩下的数据包包括数据包 P n+1,P n+2,...,P m,所述数据包P n+1包含分片S n+1以及分片序号I n+1,所述数据包P n+2包含分片S n+2以及分片序号I n+2,…,数据包P m包含分片S m以及分片序号I mReceive the remaining data packets that the client continues to transmit from the data packet P n+1 according to the fragment sequence number I n , and send the fragments corresponding to the remaining data packets to the object Storage device for the object storage device to restore the target image file according to the fragments S 1 , S 2 ,..., S m , wherein the remaining data packets include data packets P n+1 ,P n+2 ,...,P m , the data packet P n+1 includes a fragment S n+1 and a fragment sequence number I n+1 , and the data packet P n+2 includes a fragment S n +2 and the fragment sequence number I n+2 ,..., the data packet P m includes the fragment S m and the fragment sequence number Im .
  7. 根据权利要求5或6所述的方法,其特征在于,所述方法还包括:The method according to claim 5 or 6, wherein the method further comprises:
    在接收所述客户端发送的所述数据包P 1时,调用镜像管理设备创建所述目标镜像文件对应的镜像标识,并保存所述镜像标识。 When receiving the packet P 1 is transmitted to the client, image management device creates a call to the target image corresponding to the image file identifier, and stores the image identification.
  8. 根据权利要求4至7任一项权利要求所述的方法,其特征在于,所述方法还包括:调用所述镜像管理设备刷新所述目标镜像文件对应的镜像状态。The method according to any one of claims 4 to 7, wherein the method further comprises: invoking the image management device to refresh the image status corresponding to the target image file.
  9. 一种客户端,其特征在于,包括:A client, characterized in that it includes:
    获取单元,用于获取目标镜像文件;The obtaining unit is used to obtain the target image file;
    分片处理单元,用于对所述目标镜像文件进行分片,获得分片S 1,S 2,...,S m和分片总量m,其中,m为正整数; The fragmentation processing unit is configured to fragment the target mirror file to obtain fragments S 1 , S 2 ,..., S m and a total fragment m, where m is a positive integer;
    发送单元,用于将数据包P 1,P 2,...,P n和所述分片总量m发送给上传代理设备,其中,所述数据包P 1包含分片S 1和分片序号I 1,数据包P 2包含分片S 2和分片序号I 2,…,数据包P n包含分片S n以及分片序号I n,n为正整数,并且n≤m。 The sending unit is configured to send data packets P 1 , P 2 ,..., P n and the total number of fragments m to the upload agent device, where the data packet P 1 includes a fragment S 1 and a fragment The sequence number I 1 , the data packet P 2 contains the fragment S 2 and the fragment sequence number I 2 ,..., the data packet P n contains the fragment S n and the fragment sequence number I n , n is a positive integer, and n≤m.
  10. 根据权利要求9所述的客户端,其特征在于,在n小于m的情况下,所述发送单元还用于:The client according to claim 9, wherein when n is less than m, the sending unit is further configured to:
    向所述上传代理设备发送断点续传请求,以获得所述分片序号I n,其中,所述断点续传请求用于请求发生断点的分片对应的分片序号; Sends the upload request HTTP proxy device to obtain the fragment number I n, wherein, said HTTP request ID fragmentation occurred fragment corresponding breakpoints for requesting;
    根据所述分片序号I n,将数据包P n+1发送给所述上传代理设备。 According to the fragment sequence number I n , the data packet P n+1 is sent to the upload proxy device.
  11. 根据权利要求10所述的客户端,其特征在于,所述发送单元具体用于:The client according to claim 10, wherein the sending unit is specifically configured to:
    利用l个线程,将数据包P 1,P 2,...,P l并行发送给所述上传代理设备;利用所述l个线程,将数据包P l+1,P l+2,...,P 2×l并行发送给所述上传代理设备;…;利用所述l个线程,将数据包P 1,P 2,...,P n并行发送给所述上传代理设备,其中,1≤l≤n/2,l是正整数。 Using l threads, the data packets P 1 , P 2 ,..., P l are sent to the upload agent device in parallel; using the l threads, the data packets P l+1 , P l+2 ,. .., P 2×l is sent to the upload agent device in parallel; ...; using the l threads, data packets P 1 , P 2 ,..., P n are sent to the upload agent device in parallel, wherein , 1≤l≤n/2, and l is a positive integer.
  12. 一种上传代理设备,其特征在于,包括:An upload proxy device, characterized in that it comprises:
    获取单元,用于接收客户端发送的分片总量m以及数据包P 1,P 2,...,P n,其中,数据包P 1包含分片S 1以及分片序号I 1,数据包P 2包含分片S 2和分片序号I 2,…,数据包P n包含分片S n以及分片序号I n,分片S 1,S 2,...,S m是所述客户端对目标镜像文件进行分片得到的,m和 n均为正整数,并且n≤m; The acquiring unit is used to receive the total number of fragments m and data packets P 1 , P 2 ,..., P n sent by the client, where the data packet P 1 includes the fragment S 1 and the fragment sequence number I 1 , and the data The packet P 2 contains the fragment S 2 and the fragment sequence number I 2 ,..., the data packet P n contains the fragment S n and the fragment sequence number I n , the fragments S 1 , S 2 ,..., S m are said The client fragments the target image file, m and n are both positive integers, and n≤m;
    发送单元,用于将所述分片总量m和分片S 1,S 2,...,S n发送给对象存储设备。 The sending unit is configured to send the total number of fragments m and the fragments S 1 , S 2 ,..., S n to the object storage device.
  13. 根据权利要求12所述的设备,其特征在于,在n小于m的情况下,在所述获取单元接收客户端发送的分片总量m以及数据包P 1,P 2,...,P n之后, The device according to claim 12, characterized in that, in the case that n is less than m, the acquiring unit receives the total number of fragments m sent by the client and the data packets P 1 , P 2 ,..., P After n,
    所述获取单元还用于接收所述客户端发送的数据包P n+2,P n+3,...,P m,并将分片S n+2,S n+3,...,S m发送给所述对象存储设备,其中,数据包P n+2包含分片S n+2以及分片序号I n+2,数据包P n+3包含分片S n+3以及分片序号I n+3,…,数据包P m包含分片S m以及分片序号I mThe acquiring unit is also used to receive data packets P n+2 , P n+3 ,...,P m sent by the client, and to fragment S n+2 , S n+3 ,... , S m is sent to the object storage device, where the data packet P n+2 contains the fragment S n+2 and the fragment sequence number I n+2 , and the data packet P n+3 contains the fragment S n+3 and the fragment The slice sequence number I n+3 ,..., the data packet P m includes the slice S m and the slice sequence number I m ;
    所述获取单元还用于接收所述客户端发送的断点续传请求;The acquiring unit is further configured to receive a resumable transmission request sent by the client;
    所述发送单元还用于根据所述断点续传请求,将发生断点的分片对应的分片序号I n发送给所述客户端; The sending unit is further configured to send the fragment sequence number I n corresponding to the fragment where the breakpoint occurs to the client according to the breakpoint resuming transmission request;
    所述获取单元还用于接收所述客户端根据所述分片序号I n发送的数据包P n+1,并将所述数据包P n+1发送给所述对象存储设备,以供所述对象存储设备根据所述分片 S 1,S 2,...,S m还原所述目标镜像文件,其中,所述数据包P n+1包含分片S n+1以及分片序号I n+1The acquiring unit is further configured to receive a data packet P n+1 sent by the client according to the fragment sequence number I n , and send the data packet P n+1 to the object storage device for the The object storage device restores the target image file according to the fragments S 1 , S 2 ,..., S m , wherein the data packet P n+1 includes a fragment S n+1 and a fragment sequence number I n+1 .
  14. 根据权利要求12所述的设备,其特征在于,在n小于m的情况下,The device according to claim 12, wherein when n is less than m,
    所述获取单元还用于接收所述客户端发送的断点续传请求;The acquiring unit is further configured to receive a resumable transmission request sent by the client;
    所述发送单元还用于根据所述断点续传请求,将发生断点的分片对应的分片序号I n发送给所述客户端; The sending unit is further configured to send the fragment sequence number I n corresponding to the fragment where the breakpoint occurs to the client according to the breakpoint resuming transmission request;
    所述获取单元还用于接收所述客户端根据所述分片序号I n从所述数据包P n+1开始续传的剩下的数据包,并将所述剩下的数据包对应的分片发送给所述对象存储设备,以供所述对象存储设备根据所述分片S 1,S 2,...,S m还原所述目标镜像文件,其中,所述剩下的数据包包括数据包P n+1,P n+2,...,P m,所述数据包P n+1包含分片S n+1以及分片序号I n+1,所述数据包P n+2包含分片S n+2以及分片序号I n+2,…,数据包P m包含分片S m以及分片序号I mThe obtaining unit is further configured to receive the client based on the remaining sub-packets from said sheet number data packet I n P n + 1 starts resume, and the rest of the packet corresponds The fragments are sent to the object storage device, so that the object storage device restores the target image file according to the fragments S 1 , S 2 ,..., S m , wherein the remaining data packets Including data packets P n+1 , P n+2 ,..., P m , the data packet P n+1 includes a fragment S n+1 and a fragment sequence number I n+1 , the data packet P n +2 contains the fragment S n+2 and the fragment sequence number I n+2 ,..., the data packet P m contains the fragment S m and the fragment sequence number I m .
  15. 根据权利要求13或14所述的设备,其特征在于,所述设备还包括调用单元和进度记录单元,The device according to claim 13 or 14, wherein the device further comprises a calling unit and a progress recording unit,
    所述调用单元用于,在接收所述客户端发送的所述数据包P 1时,调用镜像管理设备创建所述目标镜像文件对应的镜像标识; The calling unit for receiving said data packet sent by the client when P 1, calls the image management device creates the image file corresponding to the target image identifier;
    所述进度记录单元用于,保存所述镜像标识。The progress recording unit is used to save the mirror image identifier.
  16. 根据权利要求12至15任一项权利要求所述的设备,其特征在于,所述调用单元还用于:调用所述镜像管理设备刷新所述目标镜像文件对应的镜像状态。The device according to any one of claims 12 to 15, wherein the calling unit is further configured to: call the mirror management device to refresh the mirror status corresponding to the target mirror file.
  17. 一种镜像文件上传系统,其特征在于,所述系统包括权利要求9至11任一项权利要求所述的客户端、权利要求12至16任一项权利要求所述的上传代理设备、对象存储设备以及镜像服务设备,其中,A mirror file upload system, characterized in that the system includes the client according to any one of claims 9 to 11, the upload agent device according to any one of claims 12 to 16, and object storage Equipment and mirroring service equipment, of which,
    所述对象存储设备用于接收所述上传代理设备发送的所述分片S 1,S 2,...,S m,并将所述分片S 1,S 2,...,S m还原为所述目标镜像文件; The object storage device is used to receive the fragments S 1 , S 2 ,..., S m sent by the upload proxy device, and to convert the fragments S 1 , S 2 ,..., S m Restore to the target image file;
    所述镜像管理设备用于创建所述目标镜像文件对应的镜像标识;The image management device is used to create an image identifier corresponding to the target image file;
    所述镜像管理设备还用于刷新所述目标镜像文件的镜像状态。The mirror management device is also used to refresh the mirror status of the target mirror file.
  18. 一种客户端,其特征在于,包括处理器和存储器,所述处理器执行所述存储器中的代码以实现权利要求1至3任一项权利要求所述的方法。A client is characterized by comprising a processor and a memory, and the processor executes the code in the memory to implement the method according to any one of claims 1 to 3.
  19. 一种上传代理设备,其特征在于,包括处理器和存储器,所述处理器执行所述存储器中的代码以实现权利要求4至8任一项权利要求所述的方法。An upload proxy device, which is characterized by comprising a processor and a memory, and the processor executes the code in the memory to implement the method according to any one of claims 4 to 8.
  20. 一种计算机存储介质,其特征在于,存储有计算机指令;所述计算机指令用于实现权利要求1至3任一项权利要求所述的方法。A computer storage medium, characterized in that it stores computer instructions; the computer instructions are used to implement the method according to any one of claims 1 to 3.
  21. 一种计算机存储介质,其特征在于,存储有计算机指令;所述计算机指令用于实现权利要求4至8任一项权利要求所述的方法。A computer storage medium, characterized in that it stores computer instructions; the computer instructions are used to implement the method according to any one of claims 4 to 8.
PCT/CN2021/075236 2020-03-16 2021-02-04 Mirror image file uploading method, related device and computer storage medium WO2021184992A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010183182.6 2020-03-16
CN202010183182.6A CN113411363A (en) 2020-03-16 2020-03-16 Uploading method of image file, related equipment and computer storage medium

Publications (1)

Publication Number Publication Date
WO2021184992A1 true WO2021184992A1 (en) 2021-09-23

Family

ID=77676598

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/075236 WO2021184992A1 (en) 2020-03-16 2021-02-04 Mirror image file uploading method, related device and computer storage medium

Country Status (2)

Country Link
CN (1) CN113411363A (en)
WO (1) WO2021184992A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114401260A (en) * 2021-12-18 2022-04-26 杭州安恒信息技术股份有限公司 Method, system, equipment and storage medium for uploading micro-service cluster file fragments
CN116233120A (en) * 2023-05-10 2023-06-06 深圳普菲特信息科技股份有限公司 Large file fragment transmission method, system and medium based on data processing

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114911580B (en) * 2022-07-11 2022-09-27 统信软件技术有限公司 Mirror image state processing method and device and computing equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103581216A (en) * 2012-07-20 2014-02-12 中国电信股份有限公司 Fragmentation data storage method, device and system
CN104144186A (en) * 2013-05-10 2014-11-12 中国电信股份有限公司 Data uploading method and system based on Web browser in cloud computing environment
CN107360233A (en) * 2017-07-14 2017-11-17 世纪龙信息网络有限责任公司 Method, apparatus, equipment and the readable storage medium storing program for executing that file uploads
CN107426258A (en) * 2016-05-23 2017-12-01 华为技术有限公司 A kind of upload of image file and method for down loading and device
CN108933837A (en) * 2018-08-07 2018-12-04 郑州云海信息技术有限公司 A kind of transmission method and device of image file
CN109783193A (en) * 2018-12-27 2019-05-21 南京优速网络科技有限公司 A kind of mirror image file management method that can be multiplexed in multiple domain cloud platform

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103581216A (en) * 2012-07-20 2014-02-12 中国电信股份有限公司 Fragmentation data storage method, device and system
CN104144186A (en) * 2013-05-10 2014-11-12 中国电信股份有限公司 Data uploading method and system based on Web browser in cloud computing environment
CN107426258A (en) * 2016-05-23 2017-12-01 华为技术有限公司 A kind of upload of image file and method for down loading and device
CN107360233A (en) * 2017-07-14 2017-11-17 世纪龙信息网络有限责任公司 Method, apparatus, equipment and the readable storage medium storing program for executing that file uploads
CN108933837A (en) * 2018-08-07 2018-12-04 郑州云海信息技术有限公司 A kind of transmission method and device of image file
CN109783193A (en) * 2018-12-27 2019-05-21 南京优速网络科技有限公司 A kind of mirror image file management method that can be multiplexed in multiple domain cloud platform

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114401260A (en) * 2021-12-18 2022-04-26 杭州安恒信息技术股份有限公司 Method, system, equipment and storage medium for uploading micro-service cluster file fragments
CN116233120A (en) * 2023-05-10 2023-06-06 深圳普菲特信息科技股份有限公司 Large file fragment transmission method, system and medium based on data processing
CN116233120B (en) * 2023-05-10 2023-07-14 深圳普菲特信息科技股份有限公司 Large file fragment transmission method, system and medium based on data processing

Also Published As

Publication number Publication date
CN113411363A (en) 2021-09-17

Similar Documents

Publication Publication Date Title
WO2021184992A1 (en) Mirror image file uploading method, related device and computer storage medium
US11533220B2 (en) Network-assisted consensus protocol
US20180302327A1 (en) Load balancing for a virtual networking system
US20190238636A1 (en) Systems and methods for synchronizing microservice data stores
US9992118B2 (en) System and method for optimizing transportation over networks
US20170339234A1 (en) Session reliability for a redirected usb device
US10484449B2 (en) Email webclient notification queuing
US11892982B2 (en) Facilitating immediate performance of volume resynchronization with the use of passive cache entries
WO2021139264A1 (en) Object storage control method and apparatus, computer device and storage medium
US20210049076A1 (en) Geographic zone data recovery in geographically distributed data storage environment
CN111225003B (en) NFS node configuration method and device
US10545667B1 (en) Dynamic data partitioning for stateless request routing
US8621260B1 (en) Site-level sub-cluster dependencies
WO2023029485A1 (en) Data processing method and apparatus, computer device, and computer-readable storage medium
WO2022218346A1 (en) Fault processing method and apparatus
US11405316B2 (en) Live application and kernel migration using routing table entries
US11307912B1 (en) Forward message compatibility safety in producer-consumer systems
WO2018032499A1 (en) Load balancing method and associated device
US10712959B2 (en) Method, device and computer program product for storing data
US9961027B2 (en) Email webclient automatic failover
US11553046B1 (en) Seamless scaling via proxy replay of session state
CN116389252B (en) Method, device, system, electronic equipment and storage medium for updating container network
CN113452539B (en) Source station switching method and device, electronic equipment and storage medium
US10397029B2 (en) Relay apparatus
CN115701600A (en) Database system, data synchronization method and related equipment

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21771642

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21771642

Country of ref document: EP

Kind code of ref document: A1