Repository: cloudstack
Updated Branches:
  refs/heads/4.4 a7bf66b9f -> 799480cf0


CLOUDSTACK-6519 [Hyper-V] while adding VM to Network it should throw error when 
it is in running state


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/799480cf
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/799480cf
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/799480cf

Branch: refs/heads/4.4
Commit: 799480cf052e7069540167880840a2533570d97c
Parents: a7bf66b
Author: Rajesh Battala <[email protected]>
Authored: Tue May 13 11:39:14 2014 +0530
Committer: Daan Hoogland <[email protected]>
Committed: Tue May 13 22:59:34 2014 +0200

----------------------------------------------------------------------
 .../hypervisor/hyperv/resource/HypervDirectConnectResource.java  | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/799480cf/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
----------------------------------------------------------------------
diff --git 
a/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
 
b/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
index 1816baf..f29839d 100644
--- 
a/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
+++ 
b/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
@@ -531,6 +531,10 @@ public class HypervDirectConnectResource extends 
ServerResourceBase implements S
         try {
 
             String vmName = cmd.getVmName();
+            if(cmd.getVMType() == VirtualMachine.Type.User) {
+                s_logger.error("Vm in Running state cannot be added to new 
network.Nic cannot be plugged to VM in running state");
+                return new PlugNicAnswer(cmd, false, "Vm in Running state 
cannot be added to new network.Nic cannot be plugged to VM in running state");
+            }
             NicTO nic = cmd.getNic();
             URI broadcastUri = nic.getBroadcastUri();
             if (BroadcastDomainType.getSchemeValue(broadcastUri) != 
BroadcastDomainType.Vlan) {

Reply via email to