CLOUDSTACK-5473: Fixed the name with which the hyper-v agent gets

installed as a service.
This commit is contained in:
Devdeep Singh 2013-12-12 20:41:32 +05:30
parent bbeb164abf
commit bdbc5f2ae3
2 changed files with 21 additions and 21 deletions

View File

@ -29,7 +29,7 @@ namespace CloudStack.Plugin.AgentShell
static class Program static class Program
{ {
private static ILog logger = LogManager.GetLogger(typeof(Program)); private static ILog logger = LogManager.GetLogger(typeof(Program));
private static string serviceName = "CloudStack ServerResource"; public static string serviceName = "CloudStack Hyper-V Agent";
/// <summary> /// <summary>
/// Application entry point allows service to run in console application or as a Windows service. /// 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) 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[] ServicesToRun = new ServiceBase[] { new AgentService() };
ServiceBase.Run(ServicesToRun); ServiceBase.Run(ServicesToRun);
} }
else if (args.Length == 1) else if (args.Length == 1)
{ {
logger.DebugFormat("CloudStack ServerResource arg is ", args[0]); logger.DebugFormat(serviceName + " arg is ", args[0]);
switch (args[0]) switch (args[0])
{ {
case "--install": case "--install":
logger.InfoFormat("Installing and running CloudStack ServerResource "); logger.InfoFormat("Installing and running " + serviceName);
InstallService(); InstallService();
StartService(); StartService();
break; break;
case "--uninstall": case "--uninstall":
logger.InfoFormat("stopping and uninstalling CloudStack ServerResource "); logger.InfoFormat("Stopping and uninstalling " + serviceName);
StopService(); StopService();
UninstallService(); UninstallService();
break; break;
case "--console": case "--console":
logger.InfoFormat("CloudStack ServerResource running as console app"); logger.InfoFormat(serviceName + " is running as console application");
new AgentService().RunConsole(args); new AgentService().RunConsole(args);
break; break;
default: default:

View File

@ -44,33 +44,33 @@ namespace CloudStack.Plugin.AgentShell
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller(); this.serviceProcessInstaller = new System.ServiceProcess.ServiceProcessInstaller();
this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller(); this.serviceInstaller = new System.ServiceProcess.ServiceInstaller();
// //
// serviceProcessInstaller1 // serviceProcessInstaller
// //
this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem; this.serviceProcessInstaller.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
this.serviceProcessInstaller1.Password = null; this.serviceProcessInstaller.Password = null;
this.serviceProcessInstaller1.Username = null; this.serviceProcessInstaller.Username = null;
// //
// serviceInstaller1 // serviceInstaller
// //
this.serviceInstaller1.Description = "CloudStack Agent"; this.serviceInstaller.Description = "CloudStack agent for managing a hyper-v host";
this.serviceInstaller1.DisplayName = "CloudStack ServerResource"; this.serviceInstaller.DisplayName = Program.serviceName;
this.serviceInstaller1.ServiceName = "CloudStack ServerResource"; this.serviceInstaller.ServiceName = Program.serviceName;
this.serviceInstaller1.StartType = System.ServiceProcess.ServiceStartMode.Automatic; this.serviceInstaller.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
// //
// ProjectInstaller // ProjectInstaller
// //
this.Installers.AddRange(new System.Configuration.Install.Installer[] { this.Installers.AddRange(new System.Configuration.Install.Installer[] {
this.serviceProcessInstaller1, this.serviceProcessInstaller,
this.serviceInstaller1}); this.serviceInstaller});
} }
#endregion #endregion
private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller1; private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller;
private System.ServiceProcess.ServiceInstaller serviceInstaller1; private System.ServiceProcess.ServiceInstaller serviceInstaller;
} }
} }