VBoxManageModifyVM.cpp revision 9601ea695ea96905d6f5d484facd272732365c40
8937a951a5b33866be1a34bb88e53f030c880468Adam Moore * VBoxManage - Implementation of modifyvm command.
8937a951a5b33866be1a34bb88e53f030c880468Adam Moore * Copyright (C) 2006-2013 Oracle Corporation
8937a951a5b33866be1a34bb88e53f030c880468Adam Moore * This file is part of VirtualBox Open Source Edition (OSE), as
8937a951a5b33866be1a34bb88e53f030c880468Adam Moore * available from http://www.virtualbox.org. This file is free software;
8937a951a5b33866be1a34bb88e53f030c880468Adam Moore * you can redistribute it and/or modify it under the terms of the GNU
8937a951a5b33866be1a34bb88e53f030c880468Adam Moore * General Public License (GPL) as published by the Free Software
8937a951a5b33866be1a34bb88e53f030c880468Adam Moore * Foundation, in version 2 as it comes in the "COPYING" file of the
8937a951a5b33866be1a34bb88e53f030c880468Adam Moore * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
162f907b0bc058a5ddc4abb9d96487a7e8054234Adam Moore * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
8937a951a5b33866be1a34bb88e53f030c880468Adam Moore/*******************************************************************************
8937a951a5b33866be1a34bb88e53f030c880468Adam Moore* Header Files *
8937a951a5b33866be1a34bb88e53f030c880468Adam Moore*******************************************************************************/
8937a951a5b33866be1a34bb88e53f030c880468Adam Moore#endif /* !VBOX_ONLY_DOCS */
8937a951a5b33866be1a34bb88e53f030c880468Adam Mooreusing namespace com;
8937a951a5b33866be1a34bb88e53f030c880468Adam Moore/** @todo refine this after HDD changes; MSC 8.0/64 has trouble with handleModifyVM. */
#ifdef VBOX_WITH_VIDEOHWACCEL
#ifdef VBOX_WITH_PCI_PASSTHROUGH
#ifdef VBOX_WITH_USB_CARDREADER
#ifdef VBOX_WITH_VPX
#ifdef VBOX_WITH_VIDEOHWACCEL
{ "--natdnshostresolver", MODIFYVM_NATDNSHOSTRESOLVER, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
{ "--vrdpvideochannelquality", MODIFYVM_VRDPVIDEOCHANNELQUALITY, RTGETOPT_REQ_STRING }, /* deprecated */
#ifdef VBOX_WITH_VPX
#ifdef VBOX_WITH_PCI_PASSTHROUGH
#ifdef VBOX_WITH_USB_CARDREADER
RTStrmPrintf(g_pStdErr, "Warning: '--vrdp%s' is deprecated. Use '--vrde%s'.\n", pszOption, pszOption);
int rc;
while (pcszGroups)
if (pComma)
char *pszNext;
pszNext++;
case MODIFYVM_NAME:
case MODIFYVM_GROUPS:
case MODIFYVM_DESCRIPTION:
case MODIFYVM_OSTYPE:
case MODIFYVM_ICONFILE:
int vrc = RTFileOpen(&iconFile, ValueUnion.psz, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE);
case MODIFYVM_MEMORY:
case MODIFYVM_PAGEFUSION:
case MODIFYVM_VRAM:
case MODIFYVM_FIRMWARE:
case MODIFYVM_ACPI:
case MODIFYVM_IOAPIC:
case MODIFYVM_PAE:
case MODIFYVM_LONGMODE:
case MODIFYVM_SYNTHCPU:
case MODIFYVM_TFRESET:
case MODIFYVM_HWVIRTEX:
case MODIFYVM_SETCPUID:
case MODIFYVM_DELCPUID:
case MODIFYVM_DELALLCPUID:
case MODIFYVM_NESTEDPAGING:
case MODIFYVM_LARGEPAGES:
case MODIFYVM_VTXVPID:
case MODIFYVM_VTXUX:
CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_UnrestrictedExecution, ValueUnion.f));
case MODIFYVM_CPUS:
case MODIFYVM_RTCUSEUTC:
case MODIFYVM_CPUHOTPLUG:
case MODIFYVM_PLUGCPU:
case MODIFYVM_UNPLUGCPU:
#ifdef VBOX_WITH_VMSVGA
case MODIFYVM_MONITORCOUNT:
case MODIFYVM_ACCELERATE3D:
#ifdef VBOX_WITH_VIDEOHWACCEL
case MODIFYVM_BIOSLOGOFADEIN:
case MODIFYVM_BIOSLOGOFADEOUT:
case MODIFYVM_BIOSBOOTMENU:
case MODIFYVM_BIOSPXEDEBUG:
case MODIFYVM_BOOT:
u1 = 0;
u1 = 0;
if (hardDisk)
hardDisk));
if (hardDisk)
hardDisk);
hardDisk));
if (!dvdMedium)
if (!dvdMedium)
if (!dvdMedium)
if (floppyAttachment)
if (!floppyAttachment)
if (!floppyMedium)
if (!floppyMedium)
case MODIFYVM_NICTRACEFILE:
case MODIFYVM_NICTRACE:
case MODIFYVM_NICPROPERTY:
if (nic)
if (pszProperty)
if (pDelimiter)
RTStrmPrintf(g_pStdErr, "Error: Failed to allocate memory for --nicproperty%d '%s'\n", GetOptState.uIndex, ValueUnion.psz);
case MODIFYVM_NICTYPE:
#ifdef VBOX_WITH_E1000
#ifdef VBOX_WITH_VIRTIO
case MODIFYVM_NICSPEED:
case MODIFYVM_NICBOOTPRIO:
errorArgument("Invalid boot priority '%u' specfied for NIC %u", ValueUnion.u32, GetOptState.uIndex);
case MODIFYVM_NICPROMISC:
case MODIFYVM_NICBWGROUP:
case MODIFYVM_NIC:
case MODIFYVM_CABLECONNECTED:
case MODIFYVM_BRIDGEADAPTER:
case MODIFYVM_HOSTONLYADAPTER:
case MODIFYVM_INTNET:
case MODIFYVM_GENERICDRV:
case MODIFYVM_NATNETWORKNAME:
case MODIFYVM_NATNET:
case MODIFYVM_NATBINDIP:
if (*ch == 0) \
ch++; \
ch++; \
case MODIFYVM_NATSETTINGS:
char *strMtu;
char *strSockSnd;
char *strSockRcv;
char *strTcpSnd;
char *strTcpRcv;
CHECK_ERROR(engine, SetNetworkSettings(RTStrToUInt32(strMtu), RTStrToUInt32(strSockSnd), RTStrToUInt32(strSockRcv),
case MODIFYVM_NATPF:
char *strName;
char *strProto;
char *strHostIp;
char *strHostPort;
char *strGuestIp;
char *strGuestPort;
int vrc;
case MODIFYVM_NATALIASMODE:
aliasMode = 0;
while(token)
token++;
case MODIFYVM_NATTFTPPREFIX:
case MODIFYVM_NATTFTPFILE:
case MODIFYVM_NATTFTPSERVER:
case MODIFYVM_NATDNSPROXY:
case MODIFYVM_MACADDRESS:
case MODIFYVM_HIDPTR:
bool fEnableUsb = false;
fEnableUsb = true;
fEnableUsb = true;
fEnableUsb = true;
if (fEnableUsb)
&& !cOhciCtrls)
case MODIFYVM_HIDKBD:
bool fEnableUsb = false;
fEnableUsb = true;
if (fEnableUsb)
&& !cOhciCtrls)
case MODIFYVM_UARTMODE:
case MODIFYVM_UART:
case MODIFYVM_LPTMODE:
case MODIFYVM_LPT:
case MODIFYVM_AUDIOCONTROLLER:
case MODIFYVM_AUDIO:
#ifdef RT_OS_WINDOWS
#ifdef VBOX_WITH_WINMM
#ifdef RT_OS_LINUX
# ifdef VBOX_WITH_ALSA
# ifdef VBOX_WITH_PULSE
#ifdef RT_OS_SOLARIS
#ifdef RT_OS_FREEBSD
# ifdef VBOX_WITH_PULSE
#ifdef RT_OS_DARWIN
case MODIFYVM_CLIPBOARD:
case MODIFYVM_DRAGANDDROP:
case MODIFYVM_VRDE_EXTPACK:
if (vrdeServer)
case MODIFYVM_VRDEPROPERTY:
if (vrdeServer)
if (pszProperty)
if (pDelimiter)
RTStrmPrintf(g_pStdErr, "Error: Failed to allocate memory for VRDE property '%s'\n", ValueUnion.psz);
case MODIFYVM_VRDPPORT:
case MODIFYVM_VRDEPORT:
case MODIFYVM_VRDPADDRESS:
case MODIFYVM_VRDEADDRESS:
case MODIFYVM_VRDPAUTHTYPE:
case MODIFYVM_VRDEAUTHTYPE:
case MODIFYVM_VRDEAUTHLIBRARY:
if (vrdeServer)
case MODIFYVM_VRDPMULTICON:
case MODIFYVM_VRDEMULTICON:
case MODIFYVM_VRDPREUSECON:
case MODIFYVM_VRDEREUSECON:
case MODIFYVM_VRDP:
case MODIFYVM_VRDE:
case MODIFYVM_USBXHCI:
case MODIFYVM_USBEHCI:
case MODIFYVM_USB:
case MODIFYVM_SNAPSHOTFOLDER:
case MODIFYVM_TELEPORTER_PORT:
case MODIFYVM_TRACING_ENABLED:
case MODIFYVM_TRACING_CONFIG:
case MODIFYVM_FAULT_TOLERANCE:
case MODIFYVM_HARDWARE_UUID:
case MODIFYVM_HPET:
case MODIFYVM_IOCACHE:
case MODIFYVM_IOCACHESIZE:
case MODIFYVM_CHIPSET:
if (!fIoApic)
#ifdef VBOX_WITH_VPX
case MODIFYVM_VCP:
case MODIFYVM_VCP_SCREENS:
case MODIFYVM_VCP_FILENAME:
case MODIFYVM_VCP_WIDTH:
case MODIFYVM_VCP_HEIGHT:
case MODIFYVM_VCP_RATE:
case MODIFYVM_VCP_FPS:
case MODIFYVM_AUTOSTART_DELAY:
case MODIFYVM_AUTOSTOP_TYPE:
errorArgument("Invalid --autostop-type argument '%s' (valid: disabled, savestate, poweroff, acpishutdown)", ValueUnion.psz);
#ifdef VBOX_WITH_PCI_PASSTHROUGH
case MODIFYVM_ATTACH_PCI:
errorArgument("Invalid --pciattach argument '%s' (valid: 'HB:HD.HF@GB:GD.GF' or just 'HB:HD.HF')", ValueUnion.psz);
case MODIFYVM_DETACH_PCI:
#ifdef VBOX_WITH_USB_CARDREADER
case MODIFYVM_USBCARDREADER:
case MODIFYVM_DEFAULTFRONTEND: