1 | /* $Id: VBoxManageHelp.cpp 29117 2010-05-05 22:59:38Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxManage - help and other message output.
|
---|
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 | /*******************************************************************************
|
---|
20 | * Header Files *
|
---|
21 | *******************************************************************************/
|
---|
22 | #include <VBox/version.h>
|
---|
23 |
|
---|
24 | #include <iprt/ctype.h>
|
---|
25 | #include <iprt/err.h>
|
---|
26 | #include <iprt/getopt.h>
|
---|
27 | #include <iprt/stream.h>
|
---|
28 |
|
---|
29 | #include "VBoxManage.h"
|
---|
30 |
|
---|
31 |
|
---|
32 |
|
---|
33 | void showLogo(void)
|
---|
34 | {
|
---|
35 | static bool s_fShown; /* show only once */
|
---|
36 |
|
---|
37 | if (!s_fShown)
|
---|
38 | {
|
---|
39 | RTPrintf(VBOX_PRODUCT" Command Line Management Interface Version "
|
---|
40 | VBOX_VERSION_STRING "\n"
|
---|
41 | "(C) 2005-" VBOX_C_YEAR " " VBOX_VENDOR "\n"
|
---|
42 | "All rights reserved.\n"
|
---|
43 | "\n");
|
---|
44 | s_fShown = true;
|
---|
45 | }
|
---|
46 | }
|
---|
47 |
|
---|
48 | void printUsage(USAGECATEGORY u64Cmd)
|
---|
49 | {
|
---|
50 | #ifdef RT_OS_LINUX
|
---|
51 | bool fLinux = true;
|
---|
52 | #else
|
---|
53 | bool fLinux = false;
|
---|
54 | #endif
|
---|
55 | #ifdef RT_OS_WINDOWS
|
---|
56 | bool fWin = true;
|
---|
57 | #else
|
---|
58 | bool fWin = false;
|
---|
59 | #endif
|
---|
60 | #ifdef RT_OS_SOLARIS
|
---|
61 | bool fSolaris = true;
|
---|
62 | #else
|
---|
63 | bool fSolaris = false;
|
---|
64 | #endif
|
---|
65 | #ifdef RT_OS_FREEBSD
|
---|
66 | bool fFreeBSD = true;
|
---|
67 | #else
|
---|
68 | bool fFreeBSD = false;
|
---|
69 | #endif
|
---|
70 | #ifdef RT_OS_DARWIN
|
---|
71 | bool fDarwin = true;
|
---|
72 | #else
|
---|
73 | bool fDarwin = false;
|
---|
74 | #endif
|
---|
75 | #ifdef VBOX_WITH_VRDP
|
---|
76 | bool fVRDP = true;
|
---|
77 | #else
|
---|
78 | bool fVRDP = false;
|
---|
79 | #endif
|
---|
80 | #ifdef VBOX_WITH_VBOXSDL
|
---|
81 | bool fVBoxSDL = true;
|
---|
82 | #else
|
---|
83 | bool fVBoxSDL = false;
|
---|
84 | #endif
|
---|
85 |
|
---|
86 | if (u64Cmd == USAGE_DUMPOPTS)
|
---|
87 | {
|
---|
88 | fLinux = true;
|
---|
89 | fWin = true;
|
---|
90 | fSolaris = true;
|
---|
91 | fFreeBSD = true;
|
---|
92 | fDarwin = true;
|
---|
93 | fVRDP = true;
|
---|
94 | fVBoxSDL = true;
|
---|
95 | u64Cmd = USAGE_ALL;
|
---|
96 | }
|
---|
97 |
|
---|
98 | RTPrintf("Usage:\n"
|
---|
99 | "\n");
|
---|
100 |
|
---|
101 | if (u64Cmd == USAGE_ALL)
|
---|
102 | {
|
---|
103 | RTPrintf("VBoxManage [-v|--version] print version number and exit\n"
|
---|
104 | "VBoxManage [-q|--nologo] ... suppress the logo\n"
|
---|
105 | "\n");
|
---|
106 | }
|
---|
107 |
|
---|
108 | if (u64Cmd & USAGE_LIST)
|
---|
109 | {
|
---|
110 | RTPrintf("VBoxManage list [--long|-l] vms|runningvms|ostypes|hostdvds|hostfloppies|\n"
|
---|
111 | #if defined(VBOX_WITH_NETFLT)
|
---|
112 | " bridgedifs|hostonlyifs|dhcpservers|hostinfo|\n"
|
---|
113 | #else
|
---|
114 | " bridgedifs|dhcpservers|hostinfo|\n"
|
---|
115 | #endif
|
---|
116 | " hostcpuids|hddbackends|hdds|dvds|floppies|\n"
|
---|
117 | " usbhost|usbfilters|systemproperties\n"
|
---|
118 | "\n");
|
---|
119 | }
|
---|
120 |
|
---|
121 | if (u64Cmd & USAGE_SHOWVMINFO)
|
---|
122 | {
|
---|
123 | RTPrintf("VBoxManage showvminfo <uuid>|<name> [--details] [--statistics]\n"
|
---|
124 | " [--machinereadable]\n"
|
---|
125 | "VBoxManage showvminfo <uuid>|<name> --log <idx>\n"
|
---|
126 | "\n");
|
---|
127 | }
|
---|
128 |
|
---|
129 | if (u64Cmd & USAGE_REGISTERVM)
|
---|
130 | {
|
---|
131 | RTPrintf("VBoxManage registervm <filename>\n"
|
---|
132 | "\n");
|
---|
133 | }
|
---|
134 |
|
---|
135 | if (u64Cmd & USAGE_UNREGISTERVM)
|
---|
136 | {
|
---|
137 | RTPrintf("VBoxManage unregistervm <uuid>|<name> [--delete]\n"
|
---|
138 | "\n");
|
---|
139 | }
|
---|
140 |
|
---|
141 | if (u64Cmd & USAGE_CREATEVM)
|
---|
142 | {
|
---|
143 | RTPrintf("VBoxManage createvm --name <name>\n"
|
---|
144 | " [--ostype <ostype>]\n"
|
---|
145 | " [--register]\n"
|
---|
146 | " [--basefolder <path> | --settingsfile <path>]\n"
|
---|
147 | " [--uuid <uuid>]\n"
|
---|
148 | "\n");
|
---|
149 | }
|
---|
150 |
|
---|
151 | if (u64Cmd & USAGE_MODIFYVM)
|
---|
152 | {
|
---|
153 | RTPrintf("VBoxManage modifyvm <uuid|name>\n"
|
---|
154 | " [--name <name>]\n"
|
---|
155 | " [--ostype <ostype>]\n"
|
---|
156 | " [--memory <memorysize in MB>]\n"
|
---|
157 | " [--vram <vramsize in MB>]\n"
|
---|
158 | " [--acpi on|off]\n"
|
---|
159 | " [--ioapic on|off]\n"
|
---|
160 | " [--pae on|off]\n"
|
---|
161 | " [--hpet on|off]\n"
|
---|
162 | " [--hwvirtex on|off]\n"
|
---|
163 | " [--nestedpaging on|off]\n"
|
---|
164 | " [--largepages on|off]\n"
|
---|
165 | " [--vtxvpid on|off]\n"
|
---|
166 | " [--synthcpu on|off]\n"
|
---|
167 | " [--cpuidset <leaf> <eax> <ebx> <ecx> <edx>]\n"
|
---|
168 | " [--cpuidremove <leaf>]\n"
|
---|
169 | " [--cpuidremoveall]\n"
|
---|
170 | " [--hardwareuuid <uuid>]\n"
|
---|
171 | " [--cpus <number>]\n"
|
---|
172 | " [--rtcuseutc]\n"
|
---|
173 | " [--monitorcount <number>]\n"
|
---|
174 | " [--accelerate3d on|off]\n"
|
---|
175 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
176 | " [--accelerate2dvideo on|off]\n"
|
---|
177 | #endif
|
---|
178 | " [--firmware bios|efi|efi32|efi64]\n"
|
---|
179 | " [--bioslogofadein on|off]\n"
|
---|
180 | " [--bioslogofadeout on|off]\n"
|
---|
181 | " [--bioslogodisplaytime <msec>]\n"
|
---|
182 | " [--bioslogoimagepath <imagepath>]\n"
|
---|
183 | " [--biosbootmenu disabled|menuonly|messageandmenu]\n"
|
---|
184 | " [--biossystemtimeoffset <msec>]\n"
|
---|
185 | " [--biospxedebug on|off]\n"
|
---|
186 | " [--boot<1-4> none|floppy|dvd|disk|net>]\n"
|
---|
187 | " [--nic<1-N> none|null|nat|bridged|intnet"
|
---|
188 | #if defined(VBOX_WITH_NETFLT) /* RT_OS_LINUX || RT_OS_DARWIN */
|
---|
189 | "|hostonly"
|
---|
190 | #endif
|
---|
191 | #ifdef VBOX_WITH_VDE
|
---|
192 | "|vde"
|
---|
193 | #endif
|
---|
194 | "]\n"
|
---|
195 | " [--nictype<1-N> Am79C970A|Am79C973"
|
---|
196 | #ifdef VBOX_WITH_E1000
|
---|
197 | "|\n 82540EM|82543GC|82545EM"
|
---|
198 | #endif
|
---|
199 | #ifdef VBOX_WITH_VIRTIO
|
---|
200 | "|\n virtio"
|
---|
201 | #endif /* VBOX_WITH_VIRTIO */
|
---|
202 | "]\n"
|
---|
203 | " [--cableconnected<1-N> on|off]\n"
|
---|
204 | " [--nictrace<1-N> on|off]\n"
|
---|
205 | " [--nictracefile<1-N> <filename>]\n"
|
---|
206 | " [--nicspeed<1-N> <kbps>]\n"
|
---|
207 | " [--nicbootprio<1-N> <priority>]\n"
|
---|
208 | " [--bridgeadapter<1-N> none|<devicename>]\n"
|
---|
209 | #if defined(VBOX_WITH_NETFLT)
|
---|
210 | " [--hostonlyadapter<1-N> none|<devicename>]\n"
|
---|
211 | #endif
|
---|
212 | " [--intnet<1-N> <network name>]\n"
|
---|
213 | " [--natnet<1-N> <network>|default]\n"
|
---|
214 | #ifdef VBOX_WITH_VDE
|
---|
215 | " [--vdenet<1-N> <network>|default]\n"
|
---|
216 | #endif
|
---|
217 | " [--natsettings<1-N> \"[<mtu>],[<socksnd>],[<sockrcv>],\n"
|
---|
218 | " [<tcpsnd>],[<tcprcv>]\"]\n"
|
---|
219 | " [--natpf<1-N> \"[<rulename>],tcp|udp,\n"
|
---|
220 | " [<hostip>],<hostport>,\n"
|
---|
221 | " [<guestip>],<guestport>\"]\n"
|
---|
222 | " [--natpf<1-N> delete <rulename>]\n"
|
---|
223 | " [--nattftpprefix<1-N> <prefix>]\n"
|
---|
224 | " [--nattftpfile<1-N> <file>]\n"
|
---|
225 | " [--nattftpserver<1-N> <ip>]\n"
|
---|
226 | " [--natdnspassdomain<1-N> on|off]\n"
|
---|
227 | " [--natdnsproxy<1-N> on|off]\n"
|
---|
228 | " [--natdnshostresolver<1-N> on|off]\n"
|
---|
229 | " [--nataliasmode<1-N> default|[log],[proxyonly],[sameports]]\n"
|
---|
230 | " [--macaddress<1-N> auto|<mac>]\n"
|
---|
231 | " [--mouse ps2|usb|usbtablet\n"
|
---|
232 | " [--keyboard ps2|usb\n"
|
---|
233 | " [--uart<1-N> off|<I/O base> <IRQ>]\n"
|
---|
234 | " [--uartmode<1-N> disconnected|\n"
|
---|
235 | " server <pipe>|\n"
|
---|
236 | " client <pipe>|\n"
|
---|
237 | " file <file>|\n"
|
---|
238 | " <devicename>]\n"
|
---|
239 | " [--guestmemoryballoon <balloonsize in MB>]\n"
|
---|
240 | " [--gueststatisticsinterval <seconds>]\n"
|
---|
241 | );
|
---|
242 | RTPrintf(" [--audio none|null");
|
---|
243 | if (fWin)
|
---|
244 | {
|
---|
245 | #ifdef VBOX_WITH_WINMM
|
---|
246 | RTPrintf( "|winmm|dsound");
|
---|
247 | #else
|
---|
248 | RTPrintf( "|dsound");
|
---|
249 | #endif
|
---|
250 | }
|
---|
251 | if (fSolaris)
|
---|
252 | {
|
---|
253 | RTPrintf( "|solaudio"
|
---|
254 | #ifdef VBOX_WITH_SOLARIS_OSS
|
---|
255 | "|oss"
|
---|
256 | #endif
|
---|
257 | );
|
---|
258 | }
|
---|
259 | if (fLinux)
|
---|
260 | {
|
---|
261 | RTPrintf( "|oss"
|
---|
262 | #ifdef VBOX_WITH_ALSA
|
---|
263 | "|alsa"
|
---|
264 | #endif
|
---|
265 | #ifdef VBOX_WITH_PULSE
|
---|
266 | "|pulse"
|
---|
267 | #endif
|
---|
268 | );
|
---|
269 | }
|
---|
270 | if (fFreeBSD)
|
---|
271 | {
|
---|
272 | RTPrintf( "|oss"
|
---|
273 | #ifdef VBOX_WITH_PULSE
|
---|
274 | "|pulse"
|
---|
275 | #endif
|
---|
276 | );
|
---|
277 | }
|
---|
278 | if (fDarwin)
|
---|
279 | {
|
---|
280 | RTPrintf( "|coreaudio");
|
---|
281 | }
|
---|
282 | RTPrintf( "]\n");
|
---|
283 | RTPrintf(" [--audiocontroller ac97|sb16]\n"
|
---|
284 | " [--clipboard disabled|hosttoguest|guesttohost|\n"
|
---|
285 | " bidirectional]\n");
|
---|
286 | if (fVRDP)
|
---|
287 | {
|
---|
288 | RTPrintf(" [--vrdp on|off]\n"
|
---|
289 | " [--vrdpport default|<ports>]\n"
|
---|
290 | " [--vrdpaddress <host>]\n"
|
---|
291 | " [--vrdpauthtype null|external|guest]\n"
|
---|
292 | " [--vrdpmulticon on|off]\n"
|
---|
293 | " [--vrdpreusecon on|off]\n"
|
---|
294 | " [--vrdpvideochannel on|off]\n"
|
---|
295 | " [--vrdpvideochannelquality <percent>]\n");
|
---|
296 | }
|
---|
297 | RTPrintf(" [--usb on|off]\n"
|
---|
298 | " [--usbehci on|off]\n"
|
---|
299 | " [--snapshotfolder default|<path>]\n"
|
---|
300 | " [--teleporter on|off]\n"
|
---|
301 | " [--teleporterport <port>]\n"
|
---|
302 | " [--teleporteraddress <address|empty>\n"
|
---|
303 | " [--teleporterpassword <password>]\n"
|
---|
304 | #if 0
|
---|
305 | " [--iomgr simple|async]\n"
|
---|
306 | " [--iobackend buffered|unbuffered]\n"
|
---|
307 | " [--iocache on|off]\n"
|
---|
308 | " [--iocachesize <I/O cache size in MB>]\n"
|
---|
309 | " [--iobandwidthmax <Maximum I/O bandwidth in MB/s>]\n"
|
---|
310 | #endif
|
---|
311 | );
|
---|
312 | RTPrintf("\n");
|
---|
313 | }
|
---|
314 |
|
---|
315 | if (u64Cmd & USAGE_IMPORTAPPLIANCE)
|
---|
316 | {
|
---|
317 | RTPrintf("VBoxManage import <ovf> [--dry-run|-n] [more options]\n"
|
---|
318 | " (run with -n to have options displayed\n"
|
---|
319 | " for a particular OVF)\n\n");
|
---|
320 | }
|
---|
321 |
|
---|
322 | if (u64Cmd & USAGE_EXPORTAPPLIANCE)
|
---|
323 | {
|
---|
324 | RTPrintf("VBoxManage export <machines> --output|-o <ovf>\n"
|
---|
325 | " [--legacy09]\n"
|
---|
326 | " [--vsys <number of virtual system>]\n"
|
---|
327 | " [--product <product name>]\n"
|
---|
328 | " [--producturl <product url>]\n"
|
---|
329 | " [--vendor <vendor name>]\n"
|
---|
330 | " [--vendorurl <vendor url>]\n"
|
---|
331 | " [--version <version info>]\n"
|
---|
332 | " [--eula <license text>]\n"
|
---|
333 | " [--eulafile <filename>]\n"
|
---|
334 | "\n");
|
---|
335 | }
|
---|
336 |
|
---|
337 | if (u64Cmd & USAGE_STARTVM)
|
---|
338 | {
|
---|
339 | RTPrintf("VBoxManage startvm <uuid>|<name>\n");
|
---|
340 | RTPrintf(" [--type gui");
|
---|
341 | if (fVBoxSDL)
|
---|
342 | RTPrintf( "|sdl");
|
---|
343 | if (fVRDP)
|
---|
344 | RTPrintf( "|vrdp");
|
---|
345 | RTPrintf( "|headless]\n");
|
---|
346 | RTPrintf("\n");
|
---|
347 | }
|
---|
348 |
|
---|
349 | if (u64Cmd & USAGE_CONTROLVM)
|
---|
350 | {
|
---|
351 | RTPrintf("VBoxManage controlvm <uuid>|<name>\n"
|
---|
352 | " pause|resume|reset|poweroff|savestate|\n"
|
---|
353 | " acpipowerbutton|acpisleepbutton|\n"
|
---|
354 | " keyboardputscancode <hex> [<hex> ...]|\n"
|
---|
355 | " injectnmi|\n"
|
---|
356 | " setlinkstate<1-N> on|off |\n"
|
---|
357 | #ifdef VBOX_DYNAMIC_NET_ATTACH
|
---|
358 | #if defined(VBOX_WITH_NETFLT)
|
---|
359 | " nic<1-N> null|nat|bridged|intnet|hostonly\n"
|
---|
360 | " [<devicename>] |\n"
|
---|
361 | #else /* !RT_OS_LINUX && !RT_OS_DARWIN */
|
---|
362 | " nic<1-N> null|nat|bridged|intnet\n"
|
---|
363 | " [<devicename>] |\n"
|
---|
364 | #endif /* !RT_OS_LINUX && !RT_OS_DARWIN */
|
---|
365 | " nictrace<1-N> on|off\n"
|
---|
366 | " nictracefile<1-N> <filename>\n"
|
---|
367 | #endif /* VBOX_DYNAMIC_NET_ATTACH */
|
---|
368 | " guestmemoryballoon <balloonsize in MB>]\n"
|
---|
369 | " gueststatisticsinterval <seconds>]\n"
|
---|
370 | " usbattach <uuid>|<address> |\n"
|
---|
371 | " usbdetach <uuid>|<address> |\n");
|
---|
372 | if (fVRDP)
|
---|
373 | {
|
---|
374 | RTPrintf(" vrdp on|off |\n");
|
---|
375 | RTPrintf(" vrdpport default|<ports> |\n");
|
---|
376 | }
|
---|
377 | RTPrintf(" setvideomodehint <xres> <yres> <bpp> [display] |\n"
|
---|
378 | " setcredentials <username> <password> <domain>\n"
|
---|
379 | " [--allowlocallogon <yes|no>] |\n"
|
---|
380 | " teleport --host <name> --port <port>\n"
|
---|
381 | " [--maxdowntime <msec>] [--password password]\n"
|
---|
382 | "\n");
|
---|
383 | }
|
---|
384 |
|
---|
385 | if (u64Cmd & USAGE_DISCARDSTATE)
|
---|
386 | {
|
---|
387 | RTPrintf("VBoxManage discardstate <uuid>|<name>\n"
|
---|
388 | "\n");
|
---|
389 | }
|
---|
390 |
|
---|
391 | if (u64Cmd & USAGE_ADOPTSTATE)
|
---|
392 | {
|
---|
393 | RTPrintf("VBoxManage adoptstate <uuid>|<name> <state_file>\n"
|
---|
394 | "\n");
|
---|
395 | }
|
---|
396 |
|
---|
397 | if (u64Cmd & USAGE_SNAPSHOT)
|
---|
398 | {
|
---|
399 | RTPrintf("VBoxManage snapshot <uuid>|<name>\n"
|
---|
400 | " take <name> [--description <desc>] [--pause] |\n"
|
---|
401 | " delete <uuid>|<name> |\n"
|
---|
402 | " restore <uuid>|<name> |\n"
|
---|
403 | " restorecurrent |\n"
|
---|
404 | " edit <uuid>|<name>|--current\n"
|
---|
405 | " [--name <name>]\n"
|
---|
406 | " [--description <desc>] |\n"
|
---|
407 | " showvminfo <uuid>|<name>\n"
|
---|
408 | "\n");
|
---|
409 | }
|
---|
410 |
|
---|
411 | if (u64Cmd & USAGE_OPENMEDIUM)
|
---|
412 | {
|
---|
413 | RTPrintf("VBoxManage openmedium disk|dvd|floppy <filename>\n"
|
---|
414 | " [--type normal|immutable|writethrough] (disk only)\n"
|
---|
415 | " [--uuid <uuid>]\n"
|
---|
416 | " [--parentuuid <uuid>] (disk only)\n"
|
---|
417 | "\n");
|
---|
418 | }
|
---|
419 |
|
---|
420 | if (u64Cmd & USAGE_CLOSEMEDIUM)
|
---|
421 | {
|
---|
422 | RTPrintf("VBoxManage closemedium disk|dvd|floppy <uuid>|<filename>\n"
|
---|
423 | " [--delete]\n"
|
---|
424 | "\n");
|
---|
425 | }
|
---|
426 |
|
---|
427 | if (u64Cmd & USAGE_STORAGEATTACH)
|
---|
428 | {
|
---|
429 | RTPrintf("VBoxManage storageattach <uuid|vmname>\n"
|
---|
430 | " --storagectl <name>\n"
|
---|
431 | " --port <number>\n"
|
---|
432 | " --device <number>\n"
|
---|
433 | " [--type dvddrive|hdd|fdd\n"
|
---|
434 | " --medium none|emptydrive|uuid|filename|host:<drive>]\n"
|
---|
435 | " [--passthrough on|off]\n"
|
---|
436 | " [--forceunmount]\n"
|
---|
437 | "\n");
|
---|
438 | }
|
---|
439 |
|
---|
440 | if (u64Cmd & USAGE_STORAGECONTROLLER)
|
---|
441 | {
|
---|
442 | RTPrintf("VBoxManage storagectl <uuid|vmname>\n"
|
---|
443 | " --name <name>\n"
|
---|
444 | " [--add ide|sata|scsi|floppy|sas]\n"
|
---|
445 | " [--controller LSILogic|LSILogicSAS|BusLogic|IntelAHCI|\n"
|
---|
446 | " PIIX3|PIIX4|ICH6|I82078]\n"
|
---|
447 | " [--sataideemulation<1-4> <1-30>]\n"
|
---|
448 | " [--sataportcount <1-30>]\n"
|
---|
449 | " [--iobackend Buffered|Unbuffered]\n"
|
---|
450 | " [--remove]\n"
|
---|
451 | "\n");
|
---|
452 | }
|
---|
453 |
|
---|
454 | if (u64Cmd & USAGE_SHOWHDINFO)
|
---|
455 | {
|
---|
456 | RTPrintf("VBoxManage showhdinfo <uuid>|<filename>\n"
|
---|
457 | "\n");
|
---|
458 | }
|
---|
459 |
|
---|
460 | if (u64Cmd & USAGE_CREATEHD)
|
---|
461 | {
|
---|
462 | RTPrintf("VBoxManage createhd --filename <filename>\n"
|
---|
463 | " --size <megabytes>\n"
|
---|
464 | " [--format VDI|VMDK|VHD] (default: VDI)\n"
|
---|
465 | " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
|
---|
466 | " [--type normal|writethrough] (default: normal)\n"
|
---|
467 | " [--comment <comment>]\n"
|
---|
468 | " [--remember]\n"
|
---|
469 | "\n");
|
---|
470 | }
|
---|
471 |
|
---|
472 | if (u64Cmd & USAGE_MODIFYHD)
|
---|
473 | {
|
---|
474 | RTPrintf("VBoxManage modifyhd <uuid>|<filename>\n"
|
---|
475 | " [--type normal|writethrough|immutable]\n"
|
---|
476 | " [--autoreset on|off]\n"
|
---|
477 | " [--compact]\n"
|
---|
478 | "\n");
|
---|
479 | }
|
---|
480 |
|
---|
481 | if (u64Cmd & USAGE_CLONEHD)
|
---|
482 | {
|
---|
483 | RTPrintf("VBoxManage clonehd <uuid>|<filename> <outputfile>\n"
|
---|
484 | " [--format VDI|VMDK|VHD|RAW|<other>]\n"
|
---|
485 | " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
|
---|
486 | " [--type normal|writethrough|immutable]\n"
|
---|
487 | " [--remember] [--existing]\n"
|
---|
488 | "\n");
|
---|
489 | }
|
---|
490 |
|
---|
491 | if (u64Cmd & USAGE_CONVERTFROMRAW)
|
---|
492 | {
|
---|
493 | RTPrintf("VBoxManage convertfromraw <filename> <outputfile>\n"
|
---|
494 | " [--format VDI|VMDK|VHD]\n"
|
---|
495 | " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
|
---|
496 | "VBoxManage convertfromraw stdin <outputfile> <bytes>\n"
|
---|
497 | " [--format VDI|VMDK|VHD]\n"
|
---|
498 | " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
|
---|
499 | "\n");
|
---|
500 | }
|
---|
501 |
|
---|
502 | if (u64Cmd & USAGE_ADDISCSIDISK)
|
---|
503 | {
|
---|
504 | RTPrintf("VBoxManage addiscsidisk --server <name>|<ip>\n"
|
---|
505 | " --target <target>\n"
|
---|
506 | " [--port <port>]\n"
|
---|
507 | " [--lun <lun>]\n"
|
---|
508 | " [--encodedlun <lun>]\n"
|
---|
509 | " [--username <username>]\n"
|
---|
510 | " [--password <password>]\n"
|
---|
511 | " [--type normal|writethrough|immutable]\n"
|
---|
512 | " [--intnet]\n"
|
---|
513 | "\n");
|
---|
514 | }
|
---|
515 |
|
---|
516 | if (u64Cmd & USAGE_GETEXTRADATA)
|
---|
517 | {
|
---|
518 | RTPrintf("VBoxManage getextradata global|<uuid>|<name>\n"
|
---|
519 | " <key>|enumerate\n"
|
---|
520 | "\n");
|
---|
521 | }
|
---|
522 |
|
---|
523 | if (u64Cmd & USAGE_SETEXTRADATA)
|
---|
524 | {
|
---|
525 | RTPrintf("VBoxManage setextradata global|<uuid>|<name>\n"
|
---|
526 | " <key>\n"
|
---|
527 | " [<value>] (no value deletes key)\n"
|
---|
528 | "\n");
|
---|
529 | }
|
---|
530 |
|
---|
531 | if (u64Cmd & USAGE_SETPROPERTY)
|
---|
532 | {
|
---|
533 | RTPrintf("VBoxManage setproperty hdfolder default|<folder> |\n"
|
---|
534 | " machinefolder default|<folder> |\n"
|
---|
535 | " vrdpauthlibrary default|<library> |\n"
|
---|
536 | " websrvauthlibrary default|null|<library> |\n"
|
---|
537 | " loghistorycount <value>\n"
|
---|
538 | "\n");
|
---|
539 | }
|
---|
540 |
|
---|
541 | if (u64Cmd & USAGE_USBFILTER_ADD)
|
---|
542 | {
|
---|
543 | RTPrintf("VBoxManage usbfilter add <index,0-N>\n"
|
---|
544 | " --target <uuid>|<name>|global\n"
|
---|
545 | " --name <string>\n"
|
---|
546 | " --action ignore|hold (global filters only)\n"
|
---|
547 | " [--active yes|no] (yes)\n"
|
---|
548 | " [--vendorid <XXXX>] (null)\n"
|
---|
549 | " [--productid <XXXX>] (null)\n"
|
---|
550 | " [--revision <IIFF>] (null)\n"
|
---|
551 | " [--manufacturer <string>] (null)\n"
|
---|
552 | " [--product <string>] (null)\n"
|
---|
553 | " [--remote yes|no] (null, VM filters only)\n"
|
---|
554 | " [--serialnumber <string>] (null)\n"
|
---|
555 | " [--maskedinterfaces <XXXXXXXX>]\n"
|
---|
556 | "\n");
|
---|
557 | }
|
---|
558 |
|
---|
559 | if (u64Cmd & USAGE_USBFILTER_MODIFY)
|
---|
560 | {
|
---|
561 | RTPrintf("VBoxManage usbfilter modify <index,0-N>\n"
|
---|
562 | " --target <uuid>|<name>|global\n"
|
---|
563 | " [--name <string>]\n"
|
---|
564 | " [--action ignore|hold] (global filters only)\n"
|
---|
565 | " [--active yes|no]\n"
|
---|
566 | " [--vendorid <XXXX>|\"\"]\n"
|
---|
567 | " [--productid <XXXX>|\"\"]\n"
|
---|
568 | " [--revision <IIFF>|\"\"]\n"
|
---|
569 | " [--manufacturer <string>|\"\"]\n"
|
---|
570 | " [--product <string>|\"\"]\n"
|
---|
571 | " [--remote yes|no] (null, VM filters only)\n"
|
---|
572 | " [--serialnumber <string>|\"\"]\n"
|
---|
573 | " [--maskedinterfaces <XXXXXXXX>]\n"
|
---|
574 | "\n");
|
---|
575 | }
|
---|
576 |
|
---|
577 | if (u64Cmd & USAGE_USBFILTER_REMOVE)
|
---|
578 | {
|
---|
579 | RTPrintf("VBoxManage usbfilter remove <index,0-N>\n"
|
---|
580 | " --target <uuid>|<name>|global\n"
|
---|
581 | "\n");
|
---|
582 | }
|
---|
583 |
|
---|
584 | if (u64Cmd & USAGE_SHAREDFOLDER_ADD)
|
---|
585 | {
|
---|
586 | RTPrintf("VBoxManage sharedfolder add <vmname>|<uuid>\n"
|
---|
587 | " --name <name> --hostpath <hostpath>\n"
|
---|
588 | " [--transient] [--readonly]\n"
|
---|
589 | "\n");
|
---|
590 | }
|
---|
591 |
|
---|
592 | if (u64Cmd & USAGE_SHAREDFOLDER_REMOVE)
|
---|
593 | {
|
---|
594 | RTPrintf("VBoxManage sharedfolder remove <vmname>|<uuid>\n"
|
---|
595 | " --name <name> [--transient]\n"
|
---|
596 | "\n");
|
---|
597 | }
|
---|
598 |
|
---|
599 | if (u64Cmd & USAGE_VM_STATISTICS)
|
---|
600 | {
|
---|
601 | RTPrintf("VBoxManage vmstatistics <vmname>|<uuid> [--reset]\n"
|
---|
602 | " [--pattern <pattern>] [--descriptions]\n"
|
---|
603 | "\n");
|
---|
604 | }
|
---|
605 |
|
---|
606 | #ifdef VBOX_WITH_GUEST_PROPS
|
---|
607 | if (u64Cmd & USAGE_GUESTPROPERTY)
|
---|
608 | usageGuestProperty();
|
---|
609 | #endif /* VBOX_WITH_GUEST_PROPS defined */
|
---|
610 |
|
---|
611 | #ifdef VBOX_WITH_GUEST_CONTROL
|
---|
612 | if (u64Cmd & USAGE_GUESTCONTROL)
|
---|
613 | usageGuestControl();
|
---|
614 | #endif /* VBOX_WITH_GUEST_CONTROL defined */
|
---|
615 |
|
---|
616 | if (u64Cmd & USAGE_METRICS)
|
---|
617 | {
|
---|
618 | RTPrintf("VBoxManage metrics list [*|host|<vmname> [<metric_list>]]\n"
|
---|
619 | " (comma-separated)\n\n"
|
---|
620 | "VBoxManage metrics setup\n"
|
---|
621 | " [--period <seconds>] (default: 1)\n"
|
---|
622 | " [--samples <count>] (default: 1)\n"
|
---|
623 | " [--list]\n"
|
---|
624 | " [*|host|<vmname> [<metric_list>]]\n\n"
|
---|
625 | "VBoxManage metrics query [*|host|<vmname> [<metric_list>]]\n\n"
|
---|
626 | "VBoxManage metrics enable\n"
|
---|
627 | " [--list]\n"
|
---|
628 | " [*|host|<vmname> [<metric_list>]]\n\n"
|
---|
629 | "VBoxManage metrics disable\n"
|
---|
630 | " [--list]\n"
|
---|
631 | " [*|host|<vmname> [<metric_list>]]\n\n"
|
---|
632 | "VBoxManage metrics collect\n"
|
---|
633 | " [--period <seconds>] (default: 1)\n"
|
---|
634 | " [--samples <count>] (default: 1)\n"
|
---|
635 | " [--list]\n"
|
---|
636 | " [--detach]\n"
|
---|
637 | " [*|host|<vmname> [<metric_list>]]\n"
|
---|
638 | "\n");
|
---|
639 | }
|
---|
640 | #if defined(VBOX_WITH_NETFLT)
|
---|
641 | if (u64Cmd & USAGE_HOSTONLYIFS)
|
---|
642 | {
|
---|
643 | RTPrintf("VBoxManage hostonlyif ipconfig <name>\n"
|
---|
644 | " [--dhcp |\n"
|
---|
645 | " --ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] |\n"
|
---|
646 | " --ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]]\n"
|
---|
647 | # if defined(RT_OS_WINDOWS)
|
---|
648 | " create |\n"
|
---|
649 | " remove <name>\n"
|
---|
650 | # endif
|
---|
651 | "\n");
|
---|
652 | }
|
---|
653 | #endif
|
---|
654 |
|
---|
655 | if (u64Cmd & USAGE_DHCPSERVER)
|
---|
656 | {
|
---|
657 | RTPrintf("VBoxManage dhcpserver add|modify --netname <network_name> |\n"
|
---|
658 | #if defined(VBOX_WITH_NETFLT)
|
---|
659 | " --ifname <hostonly_if_name>\n"
|
---|
660 | #endif
|
---|
661 | " [--ip <ip_address>\n"
|
---|
662 | " --netmask <network_mask>\n"
|
---|
663 | " --lowerip <lower_ip>\n"
|
---|
664 | " --upperip <upper_ip>]\n"
|
---|
665 | " [--enable | --disable]\n\n"
|
---|
666 | "VBoxManage dhcpserver remove --netname <network_name> |\n"
|
---|
667 | #if defined(VBOX_WITH_NETFLT)
|
---|
668 | " --ifname <hostonly_if_name>\n"
|
---|
669 | #endif
|
---|
670 | "\n");
|
---|
671 | }
|
---|
672 | }
|
---|
673 |
|
---|
674 | /**
|
---|
675 | * Print a usage synopsis and the syntax error message.
|
---|
676 | */
|
---|
677 | int errorSyntax(USAGECATEGORY u64Cmd, const char *pszFormat, ...)
|
---|
678 | {
|
---|
679 | va_list args;
|
---|
680 | showLogo(); // show logo even if suppressed
|
---|
681 | #ifndef VBOX_ONLY_DOCS
|
---|
682 | if (g_fInternalMode)
|
---|
683 | printUsageInternal(u64Cmd);
|
---|
684 | else
|
---|
685 | printUsage(u64Cmd);
|
---|
686 | #endif /* !VBOX_ONLY_DOCS */
|
---|
687 | va_start(args, pszFormat);
|
---|
688 | RTPrintf("\n"
|
---|
689 | "Syntax error: %N\n", pszFormat, &args);
|
---|
690 | va_end(args);
|
---|
691 | return 1;
|
---|
692 | }
|
---|
693 |
|
---|
694 | /**
|
---|
695 | * errorSyntax for RTGetOpt users.
|
---|
696 | *
|
---|
697 | * @returns 1.
|
---|
698 | *
|
---|
699 | * @param fUsageCategory The usage category of the command.
|
---|
700 | * @param rc The RTGetOpt return code.
|
---|
701 | * @param pValueUnion The value union.
|
---|
702 | */
|
---|
703 | int errorGetOpt(USAGECATEGORY fUsageCategory, int rc, union RTGETOPTUNION const *pValueUnion)
|
---|
704 | {
|
---|
705 | showLogo(); // show logo even if suppressed
|
---|
706 | #ifndef VBOX_ONLY_DOCS
|
---|
707 | if (g_fInternalMode)
|
---|
708 | printUsageInternal(fUsageCategory);
|
---|
709 | else
|
---|
710 | printUsage(fUsageCategory);
|
---|
711 | #endif /* !VBOX_ONLY_DOCS */
|
---|
712 |
|
---|
713 | if (rc == VINF_GETOPT_NOT_OPTION)
|
---|
714 | return RTPrintf("error: Invalid parameter '%s'\n", pValueUnion->psz);
|
---|
715 | if (rc > 0)
|
---|
716 | {
|
---|
717 | if (RT_C_IS_PRINT(rc))
|
---|
718 | return RTPrintf("error: Invalid option -%c\n", rc);
|
---|
719 | return RTPrintf("error: Invalid option case %i\n", rc);
|
---|
720 | }
|
---|
721 | if (rc == VERR_GETOPT_UNKNOWN_OPTION)
|
---|
722 | return RTPrintf("error: unknown option: %s\n", pValueUnion->psz);
|
---|
723 | if (pValueUnion->pDef)
|
---|
724 | return RTPrintf("error: %s: %Rrs\n", pValueUnion->pDef->pszLong, rc);
|
---|
725 | return RTPrintf("error: %Rrs\n", rc);
|
---|
726 | }
|
---|
727 |
|
---|
728 | /**
|
---|
729 | * Print an error message without the syntax stuff.
|
---|
730 | */
|
---|
731 | int errorArgument(const char *pszFormat, ...)
|
---|
732 | {
|
---|
733 | va_list args;
|
---|
734 | va_start(args, pszFormat);
|
---|
735 | RTPrintf("error: %N\n", pszFormat, &args);
|
---|
736 | va_end(args);
|
---|
737 | return 1;
|
---|
738 | }
|
---|