Changeset 28110 in vbox for trunk/src/VBox/Main/ApplianceImplImport.cpp
- Timestamp:
- Apr 8, 2010 6:07:13 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 59826
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ApplianceImplImport.cpp
r28098 r28110 34 34 #include "GuestOSTypeImpl.h" 35 35 #include "ProgressImpl.h" 36 #include "MachineImpl.h" 36 37 37 38 #include "AutoCaller.h" … … 1121 1122 1122 1123 if (vsdescThis->m->pConfig) 1123 importVBoxMachine( *vsdescThis->m->pConfig, pNewMachine, stack);1124 importVBoxMachine(vsdescThis, pNewMachine, stack); 1124 1125 else 1125 1126 importMachineGeneric(vsysThis, vsdescThis, pNewMachine, stack); 1126 1127 } 1127 catch (HRESULT aRC)1128 catch (HRESULT aRC) 1128 1129 { 1129 1130 rc = aRC; … … 1367 1368 size_t a = 0; 1368 1369 for (nwIt = vsdeNW.begin(); 1369 1370 1370 (nwIt != vsdeNW.end() && a < SchemaDefs::NetworkAdapterCount); 1371 ++nwIt, ++a) 1371 1372 { 1372 1373 const VirtualSystemDescriptionEntry* pvsys = *nwIt; … … 1529 1530 if (FAILED(rc)) throw rc; 1530 1531 1532 // store new machine for roll-back in case of errors 1531 1533 Bstr bstrNewMachineId; 1532 1534 rc = pNewMachine->COMGETTER(Id)(bstrNewMachineId.asOutParam()); 1533 1535 if (FAILED(rc)) throw rc; 1534 1535 // store new machine for roll-back in case of errors1536 1536 stack.llMachinesRegistered.push_back(bstrNewMachineId); 1537 1537 … … 1862 1862 * @param stack 1863 1863 */ 1864 void Appliance::importVBoxMachine( const settings::MachineConfigFile &config,1865 ComPtr<IMachine> &p NewMachine,1864 void Appliance::importVBoxMachine(ComObjPtr<VirtualSystemDescription> &vsdescThis, 1865 ComPtr<IMachine> &pReturnNewMachine, 1866 1866 ImportStack &stack) 1867 1867 { 1868 Assert(vsdescThis->m->pConfig); 1869 const settings::MachineConfigFile &config = *vsdescThis->m->pConfig; 1870 1871 // use the name that we computed in the OVF fields to avoid duplicates 1872 std::list<VirtualSystemDescriptionEntry*> vsdeName = vsdescThis->findByType(VirtualSystemDescriptionType_Name); 1873 if (vsdeName.size() < 1) 1874 throw setError(VBOX_E_FILE_ERROR, 1875 tr("Missing VM name")); 1876 const Utf8Str &strNameVBox = vsdeName.front()->strVbox; 1877 1878 ComObjPtr<Machine> pNewMachine; 1879 HRESULT rc = pNewMachine.createObject(); 1880 if (FAILED(rc)) throw rc; 1881 rc = pNewMachine->init(mVirtualBox, strNameVBox, config); 1882 if (FAILED(rc)) throw rc; 1883 1884 IMachine *p; 1885 rc = pNewMachine.queryInterfaceTo(&p); 1886 if (FAILED(rc)) throw rc; 1887 1888 pReturnNewMachine = p; 1889 1890 rc = mVirtualBox->RegisterMachine(pNewMachine); 1891 if (FAILED(rc)) throw rc; 1892 1893 // store new machine for roll-back in case of errors 1894 Bstr bstrNewMachineId; 1895 rc = pNewMachine->COMGETTER(Id)(bstrNewMachineId.asOutParam()); 1896 if (FAILED(rc)) throw rc; 1897 stack.llMachinesRegistered.push_back(bstrNewMachineId); 1868 1898 } 1869 1899
Note:
See TracChangeset
for help on using the changeset viewer.