diff --git a/core/src/com/cloud/agent/api/PlugNicCommand.java b/core/src/com/cloud/agent/api/PlugNicCommand.java index e68931d5e36..322b755b86a 100644 --- a/core/src/com/cloud/agent/api/PlugNicCommand.java +++ b/core/src/com/cloud/agent/api/PlugNicCommand.java @@ -22,11 +22,14 @@ package com.cloud.agent.api; import com.cloud.agent.api.to.NicTO; import com.cloud.vm.VirtualMachine; +import java.util.Map; + public class PlugNicCommand extends Command { NicTO nic; String instanceName; VirtualMachine.Type vmType; + Map details; public NicTO getNic() { return nic; @@ -46,6 +49,13 @@ public class PlugNicCommand extends Command { this.vmType = vmtype; } + public PlugNicCommand(NicTO nic, String instanceName, VirtualMachine.Type vmtype, Map details) { + this.nic = nic; + this.instanceName = instanceName; + this.vmType = vmtype; + this.details = details; + } + public String getVmName() { return instanceName; } @@ -53,4 +63,8 @@ public class PlugNicCommand extends Command { public VirtualMachine.Type getVMType() { return vmType; } + + public Map getDetails() { + return this.details; + } } diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java index 3426a0a1be3..f6280c27a63 100644 --- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -3422,8 +3422,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac final VMInstanceVO router = _vmDao.findById(vm.getId()); if (router.getState() == State.Running) { try { - final PlugNicCommand plugNicCmd = new PlugNicCommand(nic, vm.getName(), vm.getType()); - + final PlugNicCommand plugNicCmd = new PlugNicCommand(nic, vm.getName(), vm.getType(), vm.getDetails()); final Commands cmds = new Commands(Command.OnError.Stop); cmds.addCommand("plugnic", plugNicCmd); _agentMgr.send(dest.getHost().getId(), cmds); diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java index f90a666bf8c..07815ee2409 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java @@ -916,8 +916,12 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa return new PlugNicAnswer(cmd, false, "Unable to execute PlugNicCommand due to " + errMsg); } */ - // TODO need a way to specify the control of NIC device type + // Fallback to E1000 if no specific nicAdapter is passed VirtualEthernetCardType nicDeviceType = VirtualEthernetCardType.E1000; + Map details = cmd.getDetails(); + if (details != null) { + nicDeviceType = VirtualEthernetCardType.valueOf((String) details.get("nicAdapter")); + } // find a usable device number in VMware environment VirtualDevice[] nicDevices = vmMo.getNicDevices();