1 | /* $Id: VBoxAutostartUtils.cpp 43912 2012-11-19 12:36:08Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxAutostart - VirtualBox Autostart service, start machines during system boot.
|
---|
4 | * Utils used by the windows and posix frontends.
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2012 Oracle Corporation
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.215389.xyz. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | */
|
---|
18 |
|
---|
19 | #include <VBox/com/com.h>
|
---|
20 | #include <VBox/com/string.h>
|
---|
21 | #include <VBox/com/Guid.h>
|
---|
22 | #include <VBox/com/array.h>
|
---|
23 | #include <VBox/com/ErrorInfo.h>
|
---|
24 | #include <VBox/com/errorprint.h>
|
---|
25 |
|
---|
26 | #include <iprt/message.h>
|
---|
27 | #include <iprt/thread.h>
|
---|
28 | #include <iprt/stream.h>
|
---|
29 | #include <iprt/log.h>
|
---|
30 |
|
---|
31 | #include <algorithm>
|
---|
32 | #include <list>
|
---|
33 | #include <string>
|
---|
34 |
|
---|
35 | #include "VBoxAutostart.h"
|
---|
36 |
|
---|
37 | using namespace com;
|
---|
38 |
|
---|
39 | DECLHIDDEN(const char *) machineStateToName(MachineState_T machineState, bool fShort)
|
---|
40 | {
|
---|
41 | switch (machineState)
|
---|
42 | {
|
---|
43 | case MachineState_PoweredOff:
|
---|
44 | return fShort ? "poweroff" : "powered off";
|
---|
45 | case MachineState_Saved:
|
---|
46 | return "saved";
|
---|
47 | case MachineState_Aborted:
|
---|
48 | return "aborted";
|
---|
49 | case MachineState_Teleported:
|
---|
50 | return "teleported";
|
---|
51 | case MachineState_Running:
|
---|
52 | return "running";
|
---|
53 | case MachineState_Paused:
|
---|
54 | return "paused";
|
---|
55 | case MachineState_Stuck:
|
---|
56 | return fShort ? "gurumeditation" : "guru meditation";
|
---|
57 | case MachineState_LiveSnapshotting:
|
---|
58 | return fShort ? "livesnapshotting" : "live snapshotting";
|
---|
59 | case MachineState_Teleporting:
|
---|
60 | return "teleporting";
|
---|
61 | case MachineState_Starting:
|
---|
62 | return "starting";
|
---|
63 | case MachineState_Stopping:
|
---|
64 | return "stopping";
|
---|
65 | case MachineState_Saving:
|
---|
66 | return "saving";
|
---|
67 | case MachineState_Restoring:
|
---|
68 | return "restoring";
|
---|
69 | case MachineState_TeleportingPausedVM:
|
---|
70 | return fShort ? "teleportingpausedvm" : "teleporting paused vm";
|
---|
71 | case MachineState_TeleportingIn:
|
---|
72 | return fShort ? "teleportingin" : "teleporting (incoming)";
|
---|
73 | case MachineState_RestoringSnapshot:
|
---|
74 | return fShort ? "restoringsnapshot" : "restoring snapshot";
|
---|
75 | case MachineState_DeletingSnapshot:
|
---|
76 | return fShort ? "deletingsnapshot" : "deleting snapshot";
|
---|
77 | case MachineState_DeletingSnapshotOnline:
|
---|
78 | return fShort ? "deletingsnapshotlive" : "deleting snapshot live";
|
---|
79 | case MachineState_DeletingSnapshotPaused:
|
---|
80 | return fShort ? "deletingsnapshotlivepaused" : "deleting snapshot live paused";
|
---|
81 | case MachineState_SettingUp:
|
---|
82 | return fShort ? "settingup" : "setting up";
|
---|
83 | default:
|
---|
84 | break;
|
---|
85 | }
|
---|
86 | return "unknown";
|
---|
87 | }
|
---|
88 |
|
---|