/// <summary> /// Install a Daemon /// </summary> /// <param name="machineID">Machine ID</param> /// <param name="mapPath">An Aneka Daemon Binaries path for future uses</param> public void InstallDaemon(int machineID, string mapPath) { try { CloudWebPortal.Areas.Aneka.Models.Machine machine = db.Machines.Find(machineID); global::Aneka.PAL.Management.Model.Machine AnekaMachine = machineManagment.ToAnekaPALMachine(machine); Daemon daemon = machine.Daemon; Configuration rootWebConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/"); String RepoAccessURL = rootWebConfig.AppSettings.Settings["RepoAccessURL"].Value; String RepoAccessUser = rootWebConfig.AppSettings.Settings["RepoAccessUser"].Value; String RepoAccessPassword = rootWebConfig.AppSettings.Settings["RepoAccessPassword"].Value; //Repository Group Property Method = new Property("Method", "File"); Property Location = new Property("Location", RepoAccessURL); Property Username = new Property("Username", RepoAccessUser); Property Password = new Property("Password", RepoAccessPassword); Property Platform = new Property("Platform", "Windows"); PropertyGroup RepositoryGroup = new PropertyGroup("Repository"); RepositoryGroup.Add(Method); RepositoryGroup.Add(Location); RepositoryGroup.Add(Username); RepositoryGroup.Add(Password); RepositoryGroup.Add(Platform); //Send Loader Binaries //string anekaDaemonBinaries = mapPath + "Repository\\Daemon\\"; string RepoLocalLocation = rootWebConfig.AppSettings.Settings["RepoLocalLocation"].Value; Property DaemonPort = new Property("Port", daemon.Port); Property FreshInstall = new Property("FreshInstall", "True"); Property EnableAutoUpdate = new Property("EnableAutoUpdate", "False"); Property DaemonHomeDirectory = new Property("HomeDirectory", daemon.Directory + "\\Runtime\\Daemon\\"); PropertyGroup DaemonGroup = new PropertyGroup("Daemon"); DaemonGroup.Add(DaemonPort); DaemonGroup.Add(FreshInstall); DaemonGroup.Add(EnableAutoUpdate); DaemonGroup.Add(DaemonHomeDirectory); ConfigurationBase daemonInstallerConfig = new ConfigurationBase(); daemonInstallerConfig.Add(DaemonGroup); daemonInstallerConfig.Add(RepositoryGroup); machine.isInProgress = true; machine.ProgressMesage = "Installing Binaries"; db.SaveChanges(); daemonManager.Install(AnekaMachine, daemonInstallerConfig, RepoLocalLocation + "\\Loader\\" ); finishedActivity(machineID); } catch (Exception ex) { CloudWebPortal.Areas.Aneka.Models.Machine machine = db.Machines.Find(machineID); machine.StatusEnum = DaemonProbeStatus.Unknown; machine.ProgressMesage = "Error while stopping daemon: " + ex.Message; machine.isInProgress = false; db.SaveChanges(); } }