cloudstack-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (CLOUDSTACK-4757) Support OVA files with multiple disks for templates
Date Sat, 23 Dec 2017 10:53:05 GMT


ASF GitHub Bot commented on CLOUDSTACK-4757:

rafaelweingartner commented on a change in pull request #2146: CLOUDSTACK-4757: Support OVA
files with multiple disks for templates

 File path: api/src/com/cloud/agent/api/storage/
 @@ -0,0 +1,333 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+public class OVFHelper {
+    private static final Logger s_logger = Logger.getLogger(OVFHelper.class);
+    public List<DatadiskTO> getOVFVolumeInfo(final String ovfFilePath) {
+        if (ovfFilePath == null || ovfFilePath.isEmpty()) {
+            return null;
+        }
+        ArrayList<OVFFile> vf = new ArrayList<OVFFile>();
+        ArrayList<OVFDisk> vd = new ArrayList<OVFDisk>();
+        File ovfFile = new File(ovfFilePath);
+        try {
+            final Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new
+            NodeList disks = doc.getElementsByTagName("Disk");
+            NodeList files = doc.getElementsByTagName("File");
+            NodeList items = doc.getElementsByTagName("Item");
+            boolean toggle = true;
+            for (int j = 0; j < files.getLength(); j++) {
+                Element file = (Element)files.item(j);
+                OVFFile of = new OVFFile();
+                of._href = file.getAttribute("ovf:href");
+                if (of._href.endsWith("vmdk") || of._href.endsWith("iso")) {
+          "MDOVA getOVFVolumeInfo File href = " + of._href);
+                    of._id = file.getAttribute("ovf:id");
+          "MDOVA getOVFVolumeInfo File Id = " + of._id);
+                    String size = file.getAttribute("ovf:size");
+                    if (size != null && !size.isEmpty()) {
+                        of._size = Long.parseLong(size);
+                    } else {
+                        String dataDiskPath = ovfFile.getParent() + File.separator + of._href;
+                        File this_file = new File(dataDiskPath);
+                        of._size = this_file.length();
+                    }
+                    of._iso = of._href.endsWith("iso");
 Review comment:
   What about changing this `_iso` attribute to a more readable name? Something like `isIso`

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

> Support OVA files with multiple disks for templates
> ---------------------------------------------------
>                 Key: CLOUDSTACK-4757
>                 URL:
>             Project: CloudStack
>          Issue Type: New Feature
>      Security Level: Public(Anyone can view this level - this is the default.) 
>          Components: Storage Controller
>            Reporter: Likitha Shetty
>            Assignee: Nicolas Vazquez
>            Priority: Minor
>             Fix For: Future
> CloudStack volumes and templates are one single virtual disk in case of XenServer/XCP
and KVM hypervisors since the files used for templates and volumes are virtual disks (VHD,
QCOW2). However, VMware volumes and templates are in OVA format, which are archives that can
contain a complete VM including multiple VMDKs and other files such as ISOs. And currently,
Cloudstack only supports Template creation based on OVA files containing a single disk. If
a user creates a template from a OVA file containing more than 1 disk and launches an instance
using this template, only the first disk is attached to the new instance and other disks are
> Similarly with uploaded volumes, attaching an uploaded volume that contains multiple
disks to a VM will result in only one VMDK to being attached to the VM.
> This behavior needs to be improved in VMWare to support OVA files with multiple disks
for both uploaded volumes and templates. i.e. If a user creates a template from a OVA file
containing more than 1 disk and launches an instance using this template, the first disk should
be attached to the new instance as the ROOT disk and volumes should be created based on other
VMDK disks in the OVA file and should be attached to the instance.

This message was sent by Atlassian JIRA

View raw message