Enable logging for deploydb and add support for hypervisor type in service offering

This commit is contained in:
Kelven Yang 2010-08-27 18:30:25 -07:00 committed by edison
parent 9c67a9f585
commit 6ae1c8fa31
1 changed files with 13 additions and 1 deletions

View File

@ -42,6 +42,7 @@ import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.apache.log4j.Logger;
import org.apache.log4j.xml.DOMConfigurator;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@ -56,6 +57,7 @@ import com.cloud.service.ServiceOfferingVO;
import com.cloud.service.dao.ServiceOfferingDaoImpl;
import com.cloud.storage.DiskOfferingVO;
import com.cloud.storage.dao.DiskOfferingDaoImpl;
import com.cloud.utils.PropertiesUtil;
import com.cloud.utils.component.ComponentLocator;
import com.cloud.utils.db.DB;
import com.cloud.utils.db.Transaction;
@ -332,6 +334,15 @@ public class DatabaseConfig {
public static void main(String[] args) {
System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl");
System.setProperty("javax.xml.parsers.SAXParserFactory", "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl");
File file = PropertiesUtil.findConfigFile("log4j-cloud.xml");
if(file != null) {
System.out.println("Log4j configuration from : " + file.getAbsolutePath());
DOMConfigurator.configureAndWatch(file.getAbsolutePath(), 10000);
} else {
System.out.println("Configure log4j with default properties");
}
if (args.length < 1) {
s_logger.error("error starting database config, missing initial data file");
} else {
@ -715,6 +726,7 @@ public class DatabaseConfig {
int ramSize = Integer.parseInt(_currentObjectParams.get("ramSize"));
int speed = Integer.parseInt(_currentObjectParams.get("speed"));
String useLocalStorageValue = _currentObjectParams.get("useLocalStorage");
String hypervisorType = _currentObjectParams.get("hypervisorType");
// int nwRate = Integer.parseInt(_currentObjectParams.get("nwRate"));
// int mcRate = Integer.parseInt(_currentObjectParams.get("mcRate"));
@ -741,7 +753,7 @@ public class DatabaseConfig {
useLocalStorage = false;
}
ServiceOfferingVO serviceOffering = new ServiceOfferingVO(name, cpu, ramSize, speed, nwRate, mcRate, ha, displayText, type, useLocalStorage, false, null, null);
ServiceOfferingVO serviceOffering = new ServiceOfferingVO(name, cpu, ramSize, speed, nwRate, mcRate, ha, displayText, type, useLocalStorage, false, null, hypervisorType);
ServiceOfferingDaoImpl dao = ComponentLocator.inject(ServiceOfferingDaoImpl.class);
try {
dao.persist(serviceOffering);