VBoxManageModifyVM.cpp revision 45e0b20bd50b7124efbbe1cdb1c65d67eb41498a
/* $Id$ */
/** @file
* VBoxManage - Implementation of modifyvm command.
*/
/*
* Copyright (C) 2006-2009 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#ifndef VBOX_ONLY_DOCS
#include <vector>
#include <list>
#endif /* !VBOX_ONLY_DOCS */
#include "VBoxManage.h"
#ifndef VBOX_ONLY_DOCS
using namespace com;
/** @todo refine this after HDD changes; MSC 8.0/64 has trouble with handleModifyVM. */
#if defined(_MSC_VER)
#endif
enum
{
MODIFYVM_NAME = 1000,
#ifdef VBOX_WITH_VIDEOHWACCEL
#endif
MODIFYVM_HDA, // deprecated
MODIFYVM_HDB, // deprecated
MODIFYVM_HDD, // deprecated
MODIFYVM_IDECONTROLLER, // deprecated
MODIFYVM_SATAIDEEMULATION, // deprecated
MODIFYVM_SATAPORTCOUNT, // deprecated
MODIFYVM_SATAPORT, // deprecated
MODIFYVM_SATA, // deprecated
MODIFYVM_SCSIPORT, // deprecated
MODIFYVM_SCSITYPE, // deprecated
MODIFYVM_SCSI, // deprecated
MODIFYVM_DVDPASSTHROUGH, // deprecated
MODIFYVM_DVD, // deprecated
MODIFYVM_FLOPPY, // deprecated
#ifdef VBOX_WITH_VRDP
#endif
};
static const RTGETOPTDEF g_aModifyVMOptions[] =
{
#ifdef VBOX_WITH_VIDEOHWACCEL
#endif
#ifdef VBOX_WITH_VRDP
#endif
};
int handleModifyVM(HandlerArg *a)
{
int c;
/* VM ID + at least one parameter. Parameter arguments are checked
* individually. */
if (a->argc < 2)
/* Get the number of network adapters */
ULONG NetworkAdapterCount = 0;
{
}
ULONG SerialPortCount = 0;
{
}
/* try to find the given machine */
{
}
else
{
}
/* open a session for the VM */
/* get the mutable session machine */
{
switch (c)
{
case MODIFYVM_NAME:
{
break;
}
case MODIFYVM_OSTYPE:
{
{
}
else
{
}
break;
}
case MODIFYVM_MEMORY:
{
break;
}
case MODIFYVM_VRAM:
{
break;
}
case MODIFYVM_FIRMWARE:
{
{
}
{
}
{
}
{
}
{
}
else
{
}
break;
}
case MODIFYVM_ACPI:
{
break;
}
case MODIFYVM_IOAPIC:
{
break;
}
case MODIFYVM_PAE:
{
break;
}
case MODIFYVM_SYNTHCPU:
{
break;
}
case MODIFYVM_HWVIRTEX:
{
break;
}
{
break;
}
case MODIFYVM_SETCPUID:
{
for (unsigned i = 0 ; i < 4 ; i++)
{
if (RT_FAILURE(vrc))
return errorSyntax(USAGE_MODIFYVM,
"Missing or Invalid argument to '%s'",
}
break;
}
case MODIFYVM_DELCPUID:
{
break;
}
case MODIFYVM_DELALLCPUID:
{
break;
}
case MODIFYVM_NESTEDPAGING:
{
break;
}
case MODIFYVM_VTXVPID:
{
break;
}
case MODIFYVM_CPUS:
{
break;
}
case MODIFYVM_RTCUSEUTC:
{
break;
}
case MODIFYVM_CPUHOTPLUG:
{
break;
}
case MODIFYVM_PLUGCPU:
{
break;
}
case MODIFYVM_UNPLUGCPU:
{
break;
}
case MODIFYVM_MONITORCOUNT:
{
break;
}
case MODIFYVM_ACCELERATE3D:
{
break;
}
#ifdef VBOX_WITH_VIDEOHWACCEL
{
break;
}
#endif
case MODIFYVM_BIOSLOGOFADEIN:
{
break;
}
case MODIFYVM_BIOSLOGOFADEOUT:
{
break;
}
{
break;
}
{
break;
}
case MODIFYVM_BIOSBOOTMENU:
{
{
}
{
}
{
}
else
{
}
break;
}
{
break;
}
case MODIFYVM_BIOSPXEDEBUG:
{
break;
}
case MODIFYVM_BOOT:
{
{
}
{
}
{
}
{
}
{
}
else
break;
}
case MODIFYVM_HDA: // deprecated
{
{
}
else
{
/* first guess is that it's a UUID */
/* not successful? Then it must be a filename */
if (!hardDisk)
{
{
/* open the new hard disk object */
}
}
if (hardDisk)
{
}
else
}
break;
}
case MODIFYVM_HDB: // deprecated
{
{
}
else
{
/* first guess is that it's a UUID */
/* not successful? Then it must be a filename */
if (!hardDisk)
{
{
/* open the new hard disk object */
}
}
if (hardDisk)
{
}
else
}
break;
}
case MODIFYVM_HDD: // deprecated
{
{
}
else
{
/* first guess is that it's a UUID */
/* not successful? Then it must be a filename */
if (!hardDisk)
{
{
/* open the new hard disk object */
}
}
if (hardDisk)
{
}
else
}
break;
}
case MODIFYVM_IDECONTROLLER: // deprecated
{
{
}
{
}
{
}
else
{
}
break;
}
case MODIFYVM_SATAIDEEMULATION: // deprecated
{
break;
}
case MODIFYVM_SATAPORTCOUNT: // deprecated
{
break;
}
case MODIFYVM_SATAPORT: // deprecated
{
{
}
else
{
/* first guess is that it's a UUID */
/* not successful? Then it must be a filename */
if (!hardDisk)
{
{
/* open the new hard disk object */
false, Bstr(""), false,
}
}
if (hardDisk)
{
0, DeviceType_HardDisk, uuid));
}
else
}
break;
}
case MODIFYVM_SATA: // deprecated
{
{
}
else
break;
}
case MODIFYVM_SCSIPORT: // deprecated
{
{
}
else
{
/* first guess is that it's a UUID */
/* not successful? Then it must be a filename */
if (!hardDisk)
{
{
/* open the new hard disk object */
}
}
if (hardDisk)
{
GetOptState.uIndex, 0,
}
else
}
break;
}
case MODIFYVM_SCSITYPE: // deprecated
{
{
ctl.asOutParam()));
}
{
ctl.asOutParam()));
}
else
break;
}
case MODIFYVM_SCSI: // deprecated
{
{
}
{
}
break;
}
case MODIFYVM_DVDPASSTHROUGH: // deprecated
{
CHECK_ERROR(machine, PassthroughDevice(Bstr("IDE Controller"), 1, 0, !strcmp(ValueUnion.psz, "on")));
break;
}
case MODIFYVM_DVD: // deprecated
{
/* unmount? */
{
/* nothing to do, NULL object will cause unmount */
}
/* host drive? */
{
if (!dvdMedium)
{
/* 2nd try: try with the real name, important on Linux+libhal */
char szPathReal[RTPATH_MAX];
{
break;
}
if (!dvdMedium)
{
break;
}
}
}
else
{
/* first assume it's a UUID */
{
/* must be a filename, check if it's in the collection */
/* not registered, do that on the fly */
if (!dvdMedium)
{
}
}
if (!dvdMedium)
{
break;
}
}
/** @todo generalize this, allow arbitrary number of DVD drives
* and as a consequence multiple attachments and different
* storage controllers. */
if (dvdMedium)
break;
}
case MODIFYVM_FLOPPY: // deprecated
{
/* disable? */
{
/* disable the controller */
if (floppyAttachment)
}
else
{
/* enable the controller */
if (!floppyAttachment)
/* unmount? */
{
/* nothing to do, NULL object will cause unmount */
}
/* host drive? */
{
if (!floppyMedium)
{
break;
}
}
else
{
/* first assume it's a UUID */
{
/* must be a filename, check if it's in the collection */
/* not registered, do that on the fly */
if (!floppyMedium)
{
floppyMedium.asOutParam()));
}
}
if (!floppyMedium)
{
break;
}
}
}
break;
}
case MODIFYVM_NICTRACEFILE:
{
break;
}
case MODIFYVM_NICTRACE:
{
break;
}
case MODIFYVM_NICTYPE:
{
{
}
{
}
#ifdef VBOX_WITH_E1000
{
}
{
}
{
}
#endif
#ifdef VBOX_WITH_VIRTIO
{
}
#endif /* VBOX_WITH_VIRTIO */
else
{
}
break;
}
case MODIFYVM_NICSPEED:
{
break;
}
case MODIFYVM_NIC:
{
{
}
{
}
{
}
{
}
{
}
#if defined(VBOX_WITH_NETFLT)
{
}
#endif
else
{
}
break;
}
case MODIFYVM_CABLECONNECTED:
{
break;
}
case MODIFYVM_BRIDGEADAPTER:
case MODIFYVM_HOSTONLYADAPTER:
{
/* remove it? */
{
}
else
{
}
break;
}
case MODIFYVM_INTNET:
{
/* remove it? */
{
}
else
{
}
break;
}
case MODIFYVM_NATNET:
{
break;
}
case MODIFYVM_MACADDRESS:
{
/* generate one? */
{
}
else
{
}
break;
}
case MODIFYVM_HIDPTR:
{
bool fEnableUsb = false;
{
}
{
fEnableUsb = true;
}
{
fEnableUsb = true;
}
else
{
}
if (fEnableUsb)
{
/* Make sure the OHCI controller is enabled. */
{
fEnabled = false;
if (!fEnabled)
}
}
break;
}
case MODIFYVM_HIDKBD:
{
bool fEnableUsb = false;
{
}
{
fEnableUsb = true;
}
else
{
}
if (fEnableUsb)
{
/* Make sure the OHCI controller is enabled. */
{
fEnabled = false;
if (!fEnabled)
}
}
break;
}
case MODIFYVM_UARTMODE:
{
{
}
{
if (RT_FAILURE(vrc))
return errorSyntax(USAGE_MODIFYVM,
"Missing or Invalid argument to '%s'",
{
}
{
}
{
}
}
else
{
}
break;
}
case MODIFYVM_UART:
{
else
{
if (RT_FAILURE(vrc))
return errorSyntax(USAGE_MODIFYVM,
"Missing or Invalid argument to '%s'",
}
break;
}
{
break;
}
{
break;
}
case MODIFYVM_AUDIOCONTROLLER:
{
else
{
}
break;
}
case MODIFYVM_AUDIO:
{
/* disable? */
{
}
{
}
#ifdef RT_OS_WINDOWS
#ifdef VBOX_WITH_WINMM
{
}
#endif
{
}
#endif /* RT_OS_WINDOWS */
#ifdef RT_OS_LINUX
# ifdef VBOX_WITH_ALSA
{
}
# endif
# ifdef VBOX_WITH_PULSE
{
}
# endif
#endif /* !RT_OS_LINUX */
#ifdef RT_OS_SOLARIS
{
}
#endif /* !RT_OS_SOLARIS */
#ifdef RT_OS_FREEBSD
{
}
# ifdef VBOX_WITH_PULSE
{
}
# endif
#endif /* !RT_OS_FREEBSD */
#ifdef RT_OS_DARWIN
{
}
#endif /* !RT_OS_DARWIN */
{
}
# endif
else
{
}
break;
}
case MODIFYVM_CLIPBOARD:
{
{
}
{
}
{
}
{
}
else
{
}
break;
}
#ifdef VBOX_WITH_VRDP
case MODIFYVM_VRDPPORT:
{
else
break;
}
case MODIFYVM_VRDPADDRESS:
{
break;
}
case MODIFYVM_VRDPAUTHTYPE:
{
{
}
{
}
{
}
else
{
}
break;
}
case MODIFYVM_VRDPMULTICON:
{
break;
}
case MODIFYVM_VRDPREUSECON:
{
break;
}
case MODIFYVM_VRDP:
{
break;
}
#endif /* VBOX_WITH_VRDP */
case MODIFYVM_USBEHCI:
{
break;
}
case MODIFYVM_USB:
{
break;
}
case MODIFYVM_SNAPSHOTFOLDER:
{
else
break;
}
{
break;
}
case MODIFYVM_TELEPORTER_PORT:
{
break;
}
{
break;
}
{
break;
}
case MODIFYVM_HARDWARE_UUID:
{
break;
}
case MODIFYVM_HPET:
{
break;
}
default:
{
break;
}
}
}
/* commit changes */
/* it's important to always close sessions */
}
#endif /* !VBOX_ONLY_DOCS */