1 | /* $Id: VBoxManageModifyVM.cpp 27822 2010-03-30 13:01:36Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxManage - Implementation of modifyvm command.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2009 Sun Microsystems, Inc.
|
---|
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 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
18 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
19 | * additional information or have any questions.
|
---|
20 | */
|
---|
21 |
|
---|
22 | /*******************************************************************************
|
---|
23 | * Header Files *
|
---|
24 | *******************************************************************************/
|
---|
25 | #ifndef VBOX_ONLY_DOCS
|
---|
26 | #include <VBox/com/com.h>
|
---|
27 | #include <VBox/com/array.h>
|
---|
28 | #include <VBox/com/ErrorInfo.h>
|
---|
29 | #include <VBox/com/errorprint.h>
|
---|
30 | #include <VBox/com/EventQueue.h>
|
---|
31 |
|
---|
32 | #include <VBox/com/VirtualBox.h>
|
---|
33 |
|
---|
34 | #include <vector>
|
---|
35 | #include <list>
|
---|
36 | #endif /* !VBOX_ONLY_DOCS */
|
---|
37 |
|
---|
38 | #include <iprt/cidr.h>
|
---|
39 | #include <iprt/param.h>
|
---|
40 | #include <iprt/path.h>
|
---|
41 | #include <iprt/stream.h>
|
---|
42 | #include <iprt/string.h>
|
---|
43 | #include <iprt/getopt.h>
|
---|
44 | #include <VBox/log.h>
|
---|
45 |
|
---|
46 | #include "VBoxManage.h"
|
---|
47 |
|
---|
48 | #ifndef VBOX_ONLY_DOCS
|
---|
49 | using namespace com;
|
---|
50 |
|
---|
51 |
|
---|
52 | /** @todo refine this after HDD changes; MSC 8.0/64 has trouble with handleModifyVM. */
|
---|
53 | #if defined(_MSC_VER)
|
---|
54 | # pragma optimize("g", off)
|
---|
55 | #endif
|
---|
56 |
|
---|
57 | enum
|
---|
58 | {
|
---|
59 | MODIFYVM_NAME = 1000,
|
---|
60 | MODIFYVM_OSTYPE,
|
---|
61 | MODIFYVM_MEMORY,
|
---|
62 | MODIFYVM_VRAM,
|
---|
63 | MODIFYVM_FIRMWARE,
|
---|
64 | MODIFYVM_ACPI,
|
---|
65 | MODIFYVM_IOAPIC,
|
---|
66 | MODIFYVM_PAE,
|
---|
67 | MODIFYVM_SYNTHCPU,
|
---|
68 | MODIFYVM_HWVIRTEX,
|
---|
69 | MODIFYVM_HWVIRTEXEXCLUSIVE,
|
---|
70 | MODIFYVM_NESTEDPAGING,
|
---|
71 | MODIFYVM_LARGEPAGES,
|
---|
72 | MODIFYVM_VTXVPID,
|
---|
73 | MODIFYVM_CPUS,
|
---|
74 | MODIFYVM_CPUHOTPLUG,
|
---|
75 | MODIFYVM_PLUGCPU,
|
---|
76 | MODIFYVM_UNPLUGCPU,
|
---|
77 | MODIFYVM_SETCPUID,
|
---|
78 | MODIFYVM_DELCPUID,
|
---|
79 | MODIFYVM_DELALLCPUID,
|
---|
80 | MODIFYVM_MONITORCOUNT,
|
---|
81 | MODIFYVM_ACCELERATE3D,
|
---|
82 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
83 | MODIFYVM_ACCELERATE2DVIDEO,
|
---|
84 | #endif
|
---|
85 | MODIFYVM_BIOSLOGOFADEIN,
|
---|
86 | MODIFYVM_BIOSLOGOFADEOUT,
|
---|
87 | MODIFYVM_BIOSLOGODISPLAYTIME,
|
---|
88 | MODIFYVM_BIOSLOGOIMAGEPATH,
|
---|
89 | MODIFYVM_BIOSBOOTMENU,
|
---|
90 | MODIFYVM_BIOSSYSTEMTIMEOFFSET,
|
---|
91 | MODIFYVM_BIOSPXEDEBUG,
|
---|
92 | MODIFYVM_BOOT,
|
---|
93 | MODIFYVM_HDA, // deprecated
|
---|
94 | MODIFYVM_HDB, // deprecated
|
---|
95 | MODIFYVM_HDD, // deprecated
|
---|
96 | MODIFYVM_IDECONTROLLER, // deprecated
|
---|
97 | MODIFYVM_SATAIDEEMULATION, // deprecated
|
---|
98 | MODIFYVM_SATAPORTCOUNT, // deprecated
|
---|
99 | MODIFYVM_SATAPORT, // deprecated
|
---|
100 | MODIFYVM_SATA, // deprecated
|
---|
101 | MODIFYVM_SCSIPORT, // deprecated
|
---|
102 | MODIFYVM_SCSITYPE, // deprecated
|
---|
103 | MODIFYVM_SCSI, // deprecated
|
---|
104 | MODIFYVM_DVDPASSTHROUGH, // deprecated
|
---|
105 | MODIFYVM_DVD, // deprecated
|
---|
106 | MODIFYVM_FLOPPY, // deprecated
|
---|
107 | MODIFYVM_NICTRACEFILE,
|
---|
108 | MODIFYVM_NICTRACE,
|
---|
109 | MODIFYVM_NICTYPE,
|
---|
110 | MODIFYVM_NICSPEED,
|
---|
111 | MODIFYVM_NIC,
|
---|
112 | MODIFYVM_CABLECONNECTED,
|
---|
113 | MODIFYVM_BRIDGEADAPTER,
|
---|
114 | MODIFYVM_HOSTONLYADAPTER,
|
---|
115 | MODIFYVM_INTNET,
|
---|
116 | MODIFYVM_NATNET,
|
---|
117 | MODIFYVM_MACADDRESS,
|
---|
118 | MODIFYVM_HIDPTR,
|
---|
119 | MODIFYVM_HIDKBD,
|
---|
120 | MODIFYVM_UARTMODE,
|
---|
121 | MODIFYVM_UART,
|
---|
122 | MODIFYVM_GUESTMEMORYBALLOON,
|
---|
123 | MODIFYVM_AUDIOCONTROLLER,
|
---|
124 | MODIFYVM_AUDIO,
|
---|
125 | MODIFYVM_CLIPBOARD,
|
---|
126 | #ifdef VBOX_WITH_VRDP
|
---|
127 | MODIFYVM_VRDPPORT,
|
---|
128 | MODIFYVM_VRDPADDRESS,
|
---|
129 | MODIFYVM_VRDPAUTHTYPE,
|
---|
130 | MODIFYVM_VRDPMULTICON,
|
---|
131 | MODIFYVM_VRDPREUSECON,
|
---|
132 | MODIFYVM_VRDP,
|
---|
133 | #endif
|
---|
134 | MODIFYVM_RTCUSEUTC,
|
---|
135 | MODIFYVM_USBEHCI,
|
---|
136 | MODIFYVM_USB,
|
---|
137 | MODIFYVM_SNAPSHOTFOLDER,
|
---|
138 | MODIFYVM_TELEPORTER_ENABLED,
|
---|
139 | MODIFYVM_TELEPORTER_PORT,
|
---|
140 | MODIFYVM_TELEPORTER_ADDRESS,
|
---|
141 | MODIFYVM_TELEPORTER_PASSWORD,
|
---|
142 | MODIFYVM_HARDWARE_UUID,
|
---|
143 | MODIFYVM_HPET,
|
---|
144 | MODIFYVM_IOMGR,
|
---|
145 | MODIFYVM_IOBACKEND,
|
---|
146 | MODIFYVM_IOCACHE,
|
---|
147 | MODIFYVM_IOCACHESIZE,
|
---|
148 | MODIFYVM_IOBANDWIDTHMAX
|
---|
149 | };
|
---|
150 |
|
---|
151 | static const RTGETOPTDEF g_aModifyVMOptions[] =
|
---|
152 | {
|
---|
153 | { "--name", MODIFYVM_NAME, RTGETOPT_REQ_STRING },
|
---|
154 | { "--ostype", MODIFYVM_OSTYPE, RTGETOPT_REQ_STRING },
|
---|
155 | { "--memory", MODIFYVM_MEMORY, RTGETOPT_REQ_UINT32 },
|
---|
156 | { "--vram", MODIFYVM_VRAM, RTGETOPT_REQ_UINT32 },
|
---|
157 | { "--firmware", MODIFYVM_FIRMWARE, RTGETOPT_REQ_STRING },
|
---|
158 | { "--acpi", MODIFYVM_ACPI, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
159 | { "--ioapic", MODIFYVM_IOAPIC, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
160 | { "--pae", MODIFYVM_PAE, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
161 | { "--synthcpu", MODIFYVM_SYNTHCPU, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
162 | { "--hwvirtex", MODIFYVM_HWVIRTEX, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
163 | { "--hwvirtexexcl", MODIFYVM_HWVIRTEXEXCLUSIVE, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
164 | { "--nestedpaging", MODIFYVM_NESTEDPAGING, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
165 | { "--largepages", MODIFYVM_LARGEPAGES, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
166 | { "--vtxvpid", MODIFYVM_VTXVPID, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
167 | { "--cpuidset", MODIFYVM_SETCPUID, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX},
|
---|
168 | { "--cpuidremove", MODIFYVM_DELCPUID, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX},
|
---|
169 | { "--cpuidremoveall", MODIFYVM_DELALLCPUID, RTGETOPT_REQ_NOTHING},
|
---|
170 | { "--cpus", MODIFYVM_CPUS, RTGETOPT_REQ_UINT32 },
|
---|
171 | { "--cpuhotplug", MODIFYVM_CPUHOTPLUG, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
172 | { "--plugcpu", MODIFYVM_PLUGCPU, RTGETOPT_REQ_UINT32 },
|
---|
173 | { "--unplugcpu", MODIFYVM_UNPLUGCPU, RTGETOPT_REQ_UINT32 },
|
---|
174 | { "--rtcuseutc", MODIFYVM_RTCUSEUTC, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
175 | { "--monitorcount", MODIFYVM_MONITORCOUNT, RTGETOPT_REQ_UINT32 },
|
---|
176 | { "--accelerate3d", MODIFYVM_ACCELERATE3D, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
177 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
178 | { "--accelerate2dvideo", MODIFYVM_ACCELERATE2DVIDEO, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
179 | #endif
|
---|
180 | { "--bioslogofadein", MODIFYVM_BIOSLOGOFADEIN, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
181 | { "--bioslogofadeout", MODIFYVM_BIOSLOGOFADEOUT, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
182 | { "--bioslogodisplaytime", MODIFYVM_BIOSLOGODISPLAYTIME, RTGETOPT_REQ_UINT32 },
|
---|
183 | { "--bioslogoimagepath", MODIFYVM_BIOSLOGOIMAGEPATH, RTGETOPT_REQ_STRING },
|
---|
184 | { "--biosbootmenu", MODIFYVM_BIOSBOOTMENU, RTGETOPT_REQ_STRING },
|
---|
185 | { "--biossystemtimeoffset", MODIFYVM_BIOSSYSTEMTIMEOFFSET, RTGETOPT_REQ_INT64 },
|
---|
186 | { "--biospxedebug", MODIFYVM_BIOSPXEDEBUG, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
187 | { "--boot", MODIFYVM_BOOT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
188 | { "--hda", MODIFYVM_HDA, RTGETOPT_REQ_STRING },
|
---|
189 | { "--hdb", MODIFYVM_HDB, RTGETOPT_REQ_STRING },
|
---|
190 | { "--hdd", MODIFYVM_HDD, RTGETOPT_REQ_STRING },
|
---|
191 | { "--idecontroller", MODIFYVM_IDECONTROLLER, RTGETOPT_REQ_STRING },
|
---|
192 | { "--sataideemulation", MODIFYVM_SATAIDEEMULATION, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_INDEX },
|
---|
193 | { "--sataportcount", MODIFYVM_SATAPORTCOUNT, RTGETOPT_REQ_UINT32 },
|
---|
194 | { "--sataport", MODIFYVM_SATAPORT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
195 | { "--sata", MODIFYVM_SATA, RTGETOPT_REQ_STRING },
|
---|
196 | { "--scsiport", MODIFYVM_SCSIPORT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
197 | { "--scsitype", MODIFYVM_SCSITYPE, RTGETOPT_REQ_STRING },
|
---|
198 | { "--scsi", MODIFYVM_SCSI, RTGETOPT_REQ_STRING },
|
---|
199 | { "--dvdpassthrough", MODIFYVM_DVDPASSTHROUGH, RTGETOPT_REQ_STRING },
|
---|
200 | { "--dvd", MODIFYVM_DVD, RTGETOPT_REQ_STRING },
|
---|
201 | { "--floppy", MODIFYVM_FLOPPY, RTGETOPT_REQ_STRING },
|
---|
202 | { "--nictracefile", MODIFYVM_NICTRACEFILE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
203 | { "--nictrace", MODIFYVM_NICTRACE, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
|
---|
204 | { "--nictype", MODIFYVM_NICTYPE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
205 | { "--nicspeed", MODIFYVM_NICSPEED, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_INDEX },
|
---|
206 | { "--nic", MODIFYVM_NIC, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
207 | { "--cableconnected", MODIFYVM_CABLECONNECTED, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
|
---|
208 | { "--bridgeadapter", MODIFYVM_BRIDGEADAPTER, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
209 | { "--hostonlyadapter", MODIFYVM_HOSTONLYADAPTER, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
210 | { "--intnet", MODIFYVM_INTNET, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
211 | { "--natnet", MODIFYVM_NATNET, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
212 | { "--macaddress", MODIFYVM_MACADDRESS, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
213 | { "--mouse", MODIFYVM_HIDPTR, RTGETOPT_REQ_STRING },
|
---|
214 | { "--keyboard", MODIFYVM_HIDKBD, RTGETOPT_REQ_STRING },
|
---|
215 | { "--uartmode", MODIFYVM_UARTMODE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
216 | { "--uart", MODIFYVM_UART, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
217 | { "--guestmemoryballoon", MODIFYVM_GUESTMEMORYBALLOON, RTGETOPT_REQ_UINT32 },
|
---|
218 | { "--audiocontroller", MODIFYVM_AUDIOCONTROLLER, RTGETOPT_REQ_STRING },
|
---|
219 | { "--audio", MODIFYVM_AUDIO, RTGETOPT_REQ_STRING },
|
---|
220 | { "--clipboard", MODIFYVM_CLIPBOARD, RTGETOPT_REQ_STRING },
|
---|
221 | #ifdef VBOX_WITH_VRDP
|
---|
222 | { "--vrdpport", MODIFYVM_VRDPPORT, RTGETOPT_REQ_STRING },
|
---|
223 | { "--vrdpaddress", MODIFYVM_VRDPADDRESS, RTGETOPT_REQ_STRING },
|
---|
224 | { "--vrdpauthtype", MODIFYVM_VRDPAUTHTYPE, RTGETOPT_REQ_STRING },
|
---|
225 | { "--vrdpmulticon", MODIFYVM_VRDPMULTICON, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
226 | { "--vrdpreusecon", MODIFYVM_VRDPREUSECON, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
227 | { "--vrdp", MODIFYVM_VRDP, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
228 | #endif
|
---|
229 | { "--usbehci", MODIFYVM_USBEHCI, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
230 | { "--usb", MODIFYVM_USB, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
231 | { "--snapshotfolder", MODIFYVM_SNAPSHOTFOLDER, RTGETOPT_REQ_STRING },
|
---|
232 | { "--teleporter", MODIFYVM_TELEPORTER_ENABLED, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
233 | { "--teleporterenabled", MODIFYVM_TELEPORTER_ENABLED, RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
|
---|
234 | { "--teleporterport", MODIFYVM_TELEPORTER_PORT, RTGETOPT_REQ_UINT32 },
|
---|
235 | { "--teleporteraddress", MODIFYVM_TELEPORTER_ADDRESS, RTGETOPT_REQ_STRING },
|
---|
236 | { "--teleporterpassword", MODIFYVM_TELEPORTER_PASSWORD, RTGETOPT_REQ_STRING },
|
---|
237 | { "--hardwareuuid", MODIFYVM_HARDWARE_UUID, RTGETOPT_REQ_STRING },
|
---|
238 | { "--hpet", MODIFYVM_HPET, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
239 | { "--iomgr", MODIFYVM_IOMGR, RTGETOPT_REQ_STRING },
|
---|
240 | { "--iobackend", MODIFYVM_IOBACKEND, RTGETOPT_REQ_STRING },
|
---|
241 | { "--iocache", MODIFYVM_IOCACHE, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
242 | { "--iocachesize", MODIFYVM_IOCACHESIZE, RTGETOPT_REQ_UINT32 },
|
---|
243 | { "--iobandwidthmax", MODIFYVM_IOBANDWIDTHMAX, RTGETOPT_REQ_UINT32 },
|
---|
244 | };
|
---|
245 |
|
---|
246 | int handleModifyVM(HandlerArg *a)
|
---|
247 | {
|
---|
248 | int c;
|
---|
249 | HRESULT rc;
|
---|
250 | Bstr name;
|
---|
251 | Bstr machineuuid (a->argv[0]);
|
---|
252 | RTGETOPTUNION ValueUnion;
|
---|
253 | RTGETOPTSTATE GetOptState;
|
---|
254 | ComPtr <IMachine> machine;
|
---|
255 | ComPtr <IBIOSSettings> biosSettings;
|
---|
256 |
|
---|
257 | /* VM ID + at least one parameter. Parameter arguments are checked
|
---|
258 | * individually. */
|
---|
259 | if (a->argc < 2)
|
---|
260 | return errorSyntax(USAGE_MODIFYVM, "Not enough parameters");
|
---|
261 |
|
---|
262 | /* Get the number of network adapters */
|
---|
263 | ULONG NetworkAdapterCount = 0;
|
---|
264 | {
|
---|
265 | ComPtr <ISystemProperties> info;
|
---|
266 | CHECK_ERROR_RET(a->virtualBox, COMGETTER(SystemProperties)(info.asOutParam()), 1);
|
---|
267 | CHECK_ERROR_RET(info, COMGETTER(NetworkAdapterCount)(&NetworkAdapterCount), 1);
|
---|
268 | }
|
---|
269 | ULONG SerialPortCount = 0;
|
---|
270 | {
|
---|
271 | ComPtr <ISystemProperties> info;
|
---|
272 | CHECK_ERROR_RET(a->virtualBox, COMGETTER(SystemProperties)(info.asOutParam()), 1);
|
---|
273 | CHECK_ERROR_RET(info, COMGETTER(SerialPortCount)(&SerialPortCount), 1);
|
---|
274 | }
|
---|
275 |
|
---|
276 | /* try to find the given machine */
|
---|
277 | if (!Guid(machineuuid).isEmpty())
|
---|
278 | {
|
---|
279 | CHECK_ERROR_RET(a->virtualBox, GetMachine(machineuuid, machine.asOutParam()), 1);
|
---|
280 | }
|
---|
281 | else
|
---|
282 | {
|
---|
283 | CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[0]), machine.asOutParam()), 1);
|
---|
284 | machine->COMGETTER(Id)(machineuuid.asOutParam());
|
---|
285 | }
|
---|
286 |
|
---|
287 | /* open a session for the VM */
|
---|
288 | CHECK_ERROR_RET(a->virtualBox, OpenSession(a->session, machineuuid), 1);
|
---|
289 |
|
---|
290 | /* get the mutable session machine */
|
---|
291 | a->session->COMGETTER(Machine)(machine.asOutParam());
|
---|
292 | machine->COMGETTER(BIOSSettings)(biosSettings.asOutParam());
|
---|
293 |
|
---|
294 | RTGetOptInit(&GetOptState, a->argc, a->argv, g_aModifyVMOptions,
|
---|
295 | RT_ELEMENTS(g_aModifyVMOptions), 1, RTGETOPTINIT_FLAGS_NO_STD_OPTS);
|
---|
296 |
|
---|
297 | while ( SUCCEEDED (rc)
|
---|
298 | && (c = RTGetOpt(&GetOptState, &ValueUnion)))
|
---|
299 | {
|
---|
300 | switch (c)
|
---|
301 | {
|
---|
302 | case MODIFYVM_NAME:
|
---|
303 | {
|
---|
304 | CHECK_ERROR(machine, COMSETTER(Name)(Bstr(ValueUnion.psz)));
|
---|
305 | break;
|
---|
306 | }
|
---|
307 | case MODIFYVM_OSTYPE:
|
---|
308 | {
|
---|
309 | ComPtr<IGuestOSType> guestOSType;
|
---|
310 | CHECK_ERROR(a->virtualBox, GetGuestOSType(Bstr(ValueUnion.psz), guestOSType.asOutParam()));
|
---|
311 | if (SUCCEEDED(rc) && guestOSType)
|
---|
312 | {
|
---|
313 | CHECK_ERROR(machine, COMSETTER(OSTypeId)(Bstr(ValueUnion.psz)));
|
---|
314 | }
|
---|
315 | else
|
---|
316 | {
|
---|
317 | errorArgument("Invalid guest OS type '%s'", Utf8Str(ValueUnion.psz).raw());
|
---|
318 | rc = E_FAIL;
|
---|
319 | }
|
---|
320 | break;
|
---|
321 | }
|
---|
322 |
|
---|
323 | case MODIFYVM_MEMORY:
|
---|
324 | {
|
---|
325 | CHECK_ERROR(machine, COMSETTER(MemorySize)(ValueUnion.u32));
|
---|
326 | break;
|
---|
327 | }
|
---|
328 |
|
---|
329 | case MODIFYVM_VRAM:
|
---|
330 | {
|
---|
331 | CHECK_ERROR(machine, COMSETTER(VRAMSize)(ValueUnion.u32));
|
---|
332 | break;
|
---|
333 | }
|
---|
334 |
|
---|
335 | case MODIFYVM_FIRMWARE:
|
---|
336 | {
|
---|
337 | if (!strcmp(ValueUnion.psz, "efi"))
|
---|
338 | {
|
---|
339 | CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI));
|
---|
340 | }
|
---|
341 | else if (!strcmp(ValueUnion.psz, "efi32"))
|
---|
342 | {
|
---|
343 | CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI32));
|
---|
344 | }
|
---|
345 | else if (!strcmp(ValueUnion.psz, "efi64"))
|
---|
346 | {
|
---|
347 | CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI64));
|
---|
348 | }
|
---|
349 | else if (!strcmp(ValueUnion.psz, "efidual"))
|
---|
350 | {
|
---|
351 | CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFIDUAL));
|
---|
352 | }
|
---|
353 | else if (!strcmp(ValueUnion.psz, "bios"))
|
---|
354 | {
|
---|
355 | CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_BIOS));
|
---|
356 | }
|
---|
357 | else
|
---|
358 | {
|
---|
359 | errorArgument("Invalid --firmware argument '%s'", ValueUnion.psz);
|
---|
360 | rc = E_FAIL;
|
---|
361 | }
|
---|
362 | break;
|
---|
363 | }
|
---|
364 |
|
---|
365 | case MODIFYVM_ACPI:
|
---|
366 | {
|
---|
367 | CHECK_ERROR(biosSettings, COMSETTER(ACPIEnabled)(ValueUnion.f));
|
---|
368 | break;
|
---|
369 | }
|
---|
370 |
|
---|
371 | case MODIFYVM_IOAPIC:
|
---|
372 | {
|
---|
373 | CHECK_ERROR(biosSettings, COMSETTER(IOAPICEnabled)(ValueUnion.f));
|
---|
374 | break;
|
---|
375 | }
|
---|
376 |
|
---|
377 | case MODIFYVM_PAE:
|
---|
378 | {
|
---|
379 | CHECK_ERROR(machine, SetCPUProperty(CPUPropertyType_PAE, ValueUnion.f));
|
---|
380 | break;
|
---|
381 | }
|
---|
382 |
|
---|
383 | case MODIFYVM_SYNTHCPU:
|
---|
384 | {
|
---|
385 | CHECK_ERROR(machine, SetCPUProperty(CPUPropertyType_Synthetic, ValueUnion.f));
|
---|
386 | break;
|
---|
387 | }
|
---|
388 |
|
---|
389 | case MODIFYVM_HWVIRTEX:
|
---|
390 | {
|
---|
391 | CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_Enabled, ValueUnion.f));
|
---|
392 | break;
|
---|
393 | }
|
---|
394 |
|
---|
395 | case MODIFYVM_HWVIRTEXEXCLUSIVE:
|
---|
396 | {
|
---|
397 | CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_Exclusive, ValueUnion.f));
|
---|
398 | break;
|
---|
399 | }
|
---|
400 |
|
---|
401 | case MODIFYVM_SETCPUID:
|
---|
402 | {
|
---|
403 | uint32_t id = ValueUnion.u32;
|
---|
404 | uint32_t aValue[4];
|
---|
405 |
|
---|
406 | for (unsigned i = 0 ; i < 4 ; i++)
|
---|
407 | {
|
---|
408 | int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX);
|
---|
409 | if (RT_FAILURE(vrc))
|
---|
410 | return errorSyntax(USAGE_MODIFYVM,
|
---|
411 | "Missing or Invalid argument to '%s'",
|
---|
412 | GetOptState.pDef->pszLong);
|
---|
413 | aValue[i] = ValueUnion.u32;
|
---|
414 | }
|
---|
415 | CHECK_ERROR(machine, SetCPUIDLeaf(id, aValue[0], aValue[1], aValue[2], aValue[3]));
|
---|
416 | break;
|
---|
417 | }
|
---|
418 |
|
---|
419 | case MODIFYVM_DELCPUID:
|
---|
420 | {
|
---|
421 | CHECK_ERROR(machine, RemoveCPUIDLeaf(ValueUnion.u32));
|
---|
422 | break;
|
---|
423 | }
|
---|
424 |
|
---|
425 | case MODIFYVM_DELALLCPUID:
|
---|
426 | {
|
---|
427 | CHECK_ERROR(machine, RemoveAllCPUIDLeaves());
|
---|
428 | break;
|
---|
429 | }
|
---|
430 |
|
---|
431 | case MODIFYVM_NESTEDPAGING:
|
---|
432 | {
|
---|
433 | CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_NestedPaging, ValueUnion.f));
|
---|
434 | break;
|
---|
435 | }
|
---|
436 |
|
---|
437 | case MODIFYVM_LARGEPAGES:
|
---|
438 | {
|
---|
439 | CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_LargePages, ValueUnion.f));
|
---|
440 | break;
|
---|
441 | }
|
---|
442 |
|
---|
443 | case MODIFYVM_VTXVPID:
|
---|
444 | {
|
---|
445 | CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_VPID, ValueUnion.f));
|
---|
446 | break;
|
---|
447 | }
|
---|
448 |
|
---|
449 | case MODIFYVM_CPUS:
|
---|
450 | {
|
---|
451 | CHECK_ERROR(machine, COMSETTER(CPUCount)(ValueUnion.u32));
|
---|
452 | break;
|
---|
453 | }
|
---|
454 |
|
---|
455 | case MODIFYVM_RTCUSEUTC:
|
---|
456 | {
|
---|
457 | CHECK_ERROR(machine, COMSETTER(RTCUseUTC)(ValueUnion.f));
|
---|
458 | break;
|
---|
459 | }
|
---|
460 |
|
---|
461 | case MODIFYVM_CPUHOTPLUG:
|
---|
462 | {
|
---|
463 | CHECK_ERROR(machine, COMSETTER(CPUHotPlugEnabled)(ValueUnion.f));
|
---|
464 | break;
|
---|
465 | }
|
---|
466 |
|
---|
467 | case MODIFYVM_PLUGCPU:
|
---|
468 | {
|
---|
469 | CHECK_ERROR(machine, HotPlugCPU(ValueUnion.u32));
|
---|
470 | break;
|
---|
471 | }
|
---|
472 |
|
---|
473 | case MODIFYVM_UNPLUGCPU:
|
---|
474 | {
|
---|
475 | CHECK_ERROR(machine, HotUnplugCPU(ValueUnion.u32));
|
---|
476 | break;
|
---|
477 | }
|
---|
478 |
|
---|
479 | case MODIFYVM_MONITORCOUNT:
|
---|
480 | {
|
---|
481 | CHECK_ERROR(machine, COMSETTER(MonitorCount)(ValueUnion.u32));
|
---|
482 | break;
|
---|
483 | }
|
---|
484 |
|
---|
485 | case MODIFYVM_ACCELERATE3D:
|
---|
486 | {
|
---|
487 | CHECK_ERROR(machine, COMSETTER(Accelerate3DEnabled)(ValueUnion.f));
|
---|
488 | break;
|
---|
489 | }
|
---|
490 |
|
---|
491 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
492 | case MODIFYVM_ACCELERATE2DVIDEO:
|
---|
493 | {
|
---|
494 | CHECK_ERROR(machine, COMSETTER(Accelerate2DVideoEnabled)(ValueUnion.f));
|
---|
495 | break;
|
---|
496 | }
|
---|
497 | #endif
|
---|
498 |
|
---|
499 | case MODIFYVM_BIOSLOGOFADEIN:
|
---|
500 | {
|
---|
501 | CHECK_ERROR(biosSettings, COMSETTER(LogoFadeIn)(ValueUnion.f));
|
---|
502 | break;
|
---|
503 | }
|
---|
504 |
|
---|
505 | case MODIFYVM_BIOSLOGOFADEOUT:
|
---|
506 | {
|
---|
507 | CHECK_ERROR(biosSettings, COMSETTER(LogoFadeOut)(ValueUnion.f));
|
---|
508 | break;
|
---|
509 | }
|
---|
510 |
|
---|
511 | case MODIFYVM_BIOSLOGODISPLAYTIME:
|
---|
512 | {
|
---|
513 | CHECK_ERROR(biosSettings, COMSETTER(LogoDisplayTime)(ValueUnion.u32));
|
---|
514 | break;
|
---|
515 | }
|
---|
516 |
|
---|
517 | case MODIFYVM_BIOSLOGOIMAGEPATH:
|
---|
518 | {
|
---|
519 | CHECK_ERROR(biosSettings, COMSETTER(LogoImagePath)(Bstr(ValueUnion.psz)));
|
---|
520 | break;
|
---|
521 | }
|
---|
522 |
|
---|
523 | case MODIFYVM_BIOSBOOTMENU:
|
---|
524 | {
|
---|
525 | if (!strcmp(ValueUnion.psz, "disabled"))
|
---|
526 | {
|
---|
527 | CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_Disabled));
|
---|
528 | }
|
---|
529 | else if (!strcmp(ValueUnion.psz, "menuonly"))
|
---|
530 | {
|
---|
531 | CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_MenuOnly));
|
---|
532 | }
|
---|
533 | else if (!strcmp(ValueUnion.psz, "messageandmenu"))
|
---|
534 | {
|
---|
535 | CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_MessageAndMenu));
|
---|
536 | }
|
---|
537 | else
|
---|
538 | {
|
---|
539 | errorArgument("Invalid --biosbootmenu argument '%s'", ValueUnion.psz);
|
---|
540 | rc = E_FAIL;
|
---|
541 | }
|
---|
542 | break;
|
---|
543 | }
|
---|
544 |
|
---|
545 | case MODIFYVM_BIOSSYSTEMTIMEOFFSET:
|
---|
546 | {
|
---|
547 | CHECK_ERROR(biosSettings, COMSETTER(TimeOffset)(ValueUnion.i64));
|
---|
548 | break;
|
---|
549 | }
|
---|
550 |
|
---|
551 | case MODIFYVM_BIOSPXEDEBUG:
|
---|
552 | {
|
---|
553 | CHECK_ERROR(biosSettings, COMSETTER(PXEDebugEnabled)(ValueUnion.f));
|
---|
554 | break;
|
---|
555 | }
|
---|
556 |
|
---|
557 | case MODIFYVM_BOOT:
|
---|
558 | {
|
---|
559 | if (!strcmp(ValueUnion.psz, "none"))
|
---|
560 | {
|
---|
561 | CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_Null));
|
---|
562 | }
|
---|
563 | else if (!strcmp(ValueUnion.psz, "floppy"))
|
---|
564 | {
|
---|
565 | CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_Floppy));
|
---|
566 | }
|
---|
567 | else if (!strcmp(ValueUnion.psz, "dvd"))
|
---|
568 | {
|
---|
569 | CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_DVD));
|
---|
570 | }
|
---|
571 | else if (!strcmp(ValueUnion.psz, "disk"))
|
---|
572 | {
|
---|
573 | CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_HardDisk));
|
---|
574 | }
|
---|
575 | else if (!strcmp(ValueUnion.psz, "net"))
|
---|
576 | {
|
---|
577 | CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_Network));
|
---|
578 | }
|
---|
579 | else
|
---|
580 | return errorArgument("Invalid boot device '%s'", ValueUnion.psz);
|
---|
581 | break;
|
---|
582 | }
|
---|
583 |
|
---|
584 | case MODIFYVM_HDA: // deprecated
|
---|
585 | {
|
---|
586 | if (!strcmp(ValueUnion.psz, "none"))
|
---|
587 | {
|
---|
588 | machine->DetachDevice(Bstr("IDE Controller"), 0, 0);
|
---|
589 | }
|
---|
590 | else
|
---|
591 | {
|
---|
592 | /* first guess is that it's a UUID */
|
---|
593 | Bstr uuid(ValueUnion.psz);
|
---|
594 | ComPtr<IMedium> hardDisk;
|
---|
595 | rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
|
---|
596 | /* not successful? Then it must be a filename */
|
---|
597 | if (!hardDisk)
|
---|
598 | {
|
---|
599 | rc = a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam());
|
---|
600 | if (FAILED(rc))
|
---|
601 | {
|
---|
602 | /* open the new hard disk object */
|
---|
603 | CHECK_ERROR(a->virtualBox,
|
---|
604 | OpenHardDisk(Bstr(ValueUnion.psz),
|
---|
605 | AccessMode_ReadWrite, false, Bstr(""),
|
---|
606 | false, Bstr(""), hardDisk.asOutParam()));
|
---|
607 | }
|
---|
608 | }
|
---|
609 | if (hardDisk)
|
---|
610 | {
|
---|
611 | hardDisk->COMGETTER(Id)(uuid.asOutParam());
|
---|
612 | CHECK_ERROR(machine, AttachDevice(Bstr("IDE Controller"), 0, 0, DeviceType_HardDisk, uuid));
|
---|
613 | }
|
---|
614 | else
|
---|
615 | rc = E_FAIL;
|
---|
616 | }
|
---|
617 | break;
|
---|
618 | }
|
---|
619 |
|
---|
620 | case MODIFYVM_HDB: // deprecated
|
---|
621 | {
|
---|
622 | if (!strcmp(ValueUnion.psz, "none"))
|
---|
623 | {
|
---|
624 | machine->DetachDevice(Bstr("IDE Controller"), 0, 1);
|
---|
625 | }
|
---|
626 | else
|
---|
627 | {
|
---|
628 | /* first guess is that it's a UUID */
|
---|
629 | Bstr uuid(ValueUnion.psz);
|
---|
630 | ComPtr<IMedium> hardDisk;
|
---|
631 | rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
|
---|
632 | /* not successful? Then it must be a filename */
|
---|
633 | if (!hardDisk)
|
---|
634 | {
|
---|
635 | rc = a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam());
|
---|
636 | if (FAILED(rc))
|
---|
637 | {
|
---|
638 | /* open the new hard disk object */
|
---|
639 | CHECK_ERROR(a->virtualBox,
|
---|
640 | OpenHardDisk(Bstr(ValueUnion.psz),
|
---|
641 | AccessMode_ReadWrite, false, Bstr(""),
|
---|
642 | false, Bstr(""), hardDisk.asOutParam()));
|
---|
643 | }
|
---|
644 | }
|
---|
645 | if (hardDisk)
|
---|
646 | {
|
---|
647 | hardDisk->COMGETTER(Id)(uuid.asOutParam());
|
---|
648 | CHECK_ERROR(machine, AttachDevice(Bstr("IDE Controller"), 0, 1, DeviceType_HardDisk, uuid));
|
---|
649 | }
|
---|
650 | else
|
---|
651 | rc = E_FAIL;
|
---|
652 | }
|
---|
653 | break;
|
---|
654 | }
|
---|
655 |
|
---|
656 | case MODIFYVM_HDD: // deprecated
|
---|
657 | {
|
---|
658 | if (!strcmp(ValueUnion.psz, "none"))
|
---|
659 | {
|
---|
660 | machine->DetachDevice(Bstr("IDE Controller"), 1, 1);
|
---|
661 | }
|
---|
662 | else
|
---|
663 | {
|
---|
664 | /* first guess is that it's a UUID */
|
---|
665 | Bstr uuid(ValueUnion.psz);
|
---|
666 | ComPtr<IMedium> hardDisk;
|
---|
667 | rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
|
---|
668 | /* not successful? Then it must be a filename */
|
---|
669 | if (!hardDisk)
|
---|
670 | {
|
---|
671 | rc = a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam());
|
---|
672 | if (FAILED(rc))
|
---|
673 | {
|
---|
674 | /* open the new hard disk object */
|
---|
675 | CHECK_ERROR(a->virtualBox,
|
---|
676 | OpenHardDisk(Bstr(ValueUnion.psz),
|
---|
677 | AccessMode_ReadWrite, false, Bstr(""),
|
---|
678 | false, Bstr(""), hardDisk.asOutParam()));
|
---|
679 | }
|
---|
680 | }
|
---|
681 | if (hardDisk)
|
---|
682 | {
|
---|
683 | hardDisk->COMGETTER(Id)(uuid.asOutParam());
|
---|
684 | CHECK_ERROR(machine, AttachDevice(Bstr("IDE Controller"), 1, 1, DeviceType_HardDisk, uuid));
|
---|
685 | }
|
---|
686 | else
|
---|
687 | rc = E_FAIL;
|
---|
688 | }
|
---|
689 | break;
|
---|
690 | }
|
---|
691 |
|
---|
692 | case MODIFYVM_IDECONTROLLER: // deprecated
|
---|
693 | {
|
---|
694 | ComPtr<IStorageController> storageController;
|
---|
695 | CHECK_ERROR(machine, GetStorageControllerByName(Bstr("IDE Controller"),
|
---|
696 | storageController.asOutParam()));
|
---|
697 |
|
---|
698 | if (!RTStrICmp(ValueUnion.psz, "PIIX3"))
|
---|
699 | {
|
---|
700 | CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_PIIX3));
|
---|
701 | }
|
---|
702 | else if (!RTStrICmp(ValueUnion.psz, "PIIX4"))
|
---|
703 | {
|
---|
704 | CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_PIIX4));
|
---|
705 | }
|
---|
706 | else if (!RTStrICmp(ValueUnion.psz, "ICH6"))
|
---|
707 | {
|
---|
708 | CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_ICH6));
|
---|
709 | }
|
---|
710 | else
|
---|
711 | {
|
---|
712 | errorArgument("Invalid --idecontroller argument '%s'", ValueUnion.psz);
|
---|
713 | rc = E_FAIL;
|
---|
714 | }
|
---|
715 | break;
|
---|
716 | }
|
---|
717 |
|
---|
718 | case MODIFYVM_SATAIDEEMULATION: // deprecated
|
---|
719 | {
|
---|
720 | ComPtr<IStorageController> SataCtl;
|
---|
721 | CHECK_ERROR(machine, GetStorageControllerByName(Bstr("SATA"), SataCtl.asOutParam()));
|
---|
722 |
|
---|
723 | if (SUCCEEDED(rc))
|
---|
724 | CHECK_ERROR(SataCtl, SetIDEEmulationPort(GetOptState.uIndex, ValueUnion.u32));
|
---|
725 | break;
|
---|
726 | }
|
---|
727 |
|
---|
728 | case MODIFYVM_SATAPORTCOUNT: // deprecated
|
---|
729 | {
|
---|
730 | ComPtr<IStorageController> SataCtl;
|
---|
731 | CHECK_ERROR(machine, GetStorageControllerByName(Bstr("SATA"), SataCtl.asOutParam()));
|
---|
732 |
|
---|
733 | if (SUCCEEDED(rc) && ValueUnion.u32 > 0)
|
---|
734 | CHECK_ERROR(SataCtl, COMSETTER(PortCount)(ValueUnion.u32));
|
---|
735 | break;
|
---|
736 | }
|
---|
737 |
|
---|
738 | case MODIFYVM_SATAPORT: // deprecated
|
---|
739 | {
|
---|
740 | if (!strcmp(ValueUnion.psz, "none"))
|
---|
741 | {
|
---|
742 | machine->DetachDevice(Bstr("SATA"), GetOptState.uIndex, 0);
|
---|
743 | }
|
---|
744 | else
|
---|
745 | {
|
---|
746 | /* first guess is that it's a UUID */
|
---|
747 | Bstr uuid(ValueUnion.psz);
|
---|
748 | ComPtr<IMedium> hardDisk;
|
---|
749 | rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
|
---|
750 | /* not successful? Then it must be a filename */
|
---|
751 | if (!hardDisk)
|
---|
752 | {
|
---|
753 | rc = a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam());
|
---|
754 | if (FAILED(rc))
|
---|
755 | {
|
---|
756 | /* open the new hard disk object */
|
---|
757 | CHECK_ERROR(a->virtualBox,
|
---|
758 | OpenHardDisk(Bstr(ValueUnion.psz), AccessMode_ReadWrite,
|
---|
759 | false, Bstr(""), false,
|
---|
760 | Bstr(""), hardDisk.asOutParam()));
|
---|
761 | }
|
---|
762 | }
|
---|
763 | if (hardDisk)
|
---|
764 | {
|
---|
765 | hardDisk->COMGETTER(Id)(uuid.asOutParam());
|
---|
766 | CHECK_ERROR(machine,
|
---|
767 | AttachDevice(Bstr("SATA"), GetOptState.uIndex,
|
---|
768 | 0, DeviceType_HardDisk, uuid));
|
---|
769 | }
|
---|
770 | else
|
---|
771 | rc = E_FAIL;
|
---|
772 | }
|
---|
773 | break;
|
---|
774 | }
|
---|
775 |
|
---|
776 | case MODIFYVM_SATA: // deprecated
|
---|
777 | {
|
---|
778 | if (!strcmp(ValueUnion.psz, "on") || !strcmp(ValueUnion.psz, "enable"))
|
---|
779 | {
|
---|
780 | ComPtr<IStorageController> ctl;
|
---|
781 | CHECK_ERROR(machine, AddStorageController(Bstr("SATA"), StorageBus_SATA, ctl.asOutParam()));
|
---|
782 | CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_IntelAhci));
|
---|
783 | }
|
---|
784 | else if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
|
---|
785 | CHECK_ERROR(machine, RemoveStorageController(Bstr("SATA")));
|
---|
786 | else
|
---|
787 | return errorArgument("Invalid --usb argument '%s'", ValueUnion.psz);
|
---|
788 | break;
|
---|
789 | }
|
---|
790 |
|
---|
791 | case MODIFYVM_SCSIPORT: // deprecated
|
---|
792 | {
|
---|
793 | if (!strcmp(ValueUnion.psz, "none"))
|
---|
794 | {
|
---|
795 | rc = machine->DetachDevice(Bstr("LsiLogic"), GetOptState.uIndex, 0);
|
---|
796 | if (FAILED(rc))
|
---|
797 | CHECK_ERROR(machine, DetachDevice(Bstr("BusLogic"), GetOptState.uIndex, 0));
|
---|
798 | }
|
---|
799 | else
|
---|
800 | {
|
---|
801 | /* first guess is that it's a UUID */
|
---|
802 | Bstr uuid(ValueUnion.psz);
|
---|
803 | ComPtr<IMedium> hardDisk;
|
---|
804 | rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
|
---|
805 | /* not successful? Then it must be a filename */
|
---|
806 | if (!hardDisk)
|
---|
807 | {
|
---|
808 | rc = a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam());
|
---|
809 | if (FAILED(rc))
|
---|
810 | {
|
---|
811 | /* open the new hard disk object */
|
---|
812 | CHECK_ERROR(a->virtualBox,
|
---|
813 | OpenHardDisk(Bstr(ValueUnion.psz),
|
---|
814 | AccessMode_ReadWrite, false, Bstr(""),
|
---|
815 | false, Bstr(""), hardDisk.asOutParam()));
|
---|
816 | }
|
---|
817 | }
|
---|
818 | if (hardDisk)
|
---|
819 | {
|
---|
820 | hardDisk->COMGETTER(Id)(uuid.asOutParam());
|
---|
821 | rc = machine->AttachDevice(Bstr("LsiLogic"), GetOptState.uIndex, 0, DeviceType_HardDisk, uuid);
|
---|
822 | if (FAILED(rc))
|
---|
823 | CHECK_ERROR(machine,
|
---|
824 | AttachDevice(Bstr("BusLogic"),
|
---|
825 | GetOptState.uIndex, 0,
|
---|
826 | DeviceType_HardDisk, uuid));
|
---|
827 | }
|
---|
828 | else
|
---|
829 | rc = E_FAIL;
|
---|
830 | }
|
---|
831 | break;
|
---|
832 | }
|
---|
833 |
|
---|
834 | case MODIFYVM_SCSITYPE: // deprecated
|
---|
835 | {
|
---|
836 | ComPtr<IStorageController> ctl;
|
---|
837 |
|
---|
838 | if (!RTStrICmp(ValueUnion.psz, "LsiLogic"))
|
---|
839 | {
|
---|
840 | rc = machine->RemoveStorageController(Bstr("BusLogic"));
|
---|
841 | if (FAILED(rc))
|
---|
842 | CHECK_ERROR(machine, RemoveStorageController(Bstr("LsiLogic")));
|
---|
843 |
|
---|
844 | CHECK_ERROR(machine,
|
---|
845 | AddStorageController(Bstr("LsiLogic"),
|
---|
846 | StorageBus_SCSI,
|
---|
847 | ctl.asOutParam()));
|
---|
848 |
|
---|
849 | if (SUCCEEDED(rc))
|
---|
850 | CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_LsiLogic));
|
---|
851 | }
|
---|
852 | else if (!RTStrICmp(ValueUnion.psz, "BusLogic"))
|
---|
853 | {
|
---|
854 | rc = machine->RemoveStorageController(Bstr("LsiLogic"));
|
---|
855 | if (FAILED(rc))
|
---|
856 | CHECK_ERROR(machine, RemoveStorageController(Bstr("BusLogic")));
|
---|
857 |
|
---|
858 | CHECK_ERROR(machine,
|
---|
859 | AddStorageController(Bstr("BusLogic"),
|
---|
860 | StorageBus_SCSI,
|
---|
861 | ctl.asOutParam()));
|
---|
862 |
|
---|
863 | if (SUCCEEDED(rc))
|
---|
864 | CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_BusLogic));
|
---|
865 | }
|
---|
866 | else
|
---|
867 | return errorArgument("Invalid --scsitype argument '%s'", ValueUnion.psz);
|
---|
868 | break;
|
---|
869 | }
|
---|
870 |
|
---|
871 | case MODIFYVM_SCSI: // deprecated
|
---|
872 | {
|
---|
873 | if (!strcmp(ValueUnion.psz, "on") || !strcmp(ValueUnion.psz, "enable"))
|
---|
874 | {
|
---|
875 | ComPtr<IStorageController> ctl;
|
---|
876 |
|
---|
877 | CHECK_ERROR(machine, AddStorageController(Bstr("BusLogic"), StorageBus_SCSI, ctl.asOutParam()));
|
---|
878 | if (SUCCEEDED(rc))
|
---|
879 | CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_BusLogic));
|
---|
880 | }
|
---|
881 | else if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
|
---|
882 | {
|
---|
883 | rc = machine->RemoveStorageController(Bstr("BusLogic"));
|
---|
884 | if (FAILED(rc))
|
---|
885 | CHECK_ERROR(machine, RemoveStorageController(Bstr("LsiLogic")));
|
---|
886 | }
|
---|
887 | break;
|
---|
888 | }
|
---|
889 |
|
---|
890 | case MODIFYVM_DVDPASSTHROUGH: // deprecated
|
---|
891 | {
|
---|
892 | CHECK_ERROR(machine, PassthroughDevice(Bstr("IDE Controller"), 1, 0, !strcmp(ValueUnion.psz, "on")));
|
---|
893 | break;
|
---|
894 | }
|
---|
895 |
|
---|
896 | case MODIFYVM_DVD: // deprecated
|
---|
897 | {
|
---|
898 | ComPtr<IMedium> dvdMedium;
|
---|
899 | Bstr uuid(ValueUnion.psz);
|
---|
900 |
|
---|
901 | /* unmount? */
|
---|
902 | if (!strcmp(ValueUnion.psz, "none"))
|
---|
903 | {
|
---|
904 | /* nothing to do, NULL object will cause unmount */
|
---|
905 | }
|
---|
906 | /* host drive? */
|
---|
907 | else if (!strncmp(ValueUnion.psz, "host:", 5))
|
---|
908 | {
|
---|
909 | ComPtr<IHost> host;
|
---|
910 | CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
|
---|
911 | rc = host->FindHostDVDDrive(Bstr(ValueUnion.psz + 5), dvdMedium.asOutParam());
|
---|
912 | if (!dvdMedium)
|
---|
913 | {
|
---|
914 | /* 2nd try: try with the real name, important on Linux+libhal */
|
---|
915 | char szPathReal[RTPATH_MAX];
|
---|
916 | if (RT_FAILURE(RTPathReal(ValueUnion.psz + 5, szPathReal, sizeof(szPathReal))))
|
---|
917 | {
|
---|
918 | errorArgument("Invalid host DVD drive name \"%s\"", ValueUnion.psz + 5);
|
---|
919 | rc = E_FAIL;
|
---|
920 | break;
|
---|
921 | }
|
---|
922 | rc = host->FindHostDVDDrive(Bstr(szPathReal), dvdMedium.asOutParam());
|
---|
923 | if (!dvdMedium)
|
---|
924 | {
|
---|
925 | errorArgument("Invalid host DVD drive name \"%s\"", ValueUnion.psz + 5);
|
---|
926 | rc = E_FAIL;
|
---|
927 | break;
|
---|
928 | }
|
---|
929 | }
|
---|
930 | }
|
---|
931 | else
|
---|
932 | {
|
---|
933 | /* first assume it's a UUID */
|
---|
934 | rc = a->virtualBox->GetDVDImage(uuid, dvdMedium.asOutParam());
|
---|
935 | if (FAILED(rc) || !dvdMedium)
|
---|
936 | {
|
---|
937 | /* must be a filename, check if it's in the collection */
|
---|
938 | rc = a->virtualBox->FindDVDImage(Bstr(ValueUnion.psz), dvdMedium.asOutParam());
|
---|
939 | /* not registered, do that on the fly */
|
---|
940 | if (!dvdMedium)
|
---|
941 | {
|
---|
942 | Bstr emptyUUID;
|
---|
943 | CHECK_ERROR(a->virtualBox, OpenDVDImage(Bstr(ValueUnion.psz),
|
---|
944 | emptyUUID, dvdMedium.asOutParam()));
|
---|
945 | }
|
---|
946 | }
|
---|
947 | if (!dvdMedium)
|
---|
948 | {
|
---|
949 | rc = E_FAIL;
|
---|
950 | break;
|
---|
951 | }
|
---|
952 | }
|
---|
953 |
|
---|
954 | /** @todo generalize this, allow arbitrary number of DVD drives
|
---|
955 | * and as a consequence multiple attachments and different
|
---|
956 | * storage controllers. */
|
---|
957 | if (dvdMedium)
|
---|
958 | dvdMedium->COMGETTER(Id)(uuid.asOutParam());
|
---|
959 | CHECK_ERROR(machine, MountMedium(Bstr("IDE Controller"), 1, 0, uuid, FALSE /* aForce */));
|
---|
960 | break;
|
---|
961 | }
|
---|
962 |
|
---|
963 | case MODIFYVM_FLOPPY: // deprecated
|
---|
964 | {
|
---|
965 | Bstr uuid(ValueUnion.psz);
|
---|
966 | ComPtr<IMedium> floppyMedium;
|
---|
967 | ComPtr<IMediumAttachment> floppyAttachment;
|
---|
968 | machine->GetMediumAttachment(Bstr("Floppy Controller"), 0, 0, floppyAttachment.asOutParam());
|
---|
969 |
|
---|
970 | /* disable? */
|
---|
971 | if (!strcmp(ValueUnion.psz, "disabled"))
|
---|
972 | {
|
---|
973 | /* disable the controller */
|
---|
974 | if (floppyAttachment)
|
---|
975 | CHECK_ERROR(machine, DetachDevice(Bstr("Floppy Controller"), 0, 0));
|
---|
976 | }
|
---|
977 | else
|
---|
978 | {
|
---|
979 | /* enable the controller */
|
---|
980 | if (!floppyAttachment)
|
---|
981 | CHECK_ERROR(machine, AttachDevice(Bstr("Floppy Controller"), 0, 0, DeviceType_Floppy, NULL));
|
---|
982 |
|
---|
983 | /* unmount? */
|
---|
984 | if ( !strcmp(ValueUnion.psz, "none")
|
---|
985 | || !strcmp(ValueUnion.psz, "empty")) // deprecated
|
---|
986 | {
|
---|
987 | /* nothing to do, NULL object will cause unmount */
|
---|
988 | }
|
---|
989 | /* host drive? */
|
---|
990 | else if (!strncmp(ValueUnion.psz, "host:", 5))
|
---|
991 | {
|
---|
992 | ComPtr<IHost> host;
|
---|
993 | CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
|
---|
994 | rc = host->FindHostFloppyDrive(Bstr(ValueUnion.psz + 5), floppyMedium.asOutParam());
|
---|
995 | if (!floppyMedium)
|
---|
996 | {
|
---|
997 | errorArgument("Invalid host floppy drive name \"%s\"", ValueUnion.psz + 5);
|
---|
998 | rc = E_FAIL;
|
---|
999 | break;
|
---|
1000 | }
|
---|
1001 | }
|
---|
1002 | else
|
---|
1003 | {
|
---|
1004 | /* first assume it's a UUID */
|
---|
1005 | rc = a->virtualBox->GetFloppyImage(uuid, floppyMedium.asOutParam());
|
---|
1006 | if (FAILED(rc) || !floppyMedium)
|
---|
1007 | {
|
---|
1008 | /* must be a filename, check if it's in the collection */
|
---|
1009 | rc = a->virtualBox->FindFloppyImage(Bstr(ValueUnion.psz), floppyMedium.asOutParam());
|
---|
1010 | /* not registered, do that on the fly */
|
---|
1011 | if (!floppyMedium)
|
---|
1012 | {
|
---|
1013 | Bstr emptyUUID;
|
---|
1014 | CHECK_ERROR(a->virtualBox,
|
---|
1015 | OpenFloppyImage(Bstr(ValueUnion.psz),
|
---|
1016 | emptyUUID,
|
---|
1017 | floppyMedium.asOutParam()));
|
---|
1018 | }
|
---|
1019 | }
|
---|
1020 | if (!floppyMedium)
|
---|
1021 | {
|
---|
1022 | rc = E_FAIL;
|
---|
1023 | break;
|
---|
1024 | }
|
---|
1025 | }
|
---|
1026 | floppyMedium->COMGETTER(Id)(uuid.asOutParam());
|
---|
1027 | CHECK_ERROR(machine, MountMedium(Bstr("Floppy Controller"), 0, 0, uuid, FALSE /* aForce */));
|
---|
1028 | }
|
---|
1029 | break;
|
---|
1030 | }
|
---|
1031 |
|
---|
1032 | case MODIFYVM_NICTRACEFILE:
|
---|
1033 | {
|
---|
1034 | ComPtr<INetworkAdapter> nic;
|
---|
1035 |
|
---|
1036 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1037 | ASSERT(nic);
|
---|
1038 |
|
---|
1039 | CHECK_ERROR(nic, COMSETTER(TraceFile)(Bstr(ValueUnion.psz)));
|
---|
1040 | break;
|
---|
1041 | }
|
---|
1042 |
|
---|
1043 | case MODIFYVM_NICTRACE:
|
---|
1044 | {
|
---|
1045 | ComPtr<INetworkAdapter> nic;
|
---|
1046 |
|
---|
1047 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1048 | ASSERT(nic);
|
---|
1049 |
|
---|
1050 | CHECK_ERROR(nic, COMSETTER(TraceEnabled)(ValueUnion.f));
|
---|
1051 | break;
|
---|
1052 | }
|
---|
1053 |
|
---|
1054 | case MODIFYVM_NICTYPE:
|
---|
1055 | {
|
---|
1056 | ComPtr<INetworkAdapter> nic;
|
---|
1057 |
|
---|
1058 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1059 | ASSERT(nic);
|
---|
1060 |
|
---|
1061 | if (!strcmp(ValueUnion.psz, "Am79C970A"))
|
---|
1062 | {
|
---|
1063 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Am79C970A));
|
---|
1064 | }
|
---|
1065 | else if (!strcmp(ValueUnion.psz, "Am79C973"))
|
---|
1066 | {
|
---|
1067 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Am79C973));
|
---|
1068 | }
|
---|
1069 | #ifdef VBOX_WITH_E1000
|
---|
1070 | else if (!strcmp(ValueUnion.psz, "82540EM"))
|
---|
1071 | {
|
---|
1072 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82540EM));
|
---|
1073 | }
|
---|
1074 | else if (!strcmp(ValueUnion.psz, "82543GC"))
|
---|
1075 | {
|
---|
1076 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82543GC));
|
---|
1077 | }
|
---|
1078 | else if (!strcmp(ValueUnion.psz, "82545EM"))
|
---|
1079 | {
|
---|
1080 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82545EM));
|
---|
1081 | }
|
---|
1082 | #endif
|
---|
1083 | #ifdef VBOX_WITH_VIRTIO
|
---|
1084 | else if (!strcmp(ValueUnion.psz, "virtio"))
|
---|
1085 | {
|
---|
1086 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Virtio));
|
---|
1087 | }
|
---|
1088 | #endif /* VBOX_WITH_VIRTIO */
|
---|
1089 | else
|
---|
1090 | {
|
---|
1091 | errorArgument("Invalid NIC type '%s' specified for NIC %u", ValueUnion.psz, GetOptState.uIndex);
|
---|
1092 | rc = E_FAIL;
|
---|
1093 | }
|
---|
1094 | break;
|
---|
1095 | }
|
---|
1096 |
|
---|
1097 | case MODIFYVM_NICSPEED:
|
---|
1098 | {
|
---|
1099 | ComPtr<INetworkAdapter> nic;
|
---|
1100 |
|
---|
1101 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1102 | ASSERT(nic);
|
---|
1103 |
|
---|
1104 | CHECK_ERROR(nic, COMSETTER(LineSpeed)(ValueUnion.u32));
|
---|
1105 | break;
|
---|
1106 | }
|
---|
1107 |
|
---|
1108 | case MODIFYVM_NIC:
|
---|
1109 | {
|
---|
1110 | ComPtr<INetworkAdapter> nic;
|
---|
1111 |
|
---|
1112 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1113 | ASSERT(nic);
|
---|
1114 |
|
---|
1115 | if (!strcmp(ValueUnion.psz, "none"))
|
---|
1116 | {
|
---|
1117 | CHECK_ERROR(nic, COMSETTER(Enabled)(FALSE));
|
---|
1118 | }
|
---|
1119 | else if (!strcmp(ValueUnion.psz, "null"))
|
---|
1120 | {
|
---|
1121 | CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
|
---|
1122 | CHECK_ERROR(nic, Detach());
|
---|
1123 | }
|
---|
1124 | else if (!strcmp(ValueUnion.psz, "nat"))
|
---|
1125 | {
|
---|
1126 | CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
|
---|
1127 | CHECK_ERROR(nic, AttachToNAT());
|
---|
1128 | }
|
---|
1129 | else if ( !strcmp(ValueUnion.psz, "bridged")
|
---|
1130 | || !strcmp(ValueUnion.psz, "hostif")) /* backward compatibility */
|
---|
1131 | {
|
---|
1132 | CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
|
---|
1133 | CHECK_ERROR(nic, AttachToBridgedInterface());
|
---|
1134 | }
|
---|
1135 | else if (!strcmp(ValueUnion.psz, "intnet"))
|
---|
1136 | {
|
---|
1137 | CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
|
---|
1138 | CHECK_ERROR(nic, AttachToInternalNetwork());
|
---|
1139 | }
|
---|
1140 | #if defined(VBOX_WITH_NETFLT)
|
---|
1141 | else if (!strcmp(ValueUnion.psz, "hostonly"))
|
---|
1142 | {
|
---|
1143 |
|
---|
1144 | CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
|
---|
1145 | CHECK_ERROR(nic, AttachToHostOnlyInterface());
|
---|
1146 | }
|
---|
1147 | #endif
|
---|
1148 | else
|
---|
1149 | {
|
---|
1150 | errorArgument("Invalid type '%s' specfied for NIC %u", ValueUnion.psz, GetOptState.uIndex);
|
---|
1151 | rc = E_FAIL;
|
---|
1152 | }
|
---|
1153 | break;
|
---|
1154 | }
|
---|
1155 |
|
---|
1156 | case MODIFYVM_CABLECONNECTED:
|
---|
1157 | {
|
---|
1158 | ComPtr<INetworkAdapter> nic;
|
---|
1159 |
|
---|
1160 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1161 | ASSERT(nic);
|
---|
1162 |
|
---|
1163 | CHECK_ERROR(nic, COMSETTER(CableConnected)(ValueUnion.f));
|
---|
1164 | break;
|
---|
1165 | }
|
---|
1166 |
|
---|
1167 | case MODIFYVM_BRIDGEADAPTER:
|
---|
1168 | case MODIFYVM_HOSTONLYADAPTER:
|
---|
1169 | {
|
---|
1170 | ComPtr<INetworkAdapter> nic;
|
---|
1171 |
|
---|
1172 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1173 | ASSERT(nic);
|
---|
1174 |
|
---|
1175 | /* remove it? */
|
---|
1176 | if (!strcmp(ValueUnion.psz, "none"))
|
---|
1177 | {
|
---|
1178 | CHECK_ERROR(nic, COMSETTER(HostInterface)(NULL));
|
---|
1179 | }
|
---|
1180 | else
|
---|
1181 | {
|
---|
1182 | CHECK_ERROR(nic, COMSETTER(HostInterface)(Bstr(ValueUnion.psz)));
|
---|
1183 | }
|
---|
1184 | break;
|
---|
1185 | }
|
---|
1186 |
|
---|
1187 | case MODIFYVM_INTNET:
|
---|
1188 | {
|
---|
1189 | ComPtr<INetworkAdapter> nic;
|
---|
1190 |
|
---|
1191 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1192 | ASSERT(nic);
|
---|
1193 |
|
---|
1194 | /* remove it? */
|
---|
1195 | if (!strcmp(ValueUnion.psz, "none"))
|
---|
1196 | {
|
---|
1197 | CHECK_ERROR(nic, COMSETTER(InternalNetwork)(NULL));
|
---|
1198 | }
|
---|
1199 | else
|
---|
1200 | {
|
---|
1201 | CHECK_ERROR(nic, COMSETTER(InternalNetwork)(Bstr(ValueUnion.psz)));
|
---|
1202 | }
|
---|
1203 | break;
|
---|
1204 | }
|
---|
1205 |
|
---|
1206 | case MODIFYVM_NATNET:
|
---|
1207 | {
|
---|
1208 | ComPtr<INetworkAdapter> nic;
|
---|
1209 |
|
---|
1210 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1211 | ASSERT(nic);
|
---|
1212 |
|
---|
1213 | CHECK_ERROR(nic, COMSETTER(NATNetwork)(Bstr(ValueUnion.psz)));
|
---|
1214 | break;
|
---|
1215 | }
|
---|
1216 |
|
---|
1217 | case MODIFYVM_MACADDRESS:
|
---|
1218 | {
|
---|
1219 | ComPtr<INetworkAdapter> nic;
|
---|
1220 |
|
---|
1221 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1222 | ASSERT(nic);
|
---|
1223 |
|
---|
1224 | /* generate one? */
|
---|
1225 | if (!strcmp(ValueUnion.psz, "auto"))
|
---|
1226 | {
|
---|
1227 | CHECK_ERROR(nic, COMSETTER(MACAddress)(NULL));
|
---|
1228 | }
|
---|
1229 | else
|
---|
1230 | {
|
---|
1231 | CHECK_ERROR(nic, COMSETTER(MACAddress)(Bstr(ValueUnion.psz)));
|
---|
1232 | }
|
---|
1233 | break;
|
---|
1234 | }
|
---|
1235 |
|
---|
1236 | case MODIFYVM_HIDPTR:
|
---|
1237 | {
|
---|
1238 | bool fEnableUsb = false;
|
---|
1239 | if (!strcmp(ValueUnion.psz, "ps2"))
|
---|
1240 | {
|
---|
1241 | CHECK_ERROR(machine, COMSETTER(PointingHidType)(PointingHidType_PS2Mouse));
|
---|
1242 | }
|
---|
1243 | else if (!strcmp(ValueUnion.psz, "usb"))
|
---|
1244 | {
|
---|
1245 | CHECK_ERROR(machine, COMSETTER(PointingHidType)(PointingHidType_USBMouse));
|
---|
1246 | if (SUCCEEDED(rc))
|
---|
1247 | fEnableUsb = true;
|
---|
1248 | }
|
---|
1249 | else if (!strcmp(ValueUnion.psz, "usbtablet"))
|
---|
1250 | {
|
---|
1251 | CHECK_ERROR(machine, COMSETTER(PointingHidType)(PointingHidType_USBTablet));
|
---|
1252 | if (SUCCEEDED(rc))
|
---|
1253 | fEnableUsb = true;
|
---|
1254 | }
|
---|
1255 | else
|
---|
1256 | {
|
---|
1257 | errorArgument("Invalid type '%s' specfied for pointing device", ValueUnion.psz);
|
---|
1258 | rc = E_FAIL;
|
---|
1259 | }
|
---|
1260 | if (fEnableUsb)
|
---|
1261 | {
|
---|
1262 | /* Make sure the OHCI controller is enabled. */
|
---|
1263 | ComPtr<IUSBController> UsbCtl;
|
---|
1264 | rc = machine->COMGETTER(USBController)(UsbCtl.asOutParam());
|
---|
1265 | if (SUCCEEDED(rc))
|
---|
1266 | {
|
---|
1267 | BOOL fEnabled;
|
---|
1268 | rc = UsbCtl->COMGETTER(Enabled)(&fEnabled);
|
---|
1269 | if (FAILED(rc))
|
---|
1270 | fEnabled = false;
|
---|
1271 | if (!fEnabled)
|
---|
1272 | CHECK_ERROR(UsbCtl, COMSETTER(Enabled)(true));
|
---|
1273 | }
|
---|
1274 | }
|
---|
1275 | break;
|
---|
1276 | }
|
---|
1277 |
|
---|
1278 | case MODIFYVM_HIDKBD:
|
---|
1279 | {
|
---|
1280 | bool fEnableUsb = false;
|
---|
1281 | if (!strcmp(ValueUnion.psz, "ps2"))
|
---|
1282 | {
|
---|
1283 | CHECK_ERROR(machine, COMSETTER(KeyboardHidType)(KeyboardHidType_PS2Keyboard));
|
---|
1284 | }
|
---|
1285 | else if (!strcmp(ValueUnion.psz, "usb"))
|
---|
1286 | {
|
---|
1287 | CHECK_ERROR(machine, COMSETTER(KeyboardHidType)(KeyboardHidType_USBKeyboard));
|
---|
1288 | if (SUCCEEDED(rc))
|
---|
1289 | fEnableUsb = true;
|
---|
1290 | }
|
---|
1291 | else
|
---|
1292 | {
|
---|
1293 | errorArgument("Invalid type '%s' specfied for keyboard", ValueUnion.psz);
|
---|
1294 | rc = E_FAIL;
|
---|
1295 | }
|
---|
1296 | if (fEnableUsb)
|
---|
1297 | {
|
---|
1298 | /* Make sure the OHCI controller is enabled. */
|
---|
1299 | ComPtr<IUSBController> UsbCtl;
|
---|
1300 | rc = machine->COMGETTER(USBController)(UsbCtl.asOutParam());
|
---|
1301 | if (SUCCEEDED(rc))
|
---|
1302 | {
|
---|
1303 | BOOL fEnabled;
|
---|
1304 | rc = UsbCtl->COMGETTER(Enabled)(&fEnabled);
|
---|
1305 | if (FAILED(rc))
|
---|
1306 | fEnabled = false;
|
---|
1307 | if (!fEnabled)
|
---|
1308 | CHECK_ERROR(UsbCtl, COMSETTER(Enabled)(true));
|
---|
1309 | }
|
---|
1310 | }
|
---|
1311 | break;
|
---|
1312 | }
|
---|
1313 |
|
---|
1314 | case MODIFYVM_UARTMODE:
|
---|
1315 | {
|
---|
1316 | ComPtr<ISerialPort> uart;
|
---|
1317 | char *pszIRQ = NULL;
|
---|
1318 |
|
---|
1319 | CHECK_ERROR_BREAK(machine, GetSerialPort(GetOptState.uIndex - 1, uart.asOutParam()));
|
---|
1320 | ASSERT(uart);
|
---|
1321 |
|
---|
1322 | if (!strcmp(ValueUnion.psz, "disconnected"))
|
---|
1323 | {
|
---|
1324 | CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_Disconnected));
|
---|
1325 | }
|
---|
1326 | else if ( !strcmp(ValueUnion.psz, "server")
|
---|
1327 | || !strcmp(ValueUnion.psz, "client")
|
---|
1328 | || !strcmp(ValueUnion.psz, "file"))
|
---|
1329 | {
|
---|
1330 | const char *pszMode = ValueUnion.psz;
|
---|
1331 |
|
---|
1332 | int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_STRING);
|
---|
1333 | if (RT_FAILURE(vrc))
|
---|
1334 | return errorSyntax(USAGE_MODIFYVM,
|
---|
1335 | "Missing or Invalid argument to '%s'",
|
---|
1336 | GetOptState.pDef->pszLong);
|
---|
1337 |
|
---|
1338 | CHECK_ERROR(uart, COMSETTER(Path)(Bstr(ValueUnion.psz)));
|
---|
1339 |
|
---|
1340 | if (!strcmp(pszMode, "server"))
|
---|
1341 | {
|
---|
1342 | CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_HostPipe));
|
---|
1343 | CHECK_ERROR(uart, COMSETTER(Server)(TRUE));
|
---|
1344 | }
|
---|
1345 | else if (!strcmp(pszMode, "client"))
|
---|
1346 | {
|
---|
1347 | CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_HostPipe));
|
---|
1348 | CHECK_ERROR(uart, COMSETTER(Server)(FALSE));
|
---|
1349 | }
|
---|
1350 | else if (!strcmp(pszMode, "file"))
|
---|
1351 | {
|
---|
1352 | CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_RawFile));
|
---|
1353 | }
|
---|
1354 | }
|
---|
1355 | else
|
---|
1356 | {
|
---|
1357 | CHECK_ERROR(uart, COMSETTER(Path)(Bstr(ValueUnion.psz)));
|
---|
1358 | CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_HostDevice));
|
---|
1359 | }
|
---|
1360 | break;
|
---|
1361 | }
|
---|
1362 |
|
---|
1363 | case MODIFYVM_UART:
|
---|
1364 | {
|
---|
1365 | ComPtr<ISerialPort> uart;
|
---|
1366 |
|
---|
1367 | CHECK_ERROR_BREAK(machine, GetSerialPort(GetOptState.uIndex - 1, uart.asOutParam()));
|
---|
1368 | ASSERT(uart);
|
---|
1369 |
|
---|
1370 | if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
|
---|
1371 | CHECK_ERROR(uart, COMSETTER(Enabled)(FALSE));
|
---|
1372 | else
|
---|
1373 | {
|
---|
1374 | const char *pszIOBase = ValueUnion.psz;
|
---|
1375 | uint32_t uVal = 0;
|
---|
1376 |
|
---|
1377 | int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_UINT32) != MODIFYVM_UART;
|
---|
1378 | if (RT_FAILURE(vrc))
|
---|
1379 | return errorSyntax(USAGE_MODIFYVM,
|
---|
1380 | "Missing or Invalid argument to '%s'",
|
---|
1381 | GetOptState.pDef->pszLong);
|
---|
1382 |
|
---|
1383 | CHECK_ERROR(uart, COMSETTER(IRQ)(ValueUnion.u32));
|
---|
1384 |
|
---|
1385 | vrc = RTStrToUInt32Ex(pszIOBase, NULL, 0, &uVal);
|
---|
1386 | if (vrc != VINF_SUCCESS || uVal == 0)
|
---|
1387 | return errorArgument("Error parsing UART I/O base '%s'", pszIOBase);
|
---|
1388 | CHECK_ERROR(uart, COMSETTER(IOBase)(uVal));
|
---|
1389 |
|
---|
1390 | CHECK_ERROR(uart, COMSETTER(Enabled)(TRUE));
|
---|
1391 | }
|
---|
1392 | break;
|
---|
1393 | }
|
---|
1394 |
|
---|
1395 | case MODIFYVM_GUESTMEMORYBALLOON:
|
---|
1396 | {
|
---|
1397 | CHECK_ERROR(machine, COMSETTER(MemoryBalloonSize)(ValueUnion.u32));
|
---|
1398 | break;
|
---|
1399 | }
|
---|
1400 |
|
---|
1401 | case MODIFYVM_AUDIOCONTROLLER:
|
---|
1402 | {
|
---|
1403 | ComPtr<IAudioAdapter> audioAdapter;
|
---|
1404 | machine->COMGETTER(AudioAdapter)(audioAdapter.asOutParam());
|
---|
1405 | ASSERT(audioAdapter);
|
---|
1406 |
|
---|
1407 | if (!strcmp(ValueUnion.psz, "sb16"))
|
---|
1408 | CHECK_ERROR(audioAdapter, COMSETTER(AudioController)(AudioControllerType_SB16));
|
---|
1409 | else if (!strcmp(ValueUnion.psz, "ac97"))
|
---|
1410 | CHECK_ERROR(audioAdapter, COMSETTER(AudioController)(AudioControllerType_AC97));
|
---|
1411 | else
|
---|
1412 | {
|
---|
1413 | errorArgument("Invalid --audiocontroller argument '%s'", ValueUnion.psz);
|
---|
1414 | rc = E_FAIL;
|
---|
1415 | }
|
---|
1416 | break;
|
---|
1417 | }
|
---|
1418 |
|
---|
1419 | case MODIFYVM_AUDIO:
|
---|
1420 | {
|
---|
1421 | ComPtr<IAudioAdapter> audioAdapter;
|
---|
1422 | machine->COMGETTER(AudioAdapter)(audioAdapter.asOutParam());
|
---|
1423 | ASSERT(audioAdapter);
|
---|
1424 |
|
---|
1425 | /* disable? */
|
---|
1426 | if (!strcmp(ValueUnion.psz, "none"))
|
---|
1427 | {
|
---|
1428 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(false));
|
---|
1429 | }
|
---|
1430 | else if (!strcmp(ValueUnion.psz, "null"))
|
---|
1431 | {
|
---|
1432 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Null));
|
---|
1433 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1434 | }
|
---|
1435 | #ifdef RT_OS_WINDOWS
|
---|
1436 | #ifdef VBOX_WITH_WINMM
|
---|
1437 | else if (!strcmp(ValueUnion.psz, "winmm"))
|
---|
1438 | {
|
---|
1439 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_WinMM));
|
---|
1440 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1441 | }
|
---|
1442 | #endif
|
---|
1443 | else if (!strcmp(ValueUnion.psz, "dsound"))
|
---|
1444 | {
|
---|
1445 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_DirectSound));
|
---|
1446 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1447 | }
|
---|
1448 | #endif /* RT_OS_WINDOWS */
|
---|
1449 | #ifdef RT_OS_LINUX
|
---|
1450 | # ifdef VBOX_WITH_ALSA
|
---|
1451 | else if (!strcmp(ValueUnion.psz, "alsa"))
|
---|
1452 | {
|
---|
1453 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_ALSA));
|
---|
1454 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1455 | }
|
---|
1456 | # endif
|
---|
1457 | # ifdef VBOX_WITH_PULSE
|
---|
1458 | else if (!strcmp(ValueUnion.psz, "pulse"))
|
---|
1459 | {
|
---|
1460 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Pulse));
|
---|
1461 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1462 | }
|
---|
1463 | # endif
|
---|
1464 | #endif /* !RT_OS_LINUX */
|
---|
1465 | #ifdef RT_OS_SOLARIS
|
---|
1466 | else if (!strcmp(ValueUnion.psz, "solaudio"))
|
---|
1467 | {
|
---|
1468 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_SolAudio));
|
---|
1469 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1470 | }
|
---|
1471 | #endif /* !RT_OS_SOLARIS */
|
---|
1472 | #ifdef RT_OS_FREEBSD
|
---|
1473 | else if (!strcmp(ValueUnion.psz, "oss"))
|
---|
1474 | {
|
---|
1475 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_OSS));
|
---|
1476 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1477 | }
|
---|
1478 | # ifdef VBOX_WITH_PULSE
|
---|
1479 | else if (!strcmp(ValueUnion.psz, "pulse"))
|
---|
1480 | {
|
---|
1481 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Pulse));
|
---|
1482 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1483 | }
|
---|
1484 | # endif
|
---|
1485 | #endif /* !RT_OS_FREEBSD */
|
---|
1486 | #ifdef RT_OS_DARWIN
|
---|
1487 | else if (!strcmp(ValueUnion.psz, "coreaudio"))
|
---|
1488 | {
|
---|
1489 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_CoreAudio));
|
---|
1490 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1491 | }
|
---|
1492 |
|
---|
1493 | #endif /* !RT_OS_DARWIN */
|
---|
1494 | # if defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX) || defined(VBOX_WITH_SOLARIS_OSS)
|
---|
1495 | else if (!strcmp(ValueUnion.psz, "oss"))
|
---|
1496 | {
|
---|
1497 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_OSS));
|
---|
1498 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1499 | }
|
---|
1500 | # endif
|
---|
1501 | else
|
---|
1502 | {
|
---|
1503 | errorArgument("Invalid --audio argument '%s'", ValueUnion.psz);
|
---|
1504 | rc = E_FAIL;
|
---|
1505 | }
|
---|
1506 | break;
|
---|
1507 | }
|
---|
1508 |
|
---|
1509 | case MODIFYVM_CLIPBOARD:
|
---|
1510 | {
|
---|
1511 | if (!strcmp(ValueUnion.psz, "disabled"))
|
---|
1512 | {
|
---|
1513 | CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_Disabled));
|
---|
1514 | }
|
---|
1515 | else if (!strcmp(ValueUnion.psz, "hosttoguest"))
|
---|
1516 | {
|
---|
1517 | CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_HostToGuest));
|
---|
1518 | }
|
---|
1519 | else if (!strcmp(ValueUnion.psz, "guesttohost"))
|
---|
1520 | {
|
---|
1521 | CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_GuestToHost));
|
---|
1522 | }
|
---|
1523 | else if (!strcmp(ValueUnion.psz, "bidirectional"))
|
---|
1524 | {
|
---|
1525 | CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_Bidirectional));
|
---|
1526 | }
|
---|
1527 | else
|
---|
1528 | {
|
---|
1529 | errorArgument("Invalid --clipboard argument '%s'", ValueUnion.psz);
|
---|
1530 | rc = E_FAIL;
|
---|
1531 | }
|
---|
1532 | break;
|
---|
1533 | }
|
---|
1534 |
|
---|
1535 | #ifdef VBOX_WITH_VRDP
|
---|
1536 | case MODIFYVM_VRDPPORT:
|
---|
1537 | {
|
---|
1538 | ComPtr<IVRDPServer> vrdpServer;
|
---|
1539 | machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
|
---|
1540 | ASSERT(vrdpServer);
|
---|
1541 |
|
---|
1542 | if (!strcmp(ValueUnion.psz, "default"))
|
---|
1543 | CHECK_ERROR(vrdpServer, COMSETTER(Ports)(Bstr("0")));
|
---|
1544 | else
|
---|
1545 | CHECK_ERROR(vrdpServer, COMSETTER(Ports)(Bstr(ValueUnion.psz)));
|
---|
1546 | break;
|
---|
1547 | }
|
---|
1548 |
|
---|
1549 | case MODIFYVM_VRDPADDRESS:
|
---|
1550 | {
|
---|
1551 | ComPtr<IVRDPServer> vrdpServer;
|
---|
1552 | machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
|
---|
1553 | ASSERT(vrdpServer);
|
---|
1554 |
|
---|
1555 | CHECK_ERROR(vrdpServer, COMSETTER(NetAddress)(Bstr(ValueUnion.psz)));
|
---|
1556 | break;
|
---|
1557 | }
|
---|
1558 |
|
---|
1559 | case MODIFYVM_VRDPAUTHTYPE:
|
---|
1560 | {
|
---|
1561 | ComPtr<IVRDPServer> vrdpServer;
|
---|
1562 | machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
|
---|
1563 | ASSERT(vrdpServer);
|
---|
1564 |
|
---|
1565 | if (!strcmp(ValueUnion.psz, "null"))
|
---|
1566 | {
|
---|
1567 | CHECK_ERROR(vrdpServer, COMSETTER(AuthType)(VRDPAuthType_Null));
|
---|
1568 | }
|
---|
1569 | else if (!strcmp(ValueUnion.psz, "external"))
|
---|
1570 | {
|
---|
1571 | CHECK_ERROR(vrdpServer, COMSETTER(AuthType)(VRDPAuthType_External));
|
---|
1572 | }
|
---|
1573 | else if (!strcmp(ValueUnion.psz, "guest"))
|
---|
1574 | {
|
---|
1575 | CHECK_ERROR(vrdpServer, COMSETTER(AuthType)(VRDPAuthType_Guest));
|
---|
1576 | }
|
---|
1577 | else
|
---|
1578 | {
|
---|
1579 | errorArgument("Invalid --vrdpauthtype argument '%s'", ValueUnion.psz);
|
---|
1580 | rc = E_FAIL;
|
---|
1581 | }
|
---|
1582 | break;
|
---|
1583 | }
|
---|
1584 |
|
---|
1585 | case MODIFYVM_VRDPMULTICON:
|
---|
1586 | {
|
---|
1587 | ComPtr<IVRDPServer> vrdpServer;
|
---|
1588 | machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
|
---|
1589 | ASSERT(vrdpServer);
|
---|
1590 |
|
---|
1591 | CHECK_ERROR(vrdpServer, COMSETTER(AllowMultiConnection)(ValueUnion.f));
|
---|
1592 | break;
|
---|
1593 | }
|
---|
1594 |
|
---|
1595 | case MODIFYVM_VRDPREUSECON:
|
---|
1596 | {
|
---|
1597 | ComPtr<IVRDPServer> vrdpServer;
|
---|
1598 | machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
|
---|
1599 | ASSERT(vrdpServer);
|
---|
1600 |
|
---|
1601 | CHECK_ERROR(vrdpServer, COMSETTER(ReuseSingleConnection)(ValueUnion.f));
|
---|
1602 | break;
|
---|
1603 | }
|
---|
1604 |
|
---|
1605 | case MODIFYVM_VRDP:
|
---|
1606 | {
|
---|
1607 | ComPtr<IVRDPServer> vrdpServer;
|
---|
1608 | machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
|
---|
1609 | ASSERT(vrdpServer);
|
---|
1610 |
|
---|
1611 | CHECK_ERROR(vrdpServer, COMSETTER(Enabled)(ValueUnion.f));
|
---|
1612 | break;
|
---|
1613 | }
|
---|
1614 | #endif /* VBOX_WITH_VRDP */
|
---|
1615 |
|
---|
1616 | case MODIFYVM_USBEHCI:
|
---|
1617 | {
|
---|
1618 | ComPtr<IUSBController> UsbCtl;
|
---|
1619 | CHECK_ERROR(machine, COMGETTER(USBController)(UsbCtl.asOutParam()));
|
---|
1620 | if (SUCCEEDED(rc))
|
---|
1621 | CHECK_ERROR(UsbCtl, COMSETTER(EnabledEhci)(ValueUnion.f));
|
---|
1622 | break;
|
---|
1623 | }
|
---|
1624 |
|
---|
1625 | case MODIFYVM_USB:
|
---|
1626 | {
|
---|
1627 | ComPtr<IUSBController> UsbCtl;
|
---|
1628 | CHECK_ERROR(machine, COMGETTER(USBController)(UsbCtl.asOutParam()));
|
---|
1629 | if (SUCCEEDED(rc))
|
---|
1630 | CHECK_ERROR(UsbCtl, COMSETTER(Enabled)(ValueUnion.f));
|
---|
1631 | break;
|
---|
1632 | }
|
---|
1633 |
|
---|
1634 | case MODIFYVM_SNAPSHOTFOLDER:
|
---|
1635 | {
|
---|
1636 | if (!strcmp(ValueUnion.psz, "default"))
|
---|
1637 | CHECK_ERROR(machine, COMSETTER(SnapshotFolder)(NULL));
|
---|
1638 | else
|
---|
1639 | CHECK_ERROR(machine, COMSETTER(SnapshotFolder)(Bstr(ValueUnion.psz)));
|
---|
1640 | break;
|
---|
1641 | }
|
---|
1642 |
|
---|
1643 | case MODIFYVM_TELEPORTER_ENABLED:
|
---|
1644 | {
|
---|
1645 | CHECK_ERROR(machine, COMSETTER(TeleporterEnabled)(ValueUnion.f));
|
---|
1646 | break;
|
---|
1647 | }
|
---|
1648 |
|
---|
1649 | case MODIFYVM_TELEPORTER_PORT:
|
---|
1650 | {
|
---|
1651 | CHECK_ERROR(machine, COMSETTER(TeleporterPort)(ValueUnion.u32));
|
---|
1652 | break;
|
---|
1653 | }
|
---|
1654 |
|
---|
1655 | case MODIFYVM_TELEPORTER_ADDRESS:
|
---|
1656 | {
|
---|
1657 | CHECK_ERROR(machine, COMSETTER(TeleporterAddress)(Bstr(ValueUnion.psz)));
|
---|
1658 | break;
|
---|
1659 | }
|
---|
1660 |
|
---|
1661 | case MODIFYVM_TELEPORTER_PASSWORD:
|
---|
1662 | {
|
---|
1663 | CHECK_ERROR(machine, COMSETTER(TeleporterPassword)(Bstr(ValueUnion.psz)));
|
---|
1664 | break;
|
---|
1665 | }
|
---|
1666 |
|
---|
1667 | case MODIFYVM_HARDWARE_UUID:
|
---|
1668 | {
|
---|
1669 | CHECK_ERROR(machine, COMSETTER(HardwareUUID)(Bstr(ValueUnion.psz)));
|
---|
1670 | break;
|
---|
1671 | }
|
---|
1672 |
|
---|
1673 | case MODIFYVM_HPET:
|
---|
1674 | {
|
---|
1675 | CHECK_ERROR(machine, COMSETTER(HpetEnabled)(ValueUnion.f));
|
---|
1676 | break;
|
---|
1677 | }
|
---|
1678 |
|
---|
1679 | case MODIFYVM_IOMGR:
|
---|
1680 | {
|
---|
1681 | if (!strcmp(ValueUnion.psz, "simple"))
|
---|
1682 | CHECK_ERROR(machine, COMSETTER(IoMgr)(IoMgrType_Simple));
|
---|
1683 | else if (!strcmp(ValueUnion.psz, "async"))
|
---|
1684 | CHECK_ERROR(machine, COMSETTER(IoMgr)(IoMgrType_Async));
|
---|
1685 | else
|
---|
1686 | {
|
---|
1687 | errorArgument("Invalid --iomgr argument '%s'", ValueUnion.psz);
|
---|
1688 | rc = E_FAIL;
|
---|
1689 | }
|
---|
1690 | break;
|
---|
1691 | }
|
---|
1692 |
|
---|
1693 | case MODIFYVM_IOBACKEND:
|
---|
1694 | {
|
---|
1695 | if (!strcmp(ValueUnion.psz, "buffered"))
|
---|
1696 | CHECK_ERROR(machine, COMSETTER(IoBackend)(IoBackendType_Buffered));
|
---|
1697 | else if (!strcmp(ValueUnion.psz, "unbuffered"))
|
---|
1698 | CHECK_ERROR(machine, COMSETTER(IoBackend)(IoBackendType_Unbuffered));
|
---|
1699 | else
|
---|
1700 | {
|
---|
1701 | errorArgument("Invalid --iobackend argument '%s'", ValueUnion.psz);
|
---|
1702 | rc = E_FAIL;
|
---|
1703 | }
|
---|
1704 | break;
|
---|
1705 | }
|
---|
1706 |
|
---|
1707 | case MODIFYVM_IOCACHE:
|
---|
1708 | {
|
---|
1709 | CHECK_ERROR(machine, COMSETTER(IoCacheEnabled)(ValueUnion.f));
|
---|
1710 | break;
|
---|
1711 | }
|
---|
1712 |
|
---|
1713 | case MODIFYVM_IOCACHESIZE:
|
---|
1714 | {
|
---|
1715 | CHECK_ERROR(machine, COMSETTER(IoCacheSize)(ValueUnion.u32));
|
---|
1716 | break;
|
---|
1717 | }
|
---|
1718 |
|
---|
1719 | case MODIFYVM_IOBANDWIDTHMAX:
|
---|
1720 | {
|
---|
1721 | CHECK_ERROR(machine, COMSETTER(IoBandwidthMax)(ValueUnion.u32));
|
---|
1722 | break;
|
---|
1723 | }
|
---|
1724 |
|
---|
1725 | default:
|
---|
1726 | {
|
---|
1727 | errorGetOpt(USAGE_MODIFYVM, c, &ValueUnion);
|
---|
1728 | rc = E_FAIL;
|
---|
1729 | break;
|
---|
1730 | }
|
---|
1731 | }
|
---|
1732 | }
|
---|
1733 |
|
---|
1734 | /* commit changes */
|
---|
1735 | if (SUCCEEDED(rc))
|
---|
1736 | CHECK_ERROR(machine, SaveSettings());
|
---|
1737 |
|
---|
1738 | /* it's important to always close sessions */
|
---|
1739 | a->session->Close();
|
---|
1740 |
|
---|
1741 | return SUCCEEDED(rc) ? 0 : 1;
|
---|
1742 | }
|
---|
1743 |
|
---|
1744 | #endif /* !VBOX_ONLY_DOCS */
|
---|