VirtualBox

Changeset 72476 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Jun 7, 2018 1:49:48 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
122961
Message:

Main/Appliance: Teach importing new tricks: importing to specific location (by settings file name or base folder) and also importing straight into a group. Lots of cleanup and minor fixing (bad code quality due to lots of copy/paste, and what's worse is that the original code was broken already, using the variables inconsistently), plus some smallish coding style cleaup. Much more needed. Also fixed the incomplete use of the VM name on expert (the one in the VBox XML was not changed, and it's the preferred name on import).
VBoxManage: small updates to reflect the new features (and actually offer setting the VM name on export, which is something the GUI could do for a long time).

Location:
trunk/src/VBox/Frontends/VBoxManage
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageAppliance.cpp

    r69500 r72476  
    121121    { "--vmname",               'V', RTGETOPT_REQ_STRING },
    122122    { "-vmname",                'V', RTGETOPT_REQ_STRING },     // deprecated
     123    { "--settingsfile",         'S', RTGETOPT_REQ_STRING },
     124    { "--basefolder",           'p', RTGETOPT_REQ_STRING },
     125    { "--group",                'g', RTGETOPT_REQ_STRING },
    123126    { "--memory",               'm', RTGETOPT_REQ_STRING },
    124127    { "-memory",                'm', RTGETOPT_REQ_STRING },     // deprecated
     
    193196                    return errorSyntax(USAGE_IMPORTAPPLIANCE, "Option \"%s\" requires preceding --vsys argument.", GetState.pDef->pszLong);
    194197                mapArgsMapsPerVsys[ulCurVsys]["vmname"] = ValueUnion.psz;
     198                break;
     199
     200            case 'S':   // --settingsfile
     201                if (ulCurVsys == (uint32_t)-1)
     202                    return errorSyntax(USAGE_IMPORTAPPLIANCE, "Option \"%s\" requires preceding --vsys argument.", GetState.pDef->pszLong);
     203                mapArgsMapsPerVsys[ulCurVsys]["settingsfile"] = ValueUnion.psz;
     204                break;
     205
     206            case 'p':   // --basefolder
     207                if (ulCurVsys == (uint32_t)-1)
     208                    return errorSyntax(USAGE_IMPORTAPPLIANCE, "Option \"%s\" requires preceding --vsys argument.", GetState.pDef->pszLong);
     209                mapArgsMapsPerVsys[ulCurVsys]["basefolder"] = ValueUnion.psz;
     210                break;
     211
     212            case 'g':   // --group
     213                if (ulCurVsys == (uint32_t)-1)
     214                    return errorSyntax(USAGE_IMPORTAPPLIANCE, "Option \"%s\" requires preceding --vsys argument.", GetState.pDef->pszLong);
     215                mapArgsMapsPerVsys[ulCurVsys]["group"] = ValueUnion.psz;
    195216                break;
    196217
     
    851872
    852873                        case VirtualSystemDescriptionType_SettingsFile:
    853                             /** @todo  VirtualSystemDescriptionType_SettingsFile? */
    854                             break;
     874                            if (findArgValue(strOverride, pmapArgs, "settingsfile"))
     875                            {
     876                                bstrFinalValue = strOverride;
     877                                RTPrintf("%2u: VM settings file name specified with --settingsfile: \"%ls\"\n",
     878                                        a, bstrFinalValue.raw());
     879                            }
     880                            else
     881                                RTPrintf("%2u: Suggested VM settings file name \"%ls\""
     882                                        "\n    (change with \"--vsys %u --settingsfile <filename>\")\n",
     883                                        a, bstrFinalValue.raw(), i);
     884                            break;
     885
     886                        case VirtualSystemDescriptionType_BaseFolder:
     887                            if (findArgValue(strOverride, pmapArgs, "basefolder"))
     888                            {
     889                                bstrFinalValue = strOverride;
     890                                RTPrintf("%2u: VM base folder specified with --basefolder: \"%ls\"\n",
     891                                        a, bstrFinalValue.raw());
     892                            }
     893                            else
     894                                RTPrintf("%2u: Suggested VM base folder \"%ls\""
     895                                        "\n    (change with \"--vsys %u --basefolder <path>\")\n",
     896                                        a, bstrFinalValue.raw(), i);
     897                            break;
     898
     899                        case VirtualSystemDescriptionType_PrimaryGroup:
     900                            if (findArgValue(strOverride, pmapArgs, "group"))
     901                            {
     902                                bstrFinalValue = strOverride;
     903                                RTPrintf("%2u: VM group specified with --group: \"%ls\"\n",
     904                                        a, bstrFinalValue.raw());
     905                            }
     906                            else
     907                                RTPrintf("%2u: Suggested VM group \"%ls\""
     908                                        "\n    (change with \"--vsys %u --group <group>\")\n",
     909                                        a, bstrFinalValue.raw(), i);
     910                            break;
     911
    855912                        case VirtualSystemDescriptionType_Miscellaneous:
    856913                            /** @todo  VirtualSystemDescriptionType_Miscellaneous? */
     
    9471004    { "--iso",                  'I', RTGETOPT_REQ_NOTHING },    // obsoleted by --options
    9481005    { "--vsys",                 's', RTGETOPT_REQ_UINT32 },
     1006    { "--vmname",               'V', RTGETOPT_REQ_STRING },
    9491007    { "--product",              'p', RTGETOPT_REQ_STRING },
    9501008    { "--producturl",           'P', RTGETOPT_REQ_STRING },
     
    10201078                case 's':   // --vsys
    10211079                    ulCurVsys = ValueUnion.u32;
     1080                    break;
     1081
     1082                case 'V':   // --vmname
     1083                    if (ulCurVsys == (uint32_t)-1)
     1084                        return errorSyntax(USAGE_EXPORTAPPLIANCE, "Option \"%s\" requires preceding --vsys argument.", GetState.pDef->pszLong);
     1085                    mapArgsMapsPerVsys[ulCurVsys]["vmname"] = ValueUnion.psz;
    10221086                    break;
    10231087
     
    11611225                     ++itD)
    11621226                {
    1163                     if (itD->first == "product")
     1227                    if (itD->first == "vmname")
     1228                        pVSD->AddDescription(VirtualSystemDescriptionType_Name,
     1229                                             Bstr(itD->second).raw(),
     1230                                             Bstr(itD->second).raw());
     1231                    else if (itD->first == "product")
    11641232                        pVSD->AddDescription(VirtualSystemDescriptionType_Product,
    11651233                                             Bstr(itD->second).raw(),
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp

    r72352 r72476  
    762762                     "                            [--options manifest|iso|nomacs|nomacsbutnat]\n"
    763763                     "                            [--vsys <number of virtual system>]\n"
     764                     "                                    [--vmname <name>]\n"
    764765                     "                                    [--product <product name>]\n"
    765766                     "                                    [--producturl <product url>]\n"
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette