- Timestamp:
- Jun 11, 2018 2:12:17 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r72476 r72511 199 199 nameVBox); 200 200 201 /* VM Primary Group */ 202 Utf8Str strPrimaryGroup; 203 if (pNewDesc->m->pConfig->machineUserData.llGroups.size()) 204 strPrimaryGroup = pNewDesc->m->pConfig->machineUserData.llGroups.front(); 205 if (strPrimaryGroup.isEmpty()) 206 strPrimaryGroup = "/"; 207 pNewDesc->i_addEntry(VirtualSystemDescriptionType_PrimaryGroup, 208 "", 209 "" /* no direct OVF correspondence */, 210 strPrimaryGroup); 211 201 212 /* Based on the VM name, create a target machine path. */ 202 213 Bstr bstrSettingsFilename; 203 214 rc = mVirtualBox->ComposeMachineFilename(Bstr(nameVBox).raw(), 204 NULL /* aGroup */,215 Bstr(strPrimaryGroup).raw(), 205 216 NULL /* aCreateFlags */, 206 217 NULL /* aBaseFolder */, … … 212 223 #if 1 213 224 /* The import logic should work exactly the same whether the 214 * following 3items are present or not, but of course it may have225 * following 2 items are present or not, but of course it may have 215 226 * an influence on the exact presentation of the import settings 216 227 * of an API client. */ … … 226 237 "" /* no direct OVF correspondence */, 227 238 strBaseFolder); 228 pNewDesc->i_addEntry(VirtualSystemDescriptionType_PrimaryGroup,229 "",230 "" /* no direct OVF correspondence */,231 "");232 239 #endif 233 240 … … 2675 2682 /* Create the machine */ 2676 2683 SafeArray<BSTR> groups; /* no groups, or maybe one group... */ 2677 if (!stack.strPrimaryGroup.isEmpty() )2684 if (!stack.strPrimaryGroup.isEmpty() && stack.strPrimaryGroup != "/") 2678 2685 Bstr(stack.strPrimaryGroup).detachTo(groups.appendedRaw()); 2679 2686 rc = mVirtualBox->CreateMachine(Bstr(stack.strSettingsFilename).raw(), … … 3443 3450 config.machineUserData.strOsType = stack.strOsTypeVBox; 3444 3451 /* Groups */ 3445 if ( !stack.strPrimaryGroup.isEmpty())3452 if (stack.strPrimaryGroup.isEmpty() || stack.strPrimaryGroup == "/") 3446 3453 { 3447 3454 config.machineUserData.llGroups.clear(); 3448 config.machineUserData.llGroups.push_back(stack.strPrimaryGroup); 3455 config.machineUserData.llGroups.push_back("/"); 3456 } 3457 else 3458 { 3459 /* Replace the primary group if there is one, otherwise add it. */ 3460 if (config.machineUserData.llGroups.size()) 3461 config.machineUserData.llGroups.pop_front(); 3462 config.machineUserData.llGroups.push_front(stack.strPrimaryGroup); 3449 3463 } 3450 3464 /* Description */ … … 4003 4017 std::list<VirtualSystemDescriptionEntry*> vsdePrimaryGroup = vsdescThis->i_findByType(VirtualSystemDescriptionType_PrimaryGroup); 4004 4018 if (vsdePrimaryGroup.size() >= 1) 4019 { 4005 4020 stack.strPrimaryGroup = vsdePrimaryGroup.front()->strVBoxCurrent; 4021 if (stack.strPrimaryGroup.isEmpty()) 4022 stack.strPrimaryGroup = "/"; 4023 } 4006 4024 4007 4025 // Draw the right conclusions from the (possibly modified) VM settings
Note:
See TracChangeset
for help on using the changeset viewer.