summaryrefslogtreecommitdiff
path: root/src/VBox/Frontends/VBoxManage/VBoxManageStorageController.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2014-03-26 19:21:20 +0000
committer <>2014-05-08 15:03:54 +0000
commitfb123f93f9f5ce42c8e5785d2f8e0edaf951740e (patch)
treec2103d76aec5f1f10892cd1d3a38e24f665ae5db /src/VBox/Frontends/VBoxManage/VBoxManageStorageController.cpp
parent58ed4748338f9466599adfc8a9171280ed99e23f (diff)
downloadVirtualBox-master.tar.gz
Imported from /home/lorry/working-area/delta_VirtualBox/VirtualBox-4.3.10.tar.bz2.HEADVirtualBox-4.3.10master
Diffstat (limited to 'src/VBox/Frontends/VBoxManage/VBoxManageStorageController.cpp')
-rw-r--r--src/VBox/Frontends/VBoxManage/VBoxManageStorageController.cpp46
1 files changed, 32 insertions, 14 deletions
diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageStorageController.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageStorageController.cpp
index 8bafaae6..2de0befe 100644
--- a/src/VBox/Frontends/VBoxManage/VBoxManageStorageController.cpp
+++ b/src/VBox/Frontends/VBoxManage/VBoxManageStorageController.cpp
@@ -101,6 +101,8 @@ int handleStorageAttach(HandlerArg *a)
Bstr bstrUsername;
Bstr bstrPassword;
Bstr bstrInitiator;
+ Bstr bstrIso;
+ Utf8Str strIso;
bool fIntNet = false;
RTGETOPTUNION ValueUnion;
@@ -138,7 +140,7 @@ int handleStorageAttach(HandlerArg *a)
break;
}
- case 'm': // medium <none|emptydrive|uuid|filename|host:<drive>|iSCSI>
+ case 'm': // medium <none|emptydrive|additions|uuid|filename|host:<drive>|iSCSI>
{
if (ValueUnion.psz)
pszMedium = ValueUnion.psz;
@@ -192,7 +194,7 @@ int handleStorageAttach(HandlerArg *a)
break;
}
- case 'u': // nonrotational <on|off>
+ case 'u': // discard <on|off>
{
if (ValueUnion.psz)
pszDiscard = ValueUnion.psz;
@@ -482,9 +484,25 @@ int handleStorageAttach(HandlerArg *a)
if (pszMedium)
{
+ if (!RTStrICmp(pszMedium, "additions"))
+ {
+ ComPtr<ISystemProperties> pProperties;
+ CHECK_ERROR(a->virtualBox,
+ COMGETTER(SystemProperties)(pProperties.asOutParam()));
+ CHECK_ERROR(pProperties, COMGETTER(DefaultAdditionsISO)(bstrIso.asOutParam()));
+ strIso = Utf8Str(bstrIso);
+ if (strIso.isEmpty())
+ throw Utf8Str("Cannot find the Guest Additions ISO image\n");
+ pszMedium = strIso.c_str();
+ if (devTypeRequested == DeviceType_Null)
+ devTypeRequested = DeviceType_DVD;
+ }
ComPtr<IMedium> pExistingMedium;
- rc = findMedium(a, pszMedium, deviceType, true /* fSilent */,
- pExistingMedium);
+ rc = openMedium(a, pszMedium, deviceType,
+ AccessMode_ReadWrite,
+ pExistingMedium,
+ false /* fForceNewUuidOnOpen */,
+ true /* fSilent */);
if (SUCCEEDED(rc) && pExistingMedium)
{
if ( (deviceType == DeviceType_DVD)
@@ -601,7 +619,7 @@ int handleStorageAttach(HandlerArg *a)
Bstr("InitiatorSecret").detachTo(names.appendedRaw());
bstrPassword.detachTo(values.appendedRaw());
}
- if (!bstrPassword.isEmpty())
+ if (!bstrInitiator.isEmpty())
{
Bstr("InitiatorName").detachTo(names.appendedRaw());
bstrInitiator.detachTo(values.appendedRaw());
@@ -637,9 +655,9 @@ int handleStorageAttach(HandlerArg *a)
else
{
Bstr bstrMedium(pszMedium);
- rc = findOrOpenMedium(a, pszMedium, devTypeRequested,
- AccessMode_ReadWrite, pMedium2Mount,
- fSetNewUuid, NULL);
+ rc = openMedium(a, pszMedium, devTypeRequested,
+ AccessMode_ReadWrite, pMedium2Mount,
+ fSetNewUuid, false /* fSilent */);
if (FAILED(rc) || !pMedium2Mount)
throw Utf8StrFmt("Invalid UUID or filename \"%s\"", pszMedium);
}
@@ -888,7 +906,7 @@ static const RTGETOPTDEF g_aStorageControllerOptions[] =
{ "--name", 'n', RTGETOPT_REQ_STRING },
{ "--add", 'a', RTGETOPT_REQ_STRING },
{ "--controller", 'c', RTGETOPT_REQ_STRING },
- { "--sataportcount", 'p', RTGETOPT_REQ_UINT32 },
+ { "--portcount", 'p', RTGETOPT_REQ_UINT32 },
{ "--remove", 'r', RTGETOPT_REQ_NOTHING },
{ "--hostiocache", 'i', RTGETOPT_REQ_STRING },
{ "--bootable", 'b', RTGETOPT_REQ_STRING },
@@ -905,7 +923,7 @@ int handleStorageController(HandlerArg *a)
const char *pszBootable = NULL;
ULONG satabootdev = ~0U;
ULONG sataidedev = ~0U;
- ULONG sataportcount = ~0U;
+ ULONG portcount = ~0U;
bool fRemoveCtl = false;
ComPtr<IMachine> machine;
RTGETOPTUNION ValueUnion;
@@ -949,9 +967,9 @@ int handleStorageController(HandlerArg *a)
break;
}
- case 'p': // sataportcount
+ case 'p': // portcount
{
- sataportcount = ValueUnion.u32;
+ portcount = ValueUnion.u32;
break;
}
@@ -1105,7 +1123,7 @@ int handleStorageController(HandlerArg *a)
}
}
- if ( (sataportcount != ~0U)
+ if ( (portcount != ~0U)
&& SUCCEEDED(rc))
{
ComPtr<IStorageController> ctl;
@@ -1115,7 +1133,7 @@ int handleStorageController(HandlerArg *a)
if (SUCCEEDED(rc))
{
- CHECK_ERROR(ctl, COMSETTER(PortCount)(sataportcount));
+ CHECK_ERROR(ctl, COMSETTER(PortCount)(portcount));
}
else
{