[vbox-dev] [PATCH] add VDE support to VBoxManage

James Lucas jimmy at secsme.org.au
Tue May 4 23:39:00 GMT 2010


Is it possible to have this patch applied + enabled for 3.2.0 Beta2? 
Even if it is marked as EXPERIMENTAL? The ability to attach VMs to VDE 
switches is incredibly handy for our network teaching environments and 
test labs, however we run all our VMs on headless servers and need the 
RDP server for remote console, therefore need the functionality in the 
closed source version.

- James

On 5/05/10 9:20 AM, Renzo Davoli wrote:
> On Mon, May 03, 2010 at 12:15:48PM +0200, Michael Thayer wrote:
>    
>> Thanks.  Could you please add an MIT statement though, since you didn't
>> send a contributor's agreement?
>>      
> The patch here enclosed has been released under the MIT license as follows:
> ------
> Copyright (c) 2010 Renzo Davoli, VirtualSquare Labs, University of Bologna
> <renzo at cs.unibo.it>
>
> Permission is hereby granted, free of charge, to any person
> obtaining a copy of this software and associated documentation
> files (the "Software"), to deal in the Software without
> restriction, including without limitation the rights to use,
> copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the
> Software is furnished to do so, subject to the following
> conditions:
>
> The above copyright notice and this permission notice shall be
> included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> OTHER DEALINGS IN THE SOFTWARE.
> ------
>
>    
>> It would also be great if you could not use tabs for spacing in any
>> future patches, as they upset our indentation.
>>      
> The patch has been updated, tabs has been converted into spaces.
> 	
> 	renzo davoli
>
> Signed-off-by: renzo davoli<renzo at cs.unibo.it>
> -----
> Index: src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
> ===================================================================
> --- src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp	(revision 28943)
> +++ src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp	(working copy)
> @@ -184,11 +184,14 @@
>                    "                            [--biossystemtimeoffset<msec>]\n"
>                    "                            [--biospxedebug on|off]\n"
>                    "                            [--boot<1-4>  none|floppy|dvd|disk|net>]\n"
> -#if defined(VBOX_WITH_NETFLT)
> -                 "                            [--nic<1-N>  none|null|nat|bridged|intnet|hostonly]\n"
> -#else /* !RT_OS_LINUX&&  !RT_OS_DARWIN */
> -                 "                            [--nic<1-N>  none|null|nat|bridged|intnet]\n"
> -#endif /* !RT_OS_LINUX&&  !RT_OS_DARWIN  */
> +                 "                            [--nic<1-N>  none|null|nat|bridged|intnet"
> +#if defined(VBOX_WITH_NETFLT) /* RT_OS_LINUX || RT_OS_DARWIN */
> +                 "|hostonly"
> +#endif
> +#ifdef VBOX_WITH_VDE
> +                 "|vde"
> +#endif
> +                 "]\n"
>                    "                            [--nictype<1-N>  Am79C970A|Am79C973"
>   #ifdef VBOX_WITH_E1000
>                 "|\n                                            82540EM|82543GC|82545EM"
> @@ -208,6 +211,9 @@
>   #endif
>                    "                            [--intnet<1-N>  <network name>]\n"
>                    "                            [--natnet<1-N>  <network>|default]\n"
> +#ifdef VBOX_WITH_VDE
> +                 "                            [--vdenet<1-N>  <network>|default]\n"
> +#endif
>                    "                            [--natsettings<1-N>  \"[<mtu>],[<socksnd>],[<sockrcv>],\n"
>                    "                                                         [<tcpsnd>],[<tcprcv>]\"]\n"
>                    "                            [--natpf<1-N>  \"[<rulename>],tcp|udp,\n"
> Index: src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp
> ===================================================================
> --- src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp	(revision 28943)
> +++ src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp	(working copy)
> @@ -111,6 +111,9 @@
>       MODIFYVM_HOSTONLYADAPTER,
>       MODIFYVM_INTNET,
>       MODIFYVM_NATNET,
> +#ifdef VBOX_WITH_VDE
> +    MODIFYVM_VDENET,
> +#endif
>       MODIFYVM_NATBINDIP,
>       MODIFYVM_NATSETTINGS,
>       MODIFYVM_NATPF,
> @@ -219,6 +222,9 @@
>       { "--hostonlyadapter",          MODIFYVM_HOSTONLYADAPTER,           RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
>       { "--intnet",                   MODIFYVM_INTNET,                    RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
>       { "--natnet",                   MODIFYVM_NATNET,                    RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
> +#ifdef VBOX_WITH_VDE
> +    { "--vdenet",                   MODIFYVM_VDENET,                    RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
> +#endif
>       { "--natbindip",                MODIFYVM_NATBINDIP,                 RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
>       { "--natsettings",              MODIFYVM_NATSETTINGS,               RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
>       { "--natpf",                    MODIFYVM_NATPF,                     RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
> @@ -1190,6 +1196,14 @@
>                       CHECK_ERROR(nic, AttachToHostOnlyInterface());
>                   }
>   #endif
> +#ifdef VBOX_WITH_VDE
> +                else if (!strcmp(ValueUnion.psz, "vde"))
> +                {
> +
> +                  CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
> +                  CHECK_ERROR(nic, AttachToVDE());
> +                }
> +#endif
>                   else
>                   {
>                       errorArgument("Invalid type '%s' specfied for NIC %u", ValueUnion.psz, GetOptState.uIndex);
> @@ -1248,6 +1262,25 @@
>                   break;
>               }
>
> +#ifdef VBOX_WITH_VDE
> +            case MODIFYVM_VDENET:
> +            {
> +              ComPtr<INetworkAdapter>  nic;
> +
> +              CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
> +              ASSERT(nic);
> +
> +              if (!strcmp(ValueUnion.psz, "default"))
> +              {
> +                CHECK_ERROR(nic, COMSETTER(VDENetwork)(NULL));
> +              }
> +              else
> +              {
> +                CHECK_ERROR(nic, COMSETTER(VDENetwork)(Bstr(ValueUnion.psz)));
> +              }
> +              break;
> +            }
> +#endif
>               case MODIFYVM_NATNET:
>               {
>                   ComPtr<INetworkAdapter>  nic;
> Index: src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
> ===================================================================
> --- src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp	(revision 28943)
> +++ src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp	(working copy)
> @@ -892,6 +892,21 @@
>                           break;
>                       }
>   #endif
> +#ifdef VBOX_WITH_VDE
> +                    case NetworkAttachmentType_VDE:
> +                    {
> +                      Bstr strVDEAdp;
> +                      nic->COMGETTER(VDENetwork)(strVDEAdp.asOutParam());
> +                      if (details == VMINFO_MACHINEREADABLE)
> +                      {
> +                        RTPrintf("vdenet%d=\"%lS\"\n", currentNIC + 1, strVDEAdp.raw());
> +                        strAttachment = "VDE";
> +                      }
> +                      else
> +                        strAttachment = Utf8StrFmt("VDE Network '%lS'", strVDEAdp.raw());
> +                      break;
> +                    }
> +#endif
>                       default:
>                           strAttachment = "unknown";
>                           break;
> Index: src/VBox/Frontends/VBoxManage/Makefile.kmk
> ===================================================================
> --- src/VBox/Frontends/VBoxManage/Makefile.kmk	(revision 28943)
> +++ src/VBox/Frontends/VBoxManage/Makefile.kmk	(working copy)
> @@ -41,7 +41,8 @@
>    	$(if $(VBOX_WITH_SCSI), VBOX_WITH_SCSI) \
>    	$(if $(VBOX_WITH_GUEST_PROPS),VBOX_WITH_GUEST_PROPS) \
>   	$(if $(VBOX_WITH_GUEST_CONTROL),VBOX_WITH_GUEST_CONTROL) \
> - 	$(if $(VBOX_WITH_HOSTNETIF_API), VBOX_WITH_HOSTNETIF_API)
> + 	$(if $(VBOX_WITH_HOSTNETIF_API), VBOX_WITH_HOSTNETIF_API) \
> + 	$(if $(VBOX_WITH_VDE), VBOX_WITH_VDE)
>    VBoxManage_DEFS.win   = _WIN32_WINNT=0x0500
>    ifdef VBOX_DYNAMIC_NET_ATTACH
>     VBoxManage_DEFS += VBOX_DYNAMIC_NET_ATTACH
>    




More information about the vbox-dev mailing list