- Timestamp:
- May 20, 2013 7:57:55 AM (12 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/ovfreader.h
r45599 r46169 169 169 }; 170 170 171 const char* const OVF09_URI_string = "http://www.vmware.com/schema/ovf/1/envelope"; 172 const char* const OVF10_URI_string = "http://schemas.dmtf.org/ovf/envelope/1"; 173 const char* const OVF20_URI_string = "http://schemas.dmtf.org/ovf/envelope/2"; 174 171 175 //////////////////////////////////////////////////////////////////////////////// 172 176 // … … 176 180 struct EnvelopeData 177 181 { 178 RTCStringversion;//OVF standard version, it is used internally only by VirtualBox182 OVFVersion_T version;//OVF standard version, it is used internally only by VirtualBox 179 183 RTCString lang;//language 180 184 181 185 OVFVersion_T getOVFVersion() const 182 186 { 183 if (version == "0.9") 184 return OVFVersion_0_9; 185 else if (version == "1.0") 186 return OVFVersion_1_0; 187 else if (version == "2.0") 188 return OVFVersion_2_0; 189 else 190 return OVFVersion_unknown; 187 return version; 191 188 } 192 189 … … 194 191 RTCString getStringOVFVersion() const 195 192 { 196 if (version == "0.9")193 if (version == OVFVersion_0_9) 197 194 return "0.9"; 198 else if (version == "1.0")195 else if (version == OVFVersion_1_0) 199 196 return "1.0"; 200 else if (version == "2.0")197 else if (version == OVFVersion_2_0) 201 198 return "2.0"; 202 199 else 203 200 return ""; 201 } 202 203 void setOVFVersion(OVFVersion_T v) 204 { 205 version = v; 204 206 } 205 207 }; … … 345 347 struct VirtualDisk 346 348 { 347 uint32_t idController; // SCSI (or IDE) controller this disk is connected to; 348 // this must match HardDiskController.idController and 349 // points into VirtualSystem.mapControllers 350 uint32_t ulAddressOnParent; // parsed strAddressOnParent of hardware item; will be 0 or 1 for IDE 351 // and possibly higher for disks attached to SCSI controllers (untested) 352 RTCString strDiskId; // if the hard disk has an ovf:/disk/<id> reference, 353 // this receives the <id> component; points to one of the 354 // references in Appliance::Data.mapDisks 349 uint32_t idController;// SCSI (or IDE) controller this disk is connected to; 350 // this must match HardDiskController.idController and 351 // points into VirtualSystem.mapControllers 352 uint32_t ulAddressOnParent;// parsed strAddressOnParent of hardware item; will be 0 or 1 for IDE 353 // and possibly higher for disks attached to SCSI controllers (untested) 354 RTCString strDiskId;// if the hard disk has an ovf:/disk/<id> reference, 355 // this receives the <id> component; points to one of the 356 // references in Appliance::Data.mapDisks 357 bool fEmpty;//true - empty disk, e.g. the component <rasd:HostResource>...</rasd:HostResource> is absent. 355 358 }; 356 359 -
trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp
r46067 r46169 709 709 if (enFormat == ovf::OVFVersion_0_9) 710 710 { 711 strNamespace = "http://www.vmware.com/schema/ovf/1/envelope";711 strNamespace = ovf::OVF09_URI_string; 712 712 } 713 713 else if (enFormat == ovf::OVFVersion_1_0) 714 714 { 715 strNamespace = "http://schemas.dmtf.org/ovf/envelope/1";715 strNamespace = ovf::OVF10_URI_string; 716 716 } 717 717 else 718 718 { 719 strNamespace = "http://schemas.dmtf.org/ovf/envelope/2";719 strNamespace = ovf::OVF20_URI_string; 720 720 } 721 721 -
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r46067 r46169 687 687 di.ulSuggestedSizeMB, 688 688 strExtraConfig); 689 }//url specifier for VHD690 else if (!di.strFormat.compare("http://go.microsoft.com/fwlink/?LinkId=137171", Utf8Str::CaseInsensitive))691 {692 689 } 693 690 else -
trunk/src/VBox/Main/xml/ovfreader.cpp
r46140 r46169 67 67 const xml::AttributeNode *pTypeAttr; 68 68 const char *pcszTypeAttr = ""; 69 70 if ( !pRootElem 71 || strcmp(pRootElem->getName(), "Envelope") 72 ) 69 RTCString pcszNamespaceURI; 70 71 if (!pRootElem || strcmp(pRootElem->getName(), "Envelope")) 73 72 throw OVFLogicError(N_("Root element in OVF file must be \"Envelope\".")); 74 73 75 if ((pTypeAttr = pRootElem->findAttribute("version"))) 74 pcszNamespaceURI = pRootElem->getNamespaceURI(); 75 if(pcszNamespaceURI.isEmpty()) 76 76 { 77 pcszTypeAttr = pTypeAttr->getValue(); 78 m_envelopeData.version = pcszTypeAttr; 77 throw OVFLogicError(N_("Error reading namespace URI in 'Envelope' element, line %d"), pRootElem->getLineNumber()); 78 } 79 80 if (strncmp(ovf::OVF20_URI_string, pcszNamespaceURI.c_str(), pcszNamespaceURI.length()) == 0) 81 { 82 m_envelopeData.setOVFVersion(ovf::OVFVersion_2_0); 83 } 84 else if (strncmp(OVF10_URI_string, pcszNamespaceURI.c_str(), pcszNamespaceURI.length()) == 0) 85 { 86 m_envelopeData.setOVFVersion(ovf::OVFVersion_1_0); 79 87 } 80 88 else 81 89 { 90 m_envelopeData.setOVFVersion(ovf::OVFVersion_0_9); 91 } 92 93 // if ((pTypeAttr = pRootElem->findAttribute("version"))) 94 // { 95 // pcszTypeAttr = pTypeAttr->getValue(); 96 // m_envelopeData.version = pcszTypeAttr; 97 // } 98 // else 99 // { 82 100 // throw OVFLogicError(N_("Error reading \"%s\": missing or invalid attribute '%s' in 'Envelope' element, line %d"), 83 // 101 // m_strPath.c_str(), 84 102 // "version", 85 103 // pRootElem->getLineNumber()); 86 }104 // } 87 105 88 106 if ((pTypeAttr = pRootElem->findAttribute("xml:lang"))) -
trunk/src/VBox/Runtime/r3/xml.cpp
r44528 r46169 527 527 { 528 528 return m_pcszNamespacePrefix; 529 } 530 531 /** 532 * Returns the XML namespace URI, which is the attribute name. For other node types it probably 533 * returns NULL. 534 * @return 535 */ 536 const char* Node::getNamespaceURI() const 537 { 538 return m_pcszNamespaceHref; 529 539 } 530 540
Note:
See TracChangeset
for help on using the changeset viewer.