Changeset 43041 in vbox
- Timestamp:
- Aug 28, 2012 1:58:40 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 80375
- Location:
- trunk
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/manual/en_US/SDKRef.xml
r43036 r43041 3638 3638 adjusted accordingly, the former taking an array of groups as an 3639 3639 additional parameter and the latter taking a group as an additional 3640 parameter.</para> 3640 parameter. The create option handling has been changed for those two 3641 methods, too.</para> 3641 3642 </listitem> 3642 3643 -
trunk/include/VBox/settings.h
r42838 r43041 1016 1016 { 1017 1017 MachineUserData() 1018 : fNameSync(true), 1018 : fDirectoryIncludesUUID(false), 1019 fNameSync(true), 1019 1020 fTeleporterEnabled(false), 1020 1021 uTeleporterPort(0), … … 1030 1031 { 1031 1032 return (strName == c.strName) 1033 && (fDirectoryIncludesUUID == c.fDirectoryIncludesUUID) 1032 1034 && (fNameSync == c.fNameSync) 1033 1035 && (strDescription == c.strDescription) … … 1048 1050 1049 1051 com::Utf8Str strName; 1052 bool fDirectoryIncludesUUID; 1050 1053 bool fNameSync; 1051 1054 com::Utf8Str strDescription; -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp
r42178 r43041 241 241 do 242 242 { 243 Bstr createFlags; 244 if (!bstrUuid.isEmpty()) 245 createFlags = BstrFmt("UUID=%ls", bstrUuid.raw()); 243 246 Bstr bstrPrimaryGroup; 244 247 if (groups.size()) … … 248 251 ComposeMachineFilename(bstrName.raw(), 249 252 bstrPrimaryGroup.raw(), 253 createFlags.raw(), 250 254 bstrBaseFolder.raw(), 251 255 bstrSettingsFile.asOutParam())); … … 256 260 ComSafeArrayAsInParam(groups), 257 261 bstrOsTypeId.raw(), 258 bstrUuid.raw(), 259 FALSE /* forceOverwrite */, 262 createFlags.raw(), 260 263 machine.asOutParam())); 261 264 … … 435 438 pszTrgName = RTStrAPrintf2("%s Clone", pszSrcName); 436 439 440 Bstr createFlags; 441 if (!bstrUuid.isEmpty()) 442 createFlags = BstrFmt("UUID=%ls", bstrUuid.raw()); 437 443 Bstr bstrPrimaryGroup; 438 444 if (groups.size()) … … 442 448 ComposeMachineFilename(Bstr(pszTrgName).raw(), 443 449 bstrPrimaryGroup.raw(), 450 createFlags.raw(), 444 451 Bstr(pszTrgBaseFolder).raw(), 445 452 bstrSettingsFile.asOutParam()), … … 451 458 ComSafeArrayAsInParam(groups), 452 459 NULL, 453 bstrUuid.raw(), 454 FALSE, 460 createFlags.raw(), 455 461 trgMachine.asOutParam()), 456 462 RTEXITCODE_FAILURE); -
trunk/src/VBox/Frontends/VBoxShell/vboxshell.py
r42904 r43041 219 219 mgr = ctx['mgr'] 220 220 vb = ctx['vb'] 221 mach = vb.createMachine("", name, [], kind, "" , False)221 mach = vb.createMachine("", name, [], kind, "") 222 222 mach.saveSettings() 223 223 print "created machine with UUID",mach.id -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVM.cpp
r42129 r43041 113 113 114 114 /* Create a new machine object. */ 115 const QString &strSettingsFile = vbox.ComposeMachineFilename(strName, QString::null /**< @todo group support */, QString::null );116 CMachine cloneMachine = vbox.CreateMachine(strSettingsFile, strName, QVector<QString>(), QString::null, QString::null , false);115 const QString &strSettingsFile = vbox.ComposeMachineFilename(strName, QString::null /**< @todo group support */, QString::null, QString::null); 116 CMachine cloneMachine = vbox.CreateMachine(strSettingsFile, strName, QVector<QString>(), QString::null, QString::null); 117 117 if (!vbox.isOk()) 118 118 { -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp
r42616 r43041 66 66 if (!m_strGroup.isEmpty()) 67 67 groups << m_strGroup; 68 m_machine = vbox.CreateMachine(QString(), field("name").toString(), groups, strTypeId, QString (), false);68 m_machine = vbox.CreateMachine(QString(), field("name").toString(), groups, strTypeId, QString::null); 69 69 if (!vbox.isOk()) 70 70 { -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.cpp
r42616 r43041 184 184 QString strDefaultMachinesFolder = vbox.GetSystemProperties().GetDefaultMachineFolder(); 185 185 /* Compose machine filename: */ 186 QString strMachineFilename = vbox.ComposeMachineFilename(m_pNameAndSystemEditor->name(), m_strGroup, strDefaultMachinesFolder);186 QString strMachineFilename = vbox.ComposeMachineFilename(m_pNameAndSystemEditor->name(), m_strGroup, QString::null, strDefaultMachinesFolder); 187 187 /* Compose machine folder/basename: */ 188 188 QFileInfo fileInfo(strMachineFilename); -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r43036 r43041 1424 1424 <interface 1425 1425 name="IVirtualBox" extends="$unknown" 1426 uuid=" 5c8814a1-2a35-402d-8680-68e5cb4e72aa"1426 uuid="3b2f08eb-b810-4715-bee0-bb06b9880ad2" 1427 1427 wsmap="managed" 1428 1428 > … … 1664 1664 used to determine the right subdirectory.</desc> 1665 1665 </param> 1666 <param name="createFlags" type="wstring" dir="in"> 1667 <desc>Machine creation flags, see <link to="#createMachine" /> (optional).</desc> 1668 </param> 1666 1669 <param name="baseFolder" type="wstring" dir="in"> 1667 1670 <desc>Base machine folder (optional).</desc> … … 1723 1726 array. 1724 1727 1725 Optionally, you may specify an UUID of to assign to the created machine.1726 However, this is not recommended and you should normally pass an empty1727 (@c null) UUID to this method so that a new UUID will be automatically1728 generated for every created machine. You can use UUID1729 00000000-0000-0000-0000-000000000000 as @c null value.1730 1731 1728 <note> 1732 1729 There is no way to change the name of the settings file or … … 1763 1760 <desc>Guest OS Type ID.</desc> 1764 1761 </param> 1765 <param name="id" type="uuid" mod="string" dir="in"> 1766 <desc>Machine UUID (optional).</desc> 1767 </param> 1768 <param name="forceOverwrite" type="boolean" dir="in"> 1769 <desc>If true, an existing machine settings file will be overwritten.</desc> 1762 <param name="flags" type="wstring" dir="in"> 1763 <desc> 1764 Additional property parameters, passed as a comma-separated list of 1765 "name=value" type entries. The following ones are recognized: 1766 <tt>forceOverwrite=1</tt> to overwrite an existing machine settings 1767 file, and <tt>UUID=<uuid></tt> to specify a machine UUID. 1768 </desc> 1770 1769 </param> 1771 1770 <param name="machine" type="IMachine" dir="return"> -
trunk/src/VBox/Main/include/MachineImpl.h
r42890 r43041 353 353 GuestOSType *aOsType, 354 354 const Guid &aId, 355 bool fForceOverwrite); 355 bool fForceOverwrite, 356 bool fDirectoryIncludesUUID); 356 357 357 358 // initializer for loading existing machine XML (either registered or not) -
trunk/src/VBox/Main/include/VirtualBoxImpl.h
r42888 r43041 127 127 128 128 /* IVirtualBox methods */ 129 STDMETHOD(ComposeMachineFilename)(IN_BSTR aName, IN_BSTR aGroup, IN_BSTR a BaseFolder, BSTR *aFilename);129 STDMETHOD(ComposeMachineFilename)(IN_BSTR aName, IN_BSTR aGroup, IN_BSTR aCreateFlags, IN_BSTR aBaseFolder, BSTR *aFilename); 130 130 STDMETHOD(CreateMachine)(IN_BSTR aSettingsFile, 131 131 IN_BSTR aName, 132 132 ComSafeArrayIn(IN_BSTR, aGroups), 133 133 IN_BSTR aOsTypeId, 134 IN_BSTR aId, 135 BOOL forceOverwrite, 134 IN_BSTR aCreateFlags, 136 135 IMachine **aMachine); 137 136 STDMETHOD(OpenMachine)(IN_BSTR aSettingsFile, IMachine **aMachine); -
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r42708 r43041 206 206 rc = mVirtualBox->ComposeMachineFilename(Bstr(nameVBox).raw(), 207 207 NULL /* aGroup */, 208 NULL /* aCreateFlags */, 208 209 NULL /* aBaseFolder */, 209 210 bstrMachineFilename.asOutParam()); … … 1954 1955 ComSafeArrayAsInParam(groups), 1955 1956 Bstr(stack.strOsTypeVBox).raw(), 1956 NULL, /* uuid */ 1957 FALSE, /* fForceOverwrite */ 1957 NULL, /* aCreateFlags */ 1958 1958 pNewMachine.asOutParam()); 1959 1959 if (FAILED(rc)) throw rc; … … 2868 2868 rc = mVirtualBox->ComposeMachineFilename(Bstr(stack.strNameVBox).raw(), 2869 2869 NULL /* aGroup */, 2870 NULL /* aCreateFlags */, 2870 2871 NULL /* aBaseFolder */, 2871 2872 bstrMachineFilename.asOutParam()); -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r43023 r43041 290 290 GuestOSType *aOsType, 291 291 const Guid &aId, 292 bool fForceOverwrite) 292 bool fForceOverwrite, 293 bool fDirectoryIncludesUUID) 293 294 { 294 295 LogFlowThisFuncEnter(); … … 324 325 mUserData->s.llGroups = llGroups; 325 326 327 mUserData->s.fDirectoryIncludesUUID = fDirectoryIncludesUUID; 326 328 // the "name sync" flag determines whether the machine directory gets renamed along 327 329 // with the machine file; say so if the settings file name is the same as the … … 10946 10948 strConfigFileOnly.stripPath() // vmname.vbox 10947 10949 .stripExt(); // vmname 10950 /** @todo hack, make somehow use of ComposeMachineFilename */ 10951 if (mUserData->s.fDirectoryIncludesUUID) 10952 strConfigFileOnly += Utf8StrFmt(" (%RTuuid)", mData->mUuid.raw()); 10948 10953 10949 10954 AssertReturn(!strMachineDirName.isEmpty(), false); -
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r42957 r43041 1406 1406 STDMETHODIMP VirtualBox::ComposeMachineFilename(IN_BSTR aName, 1407 1407 IN_BSTR aGroup, 1408 IN_BSTR aCreateFlags, 1408 1409 IN_BSTR aBaseFolder, 1409 1410 BSTR *aFilename) … … 1417 1418 AutoCaller autoCaller(this); 1418 1419 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1420 1421 Utf8Str strCreateFlags(aCreateFlags); 1422 Guid id; 1423 bool fDirectoryIncludesUUID = false; 1424 if (!strCreateFlags.isEmpty()) 1425 { 1426 const char *pcszNext = strCreateFlags.c_str(); 1427 while (*pcszNext != '\0') 1428 { 1429 Utf8Str strFlag; 1430 const char *pcszComma = RTStrStr(pcszNext, ","); 1431 if (!pcszComma) 1432 strFlag = pcszNext; 1433 else 1434 strFlag = Utf8Str(pcszNext, pcszComma - pcszNext); 1435 1436 const char *pcszEqual = RTStrStr(strFlag.c_str(), "="); 1437 /* skip over everything which doesn't contain '=' */ 1438 if (pcszEqual && pcszEqual != strFlag.c_str()) 1439 { 1440 Utf8Str strKey(strFlag.c_str(), pcszEqual - strFlag.c_str()); 1441 Utf8Str strValue(strFlag.c_str() + (pcszEqual - strFlag.c_str() + 1)); 1442 1443 if (strKey == "UUID") 1444 id = strValue.c_str(); 1445 else if (strKey == "directoryIncludesUUID") 1446 fDirectoryIncludesUUID = (strValue == "1"); 1447 } 1448 1449 if (!pcszComma) 1450 pcszNext += strFlag.length(); 1451 else 1452 pcszNext += strFlag.length() + 1; 1453 } 1454 } 1455 if (id.isEmpty()) 1456 fDirectoryIncludesUUID = false; 1419 1457 1420 1458 Utf8Str strGroup(aGroup); … … 1436 1474 Utf8Str strBase = aBaseFolder; 1437 1475 Utf8Str strName = aName; 1476 Utf8Str strDirName(strName); 1477 if (fDirectoryIncludesUUID) 1478 strDirName += Utf8StrFmt(" (%RTuuid)", id.raw()); 1438 1479 sanitiseMachineFilename(strName); 1480 sanitiseMachineFilename(strDirName); 1439 1481 1440 1482 if (strBase.isEmpty()) … … 1551 1593 ComSafeArrayIn(IN_BSTR, aGroups), 1552 1594 IN_BSTR aOsTypeId, 1553 IN_BSTR aId, 1554 BOOL forceOverwrite, 1595 IN_BSTR aCreateFlags, 1555 1596 IMachine **aMachine) 1556 1597 { 1557 1598 LogFlowThisFuncEnter(); 1558 LogFlowThisFunc(("aSettingsFile=\"%ls\", aName=\"%ls\", aOsTypeId =\"%ls\" \n", aSettingsFile, aName, aOsTypeId));1599 LogFlowThisFunc(("aSettingsFile=\"%ls\", aName=\"%ls\", aOsTypeId =\"%ls\", aCreateFlags=\"%ls\"\n", aSettingsFile, aName, aOsTypeId, aCreateFlags)); 1559 1600 1560 1601 CheckComArgStrNotEmptyOrNull(aName); … … 1570 1611 return rc; 1571 1612 1613 Utf8Str strCreateFlags(aCreateFlags); 1614 Guid id; 1615 bool fForceOverwrite = false; 1616 bool fDirectoryIncludesUUID = false; 1617 if (!strCreateFlags.isEmpty()) 1618 { 1619 const char *pcszNext = strCreateFlags.c_str(); 1620 while (*pcszNext != '\0') 1621 { 1622 Utf8Str strFlag; 1623 const char *pcszComma = RTStrStr(pcszNext, ","); 1624 if (!pcszComma) 1625 strFlag = pcszNext; 1626 else 1627 strFlag = Utf8Str(pcszNext, pcszComma - pcszNext); 1628 1629 const char *pcszEqual = RTStrStr(strFlag.c_str(), "="); 1630 /* skip over everything which doesn't contain '=' */ 1631 if (pcszEqual && pcszEqual != strFlag.c_str()) 1632 { 1633 Utf8Str strKey(strFlag.c_str(), pcszEqual - strFlag.c_str()); 1634 Utf8Str strValue(strFlag.c_str() + (pcszEqual - strFlag.c_str() + 1)); 1635 1636 if (strKey == "UUID") 1637 id = strValue.c_str(); 1638 else if (strKey == "forceOverwrite") 1639 fForceOverwrite = (strValue == "1"); 1640 else if (strKey == "directoryIncludesUUID") 1641 fDirectoryIncludesUUID = (strValue == "1"); 1642 } 1643 1644 if (!pcszComma) 1645 pcszNext += strFlag.length(); 1646 else 1647 pcszNext += strFlag.length() + 1; 1648 } 1649 } 1650 /* Create UUID if none was specified. */ 1651 if (id.isEmpty()) 1652 id.create(); 1653 1572 1654 /* NULL settings file means compose automatically */ 1573 1655 Bstr bstrSettingsFile(aSettingsFile); 1574 1656 if (bstrSettingsFile.isEmpty()) 1575 1657 { 1658 Utf8Str strNewCreateFlags(Utf8StrFmt("UUID=%RTuuid", id.raw())); 1659 if (fDirectoryIncludesUUID) 1660 strNewCreateFlags += ",directoryIncludesUUID=1"; 1661 1576 1662 rc = ComposeMachineFilename(aName, 1577 1663 Bstr(llGroups.front()).raw(), 1664 Bstr(strNewCreateFlags).raw(), 1578 1665 NULL /* aBaseFolder */, 1579 1666 bstrSettingsFile.asOutParam()); … … 1585 1672 rc = machine.createObject(); 1586 1673 if (FAILED(rc)) return rc; 1587 1588 /* Create UUID if an empty one was specified. */1589 Guid id(aId);1590 if (id.isEmpty())1591 id.create();1592 1674 1593 1675 GuestOSType *osType = NULL; … … 1602 1684 osType, 1603 1685 id, 1604 !!forceOverwrite); 1686 fForceOverwrite, 1687 fDirectoryIncludesUUID); 1605 1688 if (SUCCEEDED(rc)) 1606 1689 { -
trunk/src/VBox/Main/testcase/tstVBoxAPILinux.cpp
r42131 r43041 193 193 0, nsnull, /* groups (safearray)*/ 194 194 nsnull, /* ostype */ 195 nsnull, /* machine uuid */ 196 false, /* forceOverwrite */ 195 nsnull, /* create flags */ 197 196 getter_AddRefs(machine)); 198 197 if (NS_FAILED(rc)) -
trunk/src/VBox/Main/xml/Settings.cpp
r42838 r43041 3437 3437 parseUUID(uuid, strUUID); 3438 3438 3439 elmMachine.getAttributeValue("directoryIncludesUUID", machineUserData.fDirectoryIncludesUUID); 3439 3440 elmMachine.getAttributeValue("nameSync", machineUserData.fNameSync); 3440 3441 … … 4643 4644 elmMachine.setAttribute("uuid", uuid.toStringCurly()); 4644 4645 elmMachine.setAttribute("name", machineUserData.strName); 4646 if (machineUserData.fDirectoryIncludesUUID) 4647 elmMachine.setAttribute("directoryIncludesUUID", machineUserData.fDirectoryIncludesUUID); 4645 4648 if (!machineUserData.fNameSync) 4646 4649 elmMachine.setAttribute("nameSync", machineUserData.fNameSync); … … 4842 4845 if (m->sv < SettingsVersion_v1_13) 4843 4846 { 4844 // VirtualBox 4.2 adds tracing, autostart and groups.4847 // VirtualBox 4.2 adds tracing, autostart, UUID in directory and groups. 4845 4848 if ( !debugging.areDefaultSettings() 4846 4849 || !autostart.areDefaultSettings() 4850 || machineUserData.fDirectoryIncludesUUID 4847 4851 || machineUserData.llGroups.size() > 1 4848 4852 || machineUserData.llGroups.front() != "/")
Note:
See TracChangeset
for help on using the changeset viewer.