You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by de...@apache.org on 2013/12/12 10:25:55 UTC

[1/2] git commit: updated refs/heads/master to ffd1a07

Updated Branches:
  refs/heads/master bbeb164ab -> ffd1a078d


CLOUDSTACK-5473: Fixed the name with which the hyper-v agent gets
installed as a service.


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

Branch: refs/heads/master
Commit: bdbc5f2ae395efbd8b4e8836418857e32dc333ed
Parents: bbeb164
Author: Devdeep Singh <de...@gmail.com>
Authored: Thu Dec 12 20:41:32 2013 +0530
Committer: Devdeep Singh <de...@gmail.com>
Committed: Thu Dec 12 14:56:29 2013 +0530

----------------------------------------------------------------------
 .../DotNet/ServerResource/AgentShell/Program.cs | 12 ++++----
 .../AgentShell/ProjectInstaller.Designer.cs     | 30 ++++++++++----------
 2 files changed, 21 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bdbc5f2a/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/Program.cs
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/Program.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/Program.cs
index e843500..5e58211 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/Program.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/Program.cs
@@ -29,7 +29,7 @@ namespace CloudStack.Plugin.AgentShell
     static class Program
     {
         private static ILog logger = LogManager.GetLogger(typeof(Program));
-        private static string serviceName = "CloudStack ServerResource";
+        public static string serviceName = "CloudStack Hyper-V Agent";
 
         /// <summary>
         /// Application entry point allows service to run in console application or as a Windows service.
@@ -39,27 +39,27 @@ namespace CloudStack.Plugin.AgentShell
         {
             if (args.Length == 0)
             {
-                logger.InfoFormat("CloudStack ServerResource running as Windows Service");
+                logger.InfoFormat(serviceName + " running as Windows Service");
                 ServiceBase[] ServicesToRun = new ServiceBase[] { new AgentService() };
                 ServiceBase.Run(ServicesToRun);
             }
             else if (args.Length == 1)
             {
-                logger.DebugFormat("CloudStack ServerResource arg is ", args[0]);
+                logger.DebugFormat(serviceName + " arg is ", args[0]);
                 switch (args[0])
                 {
                     case "--install":
-                        logger.InfoFormat("Installing and running CloudStack ServerResource ");
+                        logger.InfoFormat("Installing and running " + serviceName);
                         InstallService();
                         StartService();
                         break;
                     case "--uninstall":
-                        logger.InfoFormat("stopping and uninstalling CloudStack ServerResource ");
+                        logger.InfoFormat("Stopping and uninstalling " + serviceName);
                         StopService();
                         UninstallService();
                         break;
                     case "--console":
-                        logger.InfoFormat("CloudStack ServerResource running as console app");
+                        logger.InfoFormat(serviceName + " is running as console application");
                         new AgentService().RunConsole(args);
                         break;
                     default:

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bdbc5f2a/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/ProjectInstaller.Designer.cs
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/ProjectInstaller.Designer.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/ProjectInstaller.Designer.cs
index a10cbb0..d858192 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/ProjectInstaller.Designer.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/ProjectInstaller.Designer.cs
@@ -44,33 +44,33 @@ namespace CloudStack.Plugin.AgentShell
         /// </summary>
         private void InitializeComponent()
         {
-            this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
-            this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller();
+            this.serviceProcessInstaller = new System.ServiceProcess.ServiceProcessInstaller();
+            this.serviceInstaller = new System.ServiceProcess.ServiceInstaller();
             // 
-            // serviceProcessInstaller1
+            // serviceProcessInstaller
             // 
-            this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
-            this.serviceProcessInstaller1.Password = null;
-            this.serviceProcessInstaller1.Username = null;
+            this.serviceProcessInstaller.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
+            this.serviceProcessInstaller.Password = null;
+            this.serviceProcessInstaller.Username = null;
             // 
-            // serviceInstaller1
+            // serviceInstaller
             // 
-            this.serviceInstaller1.Description = "CloudStack Agent";
-            this.serviceInstaller1.DisplayName = "CloudStack ServerResource";
-            this.serviceInstaller1.ServiceName = "CloudStack ServerResource";
-            this.serviceInstaller1.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
+            this.serviceInstaller.Description = "CloudStack agent for managing a hyper-v host";
+            this.serviceInstaller.DisplayName = Program.serviceName;
+            this.serviceInstaller.ServiceName = Program.serviceName;
+            this.serviceInstaller.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
             // 
             // ProjectInstaller
             // 
             this.Installers.AddRange(new System.Configuration.Install.Installer[] {
-            this.serviceProcessInstaller1,
-            this.serviceInstaller1});
+            this.serviceProcessInstaller,
+            this.serviceInstaller});
 
         }
 
         #endregion
 
-        private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller1;
-        private System.ServiceProcess.ServiceInstaller serviceInstaller1;
+        private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller;
+        private System.ServiceProcess.ServiceInstaller serviceInstaller;
     }
 }


