VirtualBox

Changeset 23667 in vbox for trunk/src


Ignore:
Timestamp:
Oct 10, 2009 1:23:58 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
53380
Message:

VBoxManage: Live migration.

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

Legend:

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

    r23643 r23667  
    12911291                CHECK_ERROR(guest, COMSETTER(StatisticsUpdateInterval)(uVal));
    12921292        }
     1293        else if (!strcmp(a->argv[1], "migrate"))
     1294        {
     1295            Bstr        bstrHostname;
     1296            uint32_t    uPort = UINT32_MAX;
     1297            Bstr        bstrPassword("");
     1298            static const RTGETOPTDEF s_aMigrateOptions[] =
     1299            {
     1300                { "--hostname",    'h', RTGETOPT_REQ_STRING }, /** @todo RTGETOPT_FLAG_MANDATORY */
     1301                { "--port",        'p', RTGETOPT_REQ_UINT32 }, /** @todo RTGETOPT_FLAG_MANDATORY */
     1302                { "--password",    'P', RTGETOPT_REQ_STRING }
     1303            };
     1304            RTGETOPTSTATE GetOptState;
     1305            RTGetOptInit(&GetOptState, a->argc, a->argv, s_aMigrateOptions, RT_ELEMENTS(s_aMigrateOptions), 2, 0 /*fFlags*/);
     1306            int ch;
     1307            RTGETOPTUNION Value;
     1308            while (   SUCCEEDED(rc)
     1309                   && (ch = RTGetOpt(&GetOptState, &Value)))
     1310            {
     1311                switch (ch)
     1312                {
     1313                    case 'h': bstrHostname  = Value.psz; break;
     1314                    case 'p': uPort         = Value.u32; break;
     1315                    case 'P': bstrPassword  = Value.psz; break;
     1316                    default:
     1317                        errorGetOpt(USAGE_SNAPSHOT, ch, &Value);
     1318                        rc = E_FAIL;
     1319                        break;
     1320                }
     1321            }
     1322            if (FAILED(rc))
     1323                break;
     1324
     1325            ComPtr<IProgress> progress;
     1326            CHECK_ERROR_BREAK(console, Migrate(bstrHostname, uPort, bstrPassword, progress.asOutParam()));
     1327            showProgress(progress);
     1328
     1329            LONG iRc;
     1330            CHECK_ERROR_BREAK(progress, COMGETTER(ResultCode)(&iRc));
     1331            if (FAILED(iRc))
     1332            {
     1333                com::ProgressErrorInfo info(progress);
     1334                if (info.isBasicAvailable())
     1335                    RTPrintf("Error: live migration failed. Error message: %lS\n", info.getText().raw());
     1336                else
     1337                    RTPrintf("Error: live migration failed. No error message available!\n");
     1338            }
     1339        }
    12931340        else
    12941341        {
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp

    r23572 r23667  
    250250        RTPrintf("                            [--usb on|off]\n"
    251251                 "                            [--usbehci on|off]\n"
    252                  "                            [--snapshotfolder default|<path>]\n");
     252                 "                            [--snapshotfolder default|<path>]\n"
     253                 "                            [--livemigrationtarget on|off]\n"
     254                 "                            [--livemigrationport <port>]\n"
     255                 "                            [--livemigrationpassword <password>]\n");
    253256        RTPrintf("\n");
    254257    }
     
    316319            RTPrintf("                            vrdpport default|<port>] |\n");
    317320        }
    318         RTPrintf("                            setvideomodehint <xres> <yres> <bpp> [display]|\n"
     321        RTPrintf("                            setvideomodehint <xres> <yres> <bpp> [display] |\n"
    319322                 "                            setcredentials <username> <password> <domain>\n"
    320                  "                                           [--allowlocallogon <yes|no>]\n"
     323                 "                                           [--allowlocallogon <yes|no>] |\n"
     324                 "                            migrate --hostname <name> --port <port>\n"
     325                 "                                   [--password password]\n"
    321326                 "\n");
    322327    }
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp

    r23643 r23667  
    109109    int   sataPortCount = -1;
    110110    int   sataBootDevices[4] = {-1,-1,-1,-1};
     111    int         fLiveMigrationTarget = -1;
     112    uint32_t    uLiveMigrationPort = UINT32_MAX;
     113    const char *pszLiveMigrationPassword = NULL;
    111114
    112115    /* VM ID + at least one parameter. Parameter arguments are checked
     
    869872            else
    870873                return errorArgument("Invalid --scsitype argument '%s'", a->argv[i]);
     874        }
     875        else if (!strcmp(a->argv[i], "--livemigrationtarget"))
     876        {
     877            if (a->argc <= i + 1)
     878                return errorArgument("Missing argument to '%s'", a->argv[i]);
     879            i++;
     880            if (!strcmp(a->argv[i], "on"))
     881                fLiveMigrationTarget = 1;
     882            else if (!strcmp(a->argv[i], "off"))
     883                fLiveMigrationTarget = 0;
     884            else
     885                return errorArgument("Invalid --livemigrationtarget value '%s'", a->argv[i]);
     886        }
     887        else if (!strcmp(a->argv[i], "--livemigrationport"))
     888        {
     889            if (a->argc <= i + 1)
     890                return errorArgument("Missing argument to '%s'", a->argv[i]);
     891            i++;
     892            int vrc = RTStrToUInt32Ex(a->argv[i], NULL, 0, &uLiveMigrationPort);
     893            if (vrc != VINF_SUCCESS)
     894                return errorArgument("Invalid --livemigrationport value '%s'", a->argv[i]);
     895        }
     896        else if (!strcmp(a->argv[i], "--livemigrationpassword"))
     897        {
     898            if (a->argc <= i + 1)
     899                return errorArgument("Missing argument to '%s'", a->argv[i]);
     900            i++;
     901            pszLiveMigrationPassword = a->argv[i];
    871902        }
    872903        else
     
    903934        if (name)
    904935            CHECK_ERROR(machine, COMSETTER(Name)(name));
     936/** @todo r=bird: What's the story on not reporting error some places
     937 *        (CHECK_ERROR) and immediately returning in other cases
     938 *        (CHECK_ERROR_RET)?  If there is a logic, a comment why would be
     939 *        nice... */
    905940        if (ostype)
    906941        {
     
    20912126        }
    20922127
     2128        /*
     2129         * Live Migration.
     2130         */
     2131        if (pszLiveMigrationPassword)
     2132            CHECK_ERROR_RET(machine, COMSETTER(LiveMigrationPassword)(Bstr(pszLiveMigrationPassword)), 1);
     2133        if (uLiveMigrationPort != UINT32_MAX)
     2134            CHECK_ERROR_RET(machine, COMSETTER(LiveMigrationPort)(uLiveMigrationPort), 1);
     2135        if (fLiveMigrationTarget != -1)
     2136            CHECK_ERROR_RET(machine, COMSETTER(LiveMigrationTarget)(fLiveMigrationTarget), 1);
     2137
    20932138        /* commit changes */
    20942139        CHECK_ERROR(machine, SaveSettings());
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