Changeset 28957 in vbox
- Timestamp:
- May 2, 2010 6:42:58 PM (15 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ApplianceImplExport.cpp
r28956 r28957 1212 1212 pItem = pelmVirtualHardwareSection->createChild("Item"); 1213 1213 1214 // NOTE: do not change the order of these items without good reason! While we don't care 1215 // about ordering, VMware's ovftool does and fails if the items are not written in 1216 // exactly this order, as stupid as it seems. 1214 // NOTE: DO NOT CHANGE THE ORDER of these items! The OVF standards prescribes that 1215 // the elements from the rasd: namespace must be sorted by letter, and VMware 1216 // actually requires this as well (see public bug #6612) 1217 1218 if (lAddress != -1) 1219 pItem->createChild("rasd:Address")->addContent(Utf8StrFmt("%d", lAddress)); 1220 1221 if (lAddressOnParent != -1) 1222 pItem->createChild("rasd:AddressOnParent")->addContent(Utf8StrFmt("%d", lAddressOnParent)); 1223 1224 if (!strAllocationUnits.isEmpty()) 1225 pItem->createChild("rasd:AllocationUnits")->addContent(strAllocationUnits); 1226 1227 if (lAutomaticAllocation != -1) 1228 pItem->createChild("rasd:AutomaticAllocation")->addContent( (lAutomaticAllocation) ? "true" : "false" ); 1229 1230 if (lBusNumber != -1) 1231 if (enFormat == OVF_0_9) // BusNumber is invalid OVF 1.0 so only write it in 0.9 mode for OVFTool compatibility 1232 pItem->createChild("rasd:BusNumber")->addContent(Utf8StrFmt("%d", lBusNumber)); 1217 1233 1218 1234 if (!strCaption.isEmpty()) 1219 {1220 1235 pItem->createChild("rasd:Caption")->addContent(strCaption); 1236 1237 if (!strConnection.isEmpty()) 1238 pItem->createChild("rasd:Connection")->addContent(strConnection); 1239 1240 if (!strDescription.isEmpty()) 1241 pItem->createChild("rasd:Description")->addContent(strDescription); 1242 1243 if (!strCaption.isEmpty()) 1221 1244 if (enFormat == OVF_1_0) 1222 1245 pItem->createChild("rasd:ElementName")->addContent(strCaption); 1223 } 1224 1225 if (!strDescription.isEmpty()) 1226 pItem->createChild("rasd:Description")->addContent(strDescription); 1246 1247 if (!strHostResource.isEmpty()) 1248 pItem->createChild("rasd:HostResource")->addContent(strHostResource); 1227 1249 1228 1250 // <rasd:InstanceID>1</rasd:InstanceID> … … 1234 1256 pelmInstanceID->addContent(Utf8StrFmt("%d", ulInstanceID++)); 1235 1257 1258 if (ulParent) 1259 pItem->createChild("rasd:Parent")->addContent(Utf8StrFmt("%d", ulParent)); 1260 1236 1261 // <rasd:ResourceType>3</rasd:ResourceType> 1237 1262 pItem->createChild("rasd:ResourceType")->addContent(Utf8StrFmt("%d", type)); … … 1239 1264 pItem->createChild("rasd:ResourceSubType")->addContent(strResourceSubType); 1240 1265 1241 if (!strHostResource.isEmpty())1242 pItem->createChild("rasd:HostResource")->addContent(strHostResource);1243 1244 if (!strAllocationUnits.isEmpty())1245 pItem->createChild("rasd:AllocationUnits")->addContent(strAllocationUnits);1246 1247 1266 // <rasd:VirtualQuantity>1</rasd:VirtualQuantity> 1248 1267 if (lVirtualQuantity != -1) 1249 1268 pItem->createChild("rasd:VirtualQuantity")->addContent(Utf8StrFmt("%d", lVirtualQuantity)); 1250 1251 if (lAutomaticAllocation != -1)1252 pItem->createChild("rasd:AutomaticAllocation")->addContent( (lAutomaticAllocation) ? "true" : "false" );1253 1254 if (!strConnection.isEmpty())1255 pItem->createChild("rasd:Connection")->addContent(strConnection);1256 1257 if (lAddress != -1)1258 pItem->createChild("rasd:Address")->addContent(Utf8StrFmt("%d", lAddress));1259 1260 if (lBusNumber != -1)1261 if (enFormat == OVF_0_9) // BusNumber is invalid OVF 1.0 so only write it in 0.9 mode for OVFTool compatibility1262 pItem->createChild("rasd:BusNumber")->addContent(Utf8StrFmt("%d", lBusNumber));1263 1264 if (ulParent)1265 pItem->createChild("rasd:Parent")->addContent(Utf8StrFmt("%d", ulParent));1266 if (lAddressOnParent != -1)1267 pItem->createChild("rasd:AddressOnParent")->addContent(Utf8StrFmt("%d", lAddressOnParent));1268 1269 } 1269 1270 } … … 1351 1352 <DiskSection> 1352 1353 <Info>List of the virtual disks used in the package</Info> 1353 <Disk ovf:capacity="4294967296" ovf:diskId="lamp" ovf:format=" http://www.vmware.com/specifications/vmdk.html#compressed" ovf:populatedSize="1924967692"/>1354 <Disk ovf:capacity="4294967296" ovf:diskId="lamp" ovf:format="..." ovf:populatedSize="1924967692"/> 1354 1355 </DiskSection> */ 1355 1356 xml::ElementNode *pelmDiskSection; … … 1541 1542 1542 1543 // add disk to XML Disks section 1543 // <Disk ovf:capacity="8589934592" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format=" http://www.vmware.com/specifications/vmdk.html#sparse"/>1544 // <Disk ovf:capacity="8589934592" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="..."/> 1544 1545 xml::ElementNode *pelmDisk = pelmDiskSection->createChild("Disk"); 1545 1546 pelmDisk->setAttribute("ovf:capacity", Utf8StrFmt("%RI64", cbCapacity).c_str()); 1546 1547 pelmDisk->setAttribute("ovf:diskId", strDiskID); 1547 1548 pelmDisk->setAttribute("ovf:fileRef", strFileRef); 1548 pelmDisk->setAttribute("ovf:format", "http://www.vmware.com/specifications/vmdk.html#sparse"); // must be sparse or ovftool chokes 1549 pelmDisk->setAttribute("ovf:format", 1550 (enFormat == OVF_0_9) 1551 ? "http://www.vmware.com/specifications/vmdk.html#sparse" // must be sparse or ovftool chokes 1552 : "http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" 1553 // correct string as communicated to us by VMware (public bug #6612) 1554 ); 1549 1555 pelmDisk->setAttribute("vbox:uuid", Utf8StrFmt("%RTuuid", guidSource.raw()).c_str()); 1550 1556 } -
trunk/src/VBox/Main/ApplianceImplImport.cpp
r28800 r28957 491 491 // - we need a url specifier for the vdi format 492 492 if ( di.strFormat.compare("http://www.vmware.com/specifications/vmdk.html#sparse", Utf8Str::CaseInsensitive) 493 || di.strFormat.compare("http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized", Utf8Str::CaseInsensitive) 493 494 || di.strFormat.compare("http://www.vmware.com/specifications/vmdk.html#compressed", Utf8Str::CaseInsensitive) 495 || di.strFormat.compare("http://www.vmware.com/interfaces/specifications/vmdk.html#compressed", Utf8Str::CaseInsensitive) 494 496 ) 495 497 { … … 1286 1288 Bstr srcFormat = L"VDI"; 1287 1289 if ( di.strFormat.compare("http://www.vmware.com/specifications/vmdk.html#sparse", Utf8Str::CaseInsensitive) 1290 || di.strFormat.compare("http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized", Utf8Str::CaseInsensitive) 1288 1291 || di.strFormat.compare("http://www.vmware.com/specifications/vmdk.html#compressed", Utf8Str::CaseInsensitive) 1289 ) 1292 || di.strFormat.compare("http://www.vmware.com/interfaces/specifications/vmdk.html#compressed", Utf8Str::CaseInsensitive) 1293 ) 1290 1294 srcFormat = L"VMDK"; 1291 1295 // create an empty hard disk -
trunk/src/VBox/Main/include/ovfreader.h
r28800 r28957 156 156 // space, but cannot be larger than iCapacity; -1 if not set) 157 157 iprt::MiniString strFormat; // value from DiskSection/Disk/@format 158 // typically http://www.vmware.com/ specifications/vmdk.html#sparse158 // typically http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized 159 159 iprt::MiniString uuidVbox; // optional; if the file was exported by VirtualBox >= 3.2, 160 160 // then this has the UUID with which the disk was registered
Note:
See TracChangeset
for help on using the changeset viewer.