1 | /* $Id: VBoxManageModifyVM.cpp 35239 2010-12-20 12:45:14Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxManage - Implementation of modifyvm command.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2010 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 | * Header Files *
|
---|
20 | *******************************************************************************/
|
---|
21 | #ifndef VBOX_ONLY_DOCS
|
---|
22 | #include <VBox/com/com.h>
|
---|
23 | #include <VBox/com/array.h>
|
---|
24 | #include <VBox/com/ErrorInfo.h>
|
---|
25 | #include <VBox/com/errorprint.h>
|
---|
26 | #include <VBox/com/EventQueue.h>
|
---|
27 |
|
---|
28 | #include <VBox/com/VirtualBox.h>
|
---|
29 | #endif /* !VBOX_ONLY_DOCS */
|
---|
30 |
|
---|
31 | #include <iprt/cidr.h>
|
---|
32 | #include <iprt/param.h>
|
---|
33 | #include <iprt/path.h>
|
---|
34 | #include <iprt/stream.h>
|
---|
35 | #include <iprt/string.h>
|
---|
36 | #include <iprt/getopt.h>
|
---|
37 | #include <VBox/log.h>
|
---|
38 |
|
---|
39 | #include "VBoxManage.h"
|
---|
40 |
|
---|
41 | #ifndef VBOX_ONLY_DOCS
|
---|
42 | using namespace com;
|
---|
43 |
|
---|
44 |
|
---|
45 | /** @todo refine this after HDD changes; MSC 8.0/64 has trouble with handleModifyVM. */
|
---|
46 | #if defined(_MSC_VER)
|
---|
47 | # pragma optimize("g", off)
|
---|
48 | #endif
|
---|
49 |
|
---|
50 | enum
|
---|
51 | {
|
---|
52 | MODIFYVM_NAME = 1000,
|
---|
53 | MODIFYVM_OSTYPE,
|
---|
54 | MODIFYVM_MEMORY,
|
---|
55 | MODIFYVM_PAGEFUSION,
|
---|
56 | MODIFYVM_VRAM,
|
---|
57 | MODIFYVM_FIRMWARE,
|
---|
58 | MODIFYVM_ACPI,
|
---|
59 | MODIFYVM_IOAPIC,
|
---|
60 | MODIFYVM_PAE,
|
---|
61 | MODIFYVM_SYNTHCPU,
|
---|
62 | MODIFYVM_HWVIRTEX,
|
---|
63 | MODIFYVM_HWVIRTEXEXCLUSIVE,
|
---|
64 | MODIFYVM_NESTEDPAGING,
|
---|
65 | MODIFYVM_LARGEPAGES,
|
---|
66 | MODIFYVM_VTXVPID,
|
---|
67 | MODIFYVM_CPUS,
|
---|
68 | MODIFYVM_CPUHOTPLUG,
|
---|
69 | MODIFYVM_PLUGCPU,
|
---|
70 | MODIFYVM_UNPLUGCPU,
|
---|
71 | MODIFYVM_SETCPUID,
|
---|
72 | MODIFYVM_DELCPUID,
|
---|
73 | MODIFYVM_DELALLCPUID,
|
---|
74 | MODIFYVM_MONITORCOUNT,
|
---|
75 | MODIFYVM_ACCELERATE3D,
|
---|
76 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
77 | MODIFYVM_ACCELERATE2DVIDEO,
|
---|
78 | #endif
|
---|
79 | MODIFYVM_BIOSLOGOFADEIN,
|
---|
80 | MODIFYVM_BIOSLOGOFADEOUT,
|
---|
81 | MODIFYVM_BIOSLOGODISPLAYTIME,
|
---|
82 | MODIFYVM_BIOSLOGOIMAGEPATH,
|
---|
83 | MODIFYVM_BIOSBOOTMENU,
|
---|
84 | MODIFYVM_BIOSSYSTEMTIMEOFFSET,
|
---|
85 | MODIFYVM_BIOSPXEDEBUG,
|
---|
86 | MODIFYVM_BOOT,
|
---|
87 | MODIFYVM_HDA, // deprecated
|
---|
88 | MODIFYVM_HDB, // deprecated
|
---|
89 | MODIFYVM_HDD, // deprecated
|
---|
90 | MODIFYVM_IDECONTROLLER, // deprecated
|
---|
91 | MODIFYVM_SATAIDEEMULATION, // deprecated
|
---|
92 | MODIFYVM_SATAPORTCOUNT, // deprecated
|
---|
93 | MODIFYVM_SATAPORT, // deprecated
|
---|
94 | MODIFYVM_SATA, // deprecated
|
---|
95 | MODIFYVM_SCSIPORT, // deprecated
|
---|
96 | MODIFYVM_SCSITYPE, // deprecated
|
---|
97 | MODIFYVM_SCSI, // deprecated
|
---|
98 | MODIFYVM_DVDPASSTHROUGH, // deprecated
|
---|
99 | MODIFYVM_DVD, // deprecated
|
---|
100 | MODIFYVM_FLOPPY, // deprecated
|
---|
101 | MODIFYVM_NICTRACEFILE,
|
---|
102 | MODIFYVM_NICTRACE,
|
---|
103 | MODIFYVM_NICTYPE,
|
---|
104 | MODIFYVM_NICSPEED,
|
---|
105 | MODIFYVM_NICBOOTPRIO,
|
---|
106 | MODIFYVM_NIC,
|
---|
107 | MODIFYVM_CABLECONNECTED,
|
---|
108 | MODIFYVM_BRIDGEADAPTER,
|
---|
109 | MODIFYVM_HOSTONLYADAPTER,
|
---|
110 | MODIFYVM_INTNET,
|
---|
111 | MODIFYVM_NATNET,
|
---|
112 | #ifdef VBOX_WITH_VDE
|
---|
113 | MODIFYVM_VDENET,
|
---|
114 | #endif
|
---|
115 | MODIFYVM_NATBINDIP,
|
---|
116 | MODIFYVM_NATSETTINGS,
|
---|
117 | MODIFYVM_NATPF,
|
---|
118 | MODIFYVM_NATALIASMODE,
|
---|
119 | MODIFYVM_NATTFTPPREFIX,
|
---|
120 | MODIFYVM_NATTFTPFILE,
|
---|
121 | MODIFYVM_NATTFTPSERVER,
|
---|
122 | MODIFYVM_NATDNSPASSDOMAIN,
|
---|
123 | MODIFYVM_NATDNSPROXY,
|
---|
124 | MODIFYVM_NATDNSHOSTRESOLVER,
|
---|
125 | MODIFYVM_MACADDRESS,
|
---|
126 | MODIFYVM_HIDPTR,
|
---|
127 | MODIFYVM_HIDKBD,
|
---|
128 | MODIFYVM_UARTMODE,
|
---|
129 | MODIFYVM_UART,
|
---|
130 | MODIFYVM_GUESTMEMORYBALLOON,
|
---|
131 | MODIFYVM_AUDIOCONTROLLER,
|
---|
132 | MODIFYVM_AUDIO,
|
---|
133 | MODIFYVM_CLIPBOARD,
|
---|
134 | MODIFYVM_VRDPPORT, /* VRDE: deprecated */
|
---|
135 | MODIFYVM_VRDPADDRESS, /* VRDE: deprecated */
|
---|
136 | MODIFYVM_VRDPAUTHTYPE, /* VRDE: deprecated */
|
---|
137 | MODIFYVM_VRDPMULTICON, /* VRDE: deprecated */
|
---|
138 | MODIFYVM_VRDPREUSECON, /* VRDE: deprecated */
|
---|
139 | MODIFYVM_VRDPVIDEOCHANNEL, /* VRDE: deprecated */
|
---|
140 | MODIFYVM_VRDPVIDEOCHANNELQUALITY, /* VRDE: deprecated */
|
---|
141 | MODIFYVM_VRDP, /* VRDE: deprecated */
|
---|
142 | MODIFYVM_VRDEPROPERTY,
|
---|
143 | MODIFYVM_VRDEPORT,
|
---|
144 | MODIFYVM_VRDEADDRESS,
|
---|
145 | MODIFYVM_VRDEAUTHTYPE,
|
---|
146 | MODIFYVM_VRDEAUTHLIBRARY,
|
---|
147 | MODIFYVM_VRDEMULTICON,
|
---|
148 | MODIFYVM_VRDEREUSECON,
|
---|
149 | MODIFYVM_VRDEVIDEOCHANNEL,
|
---|
150 | MODIFYVM_VRDEVIDEOCHANNELQUALITY,
|
---|
151 | MODIFYVM_VRDE_EXTPACK,
|
---|
152 | MODIFYVM_VRDE,
|
---|
153 | MODIFYVM_RTCUSEUTC,
|
---|
154 | MODIFYVM_USBEHCI,
|
---|
155 | MODIFYVM_USB,
|
---|
156 | MODIFYVM_SNAPSHOTFOLDER,
|
---|
157 | MODIFYVM_TELEPORTER_ENABLED,
|
---|
158 | MODIFYVM_TELEPORTER_PORT,
|
---|
159 | MODIFYVM_TELEPORTER_ADDRESS,
|
---|
160 | MODIFYVM_TELEPORTER_PASSWORD,
|
---|
161 | MODIFYVM_HARDWARE_UUID,
|
---|
162 | MODIFYVM_HPET,
|
---|
163 | MODIFYVM_IOCACHE,
|
---|
164 | MODIFYVM_IOCACHESIZE,
|
---|
165 | MODIFYVM_FAULT_TOLERANCE,
|
---|
166 | MODIFYVM_FAULT_TOLERANCE_ADDRESS,
|
---|
167 | MODIFYVM_FAULT_TOLERANCE_PORT,
|
---|
168 | MODIFYVM_FAULT_TOLERANCE_PASSWORD,
|
---|
169 | MODIFYVM_FAULT_TOLERANCE_SYNC_INTERVAL,
|
---|
170 | MODIFYVM_CPU_EXECTUION_CAP,
|
---|
171 | MODIFYVM_CHIPSET
|
---|
172 | };
|
---|
173 |
|
---|
174 | static const RTGETOPTDEF g_aModifyVMOptions[] =
|
---|
175 | {
|
---|
176 | { "--name", MODIFYVM_NAME, RTGETOPT_REQ_STRING },
|
---|
177 | { "--ostype", MODIFYVM_OSTYPE, RTGETOPT_REQ_STRING },
|
---|
178 | { "--memory", MODIFYVM_MEMORY, RTGETOPT_REQ_UINT32 },
|
---|
179 | { "--pagefusion", MODIFYVM_PAGEFUSION, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
180 | { "--vram", MODIFYVM_VRAM, RTGETOPT_REQ_UINT32 },
|
---|
181 | { "--firmware", MODIFYVM_FIRMWARE, RTGETOPT_REQ_STRING },
|
---|
182 | { "--acpi", MODIFYVM_ACPI, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
183 | { "--ioapic", MODIFYVM_IOAPIC, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
184 | { "--pae", MODIFYVM_PAE, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
185 | { "--synthcpu", MODIFYVM_SYNTHCPU, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
186 | { "--hwvirtex", MODIFYVM_HWVIRTEX, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
187 | { "--hwvirtexexcl", MODIFYVM_HWVIRTEXEXCLUSIVE, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
188 | { "--nestedpaging", MODIFYVM_NESTEDPAGING, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
189 | { "--largepages", MODIFYVM_LARGEPAGES, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
190 | { "--vtxvpid", MODIFYVM_VTXVPID, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
191 | { "--cpuidset", MODIFYVM_SETCPUID, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX},
|
---|
192 | { "--cpuidremove", MODIFYVM_DELCPUID, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX},
|
---|
193 | { "--cpuidremoveall", MODIFYVM_DELALLCPUID, RTGETOPT_REQ_NOTHING},
|
---|
194 | { "--cpus", MODIFYVM_CPUS, RTGETOPT_REQ_UINT32 },
|
---|
195 | { "--cpuhotplug", MODIFYVM_CPUHOTPLUG, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
196 | { "--plugcpu", MODIFYVM_PLUGCPU, RTGETOPT_REQ_UINT32 },
|
---|
197 | { "--unplugcpu", MODIFYVM_UNPLUGCPU, RTGETOPT_REQ_UINT32 },
|
---|
198 | { "--cpuexecutioncap", MODIFYVM_CPU_EXECTUION_CAP, RTGETOPT_REQ_UINT32 },
|
---|
199 | { "--rtcuseutc", MODIFYVM_RTCUSEUTC, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
200 | { "--monitorcount", MODIFYVM_MONITORCOUNT, RTGETOPT_REQ_UINT32 },
|
---|
201 | { "--accelerate3d", MODIFYVM_ACCELERATE3D, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
202 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
203 | { "--accelerate2dvideo", MODIFYVM_ACCELERATE2DVIDEO, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
204 | #endif
|
---|
205 | { "--bioslogofadein", MODIFYVM_BIOSLOGOFADEIN, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
206 | { "--bioslogofadeout", MODIFYVM_BIOSLOGOFADEOUT, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
207 | { "--bioslogodisplaytime", MODIFYVM_BIOSLOGODISPLAYTIME, RTGETOPT_REQ_UINT32 },
|
---|
208 | { "--bioslogoimagepath", MODIFYVM_BIOSLOGOIMAGEPATH, RTGETOPT_REQ_STRING },
|
---|
209 | { "--biosbootmenu", MODIFYVM_BIOSBOOTMENU, RTGETOPT_REQ_STRING },
|
---|
210 | { "--biossystemtimeoffset", MODIFYVM_BIOSSYSTEMTIMEOFFSET, RTGETOPT_REQ_INT64 },
|
---|
211 | { "--biospxedebug", MODIFYVM_BIOSPXEDEBUG, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
212 | { "--boot", MODIFYVM_BOOT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
213 | { "--hda", MODIFYVM_HDA, RTGETOPT_REQ_STRING },
|
---|
214 | { "--hdb", MODIFYVM_HDB, RTGETOPT_REQ_STRING },
|
---|
215 | { "--hdd", MODIFYVM_HDD, RTGETOPT_REQ_STRING },
|
---|
216 | { "--idecontroller", MODIFYVM_IDECONTROLLER, RTGETOPT_REQ_STRING },
|
---|
217 | { "--sataideemulation", MODIFYVM_SATAIDEEMULATION, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_INDEX },
|
---|
218 | { "--sataportcount", MODIFYVM_SATAPORTCOUNT, RTGETOPT_REQ_UINT32 },
|
---|
219 | { "--sataport", MODIFYVM_SATAPORT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
220 | { "--sata", MODIFYVM_SATA, RTGETOPT_REQ_STRING },
|
---|
221 | { "--scsiport", MODIFYVM_SCSIPORT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
222 | { "--scsitype", MODIFYVM_SCSITYPE, RTGETOPT_REQ_STRING },
|
---|
223 | { "--scsi", MODIFYVM_SCSI, RTGETOPT_REQ_STRING },
|
---|
224 | { "--dvdpassthrough", MODIFYVM_DVDPASSTHROUGH, RTGETOPT_REQ_STRING },
|
---|
225 | { "--dvd", MODIFYVM_DVD, RTGETOPT_REQ_STRING },
|
---|
226 | { "--floppy", MODIFYVM_FLOPPY, RTGETOPT_REQ_STRING },
|
---|
227 | { "--nictracefile", MODIFYVM_NICTRACEFILE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
228 | { "--nictrace", MODIFYVM_NICTRACE, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
|
---|
229 | { "--nictype", MODIFYVM_NICTYPE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
230 | { "--nicspeed", MODIFYVM_NICSPEED, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_INDEX },
|
---|
231 | { "--nicbootprio", MODIFYVM_NICBOOTPRIO, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_INDEX },
|
---|
232 | { "--nic", MODIFYVM_NIC, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
233 | { "--cableconnected", MODIFYVM_CABLECONNECTED, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
|
---|
234 | { "--bridgeadapter", MODIFYVM_BRIDGEADAPTER, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
235 | { "--hostonlyadapter", MODIFYVM_HOSTONLYADAPTER, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
236 | { "--intnet", MODIFYVM_INTNET, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
237 | { "--natnet", MODIFYVM_NATNET, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
238 | #ifdef VBOX_WITH_VDE
|
---|
239 | { "--vdenet", MODIFYVM_VDENET, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
240 | #endif
|
---|
241 | { "--natbindip", MODIFYVM_NATBINDIP, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
242 | { "--natsettings", MODIFYVM_NATSETTINGS, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
243 | { "--natpf", MODIFYVM_NATPF, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
244 | { "--nataliasmode", MODIFYVM_NATALIASMODE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
245 | { "--nattftpprefix", MODIFYVM_NATTFTPPREFIX, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
246 | { "--nattftpfile", MODIFYVM_NATTFTPFILE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
247 | { "--nattftpserver", MODIFYVM_NATTFTPSERVER, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
248 | { "--natdnspassdomain", MODIFYVM_NATDNSPASSDOMAIN, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
|
---|
249 | { "--natdnsproxy", MODIFYVM_NATDNSPROXY, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
|
---|
250 | { "--natdnshostresolver", MODIFYVM_NATDNSHOSTRESOLVER, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
|
---|
251 | { "--macaddress", MODIFYVM_MACADDRESS, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
252 | { "--mouse", MODIFYVM_HIDPTR, RTGETOPT_REQ_STRING },
|
---|
253 | { "--keyboard", MODIFYVM_HIDKBD, RTGETOPT_REQ_STRING },
|
---|
254 | { "--uartmode", MODIFYVM_UARTMODE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
255 | { "--uart", MODIFYVM_UART, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
256 | { "--guestmemoryballoon", MODIFYVM_GUESTMEMORYBALLOON, RTGETOPT_REQ_UINT32 },
|
---|
257 | { "--audiocontroller", MODIFYVM_AUDIOCONTROLLER, RTGETOPT_REQ_STRING },
|
---|
258 | { "--audio", MODIFYVM_AUDIO, RTGETOPT_REQ_STRING },
|
---|
259 | { "--clipboard", MODIFYVM_CLIPBOARD, RTGETOPT_REQ_STRING },
|
---|
260 | { "--vrdpport", MODIFYVM_VRDPPORT, RTGETOPT_REQ_STRING }, /* deprecated */
|
---|
261 | { "--vrdpaddress", MODIFYVM_VRDPADDRESS, RTGETOPT_REQ_STRING }, /* deprecated */
|
---|
262 | { "--vrdpauthtype", MODIFYVM_VRDPAUTHTYPE, RTGETOPT_REQ_STRING }, /* deprecated */
|
---|
263 | { "--vrdpmulticon", MODIFYVM_VRDPMULTICON, RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
|
---|
264 | { "--vrdpreusecon", MODIFYVM_VRDPREUSECON, RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
|
---|
265 | { "--vrdpvideochannel", MODIFYVM_VRDPVIDEOCHANNEL, RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
|
---|
266 | { "--vrdpvideochannelquality", MODIFYVM_VRDPVIDEOCHANNELQUALITY, RTGETOPT_REQ_STRING }, /* deprecated */
|
---|
267 | { "--vrdp", MODIFYVM_VRDP, RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
|
---|
268 | { "--vrdeproperty", MODIFYVM_VRDEPROPERTY, RTGETOPT_REQ_STRING },
|
---|
269 | { "--vrdeport", MODIFYVM_VRDEPORT, RTGETOPT_REQ_STRING },
|
---|
270 | { "--vrdeaddress", MODIFYVM_VRDEADDRESS, RTGETOPT_REQ_STRING },
|
---|
271 | { "--vrdeauthtype", MODIFYVM_VRDEAUTHTYPE, RTGETOPT_REQ_STRING },
|
---|
272 | { "--vrdeauthlibrary", MODIFYVM_VRDEAUTHLIBRARY, RTGETOPT_REQ_STRING },
|
---|
273 | { "--vrdemulticon", MODIFYVM_VRDEMULTICON, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
274 | { "--vrdereusecon", MODIFYVM_VRDEREUSECON, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
275 | { "--vrdevideochannel", MODIFYVM_VRDEVIDEOCHANNEL, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
276 | { "--vrdevideochannelquality", MODIFYVM_VRDEVIDEOCHANNELQUALITY, RTGETOPT_REQ_STRING },
|
---|
277 | { "--vrdeextpack", MODIFYVM_VRDE_EXTPACK, RTGETOPT_REQ_STRING },
|
---|
278 | { "--vrde", MODIFYVM_VRDE, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
279 | { "--usbehci", MODIFYVM_USBEHCI, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
280 | { "--usb", MODIFYVM_USB, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
281 | { "--snapshotfolder", MODIFYVM_SNAPSHOTFOLDER, RTGETOPT_REQ_STRING },
|
---|
282 | { "--teleporter", MODIFYVM_TELEPORTER_ENABLED, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
283 | { "--teleporterenabled", MODIFYVM_TELEPORTER_ENABLED, RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
|
---|
284 | { "--teleporterport", MODIFYVM_TELEPORTER_PORT, RTGETOPT_REQ_UINT32 },
|
---|
285 | { "--teleporteraddress", MODIFYVM_TELEPORTER_ADDRESS, RTGETOPT_REQ_STRING },
|
---|
286 | { "--teleporterpassword", MODIFYVM_TELEPORTER_PASSWORD, RTGETOPT_REQ_STRING },
|
---|
287 | { "--hardwareuuid", MODIFYVM_HARDWARE_UUID, RTGETOPT_REQ_STRING },
|
---|
288 | { "--hpet", MODIFYVM_HPET, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
289 | { "--iocache", MODIFYVM_IOCACHE, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
290 | { "--iocachesize", MODIFYVM_IOCACHESIZE, RTGETOPT_REQ_UINT32 },
|
---|
291 | { "--faulttolerance", MODIFYVM_FAULT_TOLERANCE, RTGETOPT_REQ_STRING },
|
---|
292 | { "--faulttoleranceaddress", MODIFYVM_FAULT_TOLERANCE_ADDRESS, RTGETOPT_REQ_STRING },
|
---|
293 | { "--faulttoleranceport", MODIFYVM_FAULT_TOLERANCE_PORT, RTGETOPT_REQ_UINT32 },
|
---|
294 | { "--faulttolerancepassword", MODIFYVM_FAULT_TOLERANCE_PASSWORD, RTGETOPT_REQ_STRING },
|
---|
295 | { "--faulttolerancesyncinterval", MODIFYVM_FAULT_TOLERANCE_SYNC_INTERVAL, RTGETOPT_REQ_UINT32 },
|
---|
296 | { "--chipset", MODIFYVM_CHIPSET, RTGETOPT_REQ_STRING },
|
---|
297 | };
|
---|
298 |
|
---|
299 | static void vrdeWarningDeprecatedOption(const char *pszOption)
|
---|
300 | {
|
---|
301 | RTStrmPrintf(g_pStdErr, "Warning: '--vrdp%s' is deprecated. Use '--vrde%s'.\n", pszOption, pszOption);
|
---|
302 | }
|
---|
303 |
|
---|
304 |
|
---|
305 | int handleModifyVM(HandlerArg *a)
|
---|
306 | {
|
---|
307 | int c;
|
---|
308 | HRESULT rc;
|
---|
309 | Bstr name;
|
---|
310 | RTGETOPTUNION ValueUnion;
|
---|
311 | RTGETOPTSTATE GetOptState;
|
---|
312 | ComPtr <IMachine> machine;
|
---|
313 | ComPtr <IBIOSSettings> biosSettings;
|
---|
314 |
|
---|
315 | /* VM ID + at least one parameter. Parameter arguments are checked
|
---|
316 | * individually. */
|
---|
317 | if (a->argc < 2)
|
---|
318 | return errorSyntax(USAGE_MODIFYVM, "Not enough parameters");
|
---|
319 |
|
---|
320 | /* Get the number of network adapters */
|
---|
321 | ULONG NetworkAdapterCount = 0;
|
---|
322 | {
|
---|
323 | ComPtr <ISystemProperties> info;
|
---|
324 | CHECK_ERROR_RET(a->virtualBox, COMGETTER(SystemProperties)(info.asOutParam()), 1);
|
---|
325 | CHECK_ERROR_RET(info, COMGETTER(NetworkAdapterCount)(&NetworkAdapterCount), 1);
|
---|
326 | }
|
---|
327 | ULONG SerialPortCount = 0;
|
---|
328 | {
|
---|
329 | ComPtr <ISystemProperties> info;
|
---|
330 | CHECK_ERROR_RET(a->virtualBox, COMGETTER(SystemProperties)(info.asOutParam()), 1);
|
---|
331 | CHECK_ERROR_RET(info, COMGETTER(SerialPortCount)(&SerialPortCount), 1);
|
---|
332 | }
|
---|
333 |
|
---|
334 | /* try to find the given machine */
|
---|
335 | CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(),
|
---|
336 | machine.asOutParam()), 1);
|
---|
337 |
|
---|
338 | /* open a session for the VM */
|
---|
339 | CHECK_ERROR_RET(machine, LockMachine(a->session, LockType_Write), 1);
|
---|
340 |
|
---|
341 | /* get the mutable session machine */
|
---|
342 | a->session->COMGETTER(Machine)(machine.asOutParam());
|
---|
343 | machine->COMGETTER(BIOSSettings)(biosSettings.asOutParam());
|
---|
344 |
|
---|
345 | RTGetOptInit(&GetOptState, a->argc, a->argv, g_aModifyVMOptions,
|
---|
346 | RT_ELEMENTS(g_aModifyVMOptions), 1, RTGETOPTINIT_FLAGS_NO_STD_OPTS);
|
---|
347 |
|
---|
348 | while ( SUCCEEDED (rc)
|
---|
349 | && (c = RTGetOpt(&GetOptState, &ValueUnion)))
|
---|
350 | {
|
---|
351 | switch (c)
|
---|
352 | {
|
---|
353 | case MODIFYVM_NAME:
|
---|
354 | {
|
---|
355 | CHECK_ERROR(machine, COMSETTER(Name)(Bstr(ValueUnion.psz).raw()));
|
---|
356 | break;
|
---|
357 | }
|
---|
358 | case MODIFYVM_OSTYPE:
|
---|
359 | {
|
---|
360 | ComPtr<IGuestOSType> guestOSType;
|
---|
361 | CHECK_ERROR(a->virtualBox, GetGuestOSType(Bstr(ValueUnion.psz).raw(),
|
---|
362 | guestOSType.asOutParam()));
|
---|
363 | if (SUCCEEDED(rc) && guestOSType)
|
---|
364 | {
|
---|
365 | CHECK_ERROR(machine, COMSETTER(OSTypeId)(Bstr(ValueUnion.psz).raw()));
|
---|
366 | }
|
---|
367 | else
|
---|
368 | {
|
---|
369 | errorArgument("Invalid guest OS type '%s'", Utf8Str(ValueUnion.psz).c_str());
|
---|
370 | rc = E_FAIL;
|
---|
371 | }
|
---|
372 | break;
|
---|
373 | }
|
---|
374 |
|
---|
375 | case MODIFYVM_MEMORY:
|
---|
376 | {
|
---|
377 | CHECK_ERROR(machine, COMSETTER(MemorySize)(ValueUnion.u32));
|
---|
378 | break;
|
---|
379 | }
|
---|
380 |
|
---|
381 | case MODIFYVM_PAGEFUSION:
|
---|
382 | {
|
---|
383 | CHECK_ERROR(machine, COMSETTER(PageFusionEnabled)(ValueUnion.f));
|
---|
384 | break;
|
---|
385 | }
|
---|
386 |
|
---|
387 | case MODIFYVM_VRAM:
|
---|
388 | {
|
---|
389 | CHECK_ERROR(machine, COMSETTER(VRAMSize)(ValueUnion.u32));
|
---|
390 | break;
|
---|
391 | }
|
---|
392 |
|
---|
393 | case MODIFYVM_FIRMWARE:
|
---|
394 | {
|
---|
395 | if (!strcmp(ValueUnion.psz, "efi"))
|
---|
396 | {
|
---|
397 | CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI));
|
---|
398 | }
|
---|
399 | else if (!strcmp(ValueUnion.psz, "efi32"))
|
---|
400 | {
|
---|
401 | CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI32));
|
---|
402 | }
|
---|
403 | else if (!strcmp(ValueUnion.psz, "efi64"))
|
---|
404 | {
|
---|
405 | CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI64));
|
---|
406 | }
|
---|
407 | else if (!strcmp(ValueUnion.psz, "efidual"))
|
---|
408 | {
|
---|
409 | CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFIDUAL));
|
---|
410 | }
|
---|
411 | else if (!strcmp(ValueUnion.psz, "bios"))
|
---|
412 | {
|
---|
413 | CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_BIOS));
|
---|
414 | }
|
---|
415 | else
|
---|
416 | {
|
---|
417 | errorArgument("Invalid --firmware argument '%s'", ValueUnion.psz);
|
---|
418 | rc = E_FAIL;
|
---|
419 | }
|
---|
420 | break;
|
---|
421 | }
|
---|
422 |
|
---|
423 | case MODIFYVM_ACPI:
|
---|
424 | {
|
---|
425 | CHECK_ERROR(biosSettings, COMSETTER(ACPIEnabled)(ValueUnion.f));
|
---|
426 | break;
|
---|
427 | }
|
---|
428 |
|
---|
429 | case MODIFYVM_IOAPIC:
|
---|
430 | {
|
---|
431 | CHECK_ERROR(biosSettings, COMSETTER(IOAPICEnabled)(ValueUnion.f));
|
---|
432 | break;
|
---|
433 | }
|
---|
434 |
|
---|
435 | case MODIFYVM_PAE:
|
---|
436 | {
|
---|
437 | CHECK_ERROR(machine, SetCPUProperty(CPUPropertyType_PAE, ValueUnion.f));
|
---|
438 | break;
|
---|
439 | }
|
---|
440 |
|
---|
441 | case MODIFYVM_SYNTHCPU:
|
---|
442 | {
|
---|
443 | CHECK_ERROR(machine, SetCPUProperty(CPUPropertyType_Synthetic, ValueUnion.f));
|
---|
444 | break;
|
---|
445 | }
|
---|
446 |
|
---|
447 | case MODIFYVM_HWVIRTEX:
|
---|
448 | {
|
---|
449 | CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_Enabled, ValueUnion.f));
|
---|
450 | break;
|
---|
451 | }
|
---|
452 |
|
---|
453 | case MODIFYVM_HWVIRTEXEXCLUSIVE:
|
---|
454 | {
|
---|
455 | CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_Exclusive, ValueUnion.f));
|
---|
456 | break;
|
---|
457 | }
|
---|
458 |
|
---|
459 | case MODIFYVM_SETCPUID:
|
---|
460 | {
|
---|
461 | uint32_t id = ValueUnion.u32;
|
---|
462 | uint32_t aValue[4];
|
---|
463 |
|
---|
464 | for (unsigned i = 0 ; i < 4 ; i++)
|
---|
465 | {
|
---|
466 | int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX);
|
---|
467 | if (RT_FAILURE(vrc))
|
---|
468 | return errorSyntax(USAGE_MODIFYVM,
|
---|
469 | "Missing or Invalid argument to '%s'",
|
---|
470 | GetOptState.pDef->pszLong);
|
---|
471 | aValue[i] = ValueUnion.u32;
|
---|
472 | }
|
---|
473 | CHECK_ERROR(machine, SetCPUIDLeaf(id, aValue[0], aValue[1], aValue[2], aValue[3]));
|
---|
474 | break;
|
---|
475 | }
|
---|
476 |
|
---|
477 | case MODIFYVM_DELCPUID:
|
---|
478 | {
|
---|
479 | CHECK_ERROR(machine, RemoveCPUIDLeaf(ValueUnion.u32));
|
---|
480 | break;
|
---|
481 | }
|
---|
482 |
|
---|
483 | case MODIFYVM_DELALLCPUID:
|
---|
484 | {
|
---|
485 | CHECK_ERROR(machine, RemoveAllCPUIDLeaves());
|
---|
486 | break;
|
---|
487 | }
|
---|
488 |
|
---|
489 | case MODIFYVM_NESTEDPAGING:
|
---|
490 | {
|
---|
491 | CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_NestedPaging, ValueUnion.f));
|
---|
492 | break;
|
---|
493 | }
|
---|
494 |
|
---|
495 | case MODIFYVM_LARGEPAGES:
|
---|
496 | {
|
---|
497 | CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_LargePages, ValueUnion.f));
|
---|
498 | break;
|
---|
499 | }
|
---|
500 |
|
---|
501 | case MODIFYVM_VTXVPID:
|
---|
502 | {
|
---|
503 | CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_VPID, ValueUnion.f));
|
---|
504 | break;
|
---|
505 | }
|
---|
506 |
|
---|
507 | case MODIFYVM_CPUS:
|
---|
508 | {
|
---|
509 | CHECK_ERROR(machine, COMSETTER(CPUCount)(ValueUnion.u32));
|
---|
510 | break;
|
---|
511 | }
|
---|
512 |
|
---|
513 | case MODIFYVM_RTCUSEUTC:
|
---|
514 | {
|
---|
515 | CHECK_ERROR(machine, COMSETTER(RTCUseUTC)(ValueUnion.f));
|
---|
516 | break;
|
---|
517 | }
|
---|
518 |
|
---|
519 | case MODIFYVM_CPUHOTPLUG:
|
---|
520 | {
|
---|
521 | CHECK_ERROR(machine, COMSETTER(CPUHotPlugEnabled)(ValueUnion.f));
|
---|
522 | break;
|
---|
523 | }
|
---|
524 |
|
---|
525 | case MODIFYVM_PLUGCPU:
|
---|
526 | {
|
---|
527 | CHECK_ERROR(machine, HotPlugCPU(ValueUnion.u32));
|
---|
528 | break;
|
---|
529 | }
|
---|
530 |
|
---|
531 | case MODIFYVM_UNPLUGCPU:
|
---|
532 | {
|
---|
533 | CHECK_ERROR(machine, HotUnplugCPU(ValueUnion.u32));
|
---|
534 | break;
|
---|
535 | }
|
---|
536 |
|
---|
537 | case MODIFYVM_CPU_EXECTUION_CAP:
|
---|
538 | {
|
---|
539 | CHECK_ERROR(machine, COMSETTER(CPUExecutionCap)(ValueUnion.u32));
|
---|
540 | break;
|
---|
541 | }
|
---|
542 |
|
---|
543 | case MODIFYVM_MONITORCOUNT:
|
---|
544 | {
|
---|
545 | CHECK_ERROR(machine, COMSETTER(MonitorCount)(ValueUnion.u32));
|
---|
546 | break;
|
---|
547 | }
|
---|
548 |
|
---|
549 | case MODIFYVM_ACCELERATE3D:
|
---|
550 | {
|
---|
551 | CHECK_ERROR(machine, COMSETTER(Accelerate3DEnabled)(ValueUnion.f));
|
---|
552 | break;
|
---|
553 | }
|
---|
554 |
|
---|
555 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
556 | case MODIFYVM_ACCELERATE2DVIDEO:
|
---|
557 | {
|
---|
558 | CHECK_ERROR(machine, COMSETTER(Accelerate2DVideoEnabled)(ValueUnion.f));
|
---|
559 | break;
|
---|
560 | }
|
---|
561 | #endif
|
---|
562 |
|
---|
563 | case MODIFYVM_BIOSLOGOFADEIN:
|
---|
564 | {
|
---|
565 | CHECK_ERROR(biosSettings, COMSETTER(LogoFadeIn)(ValueUnion.f));
|
---|
566 | break;
|
---|
567 | }
|
---|
568 |
|
---|
569 | case MODIFYVM_BIOSLOGOFADEOUT:
|
---|
570 | {
|
---|
571 | CHECK_ERROR(biosSettings, COMSETTER(LogoFadeOut)(ValueUnion.f));
|
---|
572 | break;
|
---|
573 | }
|
---|
574 |
|
---|
575 | case MODIFYVM_BIOSLOGODISPLAYTIME:
|
---|
576 | {
|
---|
577 | CHECK_ERROR(biosSettings, COMSETTER(LogoDisplayTime)(ValueUnion.u32));
|
---|
578 | break;
|
---|
579 | }
|
---|
580 |
|
---|
581 | case MODIFYVM_BIOSLOGOIMAGEPATH:
|
---|
582 | {
|
---|
583 | CHECK_ERROR(biosSettings, COMSETTER(LogoImagePath)(Bstr(ValueUnion.psz).raw()));
|
---|
584 | break;
|
---|
585 | }
|
---|
586 |
|
---|
587 | case MODIFYVM_BIOSBOOTMENU:
|
---|
588 | {
|
---|
589 | if (!strcmp(ValueUnion.psz, "disabled"))
|
---|
590 | {
|
---|
591 | CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_Disabled));
|
---|
592 | }
|
---|
593 | else if (!strcmp(ValueUnion.psz, "menuonly"))
|
---|
594 | {
|
---|
595 | CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_MenuOnly));
|
---|
596 | }
|
---|
597 | else if (!strcmp(ValueUnion.psz, "messageandmenu"))
|
---|
598 | {
|
---|
599 | CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_MessageAndMenu));
|
---|
600 | }
|
---|
601 | else
|
---|
602 | {
|
---|
603 | errorArgument("Invalid --biosbootmenu argument '%s'", ValueUnion.psz);
|
---|
604 | rc = E_FAIL;
|
---|
605 | }
|
---|
606 | break;
|
---|
607 | }
|
---|
608 |
|
---|
609 | case MODIFYVM_BIOSSYSTEMTIMEOFFSET:
|
---|
610 | {
|
---|
611 | CHECK_ERROR(biosSettings, COMSETTER(TimeOffset)(ValueUnion.i64));
|
---|
612 | break;
|
---|
613 | }
|
---|
614 |
|
---|
615 | case MODIFYVM_BIOSPXEDEBUG:
|
---|
616 | {
|
---|
617 | CHECK_ERROR(biosSettings, COMSETTER(PXEDebugEnabled)(ValueUnion.f));
|
---|
618 | break;
|
---|
619 | }
|
---|
620 |
|
---|
621 | case MODIFYVM_BOOT:
|
---|
622 | {
|
---|
623 | if (!strcmp(ValueUnion.psz, "none"))
|
---|
624 | {
|
---|
625 | CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_Null));
|
---|
626 | }
|
---|
627 | else if (!strcmp(ValueUnion.psz, "floppy"))
|
---|
628 | {
|
---|
629 | CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_Floppy));
|
---|
630 | }
|
---|
631 | else if (!strcmp(ValueUnion.psz, "dvd"))
|
---|
632 | {
|
---|
633 | CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_DVD));
|
---|
634 | }
|
---|
635 | else if (!strcmp(ValueUnion.psz, "disk"))
|
---|
636 | {
|
---|
637 | CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_HardDisk));
|
---|
638 | }
|
---|
639 | else if (!strcmp(ValueUnion.psz, "net"))
|
---|
640 | {
|
---|
641 | CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_Network));
|
---|
642 | }
|
---|
643 | else
|
---|
644 | return errorArgument("Invalid boot device '%s'", ValueUnion.psz);
|
---|
645 | break;
|
---|
646 | }
|
---|
647 |
|
---|
648 | case MODIFYVM_HDA: // deprecated
|
---|
649 | case MODIFYVM_HDB: // deprecated
|
---|
650 | case MODIFYVM_HDD: // deprecated
|
---|
651 | case MODIFYVM_SATAPORT: // deprecated
|
---|
652 | {
|
---|
653 | uint32_t u1 = 0, u2 = 0;
|
---|
654 | Bstr bstrController = L"IDE Controller";
|
---|
655 |
|
---|
656 | switch (c)
|
---|
657 | {
|
---|
658 | case MODIFYVM_HDA: // deprecated
|
---|
659 | u1 = 0;
|
---|
660 | break;
|
---|
661 |
|
---|
662 | case MODIFYVM_HDB: // deprecated
|
---|
663 | u1 = 0;
|
---|
664 | u2 = 1;
|
---|
665 | break;
|
---|
666 |
|
---|
667 | case MODIFYVM_HDD: // deprecated
|
---|
668 | u1 = 1;
|
---|
669 | u2 = 1;
|
---|
670 | break;
|
---|
671 |
|
---|
672 | case MODIFYVM_SATAPORT: // deprecated
|
---|
673 | u1 = GetOptState.uIndex;
|
---|
674 | bstrController = L"SATA";
|
---|
675 | break;
|
---|
676 | }
|
---|
677 |
|
---|
678 | if (!strcmp(ValueUnion.psz, "none"))
|
---|
679 | {
|
---|
680 | machine->DetachDevice(bstrController.raw(), u1, u2);
|
---|
681 | }
|
---|
682 | else
|
---|
683 | {
|
---|
684 | ComPtr<IMedium> hardDisk;
|
---|
685 | rc = findOrOpenMedium(a, ValueUnion.psz, DeviceType_HardDisk,
|
---|
686 | hardDisk, NULL);
|
---|
687 | if (FAILED(rc))
|
---|
688 | break;
|
---|
689 | if (hardDisk)
|
---|
690 | {
|
---|
691 | CHECK_ERROR(machine, AttachDevice(bstrController.raw(),
|
---|
692 | u1, u2,
|
---|
693 | DeviceType_HardDisk,
|
---|
694 | hardDisk));
|
---|
695 | }
|
---|
696 | else
|
---|
697 | rc = E_FAIL;
|
---|
698 | }
|
---|
699 | break;
|
---|
700 | }
|
---|
701 |
|
---|
702 | case MODIFYVM_IDECONTROLLER: // deprecated
|
---|
703 | {
|
---|
704 | ComPtr<IStorageController> storageController;
|
---|
705 | CHECK_ERROR(machine, GetStorageControllerByName(Bstr("IDE Controller").raw(),
|
---|
706 | storageController.asOutParam()));
|
---|
707 |
|
---|
708 | if (!RTStrICmp(ValueUnion.psz, "PIIX3"))
|
---|
709 | {
|
---|
710 | CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_PIIX3));
|
---|
711 | }
|
---|
712 | else if (!RTStrICmp(ValueUnion.psz, "PIIX4"))
|
---|
713 | {
|
---|
714 | CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_PIIX4));
|
---|
715 | }
|
---|
716 | else if (!RTStrICmp(ValueUnion.psz, "ICH6"))
|
---|
717 | {
|
---|
718 | CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_ICH6));
|
---|
719 | }
|
---|
720 | else
|
---|
721 | {
|
---|
722 | errorArgument("Invalid --idecontroller argument '%s'", ValueUnion.psz);
|
---|
723 | rc = E_FAIL;
|
---|
724 | }
|
---|
725 | break;
|
---|
726 | }
|
---|
727 |
|
---|
728 | case MODIFYVM_SATAIDEEMULATION: // deprecated
|
---|
729 | {
|
---|
730 | ComPtr<IStorageController> SataCtl;
|
---|
731 | CHECK_ERROR(machine, GetStorageControllerByName(Bstr("SATA").raw(),
|
---|
732 | SataCtl.asOutParam()));
|
---|
733 |
|
---|
734 | if (SUCCEEDED(rc))
|
---|
735 | CHECK_ERROR(SataCtl, SetIDEEmulationPort(GetOptState.uIndex, ValueUnion.u32));
|
---|
736 | break;
|
---|
737 | }
|
---|
738 |
|
---|
739 | case MODIFYVM_SATAPORTCOUNT: // deprecated
|
---|
740 | {
|
---|
741 | ComPtr<IStorageController> SataCtl;
|
---|
742 | CHECK_ERROR(machine, GetStorageControllerByName(Bstr("SATA").raw(),
|
---|
743 | SataCtl.asOutParam()));
|
---|
744 |
|
---|
745 | if (SUCCEEDED(rc) && ValueUnion.u32 > 0)
|
---|
746 | CHECK_ERROR(SataCtl, COMSETTER(PortCount)(ValueUnion.u32));
|
---|
747 | break;
|
---|
748 | }
|
---|
749 |
|
---|
750 | case MODIFYVM_SATA: // deprecated
|
---|
751 | {
|
---|
752 | if (!strcmp(ValueUnion.psz, "on") || !strcmp(ValueUnion.psz, "enable"))
|
---|
753 | {
|
---|
754 | ComPtr<IStorageController> ctl;
|
---|
755 | CHECK_ERROR(machine, AddStorageController(Bstr("SATA").raw(),
|
---|
756 | StorageBus_SATA,
|
---|
757 | ctl.asOutParam()));
|
---|
758 | CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_IntelAhci));
|
---|
759 | }
|
---|
760 | else if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
|
---|
761 | CHECK_ERROR(machine, RemoveStorageController(Bstr("SATA").raw()));
|
---|
762 | else
|
---|
763 | return errorArgument("Invalid --usb argument '%s'", ValueUnion.psz);
|
---|
764 | break;
|
---|
765 | }
|
---|
766 |
|
---|
767 | case MODIFYVM_SCSIPORT: // deprecated
|
---|
768 | {
|
---|
769 | if (!strcmp(ValueUnion.psz, "none"))
|
---|
770 | {
|
---|
771 | rc = machine->DetachDevice(Bstr("LsiLogic").raw(),
|
---|
772 | GetOptState.uIndex, 0);
|
---|
773 | if (FAILED(rc))
|
---|
774 | CHECK_ERROR(machine, DetachDevice(Bstr("BusLogic").raw(),
|
---|
775 | GetOptState.uIndex, 0));
|
---|
776 | }
|
---|
777 | else
|
---|
778 | {
|
---|
779 | ComPtr<IMedium> hardDisk;
|
---|
780 | rc = findOrOpenMedium(a, ValueUnion.psz, DeviceType_HardDisk,
|
---|
781 | hardDisk, NULL);
|
---|
782 | if (FAILED(rc))
|
---|
783 | break;
|
---|
784 | if (hardDisk)
|
---|
785 | {
|
---|
786 | rc = machine->AttachDevice(Bstr("LsiLogic").raw(),
|
---|
787 | GetOptState.uIndex, 0,
|
---|
788 | DeviceType_HardDisk,
|
---|
789 | hardDisk);
|
---|
790 | if (FAILED(rc))
|
---|
791 | CHECK_ERROR(machine,
|
---|
792 | AttachDevice(Bstr("BusLogic").raw(),
|
---|
793 | GetOptState.uIndex, 0,
|
---|
794 | DeviceType_HardDisk,
|
---|
795 | hardDisk));
|
---|
796 | }
|
---|
797 | else
|
---|
798 | rc = E_FAIL;
|
---|
799 | }
|
---|
800 | break;
|
---|
801 | }
|
---|
802 |
|
---|
803 | case MODIFYVM_SCSITYPE: // deprecated
|
---|
804 | {
|
---|
805 | ComPtr<IStorageController> ctl;
|
---|
806 |
|
---|
807 | if (!RTStrICmp(ValueUnion.psz, "LsiLogic"))
|
---|
808 | {
|
---|
809 | rc = machine->RemoveStorageController(Bstr("BusLogic").raw());
|
---|
810 | if (FAILED(rc))
|
---|
811 | CHECK_ERROR(machine, RemoveStorageController(Bstr("LsiLogic").raw()));
|
---|
812 |
|
---|
813 | CHECK_ERROR(machine,
|
---|
814 | AddStorageController(Bstr("LsiLogic").raw(),
|
---|
815 | StorageBus_SCSI,
|
---|
816 | ctl.asOutParam()));
|
---|
817 |
|
---|
818 | if (SUCCEEDED(rc))
|
---|
819 | CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_LsiLogic));
|
---|
820 | }
|
---|
821 | else if (!RTStrICmp(ValueUnion.psz, "BusLogic"))
|
---|
822 | {
|
---|
823 | rc = machine->RemoveStorageController(Bstr("LsiLogic").raw());
|
---|
824 | if (FAILED(rc))
|
---|
825 | CHECK_ERROR(machine, RemoveStorageController(Bstr("BusLogic").raw()));
|
---|
826 |
|
---|
827 | CHECK_ERROR(machine,
|
---|
828 | AddStorageController(Bstr("BusLogic").raw(),
|
---|
829 | StorageBus_SCSI,
|
---|
830 | ctl.asOutParam()));
|
---|
831 |
|
---|
832 | if (SUCCEEDED(rc))
|
---|
833 | CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_BusLogic));
|
---|
834 | }
|
---|
835 | else
|
---|
836 | return errorArgument("Invalid --scsitype argument '%s'", ValueUnion.psz);
|
---|
837 | break;
|
---|
838 | }
|
---|
839 |
|
---|
840 | case MODIFYVM_SCSI: // deprecated
|
---|
841 | {
|
---|
842 | if (!strcmp(ValueUnion.psz, "on") || !strcmp(ValueUnion.psz, "enable"))
|
---|
843 | {
|
---|
844 | ComPtr<IStorageController> ctl;
|
---|
845 |
|
---|
846 | CHECK_ERROR(machine, AddStorageController(Bstr("BusLogic").raw(),
|
---|
847 | StorageBus_SCSI,
|
---|
848 | ctl.asOutParam()));
|
---|
849 | if (SUCCEEDED(rc))
|
---|
850 | CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_BusLogic));
|
---|
851 | }
|
---|
852 | else if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
|
---|
853 | {
|
---|
854 | rc = machine->RemoveStorageController(Bstr("BusLogic").raw());
|
---|
855 | if (FAILED(rc))
|
---|
856 | CHECK_ERROR(machine, RemoveStorageController(Bstr("LsiLogic").raw()));
|
---|
857 | }
|
---|
858 | break;
|
---|
859 | }
|
---|
860 |
|
---|
861 | case MODIFYVM_DVDPASSTHROUGH: // deprecated
|
---|
862 | {
|
---|
863 | CHECK_ERROR(machine, PassthroughDevice(Bstr("IDE Controller").raw(),
|
---|
864 | 1, 0,
|
---|
865 | !strcmp(ValueUnion.psz, "on")));
|
---|
866 | break;
|
---|
867 | }
|
---|
868 |
|
---|
869 | case MODIFYVM_DVD: // deprecated
|
---|
870 | {
|
---|
871 | ComPtr<IMedium> dvdMedium;
|
---|
872 |
|
---|
873 | /* unmount? */
|
---|
874 | if (!strcmp(ValueUnion.psz, "none"))
|
---|
875 | {
|
---|
876 | /* nothing to do, NULL object will cause unmount */
|
---|
877 | }
|
---|
878 | /* host drive? */
|
---|
879 | else if (!strncmp(ValueUnion.psz, "host:", 5))
|
---|
880 | {
|
---|
881 | ComPtr<IHost> host;
|
---|
882 | CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
|
---|
883 | rc = host->FindHostDVDDrive(Bstr(ValueUnion.psz + 5).raw(),
|
---|
884 | dvdMedium.asOutParam());
|
---|
885 | if (!dvdMedium)
|
---|
886 | {
|
---|
887 | /* 2nd try: try with the real name, important on Linux+libhal */
|
---|
888 | char szPathReal[RTPATH_MAX];
|
---|
889 | if (RT_FAILURE(RTPathReal(ValueUnion.psz + 5, szPathReal, sizeof(szPathReal))))
|
---|
890 | {
|
---|
891 | errorArgument("Invalid host DVD drive name \"%s\"", ValueUnion.psz + 5);
|
---|
892 | rc = E_FAIL;
|
---|
893 | break;
|
---|
894 | }
|
---|
895 | rc = host->FindHostDVDDrive(Bstr(szPathReal).raw(),
|
---|
896 | dvdMedium.asOutParam());
|
---|
897 | if (!dvdMedium)
|
---|
898 | {
|
---|
899 | errorArgument("Invalid host DVD drive name \"%s\"", ValueUnion.psz + 5);
|
---|
900 | rc = E_FAIL;
|
---|
901 | break;
|
---|
902 | }
|
---|
903 | }
|
---|
904 | }
|
---|
905 | else
|
---|
906 | {
|
---|
907 | rc = findOrOpenMedium(a, ValueUnion.psz, DeviceType_DVD,
|
---|
908 | dvdMedium, NULL);
|
---|
909 | if (FAILED(rc))
|
---|
910 | break;
|
---|
911 | if (!dvdMedium)
|
---|
912 | {
|
---|
913 | rc = E_FAIL;
|
---|
914 | break;
|
---|
915 | }
|
---|
916 | }
|
---|
917 |
|
---|
918 | CHECK_ERROR(machine, MountMedium(Bstr("IDE Controller").raw(),
|
---|
919 | 1, 0,
|
---|
920 | dvdMedium,
|
---|
921 | FALSE /* aForce */));
|
---|
922 | break;
|
---|
923 | }
|
---|
924 |
|
---|
925 | case MODIFYVM_FLOPPY: // deprecated
|
---|
926 | {
|
---|
927 | ComPtr<IMedium> floppyMedium;
|
---|
928 | ComPtr<IMediumAttachment> floppyAttachment;
|
---|
929 | machine->GetMediumAttachment(Bstr("Floppy Controller").raw(),
|
---|
930 | 0, 0, floppyAttachment.asOutParam());
|
---|
931 |
|
---|
932 | /* disable? */
|
---|
933 | if (!strcmp(ValueUnion.psz, "disabled"))
|
---|
934 | {
|
---|
935 | /* disable the controller */
|
---|
936 | if (floppyAttachment)
|
---|
937 | CHECK_ERROR(machine, DetachDevice(Bstr("Floppy Controller").raw(),
|
---|
938 | 0, 0));
|
---|
939 | }
|
---|
940 | else
|
---|
941 | {
|
---|
942 | /* enable the controller */
|
---|
943 | if (!floppyAttachment)
|
---|
944 | CHECK_ERROR(machine, AttachDevice(Bstr("Floppy Controller").raw(),
|
---|
945 | 0, 0,
|
---|
946 | DeviceType_Floppy, NULL));
|
---|
947 |
|
---|
948 | /* unmount? */
|
---|
949 | if ( !strcmp(ValueUnion.psz, "none")
|
---|
950 | || !strcmp(ValueUnion.psz, "empty")) // deprecated
|
---|
951 | {
|
---|
952 | /* nothing to do, NULL object will cause unmount */
|
---|
953 | }
|
---|
954 | /* host drive? */
|
---|
955 | else if (!strncmp(ValueUnion.psz, "host:", 5))
|
---|
956 | {
|
---|
957 | ComPtr<IHost> host;
|
---|
958 | CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
|
---|
959 | rc = host->FindHostFloppyDrive(Bstr(ValueUnion.psz + 5).raw(),
|
---|
960 | floppyMedium.asOutParam());
|
---|
961 | if (!floppyMedium)
|
---|
962 | {
|
---|
963 | errorArgument("Invalid host floppy drive name \"%s\"", ValueUnion.psz + 5);
|
---|
964 | rc = E_FAIL;
|
---|
965 | break;
|
---|
966 | }
|
---|
967 | }
|
---|
968 | else
|
---|
969 | {
|
---|
970 | rc = findOrOpenMedium(a, ValueUnion.psz, DeviceType_Floppy,
|
---|
971 | floppyMedium, NULL);
|
---|
972 | if (FAILED(rc))
|
---|
973 | break;
|
---|
974 | if (!floppyMedium)
|
---|
975 | {
|
---|
976 | rc = E_FAIL;
|
---|
977 | break;
|
---|
978 | }
|
---|
979 | }
|
---|
980 | CHECK_ERROR(machine, MountMedium(Bstr("Floppy Controller").raw(),
|
---|
981 | 0, 0,
|
---|
982 | floppyMedium,
|
---|
983 | FALSE /* aForce */));
|
---|
984 | }
|
---|
985 | break;
|
---|
986 | }
|
---|
987 |
|
---|
988 | case MODIFYVM_NICTRACEFILE:
|
---|
989 | {
|
---|
990 | ComPtr<INetworkAdapter> nic;
|
---|
991 |
|
---|
992 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
993 | ASSERT(nic);
|
---|
994 |
|
---|
995 | CHECK_ERROR(nic, COMSETTER(TraceFile)(Bstr(ValueUnion.psz).raw()));
|
---|
996 | break;
|
---|
997 | }
|
---|
998 |
|
---|
999 | case MODIFYVM_NICTRACE:
|
---|
1000 | {
|
---|
1001 | ComPtr<INetworkAdapter> nic;
|
---|
1002 |
|
---|
1003 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1004 | ASSERT(nic);
|
---|
1005 |
|
---|
1006 | CHECK_ERROR(nic, COMSETTER(TraceEnabled)(ValueUnion.f));
|
---|
1007 | break;
|
---|
1008 | }
|
---|
1009 |
|
---|
1010 | case MODIFYVM_NICTYPE:
|
---|
1011 | {
|
---|
1012 | ComPtr<INetworkAdapter> nic;
|
---|
1013 |
|
---|
1014 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1015 | ASSERT(nic);
|
---|
1016 |
|
---|
1017 | if (!strcmp(ValueUnion.psz, "Am79C970A"))
|
---|
1018 | {
|
---|
1019 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Am79C970A));
|
---|
1020 | }
|
---|
1021 | else if (!strcmp(ValueUnion.psz, "Am79C973"))
|
---|
1022 | {
|
---|
1023 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Am79C973));
|
---|
1024 | }
|
---|
1025 | #ifdef VBOX_WITH_E1000
|
---|
1026 | else if (!strcmp(ValueUnion.psz, "82540EM"))
|
---|
1027 | {
|
---|
1028 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82540EM));
|
---|
1029 | }
|
---|
1030 | else if (!strcmp(ValueUnion.psz, "82543GC"))
|
---|
1031 | {
|
---|
1032 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82543GC));
|
---|
1033 | }
|
---|
1034 | else if (!strcmp(ValueUnion.psz, "82545EM"))
|
---|
1035 | {
|
---|
1036 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82545EM));
|
---|
1037 | }
|
---|
1038 | #endif
|
---|
1039 | #ifdef VBOX_WITH_VIRTIO
|
---|
1040 | else if (!strcmp(ValueUnion.psz, "virtio"))
|
---|
1041 | {
|
---|
1042 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Virtio));
|
---|
1043 | }
|
---|
1044 | #endif /* VBOX_WITH_VIRTIO */
|
---|
1045 | else
|
---|
1046 | {
|
---|
1047 | errorArgument("Invalid NIC type '%s' specified for NIC %u", ValueUnion.psz, GetOptState.uIndex);
|
---|
1048 | rc = E_FAIL;
|
---|
1049 | }
|
---|
1050 | break;
|
---|
1051 | }
|
---|
1052 |
|
---|
1053 | case MODIFYVM_NICSPEED:
|
---|
1054 | {
|
---|
1055 | ComPtr<INetworkAdapter> nic;
|
---|
1056 |
|
---|
1057 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1058 | ASSERT(nic);
|
---|
1059 |
|
---|
1060 | CHECK_ERROR(nic, COMSETTER(LineSpeed)(ValueUnion.u32));
|
---|
1061 | break;
|
---|
1062 | }
|
---|
1063 |
|
---|
1064 | case MODIFYVM_NICBOOTPRIO:
|
---|
1065 | {
|
---|
1066 | ComPtr<INetworkAdapter> nic;
|
---|
1067 |
|
---|
1068 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1069 | ASSERT(nic);
|
---|
1070 |
|
---|
1071 | /* Somewhat arbitrary limitation - we can pass a list of up to 4 PCI devices
|
---|
1072 | * to the PXE ROM, hence only boot priorities 1-4 are allowed (in addition to
|
---|
1073 | * 0 for the default lowest priority).
|
---|
1074 | */
|
---|
1075 | if (ValueUnion.u32 > 4)
|
---|
1076 | {
|
---|
1077 | errorArgument("Invalid boot priority '%u' specfied for NIC %u", ValueUnion.u32, GetOptState.uIndex);
|
---|
1078 | rc = E_FAIL;
|
---|
1079 | }
|
---|
1080 | else
|
---|
1081 | {
|
---|
1082 | CHECK_ERROR(nic, COMSETTER(BootPriority)(ValueUnion.u32));
|
---|
1083 | }
|
---|
1084 | break;
|
---|
1085 | }
|
---|
1086 |
|
---|
1087 | case MODIFYVM_NIC:
|
---|
1088 | {
|
---|
1089 | ComPtr<INetworkAdapter> nic;
|
---|
1090 |
|
---|
1091 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1092 | ASSERT(nic);
|
---|
1093 |
|
---|
1094 | if (!strcmp(ValueUnion.psz, "none"))
|
---|
1095 | {
|
---|
1096 | CHECK_ERROR(nic, COMSETTER(Enabled)(FALSE));
|
---|
1097 | }
|
---|
1098 | else if (!strcmp(ValueUnion.psz, "null"))
|
---|
1099 | {
|
---|
1100 | CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
|
---|
1101 | CHECK_ERROR(nic, Detach());
|
---|
1102 | }
|
---|
1103 | else if (!strcmp(ValueUnion.psz, "nat"))
|
---|
1104 | {
|
---|
1105 | CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
|
---|
1106 | CHECK_ERROR(nic, AttachToNAT());
|
---|
1107 | }
|
---|
1108 | else if ( !strcmp(ValueUnion.psz, "bridged")
|
---|
1109 | || !strcmp(ValueUnion.psz, "hostif")) /* backward compatibility */
|
---|
1110 | {
|
---|
1111 | CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
|
---|
1112 | CHECK_ERROR(nic, AttachToBridgedInterface());
|
---|
1113 | }
|
---|
1114 | else if (!strcmp(ValueUnion.psz, "intnet"))
|
---|
1115 | {
|
---|
1116 | CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
|
---|
1117 | CHECK_ERROR(nic, AttachToInternalNetwork());
|
---|
1118 | }
|
---|
1119 | #if defined(VBOX_WITH_NETFLT)
|
---|
1120 | else if (!strcmp(ValueUnion.psz, "hostonly"))
|
---|
1121 | {
|
---|
1122 |
|
---|
1123 | CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
|
---|
1124 | CHECK_ERROR(nic, AttachToHostOnlyInterface());
|
---|
1125 | }
|
---|
1126 | #endif
|
---|
1127 | #ifdef VBOX_WITH_VDE
|
---|
1128 | else if (!strcmp(ValueUnion.psz, "vde"))
|
---|
1129 | {
|
---|
1130 |
|
---|
1131 | CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
|
---|
1132 | CHECK_ERROR(nic, AttachToVDE());
|
---|
1133 | }
|
---|
1134 | #endif
|
---|
1135 | else
|
---|
1136 | {
|
---|
1137 | errorArgument("Invalid type '%s' specfied for NIC %u", ValueUnion.psz, GetOptState.uIndex);
|
---|
1138 | rc = E_FAIL;
|
---|
1139 | }
|
---|
1140 | break;
|
---|
1141 | }
|
---|
1142 |
|
---|
1143 | case MODIFYVM_CABLECONNECTED:
|
---|
1144 | {
|
---|
1145 | ComPtr<INetworkAdapter> nic;
|
---|
1146 |
|
---|
1147 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1148 | ASSERT(nic);
|
---|
1149 |
|
---|
1150 | CHECK_ERROR(nic, COMSETTER(CableConnected)(ValueUnion.f));
|
---|
1151 | break;
|
---|
1152 | }
|
---|
1153 |
|
---|
1154 | case MODIFYVM_BRIDGEADAPTER:
|
---|
1155 | case MODIFYVM_HOSTONLYADAPTER:
|
---|
1156 | {
|
---|
1157 | ComPtr<INetworkAdapter> nic;
|
---|
1158 |
|
---|
1159 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1160 | ASSERT(nic);
|
---|
1161 |
|
---|
1162 | /** @todo NULL string deprecated */
|
---|
1163 | /* remove it? */
|
---|
1164 | if (!strcmp(ValueUnion.psz, "none"))
|
---|
1165 | {
|
---|
1166 | CHECK_ERROR(nic, COMSETTER(HostInterface)(NULL));
|
---|
1167 | }
|
---|
1168 | else
|
---|
1169 | {
|
---|
1170 | CHECK_ERROR(nic, COMSETTER(HostInterface)(Bstr(ValueUnion.psz).raw()));
|
---|
1171 | }
|
---|
1172 | break;
|
---|
1173 | }
|
---|
1174 |
|
---|
1175 | case MODIFYVM_INTNET:
|
---|
1176 | {
|
---|
1177 | ComPtr<INetworkAdapter> nic;
|
---|
1178 |
|
---|
1179 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1180 | ASSERT(nic);
|
---|
1181 |
|
---|
1182 | /** @todo NULL string deprecated */
|
---|
1183 | /* remove it? */
|
---|
1184 | if (!strcmp(ValueUnion.psz, "none"))
|
---|
1185 | {
|
---|
1186 | CHECK_ERROR(nic, COMSETTER(InternalNetwork)(NULL));
|
---|
1187 | }
|
---|
1188 | else
|
---|
1189 | {
|
---|
1190 | CHECK_ERROR(nic, COMSETTER(InternalNetwork)(Bstr(ValueUnion.psz).raw()));
|
---|
1191 | }
|
---|
1192 | break;
|
---|
1193 | }
|
---|
1194 |
|
---|
1195 | #ifdef VBOX_WITH_VDE
|
---|
1196 | case MODIFYVM_VDENET:
|
---|
1197 | {
|
---|
1198 | ComPtr<INetworkAdapter> nic;
|
---|
1199 |
|
---|
1200 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1201 | ASSERT(nic);
|
---|
1202 |
|
---|
1203 | /** @todo NULL string deprecated */
|
---|
1204 | /* remove it? */
|
---|
1205 | if (!strcmp(ValueUnion.psz, "default"))
|
---|
1206 | {
|
---|
1207 | CHECK_ERROR(nic, COMSETTER(VDENetwork)(NULL));
|
---|
1208 | }
|
---|
1209 | else
|
---|
1210 | {
|
---|
1211 | CHECK_ERROR(nic, COMSETTER(VDENetwork)(Bstr(ValueUnion.psz).raw()));
|
---|
1212 | }
|
---|
1213 | break;
|
---|
1214 | }
|
---|
1215 | #endif
|
---|
1216 | case MODIFYVM_NATNET:
|
---|
1217 | {
|
---|
1218 | ComPtr<INetworkAdapter> nic;
|
---|
1219 | ComPtr<INATEngine> driver;
|
---|
1220 |
|
---|
1221 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1222 | ASSERT(nic);
|
---|
1223 |
|
---|
1224 | CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
|
---|
1225 |
|
---|
1226 | const char *psz = ValueUnion.psz;
|
---|
1227 | if (!strcmp("default", psz))
|
---|
1228 | psz = "";
|
---|
1229 |
|
---|
1230 | CHECK_ERROR(driver, COMSETTER(Network)(Bstr(psz).raw()));
|
---|
1231 | break;
|
---|
1232 | }
|
---|
1233 |
|
---|
1234 | case MODIFYVM_NATBINDIP:
|
---|
1235 | {
|
---|
1236 | ComPtr<INetworkAdapter> nic;
|
---|
1237 | ComPtr<INATEngine> driver;
|
---|
1238 |
|
---|
1239 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1240 | ASSERT(nic);
|
---|
1241 |
|
---|
1242 | CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
|
---|
1243 | CHECK_ERROR(driver, COMSETTER(HostIP)(Bstr(ValueUnion.psz).raw()));
|
---|
1244 | break;
|
---|
1245 | }
|
---|
1246 |
|
---|
1247 | #define ITERATE_TO_NEXT_TERM(ch) \
|
---|
1248 | do { \
|
---|
1249 | while (*ch != ',') \
|
---|
1250 | { \
|
---|
1251 | if (*ch == 0) \
|
---|
1252 | { \
|
---|
1253 | return errorSyntax(USAGE_MODIFYVM, \
|
---|
1254 | "Missing or Invalid argument to '%s'", \
|
---|
1255 | GetOptState.pDef->pszLong); \
|
---|
1256 | } \
|
---|
1257 | ch++; \
|
---|
1258 | } \
|
---|
1259 | *ch = '\0'; \
|
---|
1260 | ch++; \
|
---|
1261 | } while(0)
|
---|
1262 |
|
---|
1263 | case MODIFYVM_NATSETTINGS:
|
---|
1264 | {
|
---|
1265 | ComPtr<INetworkAdapter> nic;
|
---|
1266 | ComPtr<INATEngine> driver;
|
---|
1267 | char *strMtu;
|
---|
1268 | char *strSockSnd;
|
---|
1269 | char *strSockRcv;
|
---|
1270 | char *strTcpSnd;
|
---|
1271 | char *strTcpRcv;
|
---|
1272 | char *strRaw = RTStrDup(ValueUnion.psz);
|
---|
1273 | char *ch = strRaw;
|
---|
1274 | strMtu = RTStrStrip(ch);
|
---|
1275 | ITERATE_TO_NEXT_TERM(ch);
|
---|
1276 | strSockSnd = RTStrStrip(ch);
|
---|
1277 | ITERATE_TO_NEXT_TERM(ch);
|
---|
1278 | strSockRcv = RTStrStrip(ch);
|
---|
1279 | ITERATE_TO_NEXT_TERM(ch);
|
---|
1280 | strTcpSnd = RTStrStrip(ch);
|
---|
1281 | ITERATE_TO_NEXT_TERM(ch);
|
---|
1282 | strTcpRcv = RTStrStrip(ch);
|
---|
1283 |
|
---|
1284 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1285 | ASSERT(nic);
|
---|
1286 |
|
---|
1287 | CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
|
---|
1288 | CHECK_ERROR(driver, SetNetworkSettings(RTStrToUInt32(strMtu), RTStrToUInt32(strSockSnd), RTStrToUInt32(strSockRcv),
|
---|
1289 | RTStrToUInt32(strTcpSnd), RTStrToUInt32(strTcpRcv)));
|
---|
1290 | break;
|
---|
1291 | }
|
---|
1292 |
|
---|
1293 |
|
---|
1294 | case MODIFYVM_NATPF:
|
---|
1295 | {
|
---|
1296 | ComPtr<INetworkAdapter> nic;
|
---|
1297 | ComPtr<INATEngine> driver;
|
---|
1298 |
|
---|
1299 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1300 | ASSERT(nic);
|
---|
1301 |
|
---|
1302 | CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
|
---|
1303 | /* format name:proto:hostip:hostport:guestip:guestport*/
|
---|
1304 | if (RTStrCmp(ValueUnion.psz, "delete") != 0)
|
---|
1305 | {
|
---|
1306 | char *strName;
|
---|
1307 | char *strProto;
|
---|
1308 | char *strHostIp;
|
---|
1309 | char *strHostPort;
|
---|
1310 | char *strGuestIp;
|
---|
1311 | char *strGuestPort;
|
---|
1312 | char *strRaw = RTStrDup(ValueUnion.psz);
|
---|
1313 | char *ch = strRaw;
|
---|
1314 | strName = RTStrStrip(ch);
|
---|
1315 | ITERATE_TO_NEXT_TERM(ch);
|
---|
1316 | strProto = RTStrStrip(ch);
|
---|
1317 | ITERATE_TO_NEXT_TERM(ch);
|
---|
1318 | strHostIp = RTStrStrip(ch);
|
---|
1319 | ITERATE_TO_NEXT_TERM(ch);
|
---|
1320 | strHostPort = RTStrStrip(ch);
|
---|
1321 | ITERATE_TO_NEXT_TERM(ch);
|
---|
1322 | strGuestIp = RTStrStrip(ch);
|
---|
1323 | ITERATE_TO_NEXT_TERM(ch);
|
---|
1324 | strGuestPort = RTStrStrip(ch);
|
---|
1325 | NATProtocol_T proto;
|
---|
1326 | if (RTStrICmp(strProto, "udp") == 0)
|
---|
1327 | proto = NATProtocol_UDP;
|
---|
1328 | else if (RTStrICmp(strProto, "tcp") == 0)
|
---|
1329 | proto = NATProtocol_TCP;
|
---|
1330 | else
|
---|
1331 | {
|
---|
1332 | errorArgument("Invalid proto '%s' specfied for NIC %u", ValueUnion.psz, GetOptState.uIndex);
|
---|
1333 | rc = E_FAIL;
|
---|
1334 | break;
|
---|
1335 | }
|
---|
1336 | CHECK_ERROR(driver, AddRedirect(Bstr(strName).raw(), proto,
|
---|
1337 | Bstr(strHostIp).raw(),
|
---|
1338 | RTStrToUInt16(strHostPort),
|
---|
1339 | Bstr(strGuestIp).raw(),
|
---|
1340 | RTStrToUInt16(strGuestPort)));
|
---|
1341 | }
|
---|
1342 | else
|
---|
1343 | {
|
---|
1344 | /* delete NAT Rule operation */
|
---|
1345 | int vrc;
|
---|
1346 | vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_STRING);
|
---|
1347 | if (RT_FAILURE(vrc))
|
---|
1348 | return errorSyntax(USAGE_MODIFYVM, "Not enough parameters");
|
---|
1349 | CHECK_ERROR(driver, RemoveRedirect(Bstr(ValueUnion.psz).raw()));
|
---|
1350 | }
|
---|
1351 | break;
|
---|
1352 | }
|
---|
1353 | #undef ITERATE_TO_NEXT_TERM
|
---|
1354 | case MODIFYVM_NATALIASMODE:
|
---|
1355 | {
|
---|
1356 | ComPtr<INetworkAdapter> nic;
|
---|
1357 | ComPtr<INATEngine> driver;
|
---|
1358 | uint32_t aliasMode = 0;
|
---|
1359 |
|
---|
1360 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1361 | ASSERT(nic);
|
---|
1362 |
|
---|
1363 | CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
|
---|
1364 | if (RTStrCmp(ValueUnion.psz,"default") == 0)
|
---|
1365 | {
|
---|
1366 | aliasMode = 0;
|
---|
1367 | }
|
---|
1368 | else
|
---|
1369 | {
|
---|
1370 | char *token = (char *)ValueUnion.psz;
|
---|
1371 | while(token)
|
---|
1372 | {
|
---|
1373 | if (RTStrNCmp(token, "log", 3) == 0)
|
---|
1374 | aliasMode |= 0x1;
|
---|
1375 | else if (RTStrNCmp(token, "proxyonly", 9) == 0)
|
---|
1376 | aliasMode |= 0x2;
|
---|
1377 | else if (RTStrNCmp(token, "sameports", 9) == 0)
|
---|
1378 | aliasMode |= 0x4;
|
---|
1379 | token = RTStrStr(token, ",");
|
---|
1380 | if (token == NULL)
|
---|
1381 | break;
|
---|
1382 | token++;
|
---|
1383 | }
|
---|
1384 | }
|
---|
1385 | CHECK_ERROR(driver, COMSETTER(AliasMode)(aliasMode));
|
---|
1386 | break;
|
---|
1387 | }
|
---|
1388 |
|
---|
1389 | case MODIFYVM_NATTFTPPREFIX:
|
---|
1390 | {
|
---|
1391 | ComPtr<INetworkAdapter> nic;
|
---|
1392 | ComPtr<INATEngine> driver;
|
---|
1393 |
|
---|
1394 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1395 | ASSERT(nic);
|
---|
1396 |
|
---|
1397 | CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
|
---|
1398 | CHECK_ERROR(driver, COMSETTER(TftpPrefix)(Bstr(ValueUnion.psz).raw()));
|
---|
1399 | break;
|
---|
1400 | }
|
---|
1401 |
|
---|
1402 | case MODIFYVM_NATTFTPFILE:
|
---|
1403 | {
|
---|
1404 | ComPtr<INetworkAdapter> nic;
|
---|
1405 | ComPtr<INATEngine> driver;
|
---|
1406 |
|
---|
1407 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1408 | ASSERT(nic);
|
---|
1409 |
|
---|
1410 | CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
|
---|
1411 | CHECK_ERROR(driver, COMSETTER(TftpBootFile)(Bstr(ValueUnion.psz).raw()));
|
---|
1412 | break;
|
---|
1413 | }
|
---|
1414 |
|
---|
1415 | case MODIFYVM_NATTFTPSERVER:
|
---|
1416 | {
|
---|
1417 | ComPtr<INetworkAdapter> nic;
|
---|
1418 | ComPtr<INATEngine> driver;
|
---|
1419 |
|
---|
1420 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1421 | ASSERT(nic);
|
---|
1422 |
|
---|
1423 | CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
|
---|
1424 | CHECK_ERROR(driver, COMSETTER(TftpNextServer)(Bstr(ValueUnion.psz).raw()));
|
---|
1425 | break;
|
---|
1426 | }
|
---|
1427 | case MODIFYVM_NATDNSPASSDOMAIN:
|
---|
1428 | {
|
---|
1429 | ComPtr<INetworkAdapter> nic;
|
---|
1430 | ComPtr<INATEngine> driver;
|
---|
1431 |
|
---|
1432 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1433 | ASSERT(nic);
|
---|
1434 |
|
---|
1435 | CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
|
---|
1436 | CHECK_ERROR(driver, COMSETTER(DnsPassDomain)(ValueUnion.f));
|
---|
1437 | break;
|
---|
1438 | }
|
---|
1439 |
|
---|
1440 | case MODIFYVM_NATDNSPROXY:
|
---|
1441 | {
|
---|
1442 | ComPtr<INetworkAdapter> nic;
|
---|
1443 | ComPtr<INATEngine> driver;
|
---|
1444 |
|
---|
1445 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1446 | ASSERT(nic);
|
---|
1447 |
|
---|
1448 | CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
|
---|
1449 | CHECK_ERROR(driver, COMSETTER(DnsProxy)(ValueUnion.f));
|
---|
1450 | break;
|
---|
1451 | }
|
---|
1452 |
|
---|
1453 | case MODIFYVM_NATDNSHOSTRESOLVER:
|
---|
1454 | {
|
---|
1455 | ComPtr<INetworkAdapter> nic;
|
---|
1456 | ComPtr<INATEngine> driver;
|
---|
1457 |
|
---|
1458 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1459 | ASSERT(nic);
|
---|
1460 |
|
---|
1461 | CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
|
---|
1462 | CHECK_ERROR(driver, COMSETTER(DnsUseHostResolver)(ValueUnion.f));
|
---|
1463 | break;
|
---|
1464 | }
|
---|
1465 | case MODIFYVM_MACADDRESS:
|
---|
1466 | {
|
---|
1467 | ComPtr<INetworkAdapter> nic;
|
---|
1468 |
|
---|
1469 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1470 | ASSERT(nic);
|
---|
1471 |
|
---|
1472 | /* generate one? */
|
---|
1473 | if (!strcmp(ValueUnion.psz, "auto"))
|
---|
1474 | {
|
---|
1475 | CHECK_ERROR(nic, COMSETTER(MACAddress)(NULL));
|
---|
1476 | }
|
---|
1477 | else
|
---|
1478 | {
|
---|
1479 | CHECK_ERROR(nic, COMSETTER(MACAddress)(Bstr(ValueUnion.psz).raw()));
|
---|
1480 | }
|
---|
1481 | break;
|
---|
1482 | }
|
---|
1483 |
|
---|
1484 | case MODIFYVM_HIDPTR:
|
---|
1485 | {
|
---|
1486 | bool fEnableUsb = false;
|
---|
1487 | if (!strcmp(ValueUnion.psz, "ps2"))
|
---|
1488 | {
|
---|
1489 | CHECK_ERROR(machine, COMSETTER(PointingHidType)(PointingHidType_PS2Mouse));
|
---|
1490 | }
|
---|
1491 | else if (!strcmp(ValueUnion.psz, "usb"))
|
---|
1492 | {
|
---|
1493 | CHECK_ERROR(machine, COMSETTER(PointingHidType)(PointingHidType_USBMouse));
|
---|
1494 | if (SUCCEEDED(rc))
|
---|
1495 | fEnableUsb = true;
|
---|
1496 | }
|
---|
1497 | else if (!strcmp(ValueUnion.psz, "usbtablet"))
|
---|
1498 | {
|
---|
1499 | CHECK_ERROR(machine, COMSETTER(PointingHidType)(PointingHidType_USBTablet));
|
---|
1500 | if (SUCCEEDED(rc))
|
---|
1501 | fEnableUsb = true;
|
---|
1502 | }
|
---|
1503 | else
|
---|
1504 | {
|
---|
1505 | errorArgument("Invalid type '%s' specfied for pointing device", ValueUnion.psz);
|
---|
1506 | rc = E_FAIL;
|
---|
1507 | }
|
---|
1508 | if (fEnableUsb)
|
---|
1509 | {
|
---|
1510 | /* Make sure the OHCI controller is enabled. */
|
---|
1511 | ComPtr<IUSBController> UsbCtl;
|
---|
1512 | rc = machine->COMGETTER(USBController)(UsbCtl.asOutParam());
|
---|
1513 | if (SUCCEEDED(rc))
|
---|
1514 | {
|
---|
1515 | BOOL fEnabled;
|
---|
1516 | rc = UsbCtl->COMGETTER(Enabled)(&fEnabled);
|
---|
1517 | if (FAILED(rc))
|
---|
1518 | fEnabled = false;
|
---|
1519 | if (!fEnabled)
|
---|
1520 | CHECK_ERROR(UsbCtl, COMSETTER(Enabled)(true));
|
---|
1521 | }
|
---|
1522 | }
|
---|
1523 | break;
|
---|
1524 | }
|
---|
1525 |
|
---|
1526 | case MODIFYVM_HIDKBD:
|
---|
1527 | {
|
---|
1528 | bool fEnableUsb = false;
|
---|
1529 | if (!strcmp(ValueUnion.psz, "ps2"))
|
---|
1530 | {
|
---|
1531 | CHECK_ERROR(machine, COMSETTER(KeyboardHidType)(KeyboardHidType_PS2Keyboard));
|
---|
1532 | }
|
---|
1533 | else if (!strcmp(ValueUnion.psz, "usb"))
|
---|
1534 | {
|
---|
1535 | CHECK_ERROR(machine, COMSETTER(KeyboardHidType)(KeyboardHidType_USBKeyboard));
|
---|
1536 | if (SUCCEEDED(rc))
|
---|
1537 | fEnableUsb = true;
|
---|
1538 | }
|
---|
1539 | else
|
---|
1540 | {
|
---|
1541 | errorArgument("Invalid type '%s' specfied for keyboard", ValueUnion.psz);
|
---|
1542 | rc = E_FAIL;
|
---|
1543 | }
|
---|
1544 | if (fEnableUsb)
|
---|
1545 | {
|
---|
1546 | /* Make sure the OHCI controller is enabled. */
|
---|
1547 | ComPtr<IUSBController> UsbCtl;
|
---|
1548 | rc = machine->COMGETTER(USBController)(UsbCtl.asOutParam());
|
---|
1549 | if (SUCCEEDED(rc))
|
---|
1550 | {
|
---|
1551 | BOOL fEnabled;
|
---|
1552 | rc = UsbCtl->COMGETTER(Enabled)(&fEnabled);
|
---|
1553 | if (FAILED(rc))
|
---|
1554 | fEnabled = false;
|
---|
1555 | if (!fEnabled)
|
---|
1556 | CHECK_ERROR(UsbCtl, COMSETTER(Enabled)(true));
|
---|
1557 | }
|
---|
1558 | }
|
---|
1559 | break;
|
---|
1560 | }
|
---|
1561 |
|
---|
1562 | case MODIFYVM_UARTMODE:
|
---|
1563 | {
|
---|
1564 | ComPtr<ISerialPort> uart;
|
---|
1565 | char *pszIRQ = NULL;
|
---|
1566 |
|
---|
1567 | CHECK_ERROR_BREAK(machine, GetSerialPort(GetOptState.uIndex - 1, uart.asOutParam()));
|
---|
1568 | ASSERT(uart);
|
---|
1569 |
|
---|
1570 | if (!strcmp(ValueUnion.psz, "disconnected"))
|
---|
1571 | {
|
---|
1572 | CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_Disconnected));
|
---|
1573 | }
|
---|
1574 | else if ( !strcmp(ValueUnion.psz, "server")
|
---|
1575 | || !strcmp(ValueUnion.psz, "client")
|
---|
1576 | || !strcmp(ValueUnion.psz, "file"))
|
---|
1577 | {
|
---|
1578 | const char *pszMode = ValueUnion.psz;
|
---|
1579 |
|
---|
1580 | int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_STRING);
|
---|
1581 | if (RT_FAILURE(vrc))
|
---|
1582 | return errorSyntax(USAGE_MODIFYVM,
|
---|
1583 | "Missing or Invalid argument to '%s'",
|
---|
1584 | GetOptState.pDef->pszLong);
|
---|
1585 |
|
---|
1586 | CHECK_ERROR(uart, COMSETTER(Path)(Bstr(ValueUnion.psz).raw()));
|
---|
1587 |
|
---|
1588 | if (!strcmp(pszMode, "server"))
|
---|
1589 | {
|
---|
1590 | CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_HostPipe));
|
---|
1591 | CHECK_ERROR(uart, COMSETTER(Server)(TRUE));
|
---|
1592 | }
|
---|
1593 | else if (!strcmp(pszMode, "client"))
|
---|
1594 | {
|
---|
1595 | CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_HostPipe));
|
---|
1596 | CHECK_ERROR(uart, COMSETTER(Server)(FALSE));
|
---|
1597 | }
|
---|
1598 | else if (!strcmp(pszMode, "file"))
|
---|
1599 | {
|
---|
1600 | CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_RawFile));
|
---|
1601 | }
|
---|
1602 | }
|
---|
1603 | else
|
---|
1604 | {
|
---|
1605 | CHECK_ERROR(uart, COMSETTER(Path)(Bstr(ValueUnion.psz).raw()));
|
---|
1606 | CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_HostDevice));
|
---|
1607 | }
|
---|
1608 | break;
|
---|
1609 | }
|
---|
1610 |
|
---|
1611 | case MODIFYVM_UART:
|
---|
1612 | {
|
---|
1613 | ComPtr<ISerialPort> uart;
|
---|
1614 |
|
---|
1615 | CHECK_ERROR_BREAK(machine, GetSerialPort(GetOptState.uIndex - 1, uart.asOutParam()));
|
---|
1616 | ASSERT(uart);
|
---|
1617 |
|
---|
1618 | if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
|
---|
1619 | CHECK_ERROR(uart, COMSETTER(Enabled)(FALSE));
|
---|
1620 | else
|
---|
1621 | {
|
---|
1622 | const char *pszIOBase = ValueUnion.psz;
|
---|
1623 | uint32_t uVal = 0;
|
---|
1624 |
|
---|
1625 | int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_UINT32) != MODIFYVM_UART;
|
---|
1626 | if (RT_FAILURE(vrc))
|
---|
1627 | return errorSyntax(USAGE_MODIFYVM,
|
---|
1628 | "Missing or Invalid argument to '%s'",
|
---|
1629 | GetOptState.pDef->pszLong);
|
---|
1630 |
|
---|
1631 | CHECK_ERROR(uart, COMSETTER(IRQ)(ValueUnion.u32));
|
---|
1632 |
|
---|
1633 | vrc = RTStrToUInt32Ex(pszIOBase, NULL, 0, &uVal);
|
---|
1634 | if (vrc != VINF_SUCCESS || uVal == 0)
|
---|
1635 | return errorArgument("Error parsing UART I/O base '%s'", pszIOBase);
|
---|
1636 | CHECK_ERROR(uart, COMSETTER(IOBase)(uVal));
|
---|
1637 |
|
---|
1638 | CHECK_ERROR(uart, COMSETTER(Enabled)(TRUE));
|
---|
1639 | }
|
---|
1640 | break;
|
---|
1641 | }
|
---|
1642 |
|
---|
1643 | case MODIFYVM_GUESTMEMORYBALLOON:
|
---|
1644 | {
|
---|
1645 | CHECK_ERROR(machine, COMSETTER(MemoryBalloonSize)(ValueUnion.u32));
|
---|
1646 | break;
|
---|
1647 | }
|
---|
1648 |
|
---|
1649 | case MODIFYVM_AUDIOCONTROLLER:
|
---|
1650 | {
|
---|
1651 | ComPtr<IAudioAdapter> audioAdapter;
|
---|
1652 | machine->COMGETTER(AudioAdapter)(audioAdapter.asOutParam());
|
---|
1653 | ASSERT(audioAdapter);
|
---|
1654 |
|
---|
1655 | if (!strcmp(ValueUnion.psz, "sb16"))
|
---|
1656 | CHECK_ERROR(audioAdapter, COMSETTER(AudioController)(AudioControllerType_SB16));
|
---|
1657 | else if (!strcmp(ValueUnion.psz, "ac97"))
|
---|
1658 | CHECK_ERROR(audioAdapter, COMSETTER(AudioController)(AudioControllerType_AC97));
|
---|
1659 | else if (!strcmp(ValueUnion.psz, "hda"))
|
---|
1660 | CHECK_ERROR(audioAdapter, COMSETTER(AudioController)(AudioControllerType_HDA));
|
---|
1661 | else
|
---|
1662 | {
|
---|
1663 | errorArgument("Invalid --audiocontroller argument '%s'", ValueUnion.psz);
|
---|
1664 | rc = E_FAIL;
|
---|
1665 | }
|
---|
1666 | break;
|
---|
1667 | }
|
---|
1668 |
|
---|
1669 | case MODIFYVM_AUDIO:
|
---|
1670 | {
|
---|
1671 | ComPtr<IAudioAdapter> audioAdapter;
|
---|
1672 | machine->COMGETTER(AudioAdapter)(audioAdapter.asOutParam());
|
---|
1673 | ASSERT(audioAdapter);
|
---|
1674 |
|
---|
1675 | /* disable? */
|
---|
1676 | if (!strcmp(ValueUnion.psz, "none"))
|
---|
1677 | {
|
---|
1678 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(false));
|
---|
1679 | }
|
---|
1680 | else if (!strcmp(ValueUnion.psz, "null"))
|
---|
1681 | {
|
---|
1682 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Null));
|
---|
1683 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1684 | }
|
---|
1685 | #ifdef RT_OS_WINDOWS
|
---|
1686 | #ifdef VBOX_WITH_WINMM
|
---|
1687 | else if (!strcmp(ValueUnion.psz, "winmm"))
|
---|
1688 | {
|
---|
1689 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_WinMM));
|
---|
1690 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1691 | }
|
---|
1692 | #endif
|
---|
1693 | else if (!strcmp(ValueUnion.psz, "dsound"))
|
---|
1694 | {
|
---|
1695 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_DirectSound));
|
---|
1696 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1697 | }
|
---|
1698 | #endif /* RT_OS_WINDOWS */
|
---|
1699 | #ifdef RT_OS_LINUX
|
---|
1700 | # ifdef VBOX_WITH_ALSA
|
---|
1701 | else if (!strcmp(ValueUnion.psz, "alsa"))
|
---|
1702 | {
|
---|
1703 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_ALSA));
|
---|
1704 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1705 | }
|
---|
1706 | # endif
|
---|
1707 | # ifdef VBOX_WITH_PULSE
|
---|
1708 | else if (!strcmp(ValueUnion.psz, "pulse"))
|
---|
1709 | {
|
---|
1710 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Pulse));
|
---|
1711 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1712 | }
|
---|
1713 | # endif
|
---|
1714 | #endif /* !RT_OS_LINUX */
|
---|
1715 | #ifdef RT_OS_SOLARIS
|
---|
1716 | else if (!strcmp(ValueUnion.psz, "solaudio"))
|
---|
1717 | {
|
---|
1718 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_SolAudio));
|
---|
1719 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1720 | }
|
---|
1721 | #endif /* !RT_OS_SOLARIS */
|
---|
1722 | #ifdef RT_OS_FREEBSD
|
---|
1723 | else if (!strcmp(ValueUnion.psz, "oss"))
|
---|
1724 | {
|
---|
1725 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_OSS));
|
---|
1726 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1727 | }
|
---|
1728 | # ifdef VBOX_WITH_PULSE
|
---|
1729 | else if (!strcmp(ValueUnion.psz, "pulse"))
|
---|
1730 | {
|
---|
1731 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Pulse));
|
---|
1732 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1733 | }
|
---|
1734 | # endif
|
---|
1735 | #endif /* !RT_OS_FREEBSD */
|
---|
1736 | #ifdef RT_OS_DARWIN
|
---|
1737 | else if (!strcmp(ValueUnion.psz, "coreaudio"))
|
---|
1738 | {
|
---|
1739 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_CoreAudio));
|
---|
1740 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1741 | }
|
---|
1742 |
|
---|
1743 | #endif /* !RT_OS_DARWIN */
|
---|
1744 | # if defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX) || defined(VBOX_WITH_SOLARIS_OSS)
|
---|
1745 | else if (!strcmp(ValueUnion.psz, "oss"))
|
---|
1746 | {
|
---|
1747 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_OSS));
|
---|
1748 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1749 | }
|
---|
1750 | # endif
|
---|
1751 | else
|
---|
1752 | {
|
---|
1753 | errorArgument("Invalid --audio argument '%s'", ValueUnion.psz);
|
---|
1754 | rc = E_FAIL;
|
---|
1755 | }
|
---|
1756 | break;
|
---|
1757 | }
|
---|
1758 |
|
---|
1759 | case MODIFYVM_CLIPBOARD:
|
---|
1760 | {
|
---|
1761 | if (!strcmp(ValueUnion.psz, "disabled"))
|
---|
1762 | {
|
---|
1763 | CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_Disabled));
|
---|
1764 | }
|
---|
1765 | else if (!strcmp(ValueUnion.psz, "hosttoguest"))
|
---|
1766 | {
|
---|
1767 | CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_HostToGuest));
|
---|
1768 | }
|
---|
1769 | else if (!strcmp(ValueUnion.psz, "guesttohost"))
|
---|
1770 | {
|
---|
1771 | CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_GuestToHost));
|
---|
1772 | }
|
---|
1773 | else if (!strcmp(ValueUnion.psz, "bidirectional"))
|
---|
1774 | {
|
---|
1775 | CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_Bidirectional));
|
---|
1776 | }
|
---|
1777 | else
|
---|
1778 | {
|
---|
1779 | errorArgument("Invalid --clipboard argument '%s'", ValueUnion.psz);
|
---|
1780 | rc = E_FAIL;
|
---|
1781 | }
|
---|
1782 | break;
|
---|
1783 | }
|
---|
1784 |
|
---|
1785 | case MODIFYVM_VRDE_EXTPACK:
|
---|
1786 | {
|
---|
1787 | ComPtr<IVRDEServer> vrdeServer;
|
---|
1788 | machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
1789 | ASSERT(vrdeServer);
|
---|
1790 |
|
---|
1791 | if (vrdeServer)
|
---|
1792 | {
|
---|
1793 | if (strcmp(ValueUnion.psz, "default") != 0)
|
---|
1794 | {
|
---|
1795 | Bstr bstr(ValueUnion.psz);
|
---|
1796 | CHECK_ERROR(vrdeServer, COMSETTER(VRDEExtPack)(bstr.raw()));
|
---|
1797 | }
|
---|
1798 | else
|
---|
1799 | CHECK_ERROR(vrdeServer, COMSETTER(VRDEExtPack)(NULL));
|
---|
1800 | }
|
---|
1801 | break;
|
---|
1802 | }
|
---|
1803 |
|
---|
1804 | case MODIFYVM_VRDEPROPERTY:
|
---|
1805 | {
|
---|
1806 | ComPtr<IVRDEServer> vrdeServer;
|
---|
1807 | machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
1808 | ASSERT(vrdeServer);
|
---|
1809 |
|
---|
1810 | if (vrdeServer)
|
---|
1811 | {
|
---|
1812 | /* Parse 'name=value' */
|
---|
1813 | char *pszProperty = RTStrDup(ValueUnion.psz);
|
---|
1814 | if (pszProperty)
|
---|
1815 | {
|
---|
1816 | char *pDelimiter = strchr(pszProperty, '=');
|
---|
1817 | if (pDelimiter)
|
---|
1818 | {
|
---|
1819 | *pDelimiter = '\0';
|
---|
1820 |
|
---|
1821 | Bstr bstrName = pszProperty;
|
---|
1822 | Bstr bstrValue = &pDelimiter[1];
|
---|
1823 | CHECK_ERROR(vrdeServer, SetVRDEProperty(bstrName.raw(), bstrValue.raw()));
|
---|
1824 | }
|
---|
1825 | else
|
---|
1826 | {
|
---|
1827 | RTStrFree(pszProperty);
|
---|
1828 |
|
---|
1829 | errorArgument("Invalid --vrdeproperty argument '%s'", ValueUnion.psz);
|
---|
1830 | rc = E_FAIL;
|
---|
1831 | break;
|
---|
1832 | }
|
---|
1833 | RTStrFree(pszProperty);
|
---|
1834 | }
|
---|
1835 | else
|
---|
1836 | {
|
---|
1837 | RTStrmPrintf(g_pStdErr, "Error: Failed to allocate memory for VRDE property '%s'\n", ValueUnion.psz);
|
---|
1838 | rc = E_FAIL;
|
---|
1839 | }
|
---|
1840 | }
|
---|
1841 | break;
|
---|
1842 | }
|
---|
1843 |
|
---|
1844 | case MODIFYVM_VRDPPORT:
|
---|
1845 | vrdeWarningDeprecatedOption("port");
|
---|
1846 |
|
---|
1847 | case MODIFYVM_VRDEPORT:
|
---|
1848 | {
|
---|
1849 | ComPtr<IVRDEServer> vrdeServer;
|
---|
1850 | machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
1851 | ASSERT(vrdeServer);
|
---|
1852 |
|
---|
1853 | if (!strcmp(ValueUnion.psz, "default"))
|
---|
1854 | CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("TCP/Ports").raw(), Bstr("0").raw()));
|
---|
1855 | else
|
---|
1856 | CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("TCP/Ports").raw(), Bstr(ValueUnion.psz).raw()));
|
---|
1857 | break;
|
---|
1858 | }
|
---|
1859 |
|
---|
1860 | case MODIFYVM_VRDPADDRESS:
|
---|
1861 | vrdeWarningDeprecatedOption("address");
|
---|
1862 |
|
---|
1863 | case MODIFYVM_VRDEADDRESS:
|
---|
1864 | {
|
---|
1865 | ComPtr<IVRDEServer> vrdeServer;
|
---|
1866 | machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
1867 | ASSERT(vrdeServer);
|
---|
1868 |
|
---|
1869 | CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("TCP/Address").raw(), Bstr(ValueUnion.psz).raw()));
|
---|
1870 | break;
|
---|
1871 | }
|
---|
1872 |
|
---|
1873 | case MODIFYVM_VRDPAUTHTYPE:
|
---|
1874 | vrdeWarningDeprecatedOption("authtype");
|
---|
1875 | case MODIFYVM_VRDEAUTHTYPE:
|
---|
1876 | {
|
---|
1877 | ComPtr<IVRDEServer> vrdeServer;
|
---|
1878 | machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
1879 | ASSERT(vrdeServer);
|
---|
1880 |
|
---|
1881 | if (!strcmp(ValueUnion.psz, "null"))
|
---|
1882 | {
|
---|
1883 | CHECK_ERROR(vrdeServer, COMSETTER(AuthType)(AuthType_Null));
|
---|
1884 | }
|
---|
1885 | else if (!strcmp(ValueUnion.psz, "external"))
|
---|
1886 | {
|
---|
1887 | CHECK_ERROR(vrdeServer, COMSETTER(AuthType)(AuthType_External));
|
---|
1888 | }
|
---|
1889 | else if (!strcmp(ValueUnion.psz, "guest"))
|
---|
1890 | {
|
---|
1891 | CHECK_ERROR(vrdeServer, COMSETTER(AuthType)(AuthType_Guest));
|
---|
1892 | }
|
---|
1893 | else
|
---|
1894 | {
|
---|
1895 | errorArgument("Invalid --vrdeauthtype argument '%s'", ValueUnion.psz);
|
---|
1896 | rc = E_FAIL;
|
---|
1897 | }
|
---|
1898 | break;
|
---|
1899 | }
|
---|
1900 |
|
---|
1901 | case MODIFYVM_VRDEAUTHLIBRARY:
|
---|
1902 | {
|
---|
1903 | ComPtr<IVRDEServer> vrdeServer;
|
---|
1904 | machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
1905 | ASSERT(vrdeServer);
|
---|
1906 |
|
---|
1907 | if (vrdeServer)
|
---|
1908 | {
|
---|
1909 | if (strcmp(ValueUnion.psz, "default") != 0)
|
---|
1910 | {
|
---|
1911 | Bstr bstr(ValueUnion.psz);
|
---|
1912 | CHECK_ERROR(vrdeServer, COMSETTER(AuthLibrary)(bstr.raw()));
|
---|
1913 | }
|
---|
1914 | else
|
---|
1915 | CHECK_ERROR(vrdeServer, COMSETTER(AuthLibrary)(NULL));
|
---|
1916 | }
|
---|
1917 | break;
|
---|
1918 | }
|
---|
1919 |
|
---|
1920 | case MODIFYVM_VRDPMULTICON:
|
---|
1921 | vrdeWarningDeprecatedOption("multicon");
|
---|
1922 | case MODIFYVM_VRDEMULTICON:
|
---|
1923 | {
|
---|
1924 | ComPtr<IVRDEServer> vrdeServer;
|
---|
1925 | machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
1926 | ASSERT(vrdeServer);
|
---|
1927 |
|
---|
1928 | CHECK_ERROR(vrdeServer, COMSETTER(AllowMultiConnection)(ValueUnion.f));
|
---|
1929 | break;
|
---|
1930 | }
|
---|
1931 |
|
---|
1932 | case MODIFYVM_VRDPREUSECON:
|
---|
1933 | vrdeWarningDeprecatedOption("reusecon");
|
---|
1934 | case MODIFYVM_VRDEREUSECON:
|
---|
1935 | {
|
---|
1936 | ComPtr<IVRDEServer> vrdeServer;
|
---|
1937 | machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
1938 | ASSERT(vrdeServer);
|
---|
1939 |
|
---|
1940 | CHECK_ERROR(vrdeServer, COMSETTER(ReuseSingleConnection)(ValueUnion.f));
|
---|
1941 | break;
|
---|
1942 | }
|
---|
1943 |
|
---|
1944 | case MODIFYVM_VRDPVIDEOCHANNEL:
|
---|
1945 | vrdeWarningDeprecatedOption("videochannel");
|
---|
1946 | case MODIFYVM_VRDEVIDEOCHANNEL:
|
---|
1947 | {
|
---|
1948 | ComPtr<IVRDEServer> vrdeServer;
|
---|
1949 | machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
1950 | ASSERT(vrdeServer);
|
---|
1951 |
|
---|
1952 | CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("VideoChannel/Enabled").raw(),
|
---|
1953 | ValueUnion.f? Bstr("true").raw(): Bstr("false").raw()));
|
---|
1954 | break;
|
---|
1955 | }
|
---|
1956 |
|
---|
1957 | case MODIFYVM_VRDPVIDEOCHANNELQUALITY:
|
---|
1958 | vrdeWarningDeprecatedOption("videochannelquality");
|
---|
1959 | case MODIFYVM_VRDEVIDEOCHANNELQUALITY:
|
---|
1960 | {
|
---|
1961 | ComPtr<IVRDEServer> vrdeServer;
|
---|
1962 | machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
1963 | ASSERT(vrdeServer);
|
---|
1964 |
|
---|
1965 | CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("VideoChannel/Quality").raw(),
|
---|
1966 | Bstr(ValueUnion.psz).raw()));
|
---|
1967 | break;
|
---|
1968 | }
|
---|
1969 |
|
---|
1970 | case MODIFYVM_VRDP:
|
---|
1971 | vrdeWarningDeprecatedOption("");
|
---|
1972 | case MODIFYVM_VRDE:
|
---|
1973 | {
|
---|
1974 | ComPtr<IVRDEServer> vrdeServer;
|
---|
1975 | machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
1976 | ASSERT(vrdeServer);
|
---|
1977 |
|
---|
1978 | CHECK_ERROR(vrdeServer, COMSETTER(Enabled)(ValueUnion.f));
|
---|
1979 | break;
|
---|
1980 | }
|
---|
1981 |
|
---|
1982 | case MODIFYVM_USBEHCI:
|
---|
1983 | {
|
---|
1984 | ComPtr<IUSBController> UsbCtl;
|
---|
1985 | CHECK_ERROR(machine, COMGETTER(USBController)(UsbCtl.asOutParam()));
|
---|
1986 | if (SUCCEEDED(rc))
|
---|
1987 | CHECK_ERROR(UsbCtl, COMSETTER(EnabledEhci)(ValueUnion.f));
|
---|
1988 | break;
|
---|
1989 | }
|
---|
1990 |
|
---|
1991 | case MODIFYVM_USB:
|
---|
1992 | {
|
---|
1993 | ComPtr<IUSBController> UsbCtl;
|
---|
1994 | CHECK_ERROR(machine, COMGETTER(USBController)(UsbCtl.asOutParam()));
|
---|
1995 | if (SUCCEEDED(rc))
|
---|
1996 | CHECK_ERROR(UsbCtl, COMSETTER(Enabled)(ValueUnion.f));
|
---|
1997 | break;
|
---|
1998 | }
|
---|
1999 |
|
---|
2000 | case MODIFYVM_SNAPSHOTFOLDER:
|
---|
2001 | {
|
---|
2002 | if (!strcmp(ValueUnion.psz, "default"))
|
---|
2003 | CHECK_ERROR(machine, COMSETTER(SnapshotFolder)(NULL));
|
---|
2004 | else
|
---|
2005 | CHECK_ERROR(machine, COMSETTER(SnapshotFolder)(Bstr(ValueUnion.psz).raw()));
|
---|
2006 | break;
|
---|
2007 | }
|
---|
2008 |
|
---|
2009 | case MODIFYVM_TELEPORTER_ENABLED:
|
---|
2010 | {
|
---|
2011 | CHECK_ERROR(machine, COMSETTER(TeleporterEnabled)(ValueUnion.f));
|
---|
2012 | break;
|
---|
2013 | }
|
---|
2014 |
|
---|
2015 | case MODIFYVM_TELEPORTER_PORT:
|
---|
2016 | {
|
---|
2017 | CHECK_ERROR(machine, COMSETTER(TeleporterPort)(ValueUnion.u32));
|
---|
2018 | break;
|
---|
2019 | }
|
---|
2020 |
|
---|
2021 | case MODIFYVM_TELEPORTER_ADDRESS:
|
---|
2022 | {
|
---|
2023 | CHECK_ERROR(machine, COMSETTER(TeleporterAddress)(Bstr(ValueUnion.psz).raw()));
|
---|
2024 | break;
|
---|
2025 | }
|
---|
2026 |
|
---|
2027 | case MODIFYVM_TELEPORTER_PASSWORD:
|
---|
2028 | {
|
---|
2029 | CHECK_ERROR(machine, COMSETTER(TeleporterPassword)(Bstr(ValueUnion.psz).raw()));
|
---|
2030 | break;
|
---|
2031 | }
|
---|
2032 |
|
---|
2033 | case MODIFYVM_FAULT_TOLERANCE:
|
---|
2034 | {
|
---|
2035 | if (!strcmp(ValueUnion.psz, "master"))
|
---|
2036 | {
|
---|
2037 | CHECK_ERROR(machine, COMSETTER(FaultToleranceState(FaultToleranceState_Master)));
|
---|
2038 | }
|
---|
2039 | else
|
---|
2040 | if (!strcmp(ValueUnion.psz, "standby"))
|
---|
2041 | {
|
---|
2042 | CHECK_ERROR(machine, COMSETTER(FaultToleranceState(FaultToleranceState_Standby)));
|
---|
2043 | }
|
---|
2044 | else
|
---|
2045 | {
|
---|
2046 | errorArgument("Invalid --faulttolerance argument '%s'", ValueUnion.psz);
|
---|
2047 | rc = E_FAIL;
|
---|
2048 | }
|
---|
2049 | break;
|
---|
2050 | }
|
---|
2051 |
|
---|
2052 | case MODIFYVM_FAULT_TOLERANCE_ADDRESS:
|
---|
2053 | {
|
---|
2054 | CHECK_ERROR(machine, COMSETTER(FaultToleranceAddress)(Bstr(ValueUnion.psz).raw()));
|
---|
2055 | break;
|
---|
2056 | }
|
---|
2057 |
|
---|
2058 | case MODIFYVM_FAULT_TOLERANCE_PORT:
|
---|
2059 | {
|
---|
2060 | CHECK_ERROR(machine, COMSETTER(FaultTolerancePort)(ValueUnion.u32));
|
---|
2061 | break;
|
---|
2062 | }
|
---|
2063 |
|
---|
2064 | case MODIFYVM_FAULT_TOLERANCE_PASSWORD:
|
---|
2065 | {
|
---|
2066 | CHECK_ERROR(machine, COMSETTER(FaultTolerancePassword)(Bstr(ValueUnion.psz).raw()));
|
---|
2067 | break;
|
---|
2068 | }
|
---|
2069 |
|
---|
2070 | case MODIFYVM_FAULT_TOLERANCE_SYNC_INTERVAL:
|
---|
2071 | {
|
---|
2072 | CHECK_ERROR(machine, COMSETTER(FaultToleranceSyncInterval)(ValueUnion.u32));
|
---|
2073 | break;
|
---|
2074 | }
|
---|
2075 |
|
---|
2076 | case MODIFYVM_HARDWARE_UUID:
|
---|
2077 | {
|
---|
2078 | CHECK_ERROR(machine, COMSETTER(HardwareUUID)(Bstr(ValueUnion.psz).raw()));
|
---|
2079 | break;
|
---|
2080 | }
|
---|
2081 |
|
---|
2082 | case MODIFYVM_HPET:
|
---|
2083 | {
|
---|
2084 | CHECK_ERROR(machine, COMSETTER(HpetEnabled)(ValueUnion.f));
|
---|
2085 | break;
|
---|
2086 | }
|
---|
2087 |
|
---|
2088 | case MODIFYVM_IOCACHE:
|
---|
2089 | {
|
---|
2090 | CHECK_ERROR(machine, COMSETTER(IoCacheEnabled)(ValueUnion.f));
|
---|
2091 | break;
|
---|
2092 | }
|
---|
2093 |
|
---|
2094 | case MODIFYVM_IOCACHESIZE:
|
---|
2095 | {
|
---|
2096 | CHECK_ERROR(machine, COMSETTER(IoCacheSize)(ValueUnion.u32));
|
---|
2097 | break;
|
---|
2098 | }
|
---|
2099 |
|
---|
2100 | case MODIFYVM_CHIPSET:
|
---|
2101 | {
|
---|
2102 | if (!strcmp(ValueUnion.psz, "piix3"))
|
---|
2103 | {
|
---|
2104 | CHECK_ERROR(machine, COMSETTER(ChipsetType)(ChipsetType_PIIX3));
|
---|
2105 | }
|
---|
2106 | else if (!strcmp(ValueUnion.psz, "ich9"))
|
---|
2107 | {
|
---|
2108 | CHECK_ERROR(machine, COMSETTER(ChipsetType)(ChipsetType_ICH9));
|
---|
2109 | BOOL fIoApic = FALSE;
|
---|
2110 | CHECK_ERROR(biosSettings, COMGETTER(IOAPICEnabled)(&fIoApic));
|
---|
2111 | if (!fIoApic)
|
---|
2112 | {
|
---|
2113 | RTStrmPrintf(g_pStdErr, "*** I/O APIC must be enabled for ICH9, enabling. ***\n");
|
---|
2114 | CHECK_ERROR(biosSettings, COMSETTER(IOAPICEnabled)(TRUE));
|
---|
2115 | }
|
---|
2116 | }
|
---|
2117 | else
|
---|
2118 | {
|
---|
2119 | errorArgument("Invalid --chipset argument '%s' (valid: piix3,ich9)", ValueUnion.psz);
|
---|
2120 | rc = E_FAIL;
|
---|
2121 | }
|
---|
2122 | break;
|
---|
2123 | }
|
---|
2124 |
|
---|
2125 | default:
|
---|
2126 | {
|
---|
2127 | errorGetOpt(USAGE_MODIFYVM, c, &ValueUnion);
|
---|
2128 | rc = E_FAIL;
|
---|
2129 | break;
|
---|
2130 | }
|
---|
2131 | }
|
---|
2132 | }
|
---|
2133 |
|
---|
2134 | /* commit changes */
|
---|
2135 | if (SUCCEEDED(rc))
|
---|
2136 | CHECK_ERROR(machine, SaveSettings());
|
---|
2137 |
|
---|
2138 | /* it's important to always close sessions */
|
---|
2139 | a->session->UnlockMachine();
|
---|
2140 |
|
---|
2141 | return SUCCEEDED(rc) ? 0 : 1;
|
---|
2142 | }
|
---|
2143 |
|
---|
2144 | #endif /* !VBOX_ONLY_DOCS */
|
---|