bug 8783: user vm fs is crashed, use O_DIRECT instead of O_DSYNC/O_SYNC in qemu, aka cache=none. Hope we can reduce the possibility of guest vm crashed.

status 8783: resolved fixed
This commit is contained in:
Edison Su 2011-03-01 16:21:51 -05:00
parent e9b2ac63d0
commit bc593b5a8f
7 changed files with 27 additions and 15 deletions

View File

@ -1136,7 +1136,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
final Script command = new Script(_manageSnapshotPath, _cmdsTimeout, s_logger);
command.add("-d", snapshotDestPath);
command.add("-n", cmd.getSnapshotName());
command.add("-f");
command.execute();
} catch (LibvirtException e) {

View File

@ -384,7 +384,7 @@ public class LibvirtVMDef {
}
diskBuilder.append(" type='" + _diskType + "'");
diskBuilder.append(">\n");
diskBuilder.append("<driver name='qemu'" + " type='" + _diskFmtType + "'/>\n");
diskBuilder.append("<driver name='qemu'" + " type='" + _diskFmtType + "' cache='none' " +"/>\n");
if (_diskType == diskType.FILE) {
diskBuilder.append("<source ");
if (_sourcePath != null) {

View File

@ -42,8 +42,7 @@ create_snapshot() {
destroy_snapshot() {
local disk=$1
local snapshotname=$2
local deleteDir=$3
local deleteDir=$2
local failed=0
if [ -d $disk ]
@ -55,7 +54,7 @@ destroy_snapshot() {
if [ "$deleteDir" == "1" ]
then
rm -rf %disk >& /dev/null
rm -rf $disk >& /dev/null
fi
return $failed

View File

@ -543,11 +543,11 @@ public class ApiDBUtils {
}
public static boolean isSecurityGroupEnabledInZone(long zoneId) {
Network network = _networkMgr.getNetworkWithSecurityGroupEnabled(zoneId);
if (network != null) {
return true;
} else {
DataCenterVO dc = _zoneDao.findById(zoneId);
if (dc == null) {
return false;
} else {
return dc.isSecurityGroupEnabled();
}
}

View File

@ -65,4 +65,6 @@ public interface DataCenterDao extends GenericDao<DataCenterVO, Long> {
List<DataCenterVO> listPublicZones();
List<DataCenterVO> findChildZones(Object[] ids);
List<DataCenterVO> listSecurityGroupEnabledZones();
}

View File

@ -56,7 +56,8 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
protected SearchBuilder<DataCenterVO> NameSearch;
protected SearchBuilder<DataCenterVO> ListZonesByDomainIdSearch;
protected SearchBuilder<DataCenterVO> PublicZonesSearch;
protected SearchBuilder<DataCenterVO> ChildZonesSearch;
protected SearchBuilder<DataCenterVO> ChildZonesSearch;
protected SearchBuilder<DataCenterVO> securityGroupSearch;
protected final DataCenterIpAddressDaoImpl _ipAllocDao = ComponentLocator.inject(DataCenterIpAddressDaoImpl.class);
protected final DataCenterLinkLocalIpAddressDaoImpl _LinkLocalIpAllocDao = ComponentLocator.inject(DataCenterLinkLocalIpAddressDaoImpl.class);
@ -92,6 +93,12 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
SearchCriteria<DataCenterVO> sc = PublicZonesSearch.create();
//sc.setParameters("domainId", domainId);
return listBy(sc);
}
@Override
public List<DataCenterVO> listSecurityGroupEnabledZones() {
SearchCriteria<DataCenterVO> sc = securityGroupSearch.create();
return listBy(sc);
}
@Override
@ -252,6 +259,10 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
ChildZonesSearch.and("domainid", ChildZonesSearch.entity().getDomainId(), SearchCriteria.Op.IN);
ChildZonesSearch.done();
securityGroupSearch = createSearchBuilder();
securityGroupSearch.and("isSgEnabled", securityGroupSearch.entity().isSecurityGroupEnabled(), SearchCriteria.Op.EQ);
securityGroupSearch.done();
_tgMacAddress = _tgs.get("macAddress");
assert _tgMacAddress != null : "Couldn't get mac address table generator";
}

View File

@ -4189,15 +4189,16 @@ public class ManagementServerImpl implements ManagementServer {
@Override
public Map<String, Object> listCapabilities(ListCapabilitiesCmd cmd) {
Map<String, Object> capabilities = new HashMap<String, Object>();
String securityGroupsEnabled = "false";
Network net = _networkMgr.getNetworkWithSecurityGroupEnabled(null);
if (net != null) {
securityGroupsEnabled = "true";
boolean securityGroupsEnabled = false;
List<DataCenterVO> dc = _dcDao.listSecurityGroupEnabledZones();
if (dc != null && !dc.isEmpty()) {
securityGroupsEnabled = true;
}
String userPublicTemplateEnabled = _configs.get(Config.AllowPublicUserTemplates.key());
capabilities.put("securityGroupsEnabled", (securityGroupsEnabled == null || securityGroupsEnabled.equals("false") ? false : true));
capabilities.put("securityGroupsEnabled", securityGroupsEnabled);
capabilities.put("userPublicTemplateEnabled", (userPublicTemplateEnabled == null || userPublicTemplateEnabled.equals("false") ? false : true));
capabilities.put("cloudStackVersion", getVersion());
return capabilities;