CN106713500A - 一种vmware的ovf模板的存储方法 - Google Patents

一种vmware的ovf模板的存储方法 Download PDF

Info

Publication number
CN106713500A
CN106713500A CN201710063332.8A CN201710063332A CN106713500A CN 106713500 A CN106713500 A CN 106713500A CN 201710063332 A CN201710063332 A CN 201710063332A CN 106713500 A CN106713500 A CN 106713500A
Authority
CN
China
Prior art keywords
ovf
vmware
files
vmdk
templates
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201710063332.8A
Other languages
English (en)
Inventor
宁升
唐晓东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhengzhou Yunhai Information Technology Co Ltd
Original Assignee
Zhengzhou Yunhai Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhengzhou Yunhai Information Technology Co Ltd filed Critical Zhengzhou Yunhai Information Technology Co Ltd
Priority to CN201710063332.8A priority Critical patent/CN106713500A/zh
Publication of CN106713500A publication Critical patent/CN106713500A/zh
Pending legal-status Critical Current

Links

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/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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • 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
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/133Protocols for remote procedure calls [RPC]

Landscapes

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

Abstract

本发明公开了一种vmware的ovf模板的存储方法,属于云计算和虚拟化技术领域。本发明的vmware的ovf模板的存储方法,上传镜像时选择包含vmdk文件和ovf模板文件的压缩包,解压后保存vmdk文件并得到保存地址,将得到的保存地址写入到ovf模板文件并保存ovf模板文件,调用vmware sdk时使用ovf模板文件的保存路径进行镜像的创建。该发明的vmware的ovf模板的存储方法能简化用户的镜像上传操作,简化vmware环境的镜像创建步骤,具有很好的推广应用价值。

Description

