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