cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajeshbatt...@apache.org
Subject git commit: updated refs/heads/master to 63b23bb
Date Fri, 08 Nov 2013 07:53:53 GMT
Updated Branches:
  refs/heads/master 3c350ab0b -> 63b23bb34


Fixed VmSync issues in HyperV.


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

Branch: refs/heads/master
Commit: 63b23bb341e86daf3b6407a1710c1b2a113b9088
Parents: 3c350ab
Author: Rajesh Battala <rajesh.battala@citrix.com>
Authored: Fri Nov 8 13:11:32 2013 +0530
Committer: Rajesh Battala <rajesh.battala@citrix.com>
Committed: Fri Nov 8 13:14:52 2013 +0530

----------------------------------------------------------------------
 .../ServerResource/HypervResource/CloudStackTypes.cs  | 14 ++++++++++++++
 .../HypervResource/HypervResourceController.cs        |  4 ++++
 .../ServerResource/HypervResource/IWmiCallsV2.cs      |  1 +
 .../DotNet/ServerResource/HypervResource/Utils.cs     | 10 ++++++++++
 .../ServerResource/HypervResource/WmiCallsV2.cs       | 13 +++++++++++++
 5 files changed, 42 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/63b23bb3/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs
b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs
index 41b2bac..dfc3e20 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs
@@ -396,6 +396,20 @@ namespace HypervResource
         }
     }
 
+    public class VmState
+    {
+        [JsonProperty("state")]
+        public String state;
+        [JsonProperty("host")]
+        String host;
+        public VmState() { }
+        public VmState(String vmState, String host)
+        {
+            this.state = vmState;
+            this.host = host;
+        }
+    }
+
     public struct StoragePoolInfo
     {
         [JsonProperty("uuid")]

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/63b23bb3/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
index 43b44df..6d5c599 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
@@ -31,6 +31,7 @@ using System.Net.Http;
 using System.Security.Cryptography;
 using System.Security.Principal;
 using System.Web.Http;
+using CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2;
 
 namespace HypervResource
 {
@@ -1449,6 +1450,9 @@ namespace HypervResource
                     logger.Debug(CloudStackTypes.StartupStorageCommand + " set available
bytes to " + available);
 
                     string ipAddr = strtRouteCmd.privateIpAddress;
+                    var vmStates = wmiCallsV2.GetVmSync(config.PrivateIpAddress);
+                    strtRouteCmd.vms = Utils.CreateCloudStackMapObject(vmStates);
+
                     StoragePoolInfo pi = new StoragePoolInfo(
                         poolGuid.ToString(),
                         ipAddr,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/63b23bb3/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/IWmiCallsV2.cs
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/IWmiCallsV2.cs
b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/IWmiCallsV2.cs
index 125c53e..223f748 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/IWmiCallsV2.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/IWmiCallsV2.cs
@@ -63,5 +63,6 @@ namespace HypervResource
         VirtualSystemSettingData GetVmSettings(ComputerSystem vm);
         void patchSystemVmIso(string vmName, string systemVmIso);
         void SetState(ComputerSystem vm, ushort requiredState);
+        Dictionary<String, VmState> GetVmSync(String privateIpAddress);
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/63b23bb3/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/Utils.cs
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/Utils.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/Utils.cs
index 631a7bd..cc2b667 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/Utils.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/Utils.cs
@@ -45,6 +45,16 @@ namespace HypervResource
             return new JObject(objTypeValuePairing);
         }
 
+        /// <summary>
+        /// serialize dictonary to map json type
+        /// </summary>
+        /// <param name="objValue">Object's data, can be an anonymous object, e.g.
</param>
+        /// <returns></returns>
+        public static JToken CreateCloudStackMapObject(object objValue)
+        {
+            JToken objContent = JToken.FromObject(objValue);
+            return objContent;
+        }
 
         /// <summary>
         /// Copy file on network share to local volume.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/63b23bb3/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
index 547a6b7..0a58131 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
@@ -1549,6 +1549,19 @@ namespace HypervResource
             return null;
         }
 
+        public Dictionary<String, VmState> GetVmSync(String privateIpAddress)
+        {
+            List<String> vms = GetVmElementNames();
+            Dictionary<String, VmState> vmSyncStates = new Dictionary<string, VmState>();
+            String vmState;
+            foreach (String vm in vms)
+            {
+                 vmState = EnabledState.ToCloudStackState(GetComputerSystem(vm).EnabledState);
+                 vmSyncStates.Add(vm, new VmState(vmState, privateIpAddress));
+            }
+            return vmSyncStates;
+        }
+
         public List<string> GetVmElementNames()
         {
             List<string> result = new List<string>();


Mime
View raw message