Changeset 91319 in vbox
- Timestamp:
- Sep 20, 2021 6:07:20 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageCloudMachine.cpp
r91188 r91319 70 70 const ComPtr<ICloudClient> &pClient); 71 71 72 static RTEXITCODE handleCloudMachineStart(HandlerArg *a, int iFirst, 73 const ComPtr<ICloudClient> &pClient); 74 static RTEXITCODE handleCloudMachineShutdown(HandlerArg *a, int iFirst, 75 const ComPtr<ICloudClient> &pClient); 76 72 77 static RTEXITCODE handleCloudMachineConsoleHistory(HandlerArg *a, int iFirst, 73 78 const ComPtr<ICloudClient> &pClient); 79 74 80 static RTEXITCODE listCloudMachinesImpl(HandlerArg *a, int iFirst, 75 81 const ComPtr<ICloudClient> &pClient); … … 607 613 kMachine_Info, 608 614 kMachine_List, 615 kMachine_Shutdown, 616 kMachine_Start, 609 617 }; 610 618 … … 616 624 { "info", kMachine_Info, RTGETOPT_REQ_NOTHING }, 617 625 { "list", kMachine_List, RTGETOPT_REQ_NOTHING }, 626 { "shutdown", kMachine_Shutdown, RTGETOPT_REQ_NOTHING }, 627 { "start", kMachine_Start, RTGETOPT_REQ_NOTHING }, 618 628 CLOUD_MACHINE_RTGETOPTDEF_HELP 619 629 }; … … 640 650 case kMachine_List: 641 651 return listCloudMachinesImpl(a, OptState.iNext, pClient); 652 653 case kMachine_Shutdown: 654 return handleCloudMachineShutdown(a, OptState.iNext, pClient); 655 656 case kMachine_Start: 657 return handleCloudMachineStart(a, OptState.iNext, pClient); 642 658 643 659 … … 909 925 return RTEXITCODE_FAILURE; 910 926 927 /* end of boilerplate */ 928 911 929 912 930 hrc = printMachineInfo(pMachine); … … 1148 1166 1149 1167 /* 1150 * cloud machine console-history "id" 1168 * Boilerplate code to get machine by name/id from the arguments. 1169 * Shared by action subcommands b/c they currently don't have any 1170 * extra options (but we can't use this for e.g. "info" that has 1171 * --details). 1151 1172 */ 1152 1173 static RTEXITCODE 1153 handleCloudMachineConsoleHistory(HandlerArg *a, int iFirst, 1154 const ComPtr<ICloudClient> &pClient) 1174 getMachineFromArgs(ComPtr<ICloudMachine> &pMachine, 1175 uint64_t fCurSubcommandScope, 1176 HandlerArg *a, int iFirst, 1177 const ComPtr<ICloudClient> &pClient) 1155 1178 { 1156 1179 MachineSpec machineSpec; 1157 ComPtr<ICloudMachine> pMachine;1158 1180 HRESULT hrc; 1159 1181 int rc; 1160 1182 1161 // setCurrentSubcommand(HELP_SCOPE_CLOUD_MACHINE_CONSOLEHISTORY); 1183 RT_NOREF(fCurSubcommandScope); /// @todo scopes not in the manual yet 1184 // setCurrentSubcommand(fCurSubcommandScope); 1162 1185 static const RTGETOPTDEF s_aOptions[] = 1163 1186 { … … 1198 1221 return RTEXITCODE_FAILURE; 1199 1222 1223 return RTEXITCODE_SUCCESS; 1224 } 1225 1226 1227 /* 1228 * cloud machine start "id" 1229 */ 1230 static RTEXITCODE 1231 handleCloudMachineStart(HandlerArg *a, int iFirst, 1232 const ComPtr<ICloudClient> &pClient) 1233 { 1234 ComPtr<ICloudMachine> pMachine; 1235 HRESULT hrc; 1236 1237 RTEXITCODE status 1238 = getMachineFromArgs(pMachine, 1239 /* HELP_SCOPE_CLOUD_MACHINE_START */ 0, 1240 a, iFirst, pClient); 1241 if (status != RTEXITCODE_SUCCESS) 1242 return status; 1243 1244 1245 ComPtr<IProgress> pProgress; 1246 CHECK_ERROR2_RET(hrc, pMachine, 1247 PowerUp(pProgress.asOutParam()), 1248 RTEXITCODE_FAILURE); 1249 1250 hrc = showProgress(pProgress, SHOW_PROGRESS_NONE); 1251 return SUCCEEDED(hrc) ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE; 1252 } 1253 1254 1255 /* 1256 * cloud machine shutdown "id" 1257 */ 1258 static RTEXITCODE 1259 handleCloudMachineShutdown(HandlerArg *a, int iFirst, 1260 const ComPtr<ICloudClient> &pClient) 1261 { 1262 ComPtr<ICloudMachine> pMachine; 1263 HRESULT hrc; 1264 1265 RTEXITCODE status 1266 = getMachineFromArgs(pMachine, 1267 /* HELP_SCOPE_CLOUD_MACHINE_SHUTDOWN */ 0, 1268 a, iFirst, pClient); 1269 if (status != RTEXITCODE_SUCCESS) 1270 return status; 1271 1272 1273 ComPtr<IProgress> pProgress; 1274 CHECK_ERROR2_RET(hrc, pMachine, 1275 Shutdown(pProgress.asOutParam()), 1276 RTEXITCODE_FAILURE); 1277 1278 hrc = showProgress(pProgress, SHOW_PROGRESS_NONE); 1279 return SUCCEEDED(hrc) ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE; 1280 } 1281 1282 1283 /* 1284 * cloud machine console-history "id" 1285 */ 1286 static RTEXITCODE 1287 handleCloudMachineConsoleHistory(HandlerArg *a, int iFirst, 1288 const ComPtr<ICloudClient> &pClient) 1289 { 1290 ComPtr<ICloudMachine> pMachine; 1291 HRESULT hrc; 1292 1293 RTEXITCODE status 1294 = getMachineFromArgs(pMachine, 1295 /* HELP_SCOPE_CLOUD_MACHINE_CONSOLEHISTORY */ 0, 1296 a, iFirst, pClient); 1297 if (status != RTEXITCODE_SUCCESS) 1298 return status; 1299 1200 1300 1201 1301 ComPtr<IDataStream> pHistoryStream;
Note:
See TracChangeset
for help on using the changeset viewer.

