VBoxManageModifyVM.cpp revision 801238b286a80a5dd67ba56a1f26c0bc98a2a1ea
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * VBoxManage - Implementation of modifyvm command.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * Copyright (C) 2006-2009 Sun Microsystems, Inc.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * available from http://www.virtualbox.org. This file is free software;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * you can redistribute it and/or modify it under the terms of the GNU
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * General Public License (GPL) as published by the Free Software
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * additional information or have any questions.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync/*******************************************************************************
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* Header Files *
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync*******************************************************************************/
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#endif /* !VBOX_ONLY_DOCS */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncusing namespace com;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync/** @todo refine this after HDD changes; MSC 8.0/64 has trouble with handleModifyVM. */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /* VM ID + at least one parameter. Parameter arguments are checked
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * individually. */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync return errorSyntax(USAGE_MODIFYVM, "Not enough parameters");
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /* Get the number of network adapters */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CHECK_ERROR_RET (a->virtualBox, COMGETTER(SystemProperties) (info.asOutParam()), 1);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CHECK_ERROR_RET (info, COMGETTER(NetworkAdapterCount) (&NetworkAdapterCount), 1);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CHECK_ERROR_RET (a->virtualBox, COMGETTER(SystemProperties) (info.asOutParam()), 1);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CHECK_ERROR_RET (info, COMGETTER(SerialPortCount) (&SerialPortCount), 1);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync std::vector <char *> nics (NetworkAdapterCount, 0);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync std::vector <char *> nictype (NetworkAdapterCount, 0);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync std::vector <char *> cableconnected (NetworkAdapterCount, 0);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync std::vector <char *> nictrace (NetworkAdapterCount, 0);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync std::vector <char *> nictracefile (NetworkAdapterCount, 0);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync std::vector <char *> nicspeed (NetworkAdapterCount, 0);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync std::vector <char *> hostifdev (NetworkAdapterCount, 0);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync std::vector <const char *> intnet (NetworkAdapterCount, 0);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync std::vector <const char *> natnet (NetworkAdapterCount, 0);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync std::vector <char *> macs (NetworkAdapterCount, 0);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync std::vector <char *> uarts_mode (SerialPortCount, 0);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync std::vector <ULONG> uarts_base (SerialPortCount, 0);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync std::vector <ULONG> uarts_irq (SerialPortCount, 0);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync std::vector <char *> uarts_path (SerialPortCount, 0);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync return errorArgument("The number of cpus cannot be 0.", a->argv[i]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
uint32_t n = 0;
#if defined(VBOX_WITH_NETFLT)
return errorArgument("Invalid IPv4 network '%s' specified -- CIDR notation expected.\n", a->argv[i + 1]);
#ifdef VBOX_WITH_VRDP
vrdpport = 0;
fUsbEnabled = 0;
fUsbEhciEnabled = 0;
#ifdef RT_OS_WINDOWS
if (a->argc <= i)
int vrc;
#ifdef VBOX_WITH_MEM_BALLOONING
int vrc;
int vrc;
fSataEnabled = 0;
sataPortCount = n;
unsigned bootDevicePos = 0;
if (!bootDevicePos)
fScsiEnabled = 0;
fScsiLsiLogic = 0;
if (name)
if (ostype)
if (memorySize > 0)
if (vramSize > 0)
if (acpi)
if (ioapic)
if (hwvirtex)
if (nestedpaging)
if (vtxvpid)
if (pae)
if (monitorcount != ~0U)
if (accelerate3d)
if (bioslogofadein)
if (bioslogofadeout)
if (bioslogodisplaytime != ~0U)
if (bioslogoimagepath)
if (biosbootmenumode)
if (biossystemtimeoffset)
if (biospxedebug)
if (hdds[0])
if (!hardDisk)
CHECK_ERROR(a->virtualBox, OpenHardDisk(Bstr(hdds[0]), AccessMode_ReadWrite, hardDisk.asOutParam()));
if (hardDisk)
if (!hardDisk)
CHECK_ERROR(a->virtualBox, OpenHardDisk(Bstr(hdds[1]), AccessMode_ReadWrite, hardDisk.asOutParam()));
if (hardDisk)
if (!hardDisk)
CHECK_ERROR(a->virtualBox, OpenHardDisk(Bstr(hdds[2]), AccessMode_ReadWrite, hardDisk.asOutParam()));
if (hardDisk)
if (dvd)
if (!hostDVDDrive)
if (!hostDVDDrive)
if (!dvdImage)
if (!dvdImage)
if (dvdpassthrough)
if (idecontroller)
if (floppy)
if (!hostFloppyDrive)
if (!floppyImage)
if (!floppyImage)
if (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_DARWIN
if (audiocontroller)
if (clipboard)
if (nics[n])
#if defined(VBOX_WITH_NETFLT)
if (nictype[n])
#ifdef VBOX_WITH_E1000
if (macs[n])
if (nicspeed[n])
if (cableconnected[n])
if (nictrace[n])
if (nictracefile[n])
if (hostifdev[n])
if (intnet[n])
if (natnet[n])
if (uarts_base[n])
if (uarts_mode[n])
#ifdef VBOX_WITH_VRDP
if (vrdp || (vrdpport != UINT16_MAX) || vrdpaddress || vrdpauthtype || vrdpmulticon || vrdpreusecon)
if (vrdpServer)
if (vrdp)
if (vrdpaddress)
if (vrdpauthtype)
if (vrdpmulticon)
if (vrdpreusecon)
if (snapshotFolder)
if (fSataEnabled)
if (hdds[i])
if (!hardDisk)
CHECK_ERROR(a->virtualBox, OpenHardDisk(Bstr(hdds[i]), AccessMode_ReadWrite, hardDisk.asOutParam()));
if (hardDisk)
if (fScsiEnabled)
if (!fScsiLsiLogic)
if (hdds[i])
if (!hardDisk)
CHECK_ERROR(a->virtualBox, OpenHardDisk(Bstr(hdds[i]), AccessMode_ReadWrite, hardDisk.asOutParam()));
if (hardDisk)