diff --git a/XenModel/Actions/CallHome/TransferCallHomeSettingAction.cs b/XenModel/Actions/CallHome/TransferCallHomeSettingAction.cs index bbb860f00..b63f282f7 100755 --- a/XenModel/Actions/CallHome/TransferCallHomeSettingAction.cs +++ b/XenModel/Actions/CallHome/TransferCallHomeSettingAction.cs @@ -36,6 +36,7 @@ using System; using System.IO.Pipes; using System.IO; using System.Text; +using System.ServiceProcess; namespace XenAdmin.Actions { @@ -64,8 +65,14 @@ namespace XenAdmin.Actions return EncryptionUtils.ProtectForLocalMachine(String.Join(SEPARATOR.ToString(), new[] { Host, username, passwordSecret })); } + private const string CALLHOMESERVICENAME = "XenHealthSvc"; + protected override void Run() { + ServiceController sc = new ServiceController(CALLHOMESERVICENAME); + if (sc.Status != ServiceControllerStatus.Running) + return; + NamedPipeClientStream pipeClient = new NamedPipeClientStream(".", CallHomeSettings.HEALTH_CHECK_PIPE, PipeDirection.Out); int retryCount = 120; do diff --git a/XenModel/XenModel.csproj b/XenModel/XenModel.csproj index ab0b2a611..2ae6b0c04 100644 --- a/XenModel/XenModel.csproj +++ b/XenModel/XenModel.csproj @@ -50,6 +50,7 @@ 3.5 + diff --git a/XenServerHealthCheck/ProjectInstaller.Designer.cs b/XenServerHealthCheck/ProjectInstaller.Designer.cs index 3fdd68a20..b19b9f5fa 100755 --- a/XenServerHealthCheck/ProjectInstaller.Designer.cs +++ b/XenServerHealthCheck/ProjectInstaller.Designer.cs @@ -35,7 +35,7 @@ // this.XenServerHealthCheckInstaller.Description = "Citrix XenServer Health Check"; this.XenServerHealthCheckInstaller.DisplayName = "Citrix XenServer Health Check"; - this.XenServerHealthCheckInstaller.ServiceName = "Citrix XenServer Health Check"; + this.XenServerHealthCheckInstaller.ServiceName = "XenHealthSvc"; this.XenServerHealthCheckInstaller.StartType = System.ServiceProcess.ServiceStartMode.Automatic; this.XenServerHealthCheckInstaller.AfterInstall += new System.Configuration.Install.InstallEventHandler(this.XenServerHealthCheckInstaller_AfterInstall); // diff --git a/XenServerHealthCheck/XenServerHealthCheckService.cs b/XenServerHealthCheck/XenServerHealthCheckService.cs index 2e85f660b..5c03743f3 100755 --- a/XenServerHealthCheck/XenServerHealthCheckService.cs +++ b/XenServerHealthCheck/XenServerHealthCheckService.cs @@ -104,12 +104,12 @@ namespace XenServerHealthCheck List servers = ServerListHelper.instance.GetServerList(); foreach (ServerInfo server in servers) { - if (server.task != null && (!server.task.IsCompleted || !server.task.IsCanceled || !server.task.IsFaulted)) + if (server.task != null && !(server.task.IsCompleted || server.task.IsCanceled || server.task.IsFaulted)) canStop = false; } if(canStop == false) Thread.Sleep(1000); - } while (canStop != true); + } while (canStop == false); } public void OnTimer(object sender, System.Timers.ElapsedEventArgs args)