VirtualBox

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

Last change on this file since 23249 was 23223, checked in by vboxsync, 15 years ago

API: big medium handling change and lots of assorted other cleanups and fixes

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