Changeset 37862 in vbox
- Timestamp:
- Jul 11, 2011 10:09:29 AM (13 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 10 edited
-
Frontends/VBoxManage/VBoxManageAppliance.cpp (modified) (5 diffs)
-
Frontends/VBoxManage/VBoxManageHelp.cpp (modified) (1 diff)
-
Frontends/VirtualBox/src/widgets/VBoxApplianceEditorWgt.cpp (modified) (1 diff)
-
Frontends/VirtualBox/src/widgets/VBoxApplianceEditorWgt.ui (modified) (4 diffs)
-
Frontends/VirtualBox/src/widgets/VBoxImportApplianceWgt.cpp (modified) (2 diffs)
-
Main/idl/VirtualBox.xidl (modified) (4 diffs)
-
Main/include/ApplianceImpl.h (modified) (1 diff)
-
Main/include/ApplianceImplPrivate.h (modified) (1 diff)
-
Main/src-server/ApplianceImplImport.cpp (modified) (5 diffs)
-
Main/testcase/tstOVF.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageAppliance.cpp
r36527 r37862 75 75 76 76 return false; 77 } 78 79 static int parseImportOptions(const char *psz, com::SafeArray<ImportOptions_T> *options) 80 { 81 int rc = VINF_SUCCESS; 82 while (psz && *psz && RT_SUCCESS(rc)) 83 { 84 size_t len; 85 const char *pszComma = strchr(psz, ','); 86 if (pszComma) 87 len = pszComma - psz; 88 else 89 len = strlen(psz); 90 if (len > 0) 91 { 92 if (!RTStrNICmp(psz, "KeepAllMACs", len)) 93 options->push_back(ImportOptions_KeepAllMACs); 94 else if (!RTStrNICmp(psz, "KeepNATMACs", len)) 95 options->push_back(ImportOptions_KeepNATMACs); 96 else 97 rc = VERR_PARSE_ERROR; 98 } 99 if (pszComma) 100 psz += len + 1; 101 else 102 psz += len; 103 } 104 105 return rc; 77 106 } 78 107 … … 112 141 #endif 113 142 { "--disk", 'D', RTGETOPT_REQ_STRING }, 143 { "--options", 'O', RTGETOPT_REQ_STRING }, 114 144 }; 115 145 … … 120 150 Utf8Str strOvfFilename; 121 151 bool fExecute = true; // if true, then we actually do the import 152 com::SafeArray<ImportOptions_T> options; 122 153 uint32_t ulCurVsys = (uint32_t)-1; 123 154 uint32_t ulCurUnit = (uint32_t)-1; … … 221 252 return errorSyntax(USAGE_IMPORTAPPLIANCE, "Option \"%s\" requires preceding --unit argument.", GetState.pDef->pszLong); 222 253 mapArgsMapsPerVsys[ulCurVsys][Utf8StrFmt("disk%u", ulCurUnit)] = ValueUnion.psz; 254 break; 255 256 case 'O': // --options 257 if (RT_FAILURE(parseImportOptions(ValueUnion.psz, &options))) 258 return errorArgument("Invalid import options '%s'\n", ValueUnion.psz); 223 259 break; 224 260 … … 747 783 ComPtr<IProgress> progress; 748 784 CHECK_ERROR_BREAK(pAppliance, 749 ImportMachines( progress.asOutParam()));785 ImportMachines(ComSafeArrayAsInParam(options), progress.asOutParam())); 750 786 751 787 rc = showProgress(progress); -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r37824 r37862 345 345 if (u64Cmd & USAGE_IMPORTAPPLIANCE) 346 346 RTStrmPrintf(pStrm, 347 "VBoxManage import <ovf/ova> [--dry-run|-n] [more options]\n" 347 "VBoxManage import <ovf/ova>\n" 348 " [--dry-run|-n]\n" 349 " [--options keepallmacs|keepnatmacs]\n" 350 " [more options]\n" 348 351 " (run with -n to have options displayed\n" 349 352 " for a particular OVF)\n\n"); -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/VBoxApplianceEditorWgt.cpp
r35979 r37862 1088 1088 mTvSettings->header()->setResizeMode (QHeaderView::ResizeToContents); 1089 1089 1090 /* Hidden by default */ 1091 mReinitMACsCheckBox->setHidden(true); 1092 1090 1093 /* Applying language settings */ 1091 1094 retranslateUi(); -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/VBoxApplianceEditorWgt.ui
r28800 r37862 10 10 you can redistribute it and/or modify it under the terms of the GNU 11 11 General Public License (GPL) as published by the Free Software 12 Foundation, in version 2 as it comes in the "COPYING"file of the12 Foundation, in version 2 as it comes in the "COPYING" file of the 13 13 VirtualBox OSE distribution. VirtualBox OSE is distributed in the 14 14 hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. … … 20 20 <x>0</x> 21 21 <y>0</y> 22 <width> 459</width>23 <height> 305</height>22 <width>548</width> 23 <height>411</height> 24 24 </rect> 25 25 </property> … … 39 39 </item> 40 40 <item> 41 <widget class="QCheckBox" name="mReinitMACsCheckBox"> 42 <property name="toolTip"> 43 <string>When checked a new unique MAC address will assigned to all configured network cards.</string> 44 </property> 45 <property name="text"> 46 <string>&Reinitialize the MAC address of all network cards</string> 47 </property> 48 </widget> 49 </item> 50 <item> 41 51 <widget class="QWidget" name="mWarningWidget" native="true"> 42 52 <property name="sizePolicy"> … … 47 57 </property> 48 58 <layout class="QVBoxLayout" name="verticalLayout"> 49 <property name="sizeConstraint">50 <enum>QLayout::SetDefaultConstraint</enum>51 </property>52 59 <property name="margin"> 53 60 <number>0</number> -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/VBoxImportApplianceWgt.cpp
r34530 r37862 42 42 : VBoxApplianceEditorWgt (aParent) 43 43 { 44 /* Show the MAC check box */ 45 mReinitMACsCheckBox->setHidden(false); 44 46 } 45 47 … … 134 136 /* Start the import asynchronously */ 135 137 CProgress progress; 136 progress = mAppliance->ImportMachines(); 138 QVector<KImportOptions> options; 139 if (!mReinitMACsCheckBox->isChecked()) 140 options.append(KImportOptions_KeepAllMACs); 141 progress = mAppliance->ImportMachines(options); 137 142 bool fResult = mAppliance->isOk(); 138 143 if (fResult) -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r37851 r37862 1927 1927 </param> 1928 1928 <param name="forceNewUuid" type="boolean" dir="in"> 1929 <desc>Allows the caller to request a completely new medium UUID for1930 the image which is to be opened. Useful if one intends to open an exact1931 copy of a previously opened image, as this would normally fail due to1932 the duplicate UUID.</desc>1933 </param>1929 <desc>Allows the caller to request a completely new medium UUID for 1930 the image which is to be opened. Useful if one intends to open an exact 1931 copy of a previously opened image, as this would normally fail due to 1932 the duplicate UUID.</desc> 1933 </param> 1934 1934 <param name="medium" type="IMedium" dir="return"> 1935 1935 <desc>Opened medium object.</desc> … … 2356 2356 </interface> 2357 2357 2358 <enum 2359 name="ImportOptions" extends="$unknown" 2360 uuid="0a981523-3b20-4004-8ee3-dfd322202ace" 2361 > 2362 2363 <desc> 2364 Import options, used with <link to="IAppliance::importMachines" />. 2365 </desc> 2366 2367 <const name="KeepAllMACs" value="1"> 2368 <desc>Don't generate new MAC addresses of the attached network adapters.</desc> 2369 </const> 2370 <const name="KeepNATMACs" value="2"> 2371 <desc>Don't generate new MAC addresses of the attached network adapters when they are using NAT.</desc> 2372 </const> 2373 2374 </enum> 2375 2376 2358 2377 <!-- 2359 2378 // IAppliance … … 2363 2382 <interface 2364 2383 name="IAppliance" extends="$unknown" 2365 uuid=" 7b148032-4124-4f46-b56a-b48ac1273f5a"2384 uuid="3059cf9e-25c7-4f0b-9fa5-3c42e441670b" 2366 2385 wsmap="managed" 2367 2386 > … … 2558 2577 retrieved from the <link to="#machines" /> array attribute. 2559 2578 </desc> 2579 2580 <param name="options" type="ImportOptions" dir="in" safearray="yes"> 2581 <desc>Options for the importing operation.</desc> 2582 </param> 2560 2583 2561 2584 <param name="aProgress" type="IProgress" dir="return"> -
trunk/src/VBox/Main/include/ApplianceImpl.h
r35638 r37862 97 97 STDMETHOD(Read)(IN_BSTR path, IProgress **aProgress); 98 98 STDMETHOD(Interpret)(void); 99 STDMETHOD(ImportMachines)( IProgress **aProgress);99 STDMETHOD(ImportMachines)(ComSafeArrayIn(ImportOptions_T, options), IProgress **aProgress); 100 100 /* Export methods */ 101 101 STDMETHOD(CreateVFSExplorer)(IN_BSTR aURI, IVFSExplorer **aExplorer); -
trunk/src/VBox/Main/include/ApplianceImplPrivate.h
r34101 r37862 73 73 LocationInfo locInfo; // location info for the currently processed OVF 74 74 bool fManifest; // Create a manifest file on export 75 RTCList<ImportOptions_T> optList; 75 76 76 77 ovf::OVFReader *pReader; -
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r37200 r37862 37 37 #include "MediumFormatImpl.h" 38 38 #include "SystemPropertiesImpl.h" 39 #include "HostImpl.h" 39 40 40 41 #include "AutoCaller.h" … … 665 666 * @return 666 667 */ 667 STDMETHODIMP Appliance::ImportMachines( IProgress **aProgress)668 STDMETHODIMP Appliance::ImportMachines(ComSafeArrayIn(ImportOptions_T, options), IProgress **aProgress) 668 669 { 669 670 CheckComArgOutPointerValid(aProgress); … … 671 672 AutoCaller autoCaller(this); 672 673 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 674 675 if (options != NULL) 676 m->optList = com::SafeArray<ImportOptions_T>(ComSafeArrayInArg(options)).toList(); 677 678 AssertReturn(!(m->optList.contains(ImportOptions_KeepAllMACs) && m->optList.contains(ImportOptions_KeepNATMACs)), E_INVALIDARG); 673 679 674 680 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 2527 2533 /* First disable all network cards, they will be enabled below again. */ 2528 2534 settings::NetworkAdaptersList::iterator it1; 2535 bool fKeepAllMACs = m->optList.contains(ImportOptions_KeepAllMACs); 2536 bool fKeepNATMACs = m->optList.contains(ImportOptions_KeepNATMACs); 2529 2537 for (it1 = llNetworkAdapters.begin(); it1 != llNetworkAdapters.end(); ++it1) 2538 { 2530 2539 it1->fEnabled = false; 2540 if (!( fKeepAllMACs 2541 || (fKeepNATMACs && it1->mode == NetworkAttachmentType_NAT))) 2542 Host::generateMACAddress(it1->strMACAddress); 2543 } 2531 2544 /* Now iterate over all network entries. */ 2532 2545 std::list<VirtualSystemDescriptionEntry*> avsdeNWs = vsdescThis->findByType(VirtualSystemDescriptionType_NetworkAdapter); … … 2534 2547 { 2535 2548 /* Iterate through all network adapter entries and search for the 2536 * corr osponding one in the machine config. If one is found, configure2549 * corresponding one in the machine config. If one is found, configure 2537 2550 * it based on the user settings. */ 2538 2551 list<VirtualSystemDescriptionEntry*>::const_iterator itNW; -
trunk/src/VBox/Main/testcase/tstOVF.cpp
r33294 r37862 233 233 234 234 RTPrintf("%s: importing %d machine(s)...\n", pcszPrefix, aDescriptions.size()); 235 rc = pAppl->ImportMachines(pProgress.asOutParam()); 235 SafeArray<ImportOptions_T> sfaOptions; 236 rc = pAppl->ImportMachines(ComSafeArrayAsInParam(sfaOptions), pProgress.asOutParam()); 236 237 if (FAILED(rc)) throw MyError(rc, "Appliance::ImportMachines() failed\n"); 237 238 rc = pProgress->WaitForCompletion(-1);
Note:
See TracChangeset
for help on using the changeset viewer.

