VirtualBox

source: vbox/trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp@ 55843

Last change on this file since 55843 was 55843, checked in by vboxsync, 10 years ago

Frontends/VBoxManage: allow configuring the VBoxSVC release logging level, plus documentation

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 51.1 KB
Line 
1/* $Id: VBoxManageHelp.cpp 55843 2015-05-13 11:33:39Z vboxsync $ */
2/** @file
3 * VBoxManage - help and other message output.
4 */
5
6/*
7 * Copyright (C) 2006-2015 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/buildconfig.h>
25#include <iprt/ctype.h>
26#include <iprt/err.h>
27#include <iprt/getopt.h>
28#include <iprt/stream.h>
29
30#include "VBoxManage.h"
31
32
33
34void showLogo(PRTSTREAM pStrm)
35{
36 static bool s_fShown; /* show only once */
37
38 if (!s_fShown)
39 {
40 RTStrmPrintf(pStrm, VBOX_PRODUCT " Command Line Management Interface Version "
41 VBOX_VERSION_STRING "\n"
42 "(C) 2005-" VBOX_C_YEAR " " VBOX_VENDOR "\n"
43 "All rights reserved.\n"
44 "\n");
45 s_fShown = true;
46 }
47}
48
49void printUsage(USAGECATEGORY fCategory, uint32_t fSubCategory, PRTSTREAM pStrm)
50{
51 bool fDumpOpts = false;
52#ifdef RT_OS_LINUX
53 bool fLinux = true;
54#else
55 bool fLinux = false;
56#endif
57#ifdef RT_OS_WINDOWS
58 bool fWin = true;
59#else
60 bool fWin = false;
61#endif
62#ifdef RT_OS_SOLARIS
63 bool fSolaris = true;
64#else
65 bool fSolaris = false;
66#endif
67#ifdef RT_OS_FREEBSD
68 bool fFreeBSD = true;
69#else
70 bool fFreeBSD = false;
71#endif
72#ifdef RT_OS_DARWIN
73 bool fDarwin = true;
74#else
75 bool fDarwin = false;
76#endif
77#ifdef VBOX_WITH_VBOXSDL
78 bool fVBoxSDL = true;
79#else
80 bool fVBoxSDL = false;
81#endif
82
83 if (fCategory == USAGE_DUMPOPTS)
84 {
85 fDumpOpts = true;
86 fLinux = true;
87 fWin = true;
88 fSolaris = true;
89 fFreeBSD = true;
90 fDarwin = true;
91 fVBoxSDL = true;
92 fCategory = USAGE_ALL;
93 }
94
95 RTStrmPrintf(pStrm,
96 "Usage:\n"
97 "\n");
98
99 if (fCategory == USAGE_ALL)
100 RTStrmPrintf(pStrm,
101 " VBoxManage [<general option>] <command>\n"
102 " \n \n"
103 "General Options:\n \n"
104 " [-v|--version] print version number and exit\n"
105 " [-q|--nologo] suppress the logo\n"
106 " [--settingspw <pw>] provide the settings password\n"
107 " [--settingspwfile <file>] provide a file containing the settings password\n"
108 " \n \n"
109 "Commands:\n \n");
110
111 const char *pcszSep1 = " ";
112 const char *pcszSep2 = " ";
113 if (fCategory != USAGE_ALL)
114 {
115 pcszSep1 = "VBoxManage";
116 pcszSep2 = "";
117 }
118
119#define SEP pcszSep1, pcszSep2
120
121 if (fCategory & USAGE_LIST)
122 RTStrmPrintf(pStrm,
123 "%s list [--long|-l]%s vms|runningvms|ostypes|hostdvds|hostfloppies|\n"
124#if defined(VBOX_WITH_NETFLT)
125 " intnets|bridgedifs|hostonlyifs|natnets|dhcpservers|\n"
126#else
127 " intnets|bridgedifs|natnets|dhcpservers|hostinfo|\n"
128#endif
129 " hostinfo|hostcpuids|hddbackends|hdds|dvds|floppies|\n"
130 " usbhost|usbfilters|systemproperties|extpacks|\n"
131 " groups|webcams|screenshotformats\n"
132 "\n", SEP);
133
134 if (fCategory & USAGE_SHOWVMINFO)
135 RTStrmPrintf(pStrm,
136 "%s showvminfo %s <uuid|vmname> [--details]\n"
137 " [--machinereadable]\n"
138 "%s showvminfo %s <uuid|vmname> --log <idx>\n"
139 "\n", SEP, SEP);
140
141 if (fCategory & USAGE_REGISTERVM)
142 RTStrmPrintf(pStrm,
143 "%s registervm %s <filename>\n"
144 "\n", SEP);
145
146 if (fCategory & USAGE_UNREGISTERVM)
147 RTStrmPrintf(pStrm,
148 "%s unregistervm %s <uuid|vmname> [--delete]\n"
149 "\n", SEP);
150
151 if (fCategory & USAGE_CREATEVM)
152 RTStrmPrintf(pStrm,
153 "%s createvm %s --name <name>\n"
154 " [--groups <group>, ...]\n"
155 " [--ostype <ostype>]\n"
156 " [--register]\n"
157 " [--basefolder <path>]\n"
158 " [--uuid <uuid>]\n"
159 "\n", SEP);
160
161 if (fCategory & USAGE_MODIFYVM)
162 {
163 RTStrmPrintf(pStrm,
164 "%s modifyvm %s <uuid|vmname>\n"
165 " [--name <name>]\n"
166 " [--groups <group>, ...]\n"
167 " [--description <desc>]\n"
168 " [--ostype <ostype>]\n"
169 " [--iconfile <filename>]\n"
170 " [--memory <memorysize in MB>]\n"
171 " [--pagefusion on|off]\n"
172 " [--vram <vramsize in MB>]\n"
173 " [--acpi on|off]\n"
174#ifdef VBOX_WITH_PCI_PASSTHROUGH
175 " [--pciattach 03:04.0]\n"
176 " [--pciattach 03:04.0@02:01.0]\n"
177 " [--pcidetach 03:04.0]\n"
178#endif
179 " [--ioapic on|off]\n"
180 " [--hpet on|off]\n"
181 " [--triplefaultreset on|off]\n"
182 " [--paravirtprovider none|default|legacy|minimal|\n"
183 " hyperv|kvm]\n"
184 " [--hwvirtex on|off]\n"
185 " [--nestedpaging on|off]\n"
186 " [--largepages on|off]\n"
187 " [--vtxvpid on|off]\n"
188 " [--vtxux on|off]\n"
189 " [--pae on|off]\n"
190 " [--longmode on|off]\n"
191 " [--cpuid-portability-level <0..3>\n"
192 " [--cpuidset <leaf> <eax> <ebx> <ecx> <edx>]\n"
193 " [--cpuidremove <leaf>]\n"
194 " [--cpuidremoveall]\n"
195 " [--hardwareuuid <uuid>]\n"
196 " [--cpus <number>]\n"
197 " [--cpuhotplug on|off]\n"
198 " [--plugcpu <id>]\n"
199 " [--unplugcpu <id>]\n"
200 " [--cpuexecutioncap <1-100>]\n"
201 " [--rtcuseutc on|off]\n"
202#ifdef VBOX_WITH_VMSVGA
203 " [--graphicscontroller none|vboxvga|vmsvga]\n"
204#else
205 " [--graphicscontroller none|vboxvga]\n"
206#endif
207 " [--monitorcount <number>]\n"
208 " [--accelerate3d on|off]\n"
209#ifdef VBOX_WITH_VIDEOHWACCEL
210 " [--accelerate2dvideo on|off]\n"
211#endif
212 " [--firmware bios|efi|efi32|efi64]\n"
213 " [--chipset ich9|piix3]\n"
214 " [--bioslogofadein on|off]\n"
215 " [--bioslogofadeout on|off]\n"
216 " [--bioslogodisplaytime <msec>]\n"
217 " [--bioslogoimagepath <imagepath>]\n"
218 " [--biosbootmenu disabled|menuonly|messageandmenu]\n"
219 " [--biossystemtimeoffset <msec>]\n"
220 " [--biospxedebug on|off]\n"
221 " [--boot<1-4> none|floppy|dvd|disk|net>]\n"
222 " [--nic<1-N> none|null|nat|bridged|intnet"
223#if defined(VBOX_WITH_NETFLT)
224 "|hostonly"
225#endif
226 "|\n"
227 " generic|natnetwork"
228 "]\n"
229 " [--nictype<1-N> Am79C970A|Am79C973"
230#ifdef VBOX_WITH_E1000
231 "|\n 82540EM|82543GC|82545EM"
232#endif
233#ifdef VBOX_WITH_VIRTIO
234 "|\n virtio"
235#endif /* VBOX_WITH_VIRTIO */
236 "]\n"
237 " [--cableconnected<1-N> on|off]\n"
238 " [--nictrace<1-N> on|off]\n"
239 " [--nictracefile<1-N> <filename>]\n"
240 " [--nicproperty<1-N> name=[value]]\n"
241 " [--nicspeed<1-N> <kbps>]\n"
242 " [--nicbootprio<1-N> <priority>]\n"
243 " [--nicpromisc<1-N> deny|allow-vms|allow-all]\n"
244 " [--nicbandwidthgroup<1-N> none|<name>]\n"
245 " [--bridgeadapter<1-N> none|<devicename>]\n"
246#if defined(VBOX_WITH_NETFLT)
247 " [--hostonlyadapter<1-N> none|<devicename>]\n"
248#endif
249 " [--intnet<1-N> <network name>]\n"
250 " [--nat-network<1-N> <network name>]\n"
251 " [--nicgenericdrv<1-N> <driver>\n"
252 " [--natnet<1-N> <network>|default]\n"
253 " [--natsettings<1-N> [<mtu>],[<socksnd>],\n"
254 " [<sockrcv>],[<tcpsnd>],\n"
255 " [<tcprcv>]]\n"
256 " [--natpf<1-N> [<rulename>],tcp|udp,[<hostip>],\n"
257 " <hostport>,[<guestip>],<guestport>]\n"
258 " [--natpf<1-N> delete <rulename>]\n"
259 " [--nattftpprefix<1-N> <prefix>]\n"
260 " [--nattftpfile<1-N> <file>]\n"
261 " [--nattftpserver<1-N> <ip>]\n"
262 " [--natbindip<1-N> <ip>\n"
263 " [--natdnspassdomain<1-N> on|off]\n"
264 " [--natdnsproxy<1-N> on|off]\n"
265 " [--natdnshostresolver<1-N> on|off]\n"
266 " [--nataliasmode<1-N> default|[log],[proxyonly],\n"
267 " [sameports]]\n"
268 " [--macaddress<1-N> auto|<mac>]\n"
269 " [--mouse ps2|usb|usbtablet|usbmultitouch]\n"
270 " [--keyboard ps2|usb\n"
271 " [--uart<1-N> off|<I/O base> <IRQ>]\n"
272 " [--uartmode<1-N> disconnected|\n"
273 " server <pipe>|\n"
274 " client <pipe>|\n"
275 " tcpserver <port>|\n"
276 " tcpclient <hostname:port>|\n"
277 " file <file>|\n"
278 " <devicename>]\n"
279#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
280 " [--lpt<1-N> off|<I/O base> <IRQ>]\n"
281 " [--lptmode<1-N> <devicename>]\n"
282#endif
283 " [--guestmemoryballoon <balloonsize in MB>]\n"
284 " [--audio none|null", SEP);
285 if (fWin)
286 {
287#ifdef VBOX_WITH_WINMM
288 RTStrmPrintf(pStrm, "|winmm|dsound");
289#else
290 RTStrmPrintf(pStrm, "|dsound");
291#endif
292 }
293 if (fSolaris)
294 {
295 RTStrmPrintf(pStrm, "|solaudio"
296#ifdef VBOX_WITH_SOLARIS_OSS
297 "|oss"
298#endif
299 );
300 }
301 if (fLinux)
302 {
303 RTStrmPrintf(pStrm, "|oss"
304#ifdef VBOX_WITH_ALSA
305 "|alsa"
306#endif
307#ifdef VBOX_WITH_PULSE
308 "|pulse"
309#endif
310 );
311 }
312 if (fFreeBSD)
313 {
314 /* Get the line break sorted when dumping all option variants. */
315 if (fDumpOpts)
316 {
317 RTStrmPrintf(pStrm, "|\n"
318 " oss");
319 }
320 else
321 RTStrmPrintf(pStrm, "|oss");
322#ifdef VBOX_WITH_PULSE
323 RTStrmPrintf(pStrm, "|pulse");
324#endif
325 }
326 if (fDarwin)
327 {
328 RTStrmPrintf(pStrm, "|coreaudio");
329 }
330 RTStrmPrintf(pStrm, "]\n");
331 RTStrmPrintf(pStrm,
332 " [--audiocontroller ac97|hda|sb16]\n"
333 " [--clipboard disabled|hosttoguest|guesttohost|\n"
334 " bidirectional]\n"
335 " [--draganddrop disabled|hosttoguest]\n");
336 RTStrmPrintf(pStrm,
337 " [--vrde on|off]\n"
338 " [--vrdeextpack default|<name>\n"
339 " [--vrdeproperty <name=[value]>]\n"
340 " [--vrdeport <hostport>]\n"
341 " [--vrdeaddress <hostip>]\n"
342 " [--vrdeauthtype null|external|guest]\n"
343 " [--vrdeauthlibrary default|<name>\n"
344 " [--vrdemulticon on|off]\n"
345 " [--vrdereusecon on|off]\n"
346 " [--vrdevideochannel on|off]\n"
347 " [--vrdevideochannelquality <percent>]\n");
348 RTStrmPrintf(pStrm,
349 " [--usb on|off]\n"
350 " [--usbehci on|off]\n"
351 " [--usbxhci on|off]\n"
352 " [--snapshotfolder default|<path>]\n"
353 " [--teleporter on|off]\n"
354 " [--teleporterport <port>]\n"
355 " [--teleporteraddress <address|empty>\n"
356 " [--teleporterpassword <password>]\n"
357 " [--teleporterpasswordfile <file>|stdin]\n"
358 " [--tracing-enabled on|off]\n"
359 " [--tracing-config <config-string>]\n"
360 " [--tracing-allow-vm-access on|off]\n"
361#if 0
362 " [--iocache on|off]\n"
363 " [--iocachesize <I/O cache size in MB>]\n"
364#endif
365#if 0
366 " [--faulttolerance master|standby]\n"
367 " [--faulttoleranceaddress <name>]\n"
368 " [--faulttoleranceport <port>]\n"
369 " [--faulttolerancesyncinterval <msec>]\n"
370 " [--faulttolerancepassword <password>]\n"
371#endif
372#ifdef VBOX_WITH_USB_CARDREADER
373 " [--usbcardreader on|off]\n"
374#endif
375 " [--autostart-enabled on|off]\n"
376 " [--autostart-delay <seconds>]\n"
377#if 0
378 " [--autostop-type disabled|savestate|poweroff|\n"
379 " acpishutdown]\n"
380#endif
381#ifdef VBOX_WITH_VPX
382 " [--videocap on|off]\n"
383 " [--videocapscreens all|<screen ID> [<screen ID> ...]]\n"
384 " [--videocapfile <filename>]\n"
385 " [--videocapres <width> <height>]\n"
386 " [--videocaprate <rate>]\n"
387 " [--videocapfps <fps>]\n"
388 " [--videocapmaxtime <time>]\n"
389 " [--videocapmaxsize <MB>]\n"
390 " [--videocapopts <key=value> [<key=value> ...]]\n"
391#endif
392 " [--defaultfrontend default|<name>]\n"
393 "\n");
394 }
395
396 if (fCategory & USAGE_CLONEVM)
397 RTStrmPrintf(pStrm,
398 "%s clonevm %s <uuid|vmname>\n"
399 " [--snapshot <uuid>|<name>]\n"
400 " [--mode machine|machineandchildren|all]\n"
401 " [--options link|keepallmacs|keepnatmacs|\n"
402 " keepdisknames]\n"
403 " [--name <name>]\n"
404 " [--groups <group>, ...]\n"
405 " [--basefolder <basefolder>]\n"
406 " [--uuid <uuid>]\n"
407 " [--register]\n"
408 "\n", SEP);
409
410 if (fCategory & USAGE_IMPORTAPPLIANCE)
411 RTStrmPrintf(pStrm,
412 "%s import %s <ovfname/ovaname>\n"
413 " [--dry-run|-n]\n"
414 " [--options keepallmacs|keepnatmacs|importtovdi]\n"
415 " [more options]\n"
416 " (run with -n to have options displayed\n"
417 " for a particular OVF)\n\n", SEP);
418
419 if (fCategory & USAGE_EXPORTAPPLIANCE)
420 RTStrmPrintf(pStrm,
421 "%s export %s <machines> --output|-o <name>.<ovf/ova>\n"
422 " [--legacy09|--ovf09|--ovf10|--ovf20]\n"
423 " [--manifest]\n"
424 " [--iso]\n"
425 " [--options manifest|iso|nomacs|nomacsbutnat]\n"
426 " [--vsys <number of virtual system>]\n"
427 " [--product <product name>]\n"
428 " [--producturl <product url>]\n"
429 " [--vendor <vendor name>]\n"
430 " [--vendorurl <vendor url>]\n"
431 " [--version <version info>]\n"
432 " [--description <description info>]\n"
433 " [--eula <license text>]\n"
434 " [--eulafile <filename>]\n"
435 "\n", SEP);
436
437 if (fCategory & USAGE_STARTVM)
438 {
439 RTStrmPrintf(pStrm,
440 "%s startvm %s <uuid|vmname>...\n"
441 " [--type gui", SEP);
442 if (fVBoxSDL)
443 RTStrmPrintf(pStrm, "|sdl");
444 RTStrmPrintf(pStrm, "|headless|separate]\n");
445 RTStrmPrintf(pStrm,
446 "\n");
447 }
448
449 if (fCategory & USAGE_CONTROLVM)
450 {
451 RTStrmPrintf(pStrm,
452 "%s controlvm %s <uuid|vmname>\n"
453 " pause|resume|reset|poweroff|savestate|\n"
454 " acpipowerbutton|acpisleepbutton|\n"
455 " keyboardputscancode <hex> [<hex> ...]|\n"
456 " setlinkstate<1-N> on|off |\n"
457#if defined(VBOX_WITH_NETFLT)
458 " nic<1-N> null|nat|bridged|intnet|hostonly|generic|\n"
459 " natnetwork [<devicename>] |\n"
460#else /* !VBOX_WITH_NETFLT */
461 " nic<1-N> null|nat|bridged|intnet|generic|natnetwork\n"
462 " [<devicename>] |\n"
463#endif /* !VBOX_WITH_NETFLT */
464 " nictrace<1-N> on|off |\n"
465 " nictracefile<1-N> <filename> |\n"
466 " nicproperty<1-N> name=[value] |\n"
467 " nicpromisc<1-N> deny|allow-vms|allow-all |\n"
468 " natpf<1-N> [<rulename>],tcp|udp,[<hostip>],\n"
469 " <hostport>,[<guestip>],<guestport> |\n"
470 " natpf<1-N> delete <rulename> |\n"
471 " guestmemoryballoon <balloonsize in MB> |\n"
472 " usbattach <uuid>|<address>\n"
473 " [--capturefile <filename>] |\n"
474 " usbdetach <uuid>|<address> |\n"
475 " clipboard disabled|hosttoguest|guesttohost|\n"
476 " bidirectional |\n"
477 " draganddrop disabled|hosttoguest |\n"
478 " vrde on|off |\n"
479 " vrdeport <port> |\n"
480 " vrdeproperty <name=[value]> |\n"
481 " vrdevideochannelquality <percent> |\n"
482 " setvideomodehint <xres> <yres> <bpp>\n"
483 " [[<display>] [<enabled:yes|no> |\n"
484 " [<xorigin> <yorigin>]]] |\n"
485 " screenshotpng <file> [display] |\n"
486 " vcpenabled on|off |\n"
487 " vcpscreens all|none|<screen>,[<screen>...] |\n"
488 " setcredentials <username>\n"
489 " --passwordfile <file> | <password>\n"
490 " <domain>\n"
491 " [--allowlocallogon <yes|no>] |\n"
492 " teleport --host <name> --port <port>\n"
493 " [--maxdowntime <msec>]\n"
494 " [--passwordfile <file> |\n"
495 " --password <password>] |\n"
496 " plugcpu <id> |\n"
497 " unplugcpu <id> |\n"
498 " cpuexecutioncap <1-100>\n"
499 " webcam <attach [path [settings]]> | <detach [path]> | <list>\n"
500 " addencpassword <id>\n"
501 " <password>\n"
502 " [--removeonsuspend <yes|no>]\n"
503 " removeencpassword <id>\n"
504 " removeallencpasswords\n"
505 "\n", SEP);
506 }
507
508 if (fCategory & USAGE_DISCARDSTATE)
509 RTStrmPrintf(pStrm,
510 "%s discardstate %s <uuid|vmname>\n"
511 "\n", SEP);
512
513 if (fCategory & USAGE_ADOPTSTATE)
514 RTStrmPrintf(pStrm,
515 "%s adoptstate %s <uuid|vmname> <state_file>\n"
516 "\n", SEP);
517
518 if (fCategory & USAGE_SNAPSHOT)
519 RTStrmPrintf(pStrm,
520 "%s snapshot %s <uuid|vmname>\n"
521 " take <name> [--description <desc>] [--live] |\n"
522 " delete <uuid|snapname> |\n"
523 " restore <uuid|snapname> |\n"
524 " restorecurrent |\n"
525 " edit <uuid|snapname>|--current\n"
526 " [--name <name>]\n"
527 " [--description <desc>] |\n"
528 " list [--details|--machinereadable]\n"
529 " showvminfo <uuid|snapname>\n"
530 "\n", SEP);
531
532 if (fCategory & USAGE_CLOSEMEDIUM)
533 RTStrmPrintf(pStrm,
534 "%s closemedium %s [disk|dvd|floppy] <uuid|filename>\n"
535 " [--delete]\n"
536 "\n", SEP);
537
538 if (fCategory & USAGE_STORAGEATTACH)
539 RTStrmPrintf(pStrm,
540 "%s storageattach %s <uuid|vmname>\n"
541 " --storagectl <name>\n"
542 " [--port <number>]\n"
543 " [--device <number>]\n"
544 " [--type dvddrive|hdd|fdd]\n"
545 " [--medium none|emptydrive|additions|\n"
546 " <uuid|filename>|host:<drive>|iscsi]\n"
547 " [--mtype normal|writethrough|immutable|shareable|\n"
548 " readonly|multiattach]\n"
549 " [--comment <text>]\n"
550 " [--setuuid <uuid>]\n"
551 " [--setparentuuid <uuid>]\n"
552 " [--passthrough on|off]\n"
553 " [--tempeject on|off]\n"
554 " [--nonrotational on|off]\n"
555 " [--discard on|off]\n"
556 " [--hotpluggable on|off]\n"
557 " [--bandwidthgroup <name>]\n"
558 " [--forceunmount]\n"
559 " [--server <name>|<ip>]\n"
560 " [--target <target>]\n"
561 " [--tport <port>]\n"
562 " [--lun <lun>]\n"
563 " [--encodedlun <lun>]\n"
564 " [--username <username>]\n"
565 " [--password <password>]\n"
566 " [--initiator <initiator>]\n"
567 " [--intnet]\n"
568 "\n", SEP);
569
570 if (fCategory & USAGE_STORAGECONTROLLER)
571 RTStrmPrintf(pStrm,
572 "%s storagectl %s <uuid|vmname>\n"
573 " --name <name>\n"
574 " [--add ide|sata|scsi|floppy|sas]\n"
575 " [--controller LSILogic|LSILogicSAS|BusLogic|\n"
576 " IntelAHCI|PIIX3|PIIX4|ICH6|I82078]\n"
577 " [--portcount <1-n>]\n"
578 " [--hostiocache on|off]\n"
579 " [--bootable on|off]\n"
580 " [--remove]\n"
581 "\n", SEP);
582
583 if (fCategory & USAGE_BANDWIDTHCONTROL)
584 RTStrmPrintf(pStrm,
585 "%s bandwidthctl %s <uuid|vmname>\n"
586 " add <name> --type disk|network\n"
587 " --limit <megabytes per second>[k|m|g|K|M|G] |\n"
588 " set <name>\n"
589 " --limit <megabytes per second>[k|m|g|K|M|G] |\n"
590 " remove <name> |\n"
591 " list [--machinereadable]\n"
592 " (limit units: k=kilobit, m=megabit, g=gigabit,\n"
593 " K=kilobyte, M=megabyte, G=gigabyte)\n"
594 "\n", SEP);
595
596 if (fCategory & USAGE_SHOWMEDIUMINFO)
597 RTStrmPrintf(pStrm,
598 "%s showmediuminfo %s [disk|dvd|floppy] <uuid|filename>\n"
599 "\n", SEP);
600
601 if (fCategory & USAGE_CREATEMEDIUM)
602 RTStrmPrintf(pStrm,
603 "%s createmedium %s [disk|dvd|floppy] --filename <filename>\n"
604 " [--size <megabytes>|--sizebyte <bytes>]\n"
605 " [--diffparent <uuid>|<filename>\n"
606 " [--format VDI|VMDK|VHD] (default: VDI)\n"
607 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
608 "\n", SEP);
609
610 if (fCategory & USAGE_MODIFYMEDIUM)
611 RTStrmPrintf(pStrm,
612 "%s modifymedium %s [disk|dvd|floppy] <uuid|filename>\n"
613 " [--type normal|writethrough|immutable|shareable|\n"
614 " readonly|multiattach]\n"
615 " [--autoreset on|off]\n"
616 " [--property <name=[value]>]\n"
617 " [--compact]\n"
618 " [--resize <megabytes>|--resizebyte <bytes>]\n"
619 "\n", SEP);
620
621 if (fCategory & USAGE_CLONEMEDIUM)
622 RTStrmPrintf(pStrm,
623 "%s clonemedium %s [disk|dvd|floppy] <uuid|inputfile> <uuid|outputfile>\n"
624 " [--format VDI|VMDK|VHD|RAW|<other>]\n"
625 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
626 " [--existing]\n"
627 "\n", SEP);
628
629 if (fCategory & USAGE_MEDIUMPROPERTY)
630 RTStrmPrintf(pStrm,
631 "%s mediumproperty %s [disk|dvd|floppy] set <uuid|filename>\n"
632 " <property> <value>\n"
633 "\n"
634 " [disk|dvd|floppy] get <uuid|filename>\n"
635 " <property>\n"
636 "\n"
637 " [disk|dvd|floppy] delete <uuid|filename>\n"
638 " <property>\n"
639 "\n", SEP);
640
641 if (fCategory & USAGE_ENCRYPTMEDIUM)
642 RTStrmPrintf(pStrm,
643 "%s encryptmedium %s <uuid|filename>\n"
644 " [--newpassword <file>|-]\n"
645 " [--oldpassword <file>|-]\n"
646 " [--cipher <cipher identifier>]\n"
647 " [--newpasswordid <password identifier>]\n"
648 "\n", SEP);
649
650 if (fCategory & USAGE_MEDIUMENCCHKPWD)
651 RTStrmPrintf(pStrm,
652 "%s checkmediumpwd %s <uuid|filename>\n"
653 " <pwd file>|-\n"
654 "\n", SEP);
655
656 if (fCategory & USAGE_CONVERTFROMRAW)
657 RTStrmPrintf(pStrm,
658 "%s convertfromraw %s <filename> <outputfile>\n"
659 " [--format VDI|VMDK|VHD]\n"
660 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
661 " [--uuid <uuid>]\n"
662 "%s convertfromraw %s stdin <outputfile> <bytes>\n"
663 " [--format VDI|VMDK|VHD]\n"
664 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
665 " [--uuid <uuid>]\n"
666 "\n", SEP, SEP);
667
668 if (fCategory & USAGE_GETEXTRADATA)
669 RTStrmPrintf(pStrm,
670 "%s getextradata %s global|<uuid|vmname>\n"
671 " <key>|enumerate\n"
672 "\n", SEP);
673
674 if (fCategory & USAGE_SETEXTRADATA)
675 RTStrmPrintf(pStrm,
676 "%s setextradata %s global|<uuid|vmname>\n"
677 " <key>\n"
678 " [<value>] (no value deletes key)\n"
679 "\n", SEP);
680
681 if (fCategory & USAGE_SETPROPERTY)
682 RTStrmPrintf(pStrm,
683 "%s setproperty %s machinefolder default|<folder> |\n"
684 " hwvirtexclusive on|off |\n"
685 " vrdeauthlibrary default|<library> |\n"
686 " websrvauthlibrary default|null|<library> |\n"
687 " vrdeextpack null|<library> |\n"
688 " autostartdbpath null|<folder> |\n"
689 " loghistorycount <value>\n"
690 " defaultfrontend default|<name>\n"
691 " logginglevel <log setting>\n"
692 "\n", SEP);
693
694 if (fCategory & USAGE_USBFILTER_ADD)
695 RTStrmPrintf(pStrm,
696 "%s usbfilter %s add <index,0-N>\n"
697 " --target <uuid|vmname>|global\n"
698 " --name <string>\n"
699 " --action ignore|hold (global filters only)\n"
700 " [--active yes|no] (yes)\n"
701 " [--vendorid <XXXX>] (null)\n"
702 " [--productid <XXXX>] (null)\n"
703 " [--revision <IIFF>] (null)\n"
704 " [--manufacturer <string>] (null)\n"
705 " [--product <string>] (null)\n"
706 " [--remote yes|no] (null, VM filters only)\n"
707 " [--serialnumber <string>] (null)\n"
708 " [--maskedinterfaces <XXXXXXXX>]\n"
709 "\n", SEP);
710
711 if (fCategory & USAGE_USBFILTER_MODIFY)
712 RTStrmPrintf(pStrm,
713 "%s usbfilter %s modify <index,0-N>\n"
714 " --target <uuid|vmname>|global\n"
715 " [--name <string>]\n"
716 " [--action ignore|hold] (global filters only)\n"
717 " [--active yes|no]\n"
718 " [--vendorid <XXXX>|\"\"]\n"
719 " [--productid <XXXX>|\"\"]\n"
720 " [--revision <IIFF>|\"\"]\n"
721 " [--manufacturer <string>|\"\"]\n"
722 " [--product <string>|\"\"]\n"
723 " [--remote yes|no] (null, VM filters only)\n"
724 " [--serialnumber <string>|\"\"]\n"
725 " [--maskedinterfaces <XXXXXXXX>]\n"
726 "\n", SEP);
727
728 if (fCategory & USAGE_USBFILTER_REMOVE)
729 RTStrmPrintf(pStrm,
730 "%s usbfilter %s remove <index,0-N>\n"
731 " --target <uuid|vmname>|global\n"
732 "\n", SEP);
733
734 if (fCategory & USAGE_SHAREDFOLDER_ADD)
735 RTStrmPrintf(pStrm,
736 "%s sharedfolder %s add <uuid|vmname>\n"
737 " --name <name> --hostpath <hostpath>\n"
738 " [--transient] [--readonly] [--automount]\n"
739 "\n", SEP);
740
741 if (fCategory & USAGE_SHAREDFOLDER_REMOVE)
742 RTStrmPrintf(pStrm,
743 "%s sharedfolder %s remove <uuid|vmname>\n"
744 " --name <name> [--transient]\n"
745 "\n", SEP);
746
747#ifdef VBOX_WITH_GUEST_PROPS
748 if (fCategory & USAGE_GUESTPROPERTY)
749 usageGuestProperty(pStrm, SEP);
750#endif /* VBOX_WITH_GUEST_PROPS defined */
751
752#ifdef VBOX_WITH_GUEST_CONTROL
753 if (fCategory & USAGE_GUESTCONTROL)
754 usageGuestControl(pStrm, SEP, fSubCategory);
755#endif /* VBOX_WITH_GUEST_CONTROL defined */
756
757 if (fCategory & USAGE_DEBUGVM)
758 {
759 RTStrmPrintf(pStrm,
760 "%s debugvm %s <uuid|vmname>\n"
761 " dumpguestcore --filename <name> |\n"
762 " info <item> [args] |\n"
763 " injectnmi |\n"
764 " log [--release|--debug] <settings> ...|\n"
765 " logdest [--release|--debug] <settings> ...|\n"
766 " logflags [--release|--debug] <settings> ...|\n"
767 " osdetect |\n"
768 " osinfo |\n"
769 " getregisters [--cpu <id>] <reg>|all ... |\n"
770 " setregisters [--cpu <id>] <reg>=<value> ... |\n"
771 " show [--human-readable|--sh-export|--sh-eval|\n"
772 " --cmd-set] \n"
773 " <logdbg-settings|logrel-settings>\n"
774 " [[opt] what ...] |\n"
775 " statistics [--reset] [--pattern <pattern>]\n"
776 " [--descriptions]\n"
777 "\n", SEP);
778 }
779 if (fCategory & USAGE_METRICS)
780 RTStrmPrintf(pStrm,
781 "%s metrics %s list [*|host|<vmname> [<metric_list>]]\n"
782 " (comma-separated)\n\n"
783 "%s metrics %s setup\n"
784 " [--period <seconds>] (default: 1)\n"
785 " [--samples <count>] (default: 1)\n"
786 " [--list]\n"
787 " [*|host|<vmname> [<metric_list>]]\n\n"
788 "%s metrics %s query [*|host|<vmname> [<metric_list>]]\n\n"
789 "%s metrics %s enable\n"
790 " [--list]\n"
791 " [*|host|<vmname> [<metric_list>]]\n\n"
792 "%s metrics %s disable\n"
793 " [--list]\n"
794 " [*|host|<vmname> [<metric_list>]]\n\n"
795 "%s metrics %s collect\n"
796 " [--period <seconds>] (default: 1)\n"
797 " [--samples <count>] (default: 1)\n"
798 " [--list]\n"
799 " [--detach]\n"
800 " [*|host|<vmname> [<metric_list>]]\n"
801 "\n", SEP, SEP, SEP, SEP, SEP, SEP);
802
803#if defined(VBOX_WITH_NAT_SERVICE)
804 if (fCategory & USAGE_NATNETWORK)
805 {
806 RTStrmPrintf(pStrm,
807 "%s natnetwork %s add --netname <name>\n"
808 " --network <network>\n"
809 " [--enable|--disable]\n"
810 " [--dhcp on|off]\n"
811 " [--port-forward-4 <rule>]\n"
812 " [--loopback-4 <rule>]\n"
813 " [--ipv6 on|off]\n"
814 " [--port-forward-6 <rule>]\n"
815 " [--loopback-6 <rule>]\n\n"
816 "%s natnetwork %s remove --netname <name>\n\n"
817 "%s natnetwork %s modify --netname <name>\n"
818 " [--network <network>]\n"
819 " [--enable|--disable]\n"
820 " [--dhcp on|off]\n"
821 " [--port-forward-4 <rule>]\n"
822 " [--loopback-4 <rule>]\n"
823 " [--ipv6 on|off]\n"
824 " [--port-forward-6 <rule>]\n"
825 " [--loopback-6 <rule>]\n\n"
826 "%s natnetwork %s start --netname <name>\n\n"
827 "%s natnetwork %s stop --netname <name>\n"
828 "\n", SEP, SEP, SEP, SEP, SEP);
829
830
831 }
832#endif
833
834#if defined(VBOX_WITH_NETFLT)
835 if (fCategory & USAGE_HOSTONLYIFS)
836 {
837 RTStrmPrintf(pStrm,
838 "%s hostonlyif %s ipconfig <name>\n"
839 " [--dhcp |\n"
840 " --ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] |\n"
841 " --ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]]\n"
842# if !defined(RT_OS_SOLARIS)
843 " create |\n"
844 " remove <name>\n"
845# endif
846 "\n", SEP);
847 }
848#endif
849
850 if (fCategory & USAGE_DHCPSERVER)
851 {
852 RTStrmPrintf(pStrm,
853 "%s dhcpserver %s add|modify --netname <network_name> |\n"
854#if defined(VBOX_WITH_NETFLT)
855 " --ifname <hostonly_if_name>\n"
856#endif
857 " [--ip <ip_address>\n"
858 " --netmask <network_mask>\n"
859 " --lowerip <lower_ip>\n"
860 " --upperip <upper_ip>]\n"
861 " [--enable | --disable]\n\n"
862 "%s dhcpserver %s remove --netname <network_name> |\n"
863#if defined(VBOX_WITH_NETFLT)
864 " --ifname <hostonly_if_name>\n"
865#endif
866 "\n", SEP, SEP);
867 }
868 if (fCategory & USAGE_EXTPACK)
869 {
870 RTStrmPrintf(pStrm,
871 "%s extpack %s install [--replace] <tarball> |\n"
872 " uninstall [--force] <name> |\n"
873 " cleanup\n"
874 "\n", SEP);
875 }
876}
877
878/**
879 * Print a usage synopsis and the syntax error message.
880 * @returns RTEXITCODE_SYNTAX.
881 */
882RTEXITCODE errorSyntax(USAGECATEGORY fCategory, const char *pszFormat, ...)
883{
884 va_list args;
885 showLogo(g_pStdErr); // show logo even if suppressed
886#ifndef VBOX_ONLY_DOCS
887 if (g_fInternalMode)
888 printUsageInternal(fCategory, g_pStdErr);
889 else
890 printUsage(fCategory, ~0U, g_pStdErr);
891#endif /* !VBOX_ONLY_DOCS */
892 va_start(args, pszFormat);
893 RTStrmPrintf(g_pStdErr, "\nSyntax error: %N\n", pszFormat, &args);
894 va_end(args);
895 return RTEXITCODE_SYNTAX;
896}
897
898/**
899 * Print a usage synopsis and the syntax error message.
900 * @returns RTEXITCODE_SYNTAX.
901 */
902RTEXITCODE errorSyntaxEx(USAGECATEGORY fCategory, uint32_t fSubCategory, const char *pszFormat, ...)
903{
904 va_list args;
905 showLogo(g_pStdErr); // show logo even if suppressed
906#ifndef VBOX_ONLY_DOCS
907 if (g_fInternalMode)
908 printUsageInternal(fCategory, g_pStdErr);
909 else
910 printUsage(fCategory, fSubCategory, g_pStdErr);
911#endif /* !VBOX_ONLY_DOCS */
912 va_start(args, pszFormat);
913 RTStrmPrintf(g_pStdErr, "\nSyntax error: %N\n", pszFormat, &args);
914 va_end(args);
915 return RTEXITCODE_SYNTAX;
916}
917
918/**
919 * errorSyntax for RTGetOpt users.
920 *
921 * @returns RTEXITCODE_SYNTAX.
922 *
923 * @param fCategory The usage category of the command.
924 * @param fSubCategory The usage sub-category of the command.
925 * @param rc The RTGetOpt return code.
926 * @param pValueUnion The value union.
927 */
928RTEXITCODE errorGetOptEx(USAGECATEGORY fCategory, uint32_t fSubCategory, int rc, union RTGETOPTUNION const *pValueUnion)
929{
930 /*
931 * Check if it is an unhandled standard option.
932 */
933 if (rc == 'V')
934 {
935 RTPrintf("%sr%d\n", VBOX_VERSION_STRING, RTBldCfgRevision());
936 return RTEXITCODE_SUCCESS;
937 }
938
939 if (rc == 'h')
940 {
941 showLogo(g_pStdErr);
942#ifndef VBOX_ONLY_DOCS
943 if (g_fInternalMode)
944 printUsageInternal(fCategory, g_pStdOut);
945 else
946 printUsage(fCategory, fSubCategory, g_pStdOut);
947#endif
948 return RTEXITCODE_SUCCESS;
949 }
950
951 /*
952 * General failure.
953 */
954 showLogo(g_pStdErr); // show logo even if suppressed
955#ifndef VBOX_ONLY_DOCS
956 if (g_fInternalMode)
957 printUsageInternal(fCategory, g_pStdErr);
958 else
959 printUsage(fCategory, fSubCategory, g_pStdErr);
960#endif /* !VBOX_ONLY_DOCS */
961
962 if (rc == VINF_GETOPT_NOT_OPTION)
963 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid parameter '%s'", pValueUnion->psz);
964 if (rc > 0)
965 {
966 if (RT_C_IS_PRINT(rc))
967 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option -%c", rc);
968 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option case %i", rc);
969 }
970 if (rc == VERR_GETOPT_UNKNOWN_OPTION)
971 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Unknown option: %s", pValueUnion->psz);
972 if (rc == VERR_GETOPT_INVALID_ARGUMENT_FORMAT)
973 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid argument format: %s", pValueUnion->psz);
974 if (pValueUnion->pDef)
975 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%s: %Rrs", pValueUnion->pDef->pszLong, rc);
976 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%Rrs", rc);
977}
978
979/**
980 * errorSyntax for RTGetOpt users.
981 *
982 * @returns RTEXITCODE_SYNTAX.
983 *
984 * @param fUsageCategory The usage category of the command.
985 * @param rc The RTGetOpt return code.
986 * @param pValueUnion The value union.
987 */
988RTEXITCODE errorGetOpt(USAGECATEGORY fCategory, int rc, union RTGETOPTUNION const *pValueUnion)
989{
990 return errorGetOptEx(fCategory, ~0U, rc, pValueUnion);
991}
992
993/**
994 * Print an error message without the syntax stuff.
995 *
996 * @returns RTEXITCODE_SYNTAX.
997 */
998RTEXITCODE errorArgument(const char *pszFormat, ...)
999{
1000 va_list args;
1001 va_start(args, pszFormat);
1002 RTMsgErrorV(pszFormat, args);
1003 va_end(args);
1004 return RTEXITCODE_SYNTAX;
1005}
Note: See TracBrowser for help on using the repository browser.

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