CLOUDSTACK-4736 Fixed issue in default service selection

This commit is contained in:
Jayapal 2013-11-07 17:07:30 +05:30
parent 5d75c6b75c
commit 416206595e
5 changed files with 14 additions and 16 deletions

View File

@ -35,7 +35,7 @@ public class MonitoringServiceDaoImpl extends GenericDaoBase<MonitoringServiceVO
public MonitoringServiceDaoImpl() {
super();
AllFieldsSearch = createSearchBuilder();
AllFieldsSearch.and("isDefault", AllFieldsSearch.entity().getDefault(), SearchCriteria.Op.EQ);
AllFieldsSearch.and("isDefault", AllFieldsSearch.entity().isDefaultService(), SearchCriteria.Op.EQ);
AllFieldsSearch.and("service", AllFieldsSearch.entity().getService(), SearchCriteria.Op.EQ);
AllFieldsSearch.and("processname", AllFieldsSearch.entity().getProcessname(), SearchCriteria.Op.EQ);
AllFieldsSearch.and("servicename", AllFieldsSearch.entity().getServiceName(), SearchCriteria.Op.EQ);

View File

@ -26,12 +26,13 @@ import java.util.UUID;
public class MonitoringServiceVO implements MonitoringService {
public MonitoringServiceVO(String service, String processname, String serviceName, String servicePath,
String pidFile) {
String pidFile, boolean defaultService) {
this.service = service;
this.processname = processname;
this.servicename = serviceName;
this.servicePath = servicePath;
this.servicePidFile= pidFile;
this.defaultService = defaultService;
}
@ -59,7 +60,7 @@ public class MonitoringServiceVO implements MonitoringService {
private String servicePidFile;
@Column(name="isDefault")
private boolean isDefault;
private boolean defaultService;
@Column(name = "uuid")
@ -105,12 +106,8 @@ public class MonitoringServiceVO implements MonitoringService {
return 0; //To change body of implemented methods use File | Settings | File Templates.
}
public boolean getDefault() {
return isDefault;
}
public void setDefault(boolean isDefault) {
isDefault = isDefault;
public boolean isDefaultService() {
return defaultService;
}
public String getProcessname() {

View File

@ -2368,7 +2368,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
List<MonitorServiceTO> servicesTO = new ArrayList<MonitorServiceTO>();
for (MonitoringServiceVO service: services) {
MonitorServiceTO serviceTO = new MonitorServiceTO( service.getService(), service.getProcessname(), service.getServiceName(), service.getServicePath(),
service.getPidFile(), service.getDefault());
service.getPidFile(), service.isDefaultService());
servicesTO.add(serviceTO);
}

View File

@ -575,10 +575,11 @@ create table `cloud`.`monitoring_services` (
`isDefault` boolean COMMENT 'Default service', PRIMARY KEY (`id`)
);
insert into cloud.monitoring_services(id, service, process_name, service_name, service_path, pidfile, isDefault) values(1,'ssh','sshd', 'ssh','/etc/init.d/ssh','/var/run/sshd.pid',true);
insert into cloud.monitoring_services(id, service, process_name, service_name, service_path, pidfile, isDefault) values(2,'dhcp','dnsmasq','dnsmasq','/etc/init.d/dnsmasq','/var/run/dnsmasq/dnsmasq.pid',false);
insert into cloud.monitoring_services(id, service, process_name, service_name, service_path, pidfile, isDefault) values(3,'loadbalancing','haproxy','haproxy','/etc/init.d/haproxy','/var/run/haproxy.pid',false);
insert into cloud.monitoring_services(id, service, process_name, service_name, service_path, pidfile, isDefault) values(4,'webserver','apache2','apache2','/etc/init.d/apache2','/var/run/apache2.pid', true);
insert into cloud.monitoring_services(id, uuid, service, process_name, service_name, service_path, pidfile, isDefault) values(1, UUID(), 'ssh','sshd', 'ssh','/etc/init.d/ssh','/var/run/sshd.pid',true);
insert into cloud.monitoring_services(id, uuid, service, process_name, service_name, service_path, pidfile, isDefault) values(2, UUID(), 'dhcp','dnsmasq','dnsmasq','/etc/init.d/dnsmasq','/var/run/dnsmasq/dnsmasq.pid',false);
insert into cloud.monitoring_services(id, uuid, service, process_name, service_name, service_path, pidfile, isDefault) values(3, UUID(), 'loadbalancing','haproxy','haproxy','/etc/init.d/haproxy','/var/run/haproxy.pid',false);
insert into cloud.monitoring_services(id, uuid, service, process_name, service_name, service_path, pidfile, isDefault) values(4, UUID(), 'webserver','apache2','apache2','/etc/init.d/apache2','/var/run/apache2.pid', true);
ALTER TABLE `cloud`.`service_offering` CHANGE COLUMN `cpu` `cpu` INT(10) UNSIGNED NULL COMMENT '# of cores' , CHANGE COLUMN `speed` `speed` INT(10) UNSIGNED NULL COMMENT 'speed per core in mhz' , CHANGE COLUMN `ram_size` `ram_size` BIGINT(20) UNSIGNED NULL ;
CREATE TABLE `cloud`.`usage_event_details` (

View File

@ -170,7 +170,7 @@ def checkProcessStatus( process ):
if isPidMatchPidFile(pidfile, pids) == StatusCodes.SUCCESS:
pidFileMatched = 1;
printd("pid file is matched ...")
raisealert(log.INFO, "The process detected as running", process_name)
raisealert(log.ALERT, "The process detected as running", process_name)
break
else:
printd("pid file is not matched ...")
@ -201,7 +201,7 @@ def checkProcessStatus( process ):
if return_val == 0:
printd("The process" + process_name +" recovered successfully ")
msg="The process " +process_name+" is recovered successfully "
raisealert(log.ALERT,process_name,msg)
raisealert(log.INFO,process_name,msg)
break;
else: