Changeset 18623 in vbox
- Timestamp:
- Apr 2, 2009 10:00:48 AM (15 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 5 edited
-
Frontends/VBoxManage/VBoxManageImport.cpp (modified) (1 diff)
-
Frontends/VirtualBox/src/VBoxExportApplianceWzd.cpp (modified) (1 diff)
-
Main/ApplianceImpl.cpp (modified) (15 diffs)
-
Main/idl/VirtualBox.xidl (modified) (1 diff)
-
Main/include/ApplianceImpl.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageImport.cpp
r18490 r18623 656 656 657 657 ComPtr<IProgress> progress; 658 CHECK_ERROR_BREAK(pAppliance, Write(Bstr( strOutputFile), progress.asOutParam()));658 CHECK_ERROR_BREAK(pAppliance, Write(Bstr("ovf-0.9"), Bstr(strOutputFile), progress.asOutParam())); 659 659 660 660 showProgress(progress); -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxExportApplianceWzd.cpp
r18402 r18623 302 302 { 303 303 /* Write the appliance */ 304 CProgress progress = aAppliance.Write ( mFileSelector->path());304 CProgress progress = aAppliance.Write ("ovf-0.9", mFileSelector->path()); 305 305 bool fResult = aAppliance.isOk(); 306 306 if (fResult) -
trunk/src/VBox/Main/ApplianceImpl.cpp
r18591 r18623 2459 2459 { 2460 2460 TaskWriteOVF(Appliance *aThat, Progress *aProgress) 2461 : pAppliance(aThat) 2462 , progress(aProgress) 2463 , rc(S_OK) 2461 : pAppliance(aThat), 2462 enFormat(unspecified), 2463 progress(aProgress), 2464 rc(S_OK) 2464 2465 {} 2465 2466 ~TaskWriteOVF() {} … … 2468 2469 2469 2470 Appliance *pAppliance; 2471 enum { unspecified, OVF_0_9, OVF_1_0 } 2472 enFormat; 2473 2470 2474 ComObjPtr<Progress> progress; 2471 2475 HRESULT rc; … … 2483 2487 } 2484 2488 2485 STDMETHODIMP Appliance::Write(IN_BSTR path, IProgress **aProgress)2489 STDMETHODIMP Appliance::Write(IN_BSTR format, IN_BSTR path, IProgress **aProgress) 2486 2490 { 2487 2491 HRESULT rc = S_OK; … … 2512 2516 //AssertComRCThrowRC (task->autoCaller.rc()); 2513 2517 2518 Utf8Str strFormat(format); 2519 if (strFormat == "ovf-0.9") 2520 task->enFormat = TaskWriteOVF::OVF_0_9; 2521 else if (strFormat == "ovf-1.0") 2522 task->enFormat = TaskWriteOVF::OVF_1_0; 2523 else 2524 return setError(VBOX_E_FILE_ERROR, 2525 tr("Invalid format \"%s\" specified"), strFormat.c_str()); 2526 2514 2527 rc = task->startThread(); 2515 2528 CheckComRCThrowRC(rc); … … 2559 2572 xml::ElementNode *pelmRoot = doc.createRootElement("Envelope"); 2560 2573 2561 pelmRoot->setAttribute("ovf:version", "1.0");2574 pelmRoot->setAttribute("ovf:version", (task->enFormat == TaskWriteOVF::OVF_1_0) ? "1.0" : "0.9"); 2562 2575 pelmRoot->setAttribute("xml:lang", "en-US"); 2563 2576 pelmRoot->setAttribute("xmlns", "http://schemas.dmtf.org/ovf/envelope/1"); 2564 2577 pelmRoot->setAttribute("xmlns:ovf", "http://schemas.dmtf.org/ovf/envelope/1"); 2565 pelmRoot->setAttribute("xmlns:ovfstr", "http://schema.dmtf.org/ovf/strings/1");2578 // pelmRoot->setAttribute("xmlns:ovfstr", "http://schema.dmtf.org/ovf/strings/1"); 2566 2579 pelmRoot->setAttribute("xmlns:rasd", "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"); 2567 2580 pelmRoot->setAttribute("xmlns:vssd", "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData"); 2568 2581 pelmRoot->setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); 2569 pelmRoot->setAttribute("xsi:schemaLocation", "http://schemas.dmtf.org/ovf/envelope/1 ../ovf-envelope.xsd");2582 // pelmRoot->setAttribute("xsi:schemaLocation", "http://schemas.dmtf.org/ovf/envelope/1 ../ovf-envelope.xsd"); 2570 2583 2571 2584 // <Envelope>/<References> 2572 xml::ElementNode *pelmReferences = pelmRoot->createChild("References"); 2585 xml::ElementNode *pelmReferences = pelmRoot->createChild("References"); // 0.9 and 1.0 2573 2586 2574 2587 /* <Envelope>/<DiskSection>: … … 2577 2590 <Disk ovf:capacity="4294967296" ovf:diskId="lamp" ovf:format="http://www.vmware.com/specifications/vmdk.html#compressed" ovf:populatedSize="1924967692"/> 2578 2591 </DiskSection> */ 2579 xml::ElementNode *pelmDiskSection = pelmRoot->createChild("DiskSection"); 2592 xml::ElementNode *pelmDiskSection; 2593 if (task->enFormat == TaskWriteOVF::OVF_0_9) 2594 { 2595 // <Section xsi:type="ovf:DiskSection_Type"> 2596 pelmDiskSection = pelmRoot->createChild("Section"); 2597 pelmDiskSection->setAttribute("xsi:type", "ovf:DiskSection_Type"); 2598 } 2599 else 2600 pelmDiskSection = pelmRoot->createChild("DiskSection"); 2601 2580 2602 xml::ElementNode *pelmDiskSectionInfo = pelmDiskSection->createChild("Info"); 2581 2603 pelmDiskSectionInfo->addContent("List of the virtual disks used in the package"); … … 2591 2613 </Network> 2592 2614 </NetworkSection> */ 2593 xml::ElementNode *pelmNetworkSection = pelmRoot->createChild("NetworkSection"); 2615 xml::ElementNode *pelmNetworkSection; 2616 if (task->enFormat == TaskWriteOVF::OVF_0_9) 2617 { 2618 // <Section xsi:type="ovf:NetworkSection_Type"> 2619 pelmNetworkSection = pelmRoot->createChild("Section"); 2620 pelmNetworkSection->setAttribute("xsi:type", "ovf:NetworkSection_Type"); 2621 } 2622 else 2623 pelmNetworkSection = pelmRoot->createChild("NetworkSection"); 2624 2594 2625 xml::ElementNode *pelmNetworkSectionInfo = pelmNetworkSection->createChild("Info"); 2595 2626 pelmNetworkSectionInfo->addContent("Logical networks used in the package"); … … 2600 2631 2601 2632 // and here come the virtual systems: 2602 xml::ElementNode *pelmVirtualSystemCollection = pelmRoot->createChild("VirtualSystemCollection"); 2633 xml::ElementNode *pelmVirtualSystemCollection; 2634 if (task->enFormat == TaskWriteOVF::OVF_0_9) 2635 { 2636 // <Section xsi:type="ovf:NetworkSection_Type"> 2637 pelmVirtualSystemCollection = pelmRoot->createChild("Content"); 2638 pelmVirtualSystemCollection->setAttribute("xsi:type", "ovf:VirtualSystemCollection_Type"); 2639 } 2640 else 2641 pelmVirtualSystemCollection = pelmRoot->createChild("VirtualSystemCollection"); 2603 2642 /* xml::AttributeNode *pattrVirtualSystemCollectionId = */ pelmVirtualSystemCollection->setAttribute("ovf:id", "ExportedVirtualBoxMachines"); // whatever 2604 2643 … … 2611 2650 ComObjPtr<VirtualSystemDescription> vsdescThis = (*it); 2612 2651 2613 xml::ElementNode *pelmVirtualSystem = pelmVirtualSystemCollection->createChild("VirtualSystem"); 2652 xml::ElementNode *pelmVirtualSystem; 2653 if (task->enFormat == TaskWriteOVF::OVF_0_9) 2654 { 2655 // <Section xsi:type="ovf:NetworkSection_Type"> 2656 pelmVirtualSystem = pelmVirtualSystemCollection->createChild("Content"); 2657 pelmVirtualSystem->setAttribute("xsi:type", "ovf:VirtualSystem_Type"); 2658 } 2659 else 2660 pelmVirtualSystem = pelmVirtualSystemCollection->createChild("VirtualSystem"); 2614 2661 2615 2662 /*xml::ElementNode *pelmVirtualSystemInfo =*/ pelmVirtualSystem->createChild("Info")->addContent("A virtual machine"); … … 2619 2666 throw setError(VBOX_E_NOT_SUPPORTED, 2620 2667 tr("Missing VM name")); 2621 pelmVirtualSystem->setAttribute("ovf:id", llName.front()->strVbox); 2668 Utf8Str &strVMName = llName.front()->strVbox; 2669 pelmVirtualSystem->setAttribute("ovf:id", strVMName); 2622 2670 2623 2671 // product info … … 2645 2693 <ProductUrl>http://blogs.sun.com/VirtualGuru</ProductUrl> 2646 2694 <VendorUrl>http://www.sun.com</VendorUrl> 2647 </Section> */ 2648 xml::ElementNode *pelmAnnotationSection = pelmVirtualSystem->createChild("ProductSection"); 2695 </Section> */ 2696 xml::ElementNode *pelmAnnotationSection; 2697 if (task->enFormat == TaskWriteOVF::OVF_0_9) 2698 { 2699 // <Section ovf:required="false" xsi:type="ovf:ProductSection_Type"> 2700 pelmAnnotationSection = pelmVirtualSystem->createChild("Section"); 2701 pelmAnnotationSection->setAttribute("xsi:type", "ovf:ProductSection_Type"); 2702 } 2703 else 2704 pelmAnnotationSection = pelmVirtualSystem->createChild("ProductSection"); 2705 2649 2706 pelmAnnotationSection->createChild("Info")->addContent("Meta-information about the installed software"); 2650 2707 if (fProduct) … … 2669 2726 <Annotation>Plan 9</Annotation> 2670 2727 </Section> */ 2671 xml::ElementNode *pelmAnnotationSection = pelmVirtualSystem->createChild("AnnotationSection"); 2728 xml::ElementNode *pelmAnnotationSection; 2729 if (task->enFormat == TaskWriteOVF::OVF_0_9) 2730 { 2731 // <Section ovf:required="false" xsi:type="ovf:AnnotationSection_Type"> 2732 pelmAnnotationSection = pelmVirtualSystem->createChild("Section"); 2733 pelmAnnotationSection->setAttribute("xsi:type", "ovf:AnnotationSection_Type"); 2734 } 2735 else 2736 pelmAnnotationSection = pelmVirtualSystem->createChild("AnnotationSection"); 2737 2672 2738 pelmAnnotationSection->createChild("Info")->addContent("A human-readable annotation"); 2673 2739 pelmAnnotationSection->createChild("Annotation")->addContent(llDescription.front()->strVbox); … … 2683 2749 <License ovf:msgid="1">License terms can go in here.</License> 2684 2750 </EulaSection> */ 2685 xml::ElementNode *pelmAnnotationSection = pelmVirtualSystem->createChild("EulaSection"); 2686 pelmAnnotationSection->createChild("Info")->addContent("License agreement for the Virtual System."); 2687 pelmAnnotationSection->createChild("License")->addContent(llLicense.front()->strVbox); 2751 xml::ElementNode *pelmEulaSection; 2752 if (task->enFormat == TaskWriteOVF::OVF_0_9) 2753 { 2754 pelmEulaSection = pelmVirtualSystem->createChild("Section"); 2755 pelmEulaSection->setAttribute("xsi:type", "ovf:EulaSection_Type"); 2756 } 2757 else 2758 pelmEulaSection = pelmVirtualSystem->createChild("EulaSection"); 2759 2760 pelmEulaSection->createChild("Info")->addContent("License agreement for the virtual system"); 2761 pelmEulaSection->createChild("License")->addContent(llLicense.front()->strVbox); 2688 2762 } 2689 2763 … … 2697 2771 <Description>Linux 2.6.x</Description> 2698 2772 </OperatingSystemSection> */ 2699 xml::ElementNode *pelmOperatingSystemSection = pelmVirtualSystem->createChild("OperatingSystemSection"); 2773 xml::ElementNode *pelmOperatingSystemSection; 2774 if (task->enFormat == TaskWriteOVF::OVF_0_9) 2775 { 2776 pelmOperatingSystemSection = pelmVirtualSystem->createChild("Section"); 2777 pelmOperatingSystemSection->setAttribute("xsi:type", "ovf:OperatingSystemSection_Type"); 2778 } 2779 else 2780 pelmOperatingSystemSection = pelmVirtualSystem->createChild("OperatingSystemSection"); 2781 2700 2782 pelmOperatingSystemSection->setAttribute("ovf:id", llOS.front()->strOvf); 2701 // pelmOperatingSystemSection->createChild("Info")->addContent("blah"); // @todo 2702 // pelmOperatingSystemSection->createChild("Description")->addContent("blah"); // @todo2783 pelmOperatingSystemSection->createChild("Info")->addContent("The kind of installed guest operating system"); 2784 // pelmOperatingSystemSection->createChild("Description")->addContent("blah"); // @todo 2703 2785 2704 2786 // <VirtualHardwareSection ovf:id="hw1" ovf:transport="iso"> 2705 xml::ElementNode *pelmVirtualHardwareSection = pelmVirtualSystem->createChild("VirtualHardwareSection"); 2787 xml::ElementNode *pelmVirtualHardwareSection; 2788 if (task->enFormat == TaskWriteOVF::OVF_0_9) 2789 { 2790 // <Section xsi:type="ovf:VirtualHardwareSection_Type"> 2791 pelmVirtualHardwareSection = pelmVirtualSystem->createChild("Section"); 2792 pelmVirtualHardwareSection->setAttribute("xsi:type", "ovf:VirtualHardwareSection_Type"); 2793 } 2794 else 2795 pelmVirtualHardwareSection = pelmVirtualSystem->createChild("VirtualHardwareSection"); 2796 2797 pelmVirtualHardwareSection->createChild("Info")->addContent("Virtual hardware requirements for a virtual machine"); 2706 2798 2707 2799 /* <System> … … 2714 2806 xml::ElementNode *pelmSystem = pelmVirtualHardwareSection->createChild("System"); 2715 2807 2808 // <vssd:InstanceId>0</vssd:InstanceId> 2809 pelmSystem->createChild("vssd:InstanceId")->addContent("0"); 2810 // <vssd:VirtualSystemIdentifier>VAtest</vssd:VirtualSystemIdentifier> 2811 pelmSystem->createChild("vssd:VirtualSystemIdentifier")->addContent(strVMName); 2716 2812 // <vssd:VirtualSystemType>vmx-4</vssd:VirtualSystemType> 2717 xml::ElementNode *pelmVirtualSystemType = pelmSystem->createChild("VirtualSystemType"); 2718 pelmVirtualSystemType->addContent("virtualbox-2.2"); // instead of vmx-7? 2813 pelmSystem->createChild("vssd:VirtualSystemType")->addContent("virtualbox-2.2"); // instead of vmx-7? 2719 2814 2720 2815 // loop thru all description entries twice; once to write out all -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r18592 r18623 3234 3234 returns an IProgress object to allow the caller to monitor the progress. 3235 3235 </desc> 3236 <param name="format" type="wstring" dir="in"> 3237 <desc> 3238 Output format, as a string. Currently supported formats are "ovf-0.9" and "ovf-1.0"; 3239 future versions of VirtualBox may support additional formats. 3240 </desc> 3241 </param> 3236 3242 <param name="path" type="wstring" dir="in"> 3237 <desc>3238 Name of appliance file to open (either with an <tt>.ovf</tt> or <tt>.ova</tt> extension, depending3239 on whether the appliance is distributed as a set of files or as a single file, respectively).3240 </desc>3243 <desc> 3244 Name of appliance file to open (either with an <tt>.ovf</tt> or <tt>.ova</tt> extension, depending 3245 on whether the appliance is distributed as a set of files or as a single file, respectively). 3246 </desc> 3241 3247 </param> 3242 3248 <param name="aProgress" type="IProgress" dir="return"> -
trunk/src/VBox/Main/include/ApplianceImpl.h
r18304 r18623 77 77 STDMETHOD(Interpret)(void); 78 78 STDMETHOD(ImportMachines)(IProgress **aProgress); 79 STDMETHOD(Write)(IN_BSTR path, IProgress **aProgress);79 STDMETHOD(Write)(IN_BSTR format, IN_BSTR path, IProgress **aProgress); 80 80 STDMETHOD(GetWarnings)(ComSafeArrayOut(BSTR, aWarnings)); 81 81
Note:
See TracChangeset
for help on using the changeset viewer.

