mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-25 14:27:26 +01:00
Merge pull request #543 from cheng--zhang/CP-12769
CP-12769: Send credential only when HealthCheckService is running.
This commit is contained in:
commit
8e8c7c4b13
@ -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
|
||||
|
@ -50,6 +50,7 @@
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.ServiceProcess" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.Xml" />
|
||||
|
@ -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);
|
||||
//
|
||||
|
@ -104,12 +104,12 @@ namespace XenServerHealthCheck
|
||||
List<ServerInfo> 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)
|
||||
|
Loading…
Reference in New Issue
Block a user