VirtualBox

source: vbox/trunk/src/VBox/Frontends/VBoxManage/VBoxManageSnapshot.cpp@ 63300

Last change on this file since 63300 was 63300, checked in by vboxsync, 8 years ago

VBoxManage: warnings

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 23.5 KB
Line 
1/* $Id: VBoxManageSnapshot.cpp 63300 2016-08-10 16:59:30Z vboxsync $ */
2/** @file
3 * VBoxManage - The 'snapshot' command.
4 */
5
6/*
7 * Copyright (C) 2006-2016 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18
19/*********************************************************************************************************************************
20* Header Files *
21*********************************************************************************************************************************/
22#include <VBox/com/com.h>
23#include <VBox/com/string.h>
24#include <VBox/com/array.h>
25#include <VBox/com/ErrorInfo.h>
26#include <VBox/com/errorprint.h>
27
28#include <VBox/com/VirtualBox.h>
29
30#include <iprt/stream.h>
31#include <iprt/getopt.h>
32#include <iprt/time.h>
33
34#include "VBoxManage.h"
35using namespace com;
36
37/**
38 * Helper function used with "VBoxManage snapshot ... dump". Gets called to find the
39 * snapshot in the machine's snapshot tree that uses a particular diff image child of
40 * a medium.
41 * Horribly inefficient since we keep re-querying the snapshots tree for each image,
42 * but this is for quick debugging only.
43 * @param pMedium
44 * @param pThisSnapshot
45 * @param pCurrentSnapshot
46 * @param uMediumLevel
47 * @param uSnapshotLevel
48 * @return
49 */
50bool FindAndPrintSnapshotUsingMedium(ComPtr<IMedium> &pMedium,
51 ComPtr<ISnapshot> &pThisSnapshot,
52 ComPtr<ISnapshot> &pCurrentSnapshot,
53 uint32_t uMediumLevel,
54 uint32_t uSnapshotLevel)
55{
56 HRESULT rc;
57
58 do
59 {
60 // get snapshot machine so we can figure out which diff image this created
61 ComPtr<IMachine> pSnapshotMachine;
62 CHECK_ERROR_BREAK(pThisSnapshot, COMGETTER(Machine)(pSnapshotMachine.asOutParam()));
63
64 // get media attachments
65 SafeIfaceArray<IMediumAttachment> aAttachments;
66 CHECK_ERROR_BREAK(pSnapshotMachine, COMGETTER(MediumAttachments)(ComSafeArrayAsOutParam(aAttachments)));
67
68 for (uint32_t i = 0;
69 i < aAttachments.size();
70 ++i)
71 {
72 ComPtr<IMediumAttachment> pAttach(aAttachments[i]);
73 DeviceType_T type;
74 CHECK_ERROR_BREAK(pAttach, COMGETTER(Type)(&type));
75 if (type == DeviceType_HardDisk)
76 {
77 ComPtr<IMedium> pMediumInSnapshot;
78 CHECK_ERROR_BREAK(pAttach, COMGETTER(Medium)(pMediumInSnapshot.asOutParam()));
79
80 if (pMediumInSnapshot == pMedium)
81 {
82 // get snapshot name
83 Bstr bstrSnapshotName;
84 CHECK_ERROR_BREAK(pThisSnapshot, COMGETTER(Name)(bstrSnapshotName.asOutParam()));
85
86 RTPrintf("%*s \"%ls\"%s\n",
87 50 + uSnapshotLevel * 2, "", // indent
88 bstrSnapshotName.raw(),
89 (pThisSnapshot == pCurrentSnapshot) ? " (CURSNAP)" : "");
90 return true; // found
91 }
92 }
93 }
94
95 // not found: then recurse into child snapshots
96 SafeIfaceArray<ISnapshot> aSnapshots;
97 CHECK_ERROR_BREAK(pThisSnapshot, COMGETTER(Children)(ComSafeArrayAsOutParam(aSnapshots)));
98
99 for (uint32_t i = 0;
100 i < aSnapshots.size();
101 ++i)
102 {
103 ComPtr<ISnapshot> pChild(aSnapshots[i]);
104 if (FindAndPrintSnapshotUsingMedium(pMedium,
105 pChild,
106 pCurrentSnapshot,
107 uMediumLevel,
108 uSnapshotLevel + 1))
109 // found:
110 break;
111 }
112 } while (0);
113
114 return false;
115}
116
117/**
118 * Helper function used with "VBoxManage snapshot ... dump". Called from DumpSnapshot()
119 * for each hard disk attachment found in a virtual machine. This then writes out the
120 * root (base) medium for that hard disk attachment and recurses into the children
121 * tree of that medium, correlating it with the snapshots of the machine.
122 * @param pCurrentStateMedium constant, the medium listed in the current machine data (latest diff image).
123 * @param pMedium variant, initially the base medium, then a child of the base medium when recursing.
124 * @param pRootSnapshot constant, the root snapshot of the machine, if any; this then looks into the child snapshots.
125 * @param pCurrentSnapshot constant, the machine's current snapshot (so we can mark it in the output).
126 * @param uLevel variant, the recursion level for output indentation.
127 */
128void DumpMediumWithChildren(ComPtr<IMedium> &pCurrentStateMedium,
129 ComPtr<IMedium> &pMedium,
130 ComPtr<ISnapshot> &pRootSnapshot,
131 ComPtr<ISnapshot> &pCurrentSnapshot,
132 uint32_t uLevel)
133{
134 HRESULT rc;
135 do
136 {
137 // print this medium
138 Bstr bstrMediumName;
139 CHECK_ERROR_BREAK(pMedium, COMGETTER(Name)(bstrMediumName.asOutParam()));
140 RTPrintf("%*s \"%ls\"%s\n",
141 uLevel * 2, "", // indent
142 bstrMediumName.raw(),
143 (pCurrentStateMedium == pMedium) ? " (CURSTATE)" : "");
144
145 // find and print the snapshot that uses this particular medium (diff image)
146 FindAndPrintSnapshotUsingMedium(pMedium, pRootSnapshot, pCurrentSnapshot, uLevel, 0);
147
148 // recurse into children
149 SafeIfaceArray<IMedium> aChildren;
150 CHECK_ERROR_BREAK(pMedium, COMGETTER(Children)(ComSafeArrayAsOutParam(aChildren)));
151 for (uint32_t i = 0;
152 i < aChildren.size();
153 ++i)
154 {
155 ComPtr<IMedium> pChild(aChildren[i]);
156 DumpMediumWithChildren(pCurrentStateMedium, pChild, pRootSnapshot, pCurrentSnapshot, uLevel + 1);
157 }
158 } while (0);
159}
160
161
162/**
163 * Handles the 'snapshot myvm list' sub-command.
164 * @returns Exit code.
165 * @param pArgs The handler argument package.
166 * @param pMachine Reference to the VM (locked) we're operating on.
167 */
168static RTEXITCODE handleSnapshotList(HandlerArg *pArgs, ComPtr<IMachine> &pMachine)
169{
170 static const RTGETOPTDEF g_aOptions[] =
171 {
172 { "--details", 'D', RTGETOPT_REQ_NOTHING },
173 { "--machinereadable", 'M', RTGETOPT_REQ_NOTHING },
174 };
175
176 VMINFO_DETAILS enmDetails = VMINFO_STANDARD;
177
178 int c;
179 RTGETOPTUNION ValueUnion;
180 RTGETOPTSTATE GetState;
181 RTGetOptInit(&GetState, pArgs->argc, pArgs->argv, g_aOptions, RT_ELEMENTS(g_aOptions), 2 /*iArg*/, 0 /*fFlags*/);
182 while ((c = RTGetOpt(&GetState, &ValueUnion)))
183 {
184 switch (c)
185 {
186 case 'D': enmDetails = VMINFO_FULL; break;
187 case 'M': enmDetails = VMINFO_MACHINEREADABLE; break;
188 default: return errorGetOpt(USAGE_SNAPSHOT, c, &ValueUnion);
189 }
190 }
191
192 ComPtr<ISnapshot> pSnapshot;
193 HRESULT hrc = pMachine->FindSnapshot(Bstr().raw(), pSnapshot.asOutParam());
194 if (FAILED(hrc))
195 {
196 RTPrintf("This machine does not have any snapshots\n");
197 return RTEXITCODE_FAILURE;
198 }
199 if (pSnapshot)
200 {
201 ComPtr<ISnapshot> pCurrentSnapshot;
202 CHECK_ERROR2I_RET(pMachine, COMGETTER(CurrentSnapshot)(pCurrentSnapshot.asOutParam()), RTEXITCODE_FAILURE);
203 hrc = showSnapshots(pSnapshot, pCurrentSnapshot, enmDetails);
204 if (FAILED(hrc))
205 return RTEXITCODE_FAILURE;
206 }
207 return RTEXITCODE_SUCCESS;
208}
209
210/**
211 * Implementation for "VBoxManage snapshot ... dump". This goes thru the machine's
212 * medium attachments and calls DumpMediumWithChildren() for each hard disk medium found,
213 * which then dumps the parent/child tree of that medium together with the corresponding
214 * snapshots.
215 * @param pMachine Machine to dump snapshots for.
216 */
217void DumpSnapshot(ComPtr<IMachine> &pMachine)
218{
219 HRESULT rc;
220
221 do
222 {
223 // get root snapshot
224 ComPtr<ISnapshot> pSnapshot;
225 CHECK_ERROR_BREAK(pMachine, FindSnapshot(Bstr("").raw(), pSnapshot.asOutParam()));
226
227 // get current snapshot
228 ComPtr<ISnapshot> pCurrentSnapshot;
229 CHECK_ERROR_BREAK(pMachine, COMGETTER(CurrentSnapshot)(pCurrentSnapshot.asOutParam()));
230
231 // get media attachments
232 SafeIfaceArray<IMediumAttachment> aAttachments;
233 CHECK_ERROR_BREAK(pMachine, COMGETTER(MediumAttachments)(ComSafeArrayAsOutParam(aAttachments)));
234 for (uint32_t i = 0;
235 i < aAttachments.size();
236 ++i)
237 {
238 ComPtr<IMediumAttachment> pAttach(aAttachments[i]);
239 DeviceType_T type;
240 CHECK_ERROR_BREAK(pAttach, COMGETTER(Type)(&type));
241 if (type == DeviceType_HardDisk)
242 {
243 ComPtr<IMedium> pCurrentStateMedium;
244 CHECK_ERROR_BREAK(pAttach, COMGETTER(Medium)(pCurrentStateMedium.asOutParam()));
245
246 ComPtr<IMedium> pBaseMedium;
247 CHECK_ERROR_BREAK(pCurrentStateMedium, COMGETTER(Base)(pBaseMedium.asOutParam()));
248
249 Bstr bstrBaseMediumName;
250 CHECK_ERROR_BREAK(pBaseMedium, COMGETTER(Name)(bstrBaseMediumName.asOutParam()));
251
252 RTPrintf("[%RI32] Images and snapshots for medium \"%ls\"\n", i, bstrBaseMediumName.raw());
253
254 DumpMediumWithChildren(pCurrentStateMedium,
255 pBaseMedium,
256 pSnapshot,
257 pCurrentSnapshot,
258 0);
259 }
260 }
261 } while (0);
262}
263
264typedef enum SnapshotUniqueFlags
265{
266 SnapshotUniqueFlags_Null = 0,
267 SnapshotUniqueFlags_Number = RT_BIT(1),
268 SnapshotUniqueFlags_Timestamp = RT_BIT(2),
269 SnapshotUniqueFlags_Space = RT_BIT(16),
270 SnapshotUniqueFlags_Force = RT_BIT(30)
271} SnapshotUniqueFlags;
272
273static int parseSnapshotUniqueFlags(const char *psz, SnapshotUniqueFlags *pUnique)
274{
275 int rc = VINF_SUCCESS;
276 unsigned uUnique = 0;
277 while (psz && *psz && RT_SUCCESS(rc))
278 {
279 size_t len;
280 const char *pszComma = strchr(psz, ',');
281 if (pszComma)
282 len = pszComma - psz;
283 else
284 len = strlen(psz);
285 if (len > 0)
286 {
287 if (!RTStrNICmp(psz, "number", len))
288 uUnique |= SnapshotUniqueFlags_Number;
289 else if (!RTStrNICmp(psz, "timestamp", len))
290 uUnique |= SnapshotUniqueFlags_Timestamp;
291 else if (!RTStrNICmp(psz, "space", len))
292 uUnique |= SnapshotUniqueFlags_Space;
293 else if (!RTStrNICmp(psz, "force", len))
294 uUnique |= SnapshotUniqueFlags_Force;
295 else
296 rc = VERR_PARSE_ERROR;
297 }
298 if (pszComma)
299 psz += len + 1;
300 else
301 psz += len;
302 }
303
304 if (RT_SUCCESS(rc))
305 *pUnique = (SnapshotUniqueFlags)uUnique;
306 return rc;
307}
308
309/**
310 * Implementation for all VBoxManage snapshot ... subcommands.
311 * @param a
312 * @return
313 */
314RTEXITCODE handleSnapshot(HandlerArg *a)
315{
316 HRESULT rc;
317
318 /* we need at least a VM and a command */
319 if (a->argc < 2)
320 return errorSyntax(USAGE_SNAPSHOT, "Not enough parameters");
321
322 /* the first argument must be the VM */
323 Bstr bstrMachine(a->argv[0]);
324 ComPtr<IMachine> pMachine;
325 CHECK_ERROR(a->virtualBox, FindMachine(bstrMachine.raw(),
326 pMachine.asOutParam()));
327 if (!pMachine)
328 return RTEXITCODE_FAILURE;
329
330 /* we have to open a session for this task (new or shared) */
331 CHECK_ERROR_RET(pMachine, LockMachine(a->session, LockType_Shared), RTEXITCODE_FAILURE);
332 do
333 {
334 /* replace the (read-only) IMachine object by a writable one */
335 ComPtr<IMachine> sessionMachine;
336 CHECK_ERROR_BREAK(a->session, COMGETTER(Machine)(sessionMachine.asOutParam()));
337
338 /* switch based on the command */
339 bool fDelete = false,
340 fRestore = false,
341 fRestoreCurrent = false;
342
343 if (!strcmp(a->argv[1], "take"))
344 {
345 /* there must be a name */
346 if (a->argc < 3)
347 {
348 errorSyntax(USAGE_SNAPSHOT, "Missing snapshot name");
349 rc = E_FAIL;
350 break;
351 }
352 Bstr name(a->argv[2]);
353
354 /* parse the optional arguments */
355 Bstr desc;
356 bool fPause = true; /* default is NO live snapshot */
357 SnapshotUniqueFlags enmUnique = SnapshotUniqueFlags_Null;
358 static const RTGETOPTDEF s_aTakeOptions[] =
359 {
360 { "--description", 'd', RTGETOPT_REQ_STRING },
361 { "-description", 'd', RTGETOPT_REQ_STRING },
362 { "-desc", 'd', RTGETOPT_REQ_STRING },
363 { "--pause", 'p', RTGETOPT_REQ_NOTHING },
364 { "--live", 'l', RTGETOPT_REQ_NOTHING },
365 { "--uniquename", 'u', RTGETOPT_REQ_STRING }
366 };
367 RTGETOPTSTATE GetOptState;
368 RTGetOptInit(&GetOptState, a->argc, a->argv, s_aTakeOptions, RT_ELEMENTS(s_aTakeOptions),
369 3, RTGETOPTINIT_FLAGS_NO_STD_OPTS);
370 int ch;
371 RTGETOPTUNION Value;
372 int vrc;
373 while ( SUCCEEDED(rc)
374 && (ch = RTGetOpt(&GetOptState, &Value)))
375 {
376 switch (ch)
377 {
378 case 'p':
379 fPause = true;
380 break;
381
382 case 'l':
383 fPause = false;
384 break;
385
386 case 'd':
387 desc = Value.psz;
388 break;
389
390 case 'u':
391 vrc = parseSnapshotUniqueFlags(Value.psz, &enmUnique);
392 if (RT_FAILURE(vrc))
393 return errorArgument("Invalid unique name description '%s'", Value.psz);
394 break;
395
396 default:
397 errorGetOpt(USAGE_SNAPSHOT, ch, &Value);
398 rc = E_FAIL;
399 break;
400 }
401 }
402 if (FAILED(rc))
403 break;
404
405 if (enmUnique & (SnapshotUniqueFlags_Number | SnapshotUniqueFlags_Timestamp))
406 {
407 ComPtr<ISnapshot> pSnapshot;
408 rc = sessionMachine->FindSnapshot(name.raw(),
409 pSnapshot.asOutParam());
410 if (SUCCEEDED(rc) || (enmUnique & SnapshotUniqueFlags_Force))
411 {
412 /* there is a duplicate, need to create a unique name */
413 uint32_t count = 0;
414 RTTIMESPEC now;
415
416 if (enmUnique & SnapshotUniqueFlags_Number)
417 {
418 if (enmUnique & SnapshotUniqueFlags_Force)
419 count = 1;
420 else
421 count = 2;
422 RTTimeSpecSetNano(&now, 0); /* Shut up MSC */
423 }
424 else
425 RTTimeNow(&now);
426
427 while (count < 500)
428 {
429 Utf8Str suffix;
430 if (enmUnique & SnapshotUniqueFlags_Number)
431 suffix = Utf8StrFmt("%u", count);
432 else
433 {
434 RTTIMESPEC nowplus = now;
435 RTTimeSpecAddSeconds(&nowplus, count);
436 RTTIME stamp;
437 RTTimeExplode(&stamp, &nowplus);
438 suffix = Utf8StrFmt("%04u-%02u-%02uT%02u:%02u:%02uZ", stamp.i32Year, stamp.u8Month, stamp.u8MonthDay, stamp.u8Hour, stamp.u8Minute, stamp.u8Second);
439 }
440 Bstr tryName = name;
441 if (enmUnique & SnapshotUniqueFlags_Space)
442 tryName = BstrFmt("%ls %s", name.raw(), suffix.c_str());
443 else
444 tryName = BstrFmt("%ls%s", name.raw(), suffix.c_str());
445 count++;
446 rc = sessionMachine->FindSnapshot(tryName.raw(),
447 pSnapshot.asOutParam());
448 if (FAILED(rc))
449 {
450 name = tryName;
451 break;
452 }
453 }
454 if (SUCCEEDED(rc))
455 {
456 errorArgument("Failed to generate a unique snapshot name");
457 rc = E_FAIL;
458 break;
459 }
460 }
461 rc = S_OK;
462 }
463
464 ComPtr<IProgress> progress;
465 Bstr snapId;
466 CHECK_ERROR_BREAK(sessionMachine, TakeSnapshot(name.raw(), desc.raw(),
467 fPause, snapId.asOutParam(),
468 progress.asOutParam()));
469
470 rc = showProgress(progress);
471 if (SUCCEEDED(rc))
472 RTPrintf("Snapshot taken. UUID: %ls\n", snapId.raw());
473 else
474 CHECK_PROGRESS_ERROR(progress, ("Failed to take snapshot"));
475 }
476 else if ( (fDelete = !strcmp(a->argv[1], "delete"))
477 || (fRestore = !strcmp(a->argv[1], "restore"))
478 || (fRestoreCurrent = !strcmp(a->argv[1], "restorecurrent"))
479 )
480 {
481 if (fRestoreCurrent)
482 {
483 if (a->argc > 2)
484 {
485 errorSyntax(USAGE_SNAPSHOT, "Too many arguments");
486 rc = E_FAIL;
487 break;
488 }
489 }
490 /* exactly one parameter: snapshot name */
491 else if (a->argc != 3)
492 {
493 errorSyntax(USAGE_SNAPSHOT, "Expecting snapshot name only");
494 rc = E_FAIL;
495 break;
496 }
497
498 ComPtr<ISnapshot> pSnapshot;
499 ComPtr<IProgress> pProgress;
500 Bstr bstrSnapGuid;
501
502 if (fRestoreCurrent)
503 {
504 CHECK_ERROR_BREAK(sessionMachine, COMGETTER(CurrentSnapshot)(pSnapshot.asOutParam()));
505 if (pSnapshot.isNull())
506 {
507 RTPrintf("This machine does not have any snapshots\n");
508 return RTEXITCODE_FAILURE;
509 }
510 }
511 else
512 {
513 // restore or delete snapshot: then resolve cmd line argument to snapshot instance
514 CHECK_ERROR_BREAK(sessionMachine, FindSnapshot(Bstr(a->argv[2]).raw(),
515 pSnapshot.asOutParam()));
516 }
517
518 CHECK_ERROR_BREAK(pSnapshot, COMGETTER(Id)(bstrSnapGuid.asOutParam()));
519
520 if (fDelete)
521 {
522 CHECK_ERROR_BREAK(sessionMachine, DeleteSnapshot(bstrSnapGuid.raw(),
523 pProgress.asOutParam()));
524 }
525 else
526 {
527 // restore or restore current
528 RTPrintf("Restoring snapshot %ls\n", bstrSnapGuid.raw());
529 CHECK_ERROR_BREAK(sessionMachine, RestoreSnapshot(pSnapshot, pProgress.asOutParam()));
530 }
531
532 rc = showProgress(pProgress);
533 CHECK_PROGRESS_ERROR(pProgress, ("Snapshot operation failed"));
534 }
535 else if (!strcmp(a->argv[1], "edit"))
536 {
537 if (a->argc < 3)
538 {
539 errorSyntax(USAGE_SNAPSHOT, "Missing snapshot name");
540 rc = E_FAIL;
541 break;
542 }
543
544 ComPtr<ISnapshot> pSnapshot;
545
546 if ( !strcmp(a->argv[2], "--current")
547 || !strcmp(a->argv[2], "-current"))
548 {
549 CHECK_ERROR_BREAK(sessionMachine, COMGETTER(CurrentSnapshot)(pSnapshot.asOutParam()));
550 if (pSnapshot.isNull())
551 {
552 RTPrintf("This machine does not have any snapshots\n");
553 return RTEXITCODE_FAILURE;
554 }
555 }
556 else
557 {
558 CHECK_ERROR_BREAK(sessionMachine, FindSnapshot(Bstr(a->argv[2]).raw(),
559 pSnapshot.asOutParam()));
560 }
561
562 /* parse options */
563 for (int i = 3; i < a->argc; i++)
564 {
565 if ( !strcmp(a->argv[i], "--name")
566 || !strcmp(a->argv[i], "-name")
567 || !strcmp(a->argv[i], "-newname"))
568 {
569 if (a->argc <= i + 1)
570 {
571 errorArgument("Missing argument to '%s'", a->argv[i]);
572 rc = E_FAIL;
573 break;
574 }
575 i++;
576 pSnapshot->COMSETTER(Name)(Bstr(a->argv[i]).raw());
577 }
578 else if ( !strcmp(a->argv[i], "--description")
579 || !strcmp(a->argv[i], "-description")
580 || !strcmp(a->argv[i], "-newdesc"))
581 {
582 if (a->argc <= i + 1)
583 {
584 errorArgument("Missing argument to '%s'", a->argv[i]);
585 rc = E_FAIL;
586 break;
587 }
588 i++;
589 pSnapshot->COMSETTER(Description)(Bstr(a->argv[i]).raw());
590 }
591 else
592 {
593 errorSyntax(USAGE_SNAPSHOT, "Invalid parameter '%s'", Utf8Str(a->argv[i]).c_str());
594 rc = E_FAIL;
595 break;
596 }
597 }
598
599 }
600 else if (!strcmp(a->argv[1], "showvminfo"))
601 {
602 /* exactly one parameter: snapshot name */
603 if (a->argc != 3)
604 {
605 errorSyntax(USAGE_SNAPSHOT, "Expecting snapshot name only");
606 rc = E_FAIL;
607 break;
608 }
609
610 ComPtr<ISnapshot> pSnapshot;
611
612 CHECK_ERROR_BREAK(sessionMachine, FindSnapshot(Bstr(a->argv[2]).raw(),
613 pSnapshot.asOutParam()));
614
615 /* get the machine of the given snapshot */
616 ComPtr<IMachine> pMachine2;
617 pSnapshot->COMGETTER(Machine)(pMachine2.asOutParam());
618 showVMInfo(a->virtualBox, pMachine2, NULL, VMINFO_NONE);
619 }
620 else if (!strcmp(a->argv[1], "list"))
621 rc = handleSnapshotList(a, sessionMachine) == RTEXITCODE_SUCCESS ? S_OK : E_FAIL;
622 else if (!strcmp(a->argv[1], "dump")) // undocumented parameter to debug snapshot info
623 DumpSnapshot(sessionMachine);
624 else
625 {
626 errorSyntax(USAGE_SNAPSHOT, "Invalid parameter '%s'", Utf8Str(a->argv[1]).c_str());
627 rc = E_FAIL;
628 }
629 } while (0);
630
631 a->session->UnlockMachine();
632
633 return SUCCEEDED(rc) ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE;
634}
635
Note: See TracBrowser for help on using the repository browser.

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