[2/2] git commit: updated refs/heads/master to ffd1a07

Posted by de...@apache.org.
CLOUDSTACK-5462: Hyperv agent confused by existing volume of different
image type. Works by avoiding volume image format inference errors and
removing existing files with same name, but different format.


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

Branch: refs/heads/master
Commit: ffd1a078d49cb8491e29a881970077c682fd1cb0
Parents: bdbc5f2
Author: Donal Lafferty <do...@citrix.com>
Authored: Thu Dec 12 21:31:14 2013 +0530
Committer: Devdeep Singh <de...@gmail.com>
Committed: Thu Dec 12 14:56:37 2013 +0530

----------------------------------------------------------------------
 .../HypervResource/HypervResourceController.cs  | 33 +++++++++++++-------
 1 file changed, 22 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ffd1a078/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 776c0fe..fe0df0f 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
@@ -1232,13 +1232,19 @@ namespace HypervResource
                         }
                     }
 
-                    // Already exists?
+                    // Template already downloaded?
                     if (destFile != null && File.Exists(destFile) &&
                         !String.IsNullOrEmpty(destTemplateObjectTO.checksum))
                     {
                         // TODO: checksum fails us, because it is of the compressed image.
                         // ASK: should we store the compressed or uncompressed version or is the checksum not calculated correctly?
+                        logger.Debug(CloudStackTypes.CopyCommand + " calling VerifyChecksum to see if we already have the file at " + destFile);
                         result = VerifyChecksum(destFile, destTemplateObjectTO.checksum);
+                        if (!result)
+                        {
+                            result = true;
+                            logger.Debug(CloudStackTypes.CopyCommand + " existing file has different checksum " + destFile);
+                        }
                     }
 
                     // Do we have to create a new one?
@@ -1320,25 +1326,30 @@ namespace HypervResource
                         // Create volume from a template?
                         else if (srcTemplateObjectTO != null && destVolumeObjectTO != null)
                         {
-                            if (destVolumeObjectTO.format == null)
+                            // VolumeObjectTO guesses file extension based on existing files
+                            // this can be wrong if the previous file had a different file type
+                            var guessedDestFile = destVolumeObjectTO.FullFileName;
+                            if (File.Exists(guessedDestFile))
                             {
-                                destVolumeObjectTO.format = srcTemplateObjectTO.format;
+                                logger.Info("Deleting existing file " + guessedDestFile);
+                                File.Delete(guessedDestFile);
                             }
+
+                            destVolumeObjectTO.format = srcTemplateObjectTO.format;
                             destFile = destVolumeObjectTO.FullFileName;
-                            string srcFile = srcTemplateObjectTO.FullFileName;
+                            if (File.Exists(destFile))
+                            {
+                                logger.Info("Deleting existing file " + destFile);
+                                File.Delete(destFile);
+                            }
 
+                            string srcFile = srcTemplateObjectTO.FullFileName;
                             if (!File.Exists(srcFile))
                             {
                                 details = "Local template file missing from " + srcFile;
                             }
                             else
                             {
-                                if (File.Exists(destFile))
-                                {
-                                    logger.Info("Deleting existing file " + destFile);
-                                    File.Delete(destFile);
-                                }
-
                                 // TODO: thin provision instead of copying the full file.
                                 File.Copy(srcFile, destFile);
                                 newData = cmd.destTO;
@@ -1377,7 +1388,7 @@ namespace HypervResource
             {
                 return true;
             }
-            return true;
+            return false;
         }
 
         /// <summary>