VirtualBox

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

Last change on this file since 22644 was 22145, checked in by vboxsync, 15 years ago

video hw accel: expose to vboxmanage

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 24.8 KB
Line 
1/* $Id: VBoxManageHelp.cpp 22145 2009-08-10 20:02:17Z vboxsync $ */
2/** @file
3 * VBoxManage - help and other message output.
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#include <iprt/stream.h>
23#include <iprt/getopt.h>
24
25#include "VBoxManage.h"
26
27void printUsage(USAGECATEGORY u64Cmd)
28{
29#ifdef RT_OS_LINUX
30 bool fLinux = true;
31#else
32 bool fLinux = false;
33#endif
34#ifdef RT_OS_WINDOWS
35 bool fWin = true;
36#else
37 bool fWin = false;
38#endif
39#ifdef RT_OS_SOLARIS
40 bool fSolaris = true;
41#else
42 bool fSolaris = false;
43#endif
44#ifdef RT_OS_DARWIN
45 bool fDarwin = true;
46#else
47 bool fDarwin = false;
48#endif
49#ifdef VBOX_WITH_VRDP
50 bool fVRDP = true;
51#else
52 bool fVRDP = false;
53#endif
54#ifdef VBOX_WITH_VBOXSDL
55 bool fVBoxSDL = true;
56#else
57 bool fVBoxSDL = false;
58#endif
59
60 if (u64Cmd == USAGE_DUMPOPTS)
61 {
62 fLinux = true;
63 fWin = true;
64 fSolaris = true;
65 fDarwin = true;
66 fVRDP = true;
67 fVBoxSDL = true;
68 u64Cmd = USAGE_ALL;
69 }
70
71 RTPrintf("Usage:\n"
72 "\n");
73
74 if (u64Cmd == USAGE_ALL)
75 {
76 RTPrintf("VBoxManage [-v|--version] print version number and exit\n"
77 "VBoxManage [-q|--nologo] ... suppress the logo\n"
78 "\n");
79 }
80
81 if (u64Cmd & USAGE_LIST)
82 {
83 RTPrintf("VBoxManage list [--long|-l] vms|runningvms|ostypes|hostdvds|hostfloppies|\n"
84#if defined(VBOX_WITH_NETFLT)
85 " bridgedifs|hostonlyifs|dhcpservers|hostinfo|\n"
86#else
87 " bridgedifs|hostinfo|dhcpservers|\n"
88#endif
89 " hddbackends|hdds|dvds|floppies|\n"
90 " usbhost|usbfilters|systemproperties\n"
91 "\n");
92 }
93
94 if (u64Cmd & USAGE_SHOWVMINFO)
95 {
96 RTPrintf("VBoxManage showvminfo <uuid>|<name> [--details] [--statistics]\n"
97 " [--machinereadable]\n"
98 "\n");
99 }
100
101 if (u64Cmd & USAGE_REGISTERVM)
102 {
103 RTPrintf("VBoxManage registervm <filename>\n"
104 "\n");
105 }
106
107 if (u64Cmd & USAGE_UNREGISTERVM)
108 {
109 RTPrintf("VBoxManage unregistervm <uuid>|<name> [--delete]\n"
110 "\n");
111 }
112
113 if (u64Cmd & USAGE_CREATEVM)
114 {
115 RTPrintf("VBoxManage createvm --name <name>\n"
116 " [--ostype <ostype>]\n"
117 " [--register]\n"
118 " [--basefolder <path> | --settingsfile <path>]\n"
119 " [--uuid <uuid>]\n"
120 "\n");
121 }
122
123 if (u64Cmd & USAGE_MODIFYVM)
124 {
125 RTPrintf("VBoxManage modifyvm <uuid|name>\n"
126 " [--name <name>]\n"
127 " [--ostype <ostype>]\n"
128 " [--memory <memorysize in MB>]\n"
129 " [--vram <vramsize in MB>]\n"
130 " [--acpi on|off]\n"
131 " [--ioapic on|off]\n"
132 " [--pae on|off]\n"
133 " [--hwvirtex on|off]\n"
134 " [--nestedpaging on|off]\n"
135 " [--vtxvpid on|off]\n"
136 " [--cpus <number>]\n"
137 " [--monitorcount <number>]\n"
138 " [--accelerate3d <on|off>]\n"
139#ifdef VBOX_WITH_VIDEOHWACCEL
140 " [--accelerate2dvideo <on|off>]\n"
141#endif
142 " [--bioslogofadein on|off]\n"
143 " [--bioslogofadeout on|off]\n"
144 " [--bioslogodisplaytime <msec>]\n"
145 " [--bioslogoimagepath <imagepath>]\n"
146 " [--biosbootmenu disabled|menuonly|messageandmenu]\n"
147 " [--biossystemtimeoffset <msec>]\n"
148 " [--biospxedebug on|off]\n"
149 " [--boot<1-4> none|floppy|dvd|disk|net>]\n"
150 " [--hd<a|b|d> none|<uuid>|<filename>]\n"
151 " [--idecontroller PIIX3|PIIX4]\n"
152#ifdef VBOX_WITH_AHCI
153 " [--sata on|off]\n"
154 " [--sataportcount <1-30>]\n"
155 " [--sataport<1-30> none|<uuid>|<filename>]\n"
156 " [--sataideemulation<1-4> <1-30>]\n"
157#endif
158#ifdef VBOX_WITH_SCSI
159 " [--scsi on|off]\n"
160 " [--scsiport<1-16> none|<uuid>|<filename>]\n"
161 " [--scsitype LsiLogic|BusLogic]\n"
162#endif
163 " [--dvd none|<uuid>|<filename>|host:<drive>]\n"
164 " [--dvdpassthrough on|off]\n"
165 " [--floppy disabled|empty|<uuid>|\n"
166 " <filename>|host:<drive>]\n"
167#if defined(VBOX_WITH_NETFLT)
168 " [--nic<1-N> none|null|nat|bridged|intnet|hostonly]\n"
169#else /* !RT_OS_LINUX && !RT_OS_DARWIN */
170 " [--nic<1-N> none|null|nat|bridged|intnet]\n"
171#endif /* !RT_OS_LINUX && !RT_OS_DARWIN */
172 " [--nictype<1-N> Am79C970A|Am79C973"
173#ifdef VBOX_WITH_E1000
174 "|\n 82540EM|82543GC|82545EM"
175#endif
176 "]\n"
177 " [--cableconnected<1-N> on|off]\n"
178 " [--nictrace<1-N> on|off]\n"
179 " [--nictracefile<1-N> <filename>]\n"
180 " [--nicspeed<1-N> <kbps>]\n"
181 " [--bridgeadapter<1-N> none|<devicename>]\n"
182#if defined(VBOX_WITH_NETFLT)
183 " [--hostonlyadapter<1-N> none|<devicename>]\n"
184#endif
185 " [--intnet<1-N> <network name>]\n"
186 " [--natnet<1-N> <network>|default]\n"
187 " [--macaddress<1-N> auto|<mac>]\n"
188 " [--uart<1-N> off|<I/O base> <IRQ>]\n"
189 " [--uartmode<1-N> disconnected|\n"
190 " server <pipe>|\n"
191 " client <pipe>|\n"
192 " file <file>|\n"
193 " <devicename>]\n"
194#ifdef VBOX_WITH_MEM_BALLOONING
195 " [--guestmemoryballoon <balloonsize in MB>]\n"
196#endif
197 " [--gueststatisticsinterval <seconds>]\n"
198 );
199 RTPrintf(" [--audio none|null");
200 if (fWin)
201 {
202#ifdef VBOX_WITH_WINMM
203 RTPrintf( "|winmm|dsound");
204#else
205 RTPrintf( "|dsound");
206#endif
207 }
208 if (fSolaris)
209 {
210 RTPrintf( "|solaudio"
211#ifdef VBOX_WITH_SOLARIS_OSS
212 "|oss"
213#endif
214 );
215 }
216 if (fLinux)
217 {
218 RTPrintf( "|oss"
219#ifdef VBOX_WITH_ALSA
220 "|alsa"
221#endif
222#ifdef VBOX_WITH_PULSE
223 "|pulse"
224#endif
225 );
226 }
227 if (fDarwin)
228 {
229 RTPrintf( "|coreaudio");
230 }
231 RTPrintf( "]\n");
232 RTPrintf(" [--audiocontroller ac97|sb16]\n"
233 " [--clipboard disabled|hosttoguest|guesttohost|\n"
234 " bidirectional]\n");
235 if (fVRDP)
236 {
237 RTPrintf(" [--vrdp on|off]\n"
238 " [--vrdpport default|<port>]\n"
239 " [--vrdpaddress <host>]\n"
240 " [--vrdpauthtype null|external|guest]\n"
241 " [--vrdpmulticon on|off]\n"
242 " [--vrdpreusecon on|off]\n");
243 }
244 RTPrintf(" [--usb on|off]\n"
245 " [--usbehci on|off]\n"
246 " [--snapshotfolder default|<path>]\n");
247 RTPrintf("\n");
248 }
249
250 if (u64Cmd & USAGE_IMPORTAPPLIANCE)
251 {
252 RTPrintf("VBoxManage import <ovf> [--dry-run|-n] [more options]\n"
253 " (run with -n to have options displayed for a particular OVF)\n\n");
254 }
255
256 if (u64Cmd & USAGE_EXPORTAPPLIANCE)
257 {
258 RTPrintf("VBoxManage export <machines> --output|-o <ovf>\n"
259 " [--legacy09]\n"
260 " [--vsys <number of virtual system>]\n"
261 " [--product <product name>]\n"
262 " [--producturl <product url>]\n"
263 " [--vendor <vendor name>]\n"
264 " [--vendorurl <vendor url>]\n"
265 " [--version <version info>]\n"
266 " [--eula <license text>]\n"
267 " [--eulafile <filename>]\n"
268 "\n");
269 }
270
271 if (u64Cmd & USAGE_STARTVM)
272 {
273 RTPrintf("VBoxManage startvm <uuid>|<name>\n");
274 RTPrintf(" [--type gui");
275 if (fVBoxSDL)
276 RTPrintf( "|sdl");
277 if (fVRDP)
278 RTPrintf( "|vrdp");
279 RTPrintf( "|headless]\n");
280 RTPrintf("\n");
281 }
282
283 if (u64Cmd & USAGE_CONTROLVM)
284 {
285 RTPrintf("VBoxManage controlvm <uuid>|<name>\n"
286 " pause|resume|reset|poweroff|savestate|\n"
287 " acpipowerbutton|acpisleepbutton|\n"
288 " keyboardputscancode <hex> [<hex> ...]|\n"
289 " injectnmi|\n"
290 " setlinkstate<1-N> on|off |\n"
291#ifdef VBOX_DYNAMIC_NET_ATTACH
292#if defined(VBOX_WITH_NETFLT)
293 " nic<1-N> null|nat|bridged|intnet|hostonly\n"
294 " [<devicename>] |\n"
295#else /* !RT_OS_LINUX && !RT_OS_DARWIN */
296 " nic<1-N> null|nat|bridged|intnet\n"
297 " [<devicename>] |\n"
298#endif /* !RT_OS_LINUX && !RT_OS_DARWIN */
299#endif /* VBOX_DYNAMIC_NET_ATTACH */
300 " usbattach <uuid>|<address> |\n"
301 " usbdetach <uuid>|<address> |\n"
302 " dvdattach none|<uuid>|<filename>|host:<drive> |\n"
303 " floppyattach none|<uuid>|<filename>|host:<drive> |\n");
304 if (fVRDP)
305 {
306 RTPrintf(" vrdp on|off] |\n");
307 }
308 RTPrintf(" setvideomodehint <xres> <yres> <bpp> [display]|\n"
309 " setcredentials <username> <password> <domain>\n"
310 " [--allowlocallogon <yes|no>]\n"
311 "\n");
312 }
313
314 if (u64Cmd & USAGE_DISCARDSTATE)
315 {
316 RTPrintf("VBoxManage discardstate <uuid>|<name>\n"
317 "\n");
318 }
319
320 if (u64Cmd & USAGE_ADOPTSTATE)
321 {
322 RTPrintf("VBoxManage adoptstate <uuid>|<name> <state_file>\n"
323 "\n");
324 }
325
326 if (u64Cmd & USAGE_SNAPSHOT)
327 {
328 RTPrintf("VBoxManage snapshot <uuid>|<name>\n"
329 " take <name> [--description <desc>] |\n"
330 " discard <uuid>|<name> |\n"
331 " discardcurrent --state|--all |\n"
332 " edit <uuid>|<name>|--current\n"
333 " [--name <name>]\n"
334 " [--description <desc>] |\n"
335 " showvminfo <uuid>|<name>\n"
336 "\n");
337 }
338
339 if (u64Cmd & USAGE_OPENMEDIUM)
340 {
341 RTPrintf("VBoxManage openmedium disk|dvd|floppy <filename>\n"
342 " [--type normal|immutable|writethrough] (disk only)\n"
343 "\n");
344 }
345
346 if (u64Cmd & USAGE_CLOSEMEDIUM)
347 {
348 RTPrintf("VBoxManage closemedium disk|dvd|floppy <uuid>|<filename>\n"
349 "\n");
350 }
351
352 if (u64Cmd & USAGE_SHOWHDINFO)
353 {
354 RTPrintf("VBoxManage showhdinfo <uuid>|<filename>\n"
355 "\n");
356 }
357
358 if (u64Cmd & USAGE_CREATEHD)
359 {
360 RTPrintf("VBoxManage createhd --filename <filename>\n"
361 " --size <megabytes>\n"
362 " [--format VDI|VMDK|VHD] (default: VDI)\n"
363 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
364 " [--type normal|writethrough] (default: normal)\n"
365 " [--comment <comment>]\n"
366 " [--remember]\n"
367 "\n");
368 }
369
370 if (u64Cmd & USAGE_MODIFYHD)
371 {
372 RTPrintf("VBoxManage modifyhd <uuid>|<filename>\n"
373 " [--type normal|writethrough|immutable]\n"
374 " [--autoreset on|off]\n"
375 " [--compact]\n"
376 "\n");
377 }
378
379 if (u64Cmd & USAGE_CLONEHD)
380 {
381 RTPrintf("VBoxManage clonehd <uuid>|<filename> <outputfile>\n"
382 " [--format VDI|VMDK|VHD|RAW|<other>]\n"
383 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
384 " [--type normal|writethrough|immutable]\n"
385 " [--remember] [--existing]\n"
386 "\n");
387 }
388
389 if (u64Cmd & USAGE_CONVERTFROMRAW)
390 {
391 RTPrintf("VBoxManage convertfromraw <filename> <outputfile>\n"
392 " [--format VDI|VMDK|VHD]\n"
393 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
394 "VBoxManage convertfromraw stdin <outputfile> <bytes>\n"
395 " [--format VDI|VMDK|VHD]\n"
396 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
397 "\n");
398 }
399
400 if (u64Cmd & USAGE_ADDISCSIDISK)
401 {
402 RTPrintf("VBoxManage addiscsidisk --server <name>|<ip>\n"
403 " --target <target>\n"
404 " [--port <port>]\n"
405 " [--lun <lun>]\n"
406 " [--encodedlun <lun>]\n"
407 " [--username <username>]\n"
408 " [--password <password>]\n"
409 " [--type normal|writethrough|immutable]\n"
410 " [--comment <comment>]\n"
411 " [--intnet]\n"
412 "\n");
413 }
414
415 if (u64Cmd & USAGE_GETEXTRADATA)
416 {
417 RTPrintf("VBoxManage getextradata global|<uuid>|<name>\n"
418 " <key>|enumerate\n"
419 "\n");
420 }
421
422 if (u64Cmd & USAGE_SETEXTRADATA)
423 {
424 RTPrintf("VBoxManage setextradata global|<uuid>|<name>\n"
425 " <key>\n"
426 " [<value>] (no value deletes key)\n"
427 "\n");
428 }
429
430 if (u64Cmd & USAGE_SETPROPERTY)
431 {
432 RTPrintf("VBoxManage setproperty hdfolder default|<folder> |\n"
433 " machinefolder default|<folder> |\n"
434 " vrdpauthlibrary default|<library> |\n"
435 " websrvauthlibrary default|null|<library> |\n"
436 " loghistorycount <value>\n"
437 "\n");
438 }
439
440 if (u64Cmd & USAGE_USBFILTER_ADD)
441 {
442 RTPrintf("VBoxManage usbfilter add <index,0-N>\n"
443 " --target <uuid>|<name>|global\n"
444 " --name <string>\n"
445 " --action ignore|hold (global filters only)\n"
446 " [--active yes|no] (yes)\n"
447 " [--vendorid <XXXX>] (null)\n"
448 " [--productid <XXXX>] (null)\n"
449 " [--revision <IIFF>] (null)\n"
450 " [--manufacturer <string>] (null)\n"
451 " [--product <string>] (null)\n"
452 " [--remote yes|no] (null, VM filters only)\n"
453 " [--serialnumber <string>] (null)\n"
454 " [--maskedinterfaces <XXXXXXXX>]\n"
455 "\n");
456 }
457
458 if (u64Cmd & USAGE_USBFILTER_MODIFY)
459 {
460 RTPrintf("VBoxManage usbfilter modify <index,0-N>\n"
461 " --target <uuid>|<name>|global\n"
462 " [--name <string>]\n"
463 " [--action ignore|hold] (global filters only)\n"
464 " [--active yes|no]\n"
465 " [--vendorid <XXXX>|\"\"]\n"
466 " [--productid <XXXX>|\"\"]\n"
467 " [--revision <IIFF>|\"\"]\n"
468 " [--manufacturer <string>|\"\"]\n"
469 " [--product <string>|\"\"]\n"
470 " [--remote yes|no] (null, VM filters only)\n"
471 " [--serialnumber <string>|\"\"]\n"
472 " [--maskedinterfaces <XXXXXXXX>]\n"
473 "\n");
474 }
475
476 if (u64Cmd & USAGE_USBFILTER_REMOVE)
477 {
478 RTPrintf("VBoxManage usbfilter remove <index,0-N>\n"
479 " --target <uuid>|<name>|global\n"
480 "\n");
481 }
482
483 if (u64Cmd & USAGE_SHAREDFOLDER_ADD)
484 {
485 RTPrintf("VBoxManage sharedfolder add <vmname>|<uuid>\n"
486 " --name <name> --hostpath <hostpath>\n"
487 " [--transient] [--readonly]\n"
488 "\n");
489 }
490
491 if (u64Cmd & USAGE_SHAREDFOLDER_REMOVE)
492 {
493 RTPrintf("VBoxManage sharedfolder remove <vmname>|<uuid>\n"
494 " --name <name> [--transient]\n"
495 "\n");
496 }
497
498 if (u64Cmd & USAGE_VM_STATISTICS)
499 {
500 RTPrintf("VBoxManage vmstatistics <vmname>|<uuid> [--reset]\n"
501 " [--pattern <pattern>] [--descriptions]\n"
502 "\n");
503 }
504
505#ifdef VBOX_WITH_GUEST_PROPS
506 if (u64Cmd & USAGE_GUESTPROPERTY)
507 usageGuestProperty();
508#endif /* VBOX_WITH_GUEST_PROPS defined */
509
510 if (u64Cmd & USAGE_METRICS)
511 {
512 RTPrintf("VBoxManage metrics list [*|host|<vmname> [<metric_list>]]\n"
513 " (comma-separated)\n\n"
514 "VBoxManage metrics setup\n"
515 " [--period <seconds>]\n"
516 " [--samples <count>]\n"
517 " [--list]\n"
518 " [*|host|<vmname> [<metric_list>]]\n\n"
519 "VBoxManage metrics query [*|host|<vmname> [<metric_list>]]\n\n"
520 "VBoxManage metrics collect\n"
521 " [--period <seconds>]\n"
522 " [--samples <count>]\n"
523 " [--list]\n"
524 " [--detach]\n"
525 " [*|host|<vmname> [<metric_list>]]\n"
526 "\n");
527 }
528#if defined(VBOX_WITH_NETFLT)
529 if (u64Cmd & USAGE_HOSTONLYIFS)
530 {
531 RTPrintf("VBoxManage hostonlyif ipconfig <name>\n"
532 " [--dhcp |\n"
533 " --ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] |\n"
534 " --ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]]\n"
535# if defined(RT_OS_WINDOWS)
536 " create |\n"
537 " remove <name>\n"
538# endif
539 "\n");
540 }
541#endif
542
543 if (u64Cmd & USAGE_DHCPSERVER)
544 {
545 RTPrintf("VBoxManage dhcpserver add|modify --netname <network_name> |\n"
546#if defined(VBOX_WITH_NETFLT)
547 " --ifname <hostonly_if_name>\n"
548#endif
549 " [--ip <ip_address>\n"
550 " --netmask <network_mask>\n"
551 " --lowerip <lower_ip>\n"
552 " --upperip <upper_ip>]\n"
553 " [--enable | --disable]\n"
554 "VBoxManage dhcpserver remove --netname <network_name> |\n"
555#if defined(VBOX_WITH_NETFLT)
556 " --ifname <hostonly_if_name>\n"
557#endif
558 "\n");
559 }
560}
561
562/**
563 * Print a usage synopsis and the syntax error message.
564 */
565int errorSyntax(USAGECATEGORY u64Cmd, const char *pszFormat, ...)
566{
567 va_list args;
568 showLogo(); // show logo even if suppressed
569#ifndef VBOX_ONLY_DOCS
570 if (g_fInternalMode)
571 printUsageInternal(u64Cmd);
572 else
573 printUsage(u64Cmd);
574#endif /* !VBOX_ONLY_DOCS */
575 va_start(args, pszFormat);
576 RTPrintf("\n"
577 "Syntax error: %N\n", pszFormat, &args);
578 va_end(args);
579 return 1;
580}
581
582/**
583 * Print an error message without the syntax stuff.
584 */
585int errorArgument(const char *pszFormat, ...)
586{
587 va_list args;
588 va_start(args, pszFormat);
589 RTPrintf("error: %N\n", pszFormat, &args);
590 va_end(args);
591 return 1;
592}
593
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