一种vmware的ovf模板的存储方法
技术领域
本发明涉及云计算和虚拟化技术领域,具体提供一种vmware的ovf模板的存储方法。
背景技术
计算机具有存储信息量大、使用者获取信息方便快捷、获取信息安全可靠等优点,使用领域越来越广泛。随着经济及社会的进一步发展,使用者对计算机的各项性能要求越来越高,其中对计算机的计算性能提出了更高的要求。云计算是基于互联网的相关服务的增加、使用和交付模式,通常涉及通过互联网来提供动态扩展且经常是虚拟化的资源。云计算是通过使计算分别在大量的分布式计算机上,而非本地计算机或远程服务器中,企业数据中心的运行将与互联网更相似,这使得企业能够将资源切换到需要的应用上,根据需求访问计算机和存储系统。在云计算技术日益成熟的背景下,各行各业都在逐步把自己的业务应用上云。在此过程中,因业务应用本身的需要或者各大厂商的引导,不同的业务可能要运行在不同种类的云环境中,每种环境下用户需要自己定制相关的镜像,其中,vmware环境的镜像的创建需要ovf模板,而ovf模板对应的vmdk地址需要指定,而用户自定义上传镜像时是没有vmdk地址的,导致vmware环境的镜像的创建过程较繁琐,有待改进。
发明内容
本发明的技术任务是针对上述存在的问题,提供一种能简化用户的镜像上传操作,简化vmware环境的镜像创建步骤的vmware的ovf模板的存储方法。
为实现上述目的,本发明提供了如下技术方案:
一种vmware的ovf模板的存储方法,上传镜像时选择包含vmdk文件和ovf模板文件的压缩包,解压后保存vmdk文件并得到保存地址,将得到的保存地址写入到ovf模板文件并保存ovf模板文件,调用vmware sdk时使用ovf模板文件的保存路径进行镜像的创建。
通过上传压缩包的形式,用户上传后后台进行解压并相应处理从而解决vmdk文件地址引用的问题,简化vmware环境的镜像创建步骤。
作为优选,所述存储方法具体包括以下步骤:
S1:保存镜像文件压缩包到本地并解压;
S2:保存vmdk文件并将保存地址写入ovf模板文件;
S3:保存ovf模板文件供创建镜像时vmware sdk调用。
作为优选,步骤S1中,本地保存上传的镜像文件压缩包,指定解压目录并解压,查找解压文件中的vmdk文件和ovf模板文件,若缺少vmdk文件、ovf模板文件的任意一个则程序报错并提示用户。
作为优选,步骤S2中,保存vmdk文件并得到保存地址,将得到的保存地址写入到ovf模板文件中。
ovf模板文件为xml文件,标签File中有个ovf:href的属性需要指定vmdk文件的保存地址。通过xml文件解析将File节点的ovf:href属性设置为得到的vmdk文件保存地址。该步骤的重点是ovf模板文件的解析。
作为优选,步骤S3中,保存处理好的ovf模板文件,得到的保存路径供创建镜像时vmware sdk调用。
该步骤中产生的本地存储的缓存需要清理干净,避免多次上传时造成本地磁盘占满而无法操作。
与现有技术相比,本发明的vmware的ovf模板的存储方法具有以下突出的有益效果:该vmware的ovf模板的存储方法可以实现vmware下的ovf模板的存储,简化用户的镜像上传操作,只需要上传一个压缩包即可,不需考虑ovf模板中的vmdk保存地址的问题,具有很好的推广应用价值。
附图说明
图1是本发明所述vmware的ovf模板的存储方法的操作流程图。
具体实施方式
下面将结合附图和实施例,对本发明的vmware的ovf模板的存储方法作进一步详细说明。
实施例
如图1所示,本发明的vmware的ovf模板的存储方法,在页面上传镜像时选择包含vmdk文件和ovf模板文件的压缩包,解压后保存vmdk文件并得到保存地址,将得到的保存地址写入到ovf模板文件并保存ovf模板文件,调用vmware sdk时使用ovf模板文件的保存路径进行镜像的创建。ovf模板文件为xml文件,标签File中有个ovf:href的属性需要指定vmdk文件的保存地址。
本发明的vmware的ovf模板的存储方法具体包括以下步骤:
S1:保存镜像文件压缩包到本地并解压。
本地保存上传的镜像文件压缩包,指定解压目录并解压,查找解压文件中的vmdk文件和ovf模板文件,若缺少vmdk文件、ovf模板文件的任意一个则程序报错并提示用户。
该步骤的操作代码为:
//本地保存上传的镜像文件压缩包
String uuid = localFileStore.save(ins,IMAGE_PATH);
//解压镜像文件压缩包到指定目录
ZipUtils.unzip(tempFileName, unzipDir);
//得到所有解压后的文件
List<File> files = findFile(new File(unzipDir));
//从解压后的文件中得到相应的ovf文件和vmdk文件
ovfFile = findOvfFile(files);
vmdkFile = findVmdkFile(files)。
S2:保存vmdk文件并将保存地址写入ovf模板文件。
保存vmdk文件到保存地址,并通过xml文件解析将File节点的ovf:href属性设置为得到的vmdk文件保存地址。
xml文件的解析工具方法为:
//将xml文件中指定内容替换为其它内容
// path 文件路径,tag 标签,attr 属性,value 替换内容
void replace(String path, String tag, String attr, String value) {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(path);
NodeList list = doc.getElementsByTagName(tagName);
for (int i = 0; i < list.getLength(); i++) {
Element ele = (Element) list.item(i);
ele.setAttribute(attribute, value);
}
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer();
DOMSource domSource = new DOMSource(doc);
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
StreamResult result = new StreamResult(new FileOutputStream(path));
transformer.transform(domSource, result);
}
S3:保存ovf模板文件供创建镜像时vmware sdk调用。
保存处理好的ovf模板文件,得到的保存路径供创建镜像时vmware sdk调用。
该步骤中产生的本地存储的缓存需要清理干净,避免多次上传时造成本地磁盘占满而无法操作。
以上所述的实施例,只是本发明较优选的具体实施方式,本领域的技术人员在本发明技术方案范围内进行的通常变化和替换都应包含在本发明的保护范围内。

Claims (5)

