You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ra...@apache.org on 2013/10/28 14:05:34 UTC

[1/2] git commit: updated refs/heads/hyperv to 8f508a0

Updated Branches:
  refs/heads/hyperv 273ac5c8c -> 8f508a023


Fix to bring up SSVM and Console Proxy systemvms


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

Branch: refs/heads/hyperv
Commit: f1b8aa90a08ebe5ce65c4536009d19b7c98b26f7
Parents: 273ac5c
Author: Rajesh Battala <ra...@citrix.com>
Authored: Mon Oct 28 18:30:33 2013 +0530
Committer: Rajesh Battala <ra...@citrix.com>
Committed: Mon Oct 28 18:30:33 2013 +0530

----------------------------------------------------------------------
 .../ServerResource/HypervResource/WmiCalls.cs   | 42 ++++++++++++++++++--
 1 file changed, 39 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f1b8aa90/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCalls.cs
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCalls.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCalls.cs
index 1d8d58a..2540e92 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCalls.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCalls.cs
@@ -27,6 +27,8 @@ using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using CloudStack.Plugin.WmiWrappers.ROOT.CIMV2;
 using System.IO;
+using System.Net.NetworkInformation;
+using System.Net;
 
 namespace HypervResource
 {
@@ -291,6 +293,7 @@ namespace HypervResource
             }
 
             // Add the Nics to the VM in the deviceId order.
+            String publicIpAddress ="";
             for (int i = 0; i <= 2; i++)
             {
                 foreach (var nic in nicInfo)
@@ -313,7 +316,10 @@ namespace HypervResource
                             throw ex;
                         }
                     }
-                    
+                    if (i == 2)
+                    {
+                        publicIpAddress = nic.ip;
+                    }
                     if (nicid == i)
                     {
                         CreateNICforVm(newVm, mac, vlan);
@@ -333,7 +339,7 @@ namespace HypervResource
             }
 
             // call patch systemvm iso only for systemvms
-            if (vmName.StartsWith("r-"))
+            if (vmName.StartsWith("r-") || vmName.StartsWith("s-") || vmName.StartsWith("v-"))
             {
                 patchSystemVmIso(vmName, systemVmIso);
             }
@@ -347,13 +353,43 @@ namespace HypervResource
                 System.Threading.Thread.Sleep(90000);
                 SetState(newVm, RequiredState.Reboot);
                 // wait for the second boot and then return with sucess
-                System.Threading.Thread.Sleep(50000);
+                if (pingResource(publicIpAddress) == true)
+                {
+                }
             }
             
             logger.InfoFormat("Started VM {0}", vmName);
             return newVm;
        }
 
+        public static Boolean pingResource(String ip)
+        {
+            PingOptions pingOptions = null;
+            PingReply pingReply = null;
+            IPAddress ipAddress = null;
+            Ping pingSender = new Ping();
+            int numberOfPings = 4;
+            int pingTimeout = 1000;
+            int byteSize = 32;
+            byte[] buffer = new byte[byteSize];
+            ipAddress = IPAddress.Parse(ip);
+            pingOptions = new PingOptions();
+            for (int i = 0; i < numberOfPings; i++)
+            {
+                pingReply = pingSender.Send(ipAddress, pingTimeout, buffer, pingOptions);
+                if (pingReply.Status == IPStatus.Success)
+                {
+                    return true;
+                }
+                else
+                {
+                    // wait for the second boot and then return with suces
+                    System.Threading.Thread.Sleep(30000);
+                }
+            }
+            return false;
+        }
+
         /// this method is to add a dvd drive and attach the systemvm iso.
         /// 
 


[2/2] git commit: updated refs/heads/hyperv to 8f508a0

Posted by ra...@apache.org.
Fix to discover the seeded template to bring up the systemvm's for the first startup and fixed UNC path isues


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

Branch: refs/heads/hyperv
Commit: 8f508a023beccd091996375ce699a8533a399275
Parents: f1b8aa9
Author: Rajesh Battala <ra...@citrix.com>
Authored: Mon Oct 28 18:33:10 2013 +0530
Committer: Rajesh Battala <ra...@citrix.com>
Committed: Mon Oct 28 18:33:10 2013 +0530

----------------------------------------------------------------------
 .../ServerResource/HypervResource/Utils.cs      | 24 +++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f508a02/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 c24a1ae..3baab5b 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/Utils.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/Utils.cs
@@ -66,7 +66,29 @@ namespace HypervResource
                 bool isSuccess = LogonUser(cifsShareDetails.User, cifsShareDetails.Domain, cifsShareDetails.Password, LOGON32_LOGON_NEW_CREDENTIALS, LOGON32_PROVIDER_DEFAULT, ref token);
                 using (WindowsImpersonationContext remoteIdentity = new WindowsIdentity(token).Impersonate())
                 {
-                    String dest = Path.Combine(cifsShareDetails.UncPath, filePathRelativeToShare);
+
+                 // if the filePathRelativeToShare string don't have filename and only a dir point then find the vhd files in that folder and use
+                 // In the clean setup, first copy command wont be having the filename it contains onlyu dir path.
+                 // we need to scan the folder point and then copy the file to destination.
+                 String dest = "";
+                 if (!filePathRelativeToShare.Contains(".vhd"))
+                 {
+                     // scan the folder and get the vhd filename.
+                     String uncPath = cifsShareDetails.UncPath + "\\" + filePathRelativeToShare;
+                     uncPath = uncPath.Replace("/", "\\");
+                     DirectoryInfo dir = new DirectoryInfo(uncPath);
+                     FileInfo[] vhdFiles = dir.GetFiles("*.vhd");
+                     if (vhdFiles.Length > 0)
+                     {
+                         FileInfo file = vhdFiles[0];
+                         dest = file.FullName;
+                     }
+                 }
+                 else
+                 {
+                     dest = Path.Combine(cifsShareDetails.UncPath, filePathRelativeToShare);
+                     dest = dest.Replace("/", "\\");
+                 }
                     s_logger.Info(CloudStackTypes.CopyCommand + ": copy " + Path.Combine(cifsShareDetails.UncPath, filePathRelativeToShare) + " to " + destFile);
 
                     File.Copy(dest, destFile, true);