1.一种vmware的ovf模板的存储方法,其特征在于:上传镜像时选择包含vmdk文件和ovf模板文件的压缩包,解压后保存vmdk文件并得到保存地址,将得到的保存地址写入到ovf模板文件并保存ovf模板文件,调用vmware sdk时使用ovf模板文件的保存路径进行镜像的创建。
2.根据权利要求1所述的vmware的ovf模板的存储方法,其特征在于:所述存储方法具体包括以下步骤:
S1:保存镜像文件压缩包到本地并解压;
S2:保存vmdk文件并将保存地址写入ovf模板文件;
S3:保存ovf模板文件供创建镜像时vmware sdk调用。
3.根据权利要求2所述的vmware的ovf模板的存储方法,其特征在于:步骤S1中,本地保存上传的镜像文件压缩包,指定解压目录并解压,查找解压文件中的vmdk文件和ovf模板文件,若缺少vmdk文件、ovf模板文件的任意一个则程序报错并提示用户。
4.根据权利要求2或3所述的vmware的ovf模板的存储方法,其特征在于:步骤S2中,保存vmdk文件并得到保存地址,将得到的保存地址写入到ovf模板文件中。
5.根据权利要求4所述的vmware的ovf模板的存储方法,其特征在于:步骤S3中,保存处理好的ovf模板文件,得到的保存路径供创建镜像时vmware sdk调用。
CN201710063332.8A 2017-02-03 2017-02-03 一种vmware的ovf模板的存储方法 Pending CN106713500A (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710063332.8A CN106713500A (zh) 2017-02-03 2017-02-03 一种vmware的ovf模板的存储方法

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710063332.8A CN106713500A (zh) 2017-02-03 2017-02-03 一种vmware的ovf模板的存储方法

Publications (1)

Publication Number Publication Date
CN106713500A true CN106713500A (zh) 2017-05-24

Family

ID=58910255

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710063332.8A Pending CN106713500A (zh) 2017-02-03 2017-02-03 一种vmware的ovf模板的存储方法

Country Status (1)

Country Link
CN (1) CN106713500A (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070294676A1 (en) * 2006-06-19 2007-12-20 Ewan Ellis Mellor Open virtual appliance
CN102646052A (zh) * 2011-02-16 2012-08-22 中国移动通信集团公司 一种虚拟机部署方法、装置及系统
US20120260249A1 (en) * 2011-04-11 2012-10-11 International Business Machines Corporation Software tool and method for updating a virtual appliance
CN103685608A (zh) * 2013-12-24 2014-03-26 北京启明星辰信息技术股份有限公司 一种自动配置安全虚拟机ip地址的方法及装置
CN104424012A (zh) * 2013-08-20 2015-03-18 国际商业机器公司 用于提供自定义虚拟装置的方法和设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070294676A1 (en) * 2006-06-19 2007-12-20 Ewan Ellis Mellor Open virtual appliance
CN102646052A (zh) * 2011-02-16 2012-08-22 中国移动通信集团公司 一种虚拟机部署方法、装置及系统
US20120260249A1 (en) * 2011-04-11 2012-10-11 International Business Machines Corporation Software tool and method for updating a virtual appliance
CN104424012A (zh) * 2013-08-20 2015-03-18 国际商业机器公司 用于提供自定义虚拟装置的方法和设备
CN103685608A (zh) * 2013-12-24 2014-03-26 北京启明星辰信息技术股份有限公司 一种自动配置安全虚拟机ip地址的方法及装置

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
ICTTANGHONGWEI: "开放虚拟化格式规范2.0.0-OVF Descriptor &Envelope Element", 《BLOG.SCIENCENET.CN/BLOG-899083-676359.HTML》 *
LANNI2460: "烂泥:vcenter通过模板部署vm", 《HTTPS://WWW.ILANNI.COM/?P=10352#3.6》 *
VMWARE: "Importing an OVA file with several disks fails with the error:unable to access file:c:\a.vmdk.End of OVA file reached while looking for:a.vmdk(2053488)", 《HTTPS:KB.VMWARE.COM/S/ARTICLE/2053488?LANG=EN_US&QUERYTERM=IMPORT+OVA》 *

Similar Documents

Publication Publication Date Title
US20210124573A1 (en) Firmware upgrade method and apparatus, and terminal
US9164998B2 (en) Archive-system-independent archive-type objects
US10437584B2 (en) Web client command infrastructure integration into a rich client application
RU2500023C2 (ru) Синхронизация документа по протоколу, не использующему информацию о состоянии
US7877682B2 (en) Modular distributed mobile data applications
US10664196B2 (en) Random access file management
US8713058B2 (en) Transporting business intelligence objects between business intelligence systems
US20120254118A1 (en) Recovery of tenant data across tenant moves
CN103631604B (zh) 一种基于celts-41规范的标准化数字学习资源管理方法
CN101977217A (zh) Widget更新方法、系统、Widget客户端及Widget服务器
CN104317964A (zh) 一种基于iBatis的对象关系映射方法及系统
CN101170436B (zh) 一种网管中模板管理的实现方法
CN102073662B (zh) 一种解析和创建xml数据的方法及系统
CN102520994A (zh) 流式加载虚拟文件方法及系统
CN106570153A (zh) 一种海量url的数据提取方法及系统
CN108205482A (zh) 文件挂载恢复方法
CN105245369A (zh) 一种支持多传输协议的组件发布容器方法
CN110569488A (zh) 一种基于xml标记语言的模块化模板word生成方法
US20060242141A1 (en) Abstracted metadata policy component and related architecture
US20190384825A1 (en) Method and device for data protection and computer readable storage medium
US10970316B1 (en) Maintaining a class hierarchy of an object-oriented data model using shared columns and/or overflow tables
CN106713500A (zh) 一种vmware的ovf模板的存储方法
CN110162412B (zh) 在客户端进行数据操作的方法和装置
US9633092B2 (en) Embedding and retrieving data in an application file format
CN108959411A (zh) Etl任务的处理方法、装置和设备

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20170524