You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2013/11/21 23:11:27 UTC
[58/69] [abbrv] Reformat of source code to set a stable base for the
future. I couldn't get checkstyle enabled. There's still about a thousand
errors from checkstyle. Most of it from length errors from comments and
strings. Will attempt to remove tho
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/433a6319/engine/orchestration/src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java
----------------------------------------------------------------------
diff --cc engine/orchestration/src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java
index 9aa9501,b7c91ae..cd4c3c0
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java
@@@ -55,31 -59,50 +58,31 @@@ public class VirtualMachinePowerStateSy
}
@Override
- public void processHostVmStatePingReport(long hostId, Map<String, HostVmStateReportEntry> report) {
- if(s_logger.isDebugEnabled())
- s_logger.debug("Process host VM state report from ping process. host: " + hostId);
-
- Map<Long, VirtualMachine.PowerState> translatedInfo = convertToInfos(report);
- processReport(hostId, translatedInfo);
- public void processHostVmStatePingReport(long hostId, Map<String, PowerState> report) {
++ public void processHostVmStatePingReport(long hostId, Map<String, HostVmStateReportEntry> report) {
+ if (s_logger.isDebugEnabled())
+ s_logger.debug("Process host VM state report from ping process. host: " + hostId);
+
- Map<Long, VirtualMachine.PowerState> translatedInfo = convertHostPingInfos(report);
++ Map<Long, VirtualMachine.PowerState> translatedInfo = convertToInfos(report);
+ processReport(hostId, translatedInfo);
}
-
+
private void processReport(long hostId, Map<Long, VirtualMachine.PowerState> translatedInfo) {
-
- for(Map.Entry<Long, VirtualMachine.PowerState> entry : translatedInfo.entrySet()) {
-
- if(s_logger.isDebugEnabled())
- s_logger.debug("VM state report. host: " + hostId + ", vm id: " + entry.getKey() + ", power state: " + entry.getValue());
-
- if(_instanceDao.updatePowerState(entry.getKey(), hostId, entry.getValue())) {
-
- if(s_logger.isDebugEnabled())
- s_logger.debug("VM state report is updated. host: " + hostId + ", vm id: " + entry.getKey() + ", power state: " + entry.getValue());
-
+
+ for (Map.Entry<Long, VirtualMachine.PowerState> entry : translatedInfo.entrySet()) {
+
+ if (s_logger.isDebugEnabled())
+ s_logger.debug("VM state report. host: " + hostId + ", vm id: " + entry.getKey() + ", power state: " + entry.getValue());
+
+ if (_instanceDao.updatePowerState(entry.getKey(), hostId, entry.getValue())) {
+
+ if (s_logger.isDebugEnabled())
+ s_logger.debug("VM state report is updated. host: " + hostId + ", vm id: " + entry.getKey() + ", power state: " + entry.getValue());
+
_messageBus.publish(null, VirtualMachineManager.Topics.VM_POWER_STATE, PublishScope.GLOBAL, entry.getKey());
- }
- }
+ }
+ }
}
-
+
- private Map<Long, VirtualMachine.PowerState> convertHostPingInfos(Map<String, PowerState> states) {
- final HashMap<Long, VirtualMachine.PowerState> map = new HashMap<Long, VirtualMachine.PowerState>();
- if (states == null) {
- return map;
- }
-
- for (Map.Entry<String, PowerState> entry : states.entrySet()) {
- VMInstanceVO vm = findVM(entry.getKey());
- if (vm != null) {
- map.put(vm.getId(), entry.getValue());
- break;
- } else {
- s_logger.info("Unable to find matched VM in CloudStack DB. name: " + entry.getKey());
- }
- }
-
- return map;
- }
-
private Map<Long, VirtualMachine.PowerState> convertToInfos(Map<String, HostVmStateReportEntry> states) {
final HashMap<Long, VirtualMachine.PowerState> map = new HashMap<Long, VirtualMachine.PowerState>();
if (states == null) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/433a6319/engine/schema/src/com/cloud/storage/DiskOfferingVO.java
----------------------------------------------------------------------
diff --cc engine/schema/src/com/cloud/storage/DiskOfferingVO.java
index 5960df4,b6229b4..8a9dd3d
--- a/engine/schema/src/com/cloud/storage/DiskOfferingVO.java
+++ b/engine/schema/src/com/cloud/storage/DiskOfferingVO.java
@@@ -110,23 -108,19 +108,23 @@@ public class DiskOfferingVO implements
@Column(name = "sort_key")
int sortKey;
- @Column(name="bytes_read_rate")
+ @Column(name = "bytes_read_rate")
Long bytesReadRate;
- @Column(name="bytes_write_rate")
+ @Column(name = "bytes_write_rate")
Long bytesWriteRate;
- @Column(name="iops_read_rate")
+ @Column(name = "iops_read_rate")
Long iopsReadRate;
- @Column(name="iops_write_rate")
+ @Column(name = "iops_write_rate")
Long iopsWriteRate;
- @Column(name="cache_mode", updatable = true, nullable=false)
- @Enumerated(value=EnumType.STRING)
++ @Column(name = "cache_mode", updatable = true, nullable = false)
++ @Enumerated(value = EnumType.STRING)
+ private DiskCacheMode cacheMode;
+
- @Column(name="display_offering")
+ @Column(name = "display_offering")
boolean displayOffering = true;
@Enumerated(EnumType.STRING)
@@@ -140,26 -134,8 +138,26 @@@
uuid = UUID.randomUUID().toString();
}
- public DiskOfferingVO(Long domainId, String name, String displayText, long diskSize, String tags, boolean isCustomized, Boolean isCustomizedIops, Long minIops,
- Long maxIops) {
+ public DiskOfferingVO(Long domainId, String name, String displayText, long diskSize, String tags, boolean isCustomized,
+ Boolean isCustomizedIops, Long minIops, Long maxIops, DiskCacheMode cacheMode) {
+ this.domainId = domainId;
+ this.name = name;
+ this.displayText = displayText;
+ this.diskSize = diskSize;
+ this.tags = tags;
- this.recreatable = false;
- this.type = Type.Disk;
- this.useLocalStorage = false;
- this.customized = isCustomized;
- this.uuid = UUID.randomUUID().toString();
- this.customizedIops = isCustomizedIops;
++ recreatable = false;
++ type = Type.Disk;
++ useLocalStorage = false;
++ customized = isCustomized;
++ uuid = UUID.randomUUID().toString();
++ customizedIops = isCustomizedIops;
+ this.minIops = minIops;
+ this.maxIops = maxIops;
+ this.cacheMode = cacheMode;
+ }
+
+ public DiskOfferingVO(Long domainId, String name, String displayText, long diskSize, String tags, boolean isCustomized,
- Boolean isCustomizedIops, Long minIops, Long maxIops) {
++ Boolean isCustomizedIops, Long minIops, Long maxIops) {
this.domainId = domainId;
this.name = name;
this.displayText = displayText;
@@@ -262,16 -238,6 +260,16 @@@
}
@Override
+ public DiskCacheMode getCacheMode() {
+ return cacheMode;
+ }
+
+ @Override
+ public void setCacheMode(DiskCacheMode cacheMode) {
+ this.cacheMode = cacheMode;
+ }
+
- @Override
++ @Override
public String getUniqueName() {
return uniqueName;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/433a6319/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java
----------------------------------------------------------------------
diff --cc engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java
index d6c8e3e,7100d5c..c5eea10
--- a/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java
+++ b/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java
@@@ -90,135 -89,119 +90,150 @@@ public class DatabaseUpgradeChecker imp
public DatabaseUpgradeChecker() {
_dao = new VersionDaoImpl();
- _upgradeMap.put("2.1.7", new DbUpgrade[] {new Upgrade217to218(), new Upgrade218to22(), new Upgrade221to222(), new UpgradeSnapshot217to224(),
- new Upgrade222to224(), new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(),
- new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
- new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()});
-
- _upgradeMap.put("2.1.8", new DbUpgrade[] {new Upgrade218to22(), new Upgrade221to222(), new UpgradeSnapshot217to224(), new Upgrade222to224(),
- new Upgrade218to224DomainVlans(), new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(),
- new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
- new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()});
-
- _upgradeMap.put("2.1.9", new DbUpgrade[] {new Upgrade218to22(), new Upgrade221to222(), new UpgradeSnapshot217to224(), new Upgrade222to224(),
- new Upgrade218to224DomainVlans(), new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(),
- new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
- new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()});
+ _upgradeMap.put("2.1.7", new DbUpgrade[] {new Upgrade217to218(), new Upgrade218to22(), new Upgrade221to222(),
- new UpgradeSnapshot217to224(), new Upgrade222to224(), new Upgrade224to225(), new Upgrade225to226(),
- new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(),
- new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(),
- new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(),
- new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
++ new UpgradeSnapshot217to224(), new Upgrade222to224(), new Upgrade224to225(), new Upgrade225to226(),
++ new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(),
++ new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(),
++ new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(),
++ new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
+
+ _upgradeMap.put("2.1.8", new DbUpgrade[] {new Upgrade218to22(), new Upgrade221to222(), new UpgradeSnapshot217to224(),
- new Upgrade222to224(), new Upgrade218to224DomainVlans(), new Upgrade224to225(), new Upgrade225to226(),
- new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(),
- new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(),
- new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(),
- new Upgrade421to430(), new Upgrade430to440()});
++ new Upgrade222to224(), new Upgrade218to224DomainVlans(), new Upgrade224to225(), new Upgrade225to226(),
++ new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(),
++ new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(),
++ new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(),
++ new Upgrade421to430(), new Upgrade430to440()});
+
+ _upgradeMap.put("2.1.9", new DbUpgrade[] {new Upgrade218to22(), new Upgrade221to222(), new UpgradeSnapshot217to224(),
- new Upgrade222to224(), new Upgrade218to224DomainVlans(), new Upgrade224to225(), new Upgrade225to226(),
- new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(),
- new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(),
- new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(),
- new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
++ new Upgrade222to224(), new Upgrade218to224DomainVlans(), new Upgrade224to225(), new Upgrade225to226(),
++ new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(),
++ new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(),
++ new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(),
++ new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
+
+ _upgradeMap.put("2.2.1", new DbUpgrade[] {new Upgrade221to222(), new UpgradeSnapshot223to224(), new Upgrade222to224(),
- new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(),
- new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(),
- new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(),
- new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
++ new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(),
++ new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(),
++ new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(),
++ new Upgrade410to420(),
++ new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
- _upgradeMap.put("2.2.1", new DbUpgrade[] {new Upgrade221to222(), new UpgradeSnapshot223to224(), new Upgrade222to224(), new Upgrade224to225(),
- new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(),
- new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(),
- new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()});
+ _upgradeMap.put("2.2.2", new DbUpgrade[] {new Upgrade222to224(), new UpgradeSnapshot223to224(), new Upgrade224to225(),
- new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(),
- new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(),
- new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(),
- new Upgrade421to430(), new Upgrade430to440()});
++ new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(),
++ new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(),
++ new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(),
++ new Upgrade421to430(), new Upgrade430to440()});
- _upgradeMap.put("2.2.2", new DbUpgrade[] {new Upgrade222to224(), new UpgradeSnapshot223to224(), new Upgrade224to225(), new Upgrade225to226(),
- new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(),
- new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(),
- new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()});
+ _upgradeMap.put("2.2.3", new DbUpgrade[] {new Upgrade222to224(), new UpgradeSnapshot223to224(), new Upgrade224to225(),
- new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(),
- new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(),
- new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(),
- new Upgrade421to430(), new Upgrade430to440()});
++ new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(),
++ new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(),
++ new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(),
++ new Upgrade421to430(), new Upgrade430to440()});
- _upgradeMap.put("2.2.3", new DbUpgrade[] {new Upgrade222to224(), new UpgradeSnapshot223to224(), new Upgrade224to225(), new Upgrade225to226(),
- new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(),
- new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(),
- new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()});
+ _upgradeMap.put("2.2.4", new DbUpgrade[] {new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(),
- new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(),
- new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
- new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
++ new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(),
++ new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
++ new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
- _upgradeMap.put("2.2.4", new DbUpgrade[] {new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(),
- new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
- new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()});
+ _upgradeMap.put("2.2.5", new DbUpgrade[] {new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(),
- new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(),
- new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
- new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
++ new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(),
++ new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
++ new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
- _upgradeMap.put("2.2.5", new DbUpgrade[] {new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(),
- new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
- new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()});
+ _upgradeMap.put("2.2.6", new DbUpgrade[] {new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(),
- new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(),
- new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(),
- new Upgrade421to430(), new Upgrade430to440()});
++ new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(),
++ new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(),
++ new Upgrade421to430(), new Upgrade430to440()});
- _upgradeMap.put("2.2.6", new DbUpgrade[] {new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(),
- new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(),
- new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()});
+ _upgradeMap.put("2.2.7", new DbUpgrade[] {new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(),
- new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(),
- new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(),
- new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
++ new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(),
++ new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(),
++ new Upgrade410to420(),
++ new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
- _upgradeMap.put("2.2.7", new DbUpgrade[] {new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(),
- new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(),
- new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()});
+ _upgradeMap.put("2.2.8", new DbUpgrade[] {new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(),
- new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30()
- , new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
++ new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30()
++ , new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(),
++ new Upgrade421to430(), new Upgrade430to440()});
- _upgradeMap.put("2.2.8", new DbUpgrade[] {new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(),
- new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(),
- new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()});
+ _upgradeMap.put("2.2.9", new DbUpgrade[] {new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(),
- new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
- new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
++ new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
++ new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
- _upgradeMap.put("2.2.9", new DbUpgrade[] {new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(),
+ _upgradeMap.put("2.2.10", new DbUpgrade[] {new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(),
- new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(),
- new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
+ new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(),
- new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()});
++ new Upgrade410to420(),
++ new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
- _upgradeMap.put("2.2.11", new DbUpgrade[] {new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(),
- new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(),
- new Upgrade421to430(), new Upgrade430to440()});
+ _upgradeMap.put("2.2.10", new DbUpgrade[] {new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(),
+ new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(),
- new Upgrade421to430()});
++ new Upgrade421to430(), new Upgrade430to440()});
+
+ _upgradeMap.put("2.2.12", new DbUpgrade[] {new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(),
- new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
++ new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(),
++ new Upgrade430to440()});
- _upgradeMap.put("2.2.11", new DbUpgrade[] {new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(),
- new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()});
+ _upgradeMap.put("2.2.13", new DbUpgrade[] {new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
- new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
++ new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
- _upgradeMap.put("2.2.12", new DbUpgrade[] {new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
- new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()});
+ _upgradeMap.put("2.2.14", new DbUpgrade[] {new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
- new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
++ new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
+
+ _upgradeMap.put("2.2.13", new DbUpgrade[] {new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(),
+ new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()});
+
+ _upgradeMap.put("2.2.14", new DbUpgrade[] {new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(),
+ new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()});
_upgradeMap.put("3.0.0", new DbUpgrade[] {new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(),
- new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
- new Upgrade420to421(), new Upgrade421to430()});
++ new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
_upgradeMap.put("3.0.1", new DbUpgrade[] {new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(),
- new Upgrade421to430(), new Upgrade430to440()});
- new Upgrade421to430()});
++ new Upgrade421to430(), new Upgrade430to440()});
- _upgradeMap.put("3.0.2", new DbUpgrade[] {new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
- _upgradeMap.put("3.0.2", new DbUpgrade[] {new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()});
++ _upgradeMap.put("3.0.2", new DbUpgrade[] {new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(),
++ new Upgrade430to440()});
- _upgradeMap.put("4.0.0", new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()});
+ _upgradeMap.put("4.0.0", new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
- _upgradeMap.put("4.0.1", new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()});
+ _upgradeMap.put("4.0.1", new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
- _upgradeMap.put("4.0.2", new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()});
+ _upgradeMap.put("4.0.2", new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
- _upgradeMap.put("4.1.0", new DbUpgrade[] {new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()});
+ _upgradeMap.put("4.1.0", new DbUpgrade[] {new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
- _upgradeMap.put("4.1.1", new DbUpgrade[] {new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()});
+ _upgradeMap.put("4.1.1", new DbUpgrade[] {new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
- _upgradeMap.put("4.2.0", new DbUpgrade[] {new Upgrade420to421(), new Upgrade421to430()});
+ _upgradeMap.put("4.2.0", new DbUpgrade[] {new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
- _upgradeMap.put("4.2.1", new DbUpgrade[] {new Upgrade421to430()});
+ _upgradeMap.put("4.2.1", new DbUpgrade[] {new Upgrade421to430(), new Upgrade430to440()});
+
+ _upgradeMap.put("4.3.0", new DbUpgrade[] {new Upgrade430to440()});
//CP Upgrades
_upgradeMap.put("3.0.3", new DbUpgrade[] {new Upgrade303to304(), new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(),
- new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
- new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()});
++ new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
_upgradeMap.put("3.0.4", new DbUpgrade[] {new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(),
- new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
- new Upgrade420to421(), new Upgrade421to430()});
++ new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
_upgradeMap.put("3.0.5", new DbUpgrade[] {new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(),
- new Upgrade421to430(), new Upgrade430to440()});
- new Upgrade421to430()});
++ new Upgrade421to430(), new Upgrade430to440()});
- _upgradeMap.put("3.0.6", new DbUpgrade[] {new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
- _upgradeMap.put("3.0.6", new DbUpgrade[] {new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()});
++ _upgradeMap.put("3.0.6", new DbUpgrade[] {new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(),
++ new Upgrade430to440()});
- _upgradeMap.put("3.0.7", new DbUpgrade[] {new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()});
+ _upgradeMap.put("3.0.7", new DbUpgrade[] {new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
- _upgradeMap.put("2.2.15", new DbUpgrade[] {new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to303(), new Upgrade303to304(),
- new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(),
- new Upgrade421to430()});
+ _upgradeMap.put("2.2.15", new DbUpgrade[] {new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
- new Upgrade302to303(), new Upgrade303to304(), new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(),
- new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
++ new Upgrade302to303(), new Upgrade303to304(), new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(),
++ new Upgrade410to420(),
++ new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
- _upgradeMap.put("2.2.16", new DbUpgrade[] {new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to303(), new Upgrade303to304(),
- new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(),
- new Upgrade421to430()});
+ _upgradeMap.put("2.2.16", new DbUpgrade[] {new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
- new Upgrade302to303(), new Upgrade303to304(), new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(),
- new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
++ new Upgrade302to303(), new Upgrade303to304(), new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(),
++ new Upgrade410to420(),
++ new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440()});
}
protected void runScript(Connection conn, File file) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/433a6319/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
----------------------------------------------------------------------
diff --cc engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
index cec76c0,94eb783..3b5d938
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
@@@ -39,8 -38,8 +38,9 @@@ import com.cloud.agent.api.storage.Down
import com.cloud.agent.api.to.DataObjectType;
import com.cloud.agent.api.to.DataTO;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.offering.DiskOffering.DiskCacheMode;
import com.cloud.storage.DataStoreRole;
+ import com.cloud.storage.DiskOfferingVO;
import com.cloud.storage.Storage.ImageFormat;
import com.cloud.storage.Volume;
import com.cloud.storage.VolumeVO;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/433a6319/framework/cluster/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java
----------------------------------------------------------------------
diff --cc framework/cluster/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java
index d187199,6ff0736..2287ca7
--- a/framework/cluster/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java
+++ b/framework/cluster/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java
@@@ -41,10 -41,10 +41,10 @@@ import com.cloud.utils.db.SearchCriteri
import com.cloud.utils.db.TransactionLegacy;
import com.cloud.utils.exception.CloudRuntimeException;
- @Local(value={ManagementServerHostDao.class})
+ @Local(value = {ManagementServerHostDao.class})
public class ManagementServerHostDaoImpl extends GenericDaoBase<ManagementServerHostVO, Long> implements ManagementServerHostDao {
private static final Logger s_logger = Logger.getLogger(ManagementServerHostDaoImpl.class);
-
+
private final SearchBuilder<ManagementServerHostVO> MsIdSearch;
private final SearchBuilder<ManagementServerHostVO> ActiveSearch;
private final SearchBuilder<ManagementServerHostVO> InactiveSearch;
@@@ -69,24 -69,25 +69,25 @@@
public ManagementServerHostVO findByMsid(long msid) {
SearchCriteria<ManagementServerHostVO> sc = MsIdSearch.create();
sc.setParameters("msid", msid);
-
- List<ManagementServerHostVO> l = listIncludingRemovedBy(sc);
+
+ List<ManagementServerHostVO> l = listIncludingRemovedBy(sc);
- if(l != null && l.size() > 0) {
+ if (l != null && l.size() > 0) {
return l.get(0);
}
-
- return null;
- }
-
- @Override
+
+ return null;
+ }
+
+ @Override
@DB
- public void update(long id, long runid, String name, String version, String serviceIP, int servicePort, Date lastUpdate) {
+ public void update(long id, long runid, String name, String version, String serviceIP, int servicePort, Date lastUpdate) {
TransactionLegacy txn = TransactionLegacy.currentTxn();
PreparedStatement pstmt = null;
try {
txn.start();
-
+
- pstmt = txn.prepareAutoCloseStatement("update mshost set name=?, version=?, service_ip=?, service_port=?, last_update=?, removed=null, alert_count=0, runid=?, state=? where id=?");
+ pstmt =
+ txn.prepareAutoCloseStatement("update mshost set name=?, version=?, service_ip=?, service_port=?, last_update=?, removed=null, alert_count=0, runid=?, state=? where id=?");
pstmt.setString(1, name);
pstmt.setString(2, version);
pstmt.setString(3, serviceIP);
@@@ -95,38 -96,38 +96,38 @@@
pstmt.setLong(6, runid);
pstmt.setString(7, ManagementServerHost.State.Up.toString());
pstmt.setLong(8, id);
-
+
pstmt.executeUpdate();
txn.commit();
- } catch(Exception e) {
+ } catch (Exception e) {
s_logger.warn("Unexpected exception, ", e);
+ throw new RuntimeException(e.getMessage(), e);
}
- }
-
- @Override
+ }
+
+ @Override
@DB
public boolean remove(Long id) {
TransactionLegacy txn = TransactionLegacy.currentTxn();
-
+
try {
- txn.start();
-
- ManagementServerHostVO msHost = findById(id);
- msHost.setState(ManagementServerHost.State.Down);
- super.remove(id);
-
- txn.commit();
- return true;
+ txn.start();
+
+ ManagementServerHostVO msHost = findById(id);
+ msHost.setState(ManagementServerHost.State.Down);
+ super.remove(id);
+
+ txn.commit();
+ return true;
- } catch(Exception e) {
+ } catch (Exception e) {
s_logger.warn("Unexpected exception, ", e);
+ throw new RuntimeException(e.getMessage(), e);
}
-
- return false;
}
- @Override
+ @Override
@DB
- public void update(long id, long runid, Date lastUpdate) {
+ public void update(long id, long runid, Date lastUpdate) {
TransactionLegacy txn = TransactionLegacy.currentTxn();
PreparedStatement pstmt = null;
try {
@@@ -140,77 -141,75 +141,76 @@@
int count = pstmt.executeUpdate();
txn.commit();
- if(count < 1) {
+ if (count < 1) {
throw new CloudRuntimeException("Invalid cluster session detected", new ClusterInvalidSessionException("runid " + runid + " is no longer valid"));
}
- } catch(Exception e) {
+ } catch (Exception e) {
s_logger.warn("Unexpected exception, ", e);
+ throw new RuntimeException(e.getMessage(), e);
}
- }
-
- @Override
+ }
+
+ @Override
public List<ManagementServerHostVO> getActiveList(Date cutTime) {
- SearchCriteria<ManagementServerHostVO> sc = ActiveSearch.create();
- sc.setParameters("lastUpdateTime", cutTime);
-
- return listIncludingRemovedBy(sc);
- }
+ SearchCriteria<ManagementServerHostVO> sc = ActiveSearch.create();
+ sc.setParameters("lastUpdateTime", cutTime);
+
+ return listIncludingRemovedBy(sc);
+ }
- @Override
+ @Override
public List<ManagementServerHostVO> getInactiveList(Date cutTime) {
- SearchCriteria<ManagementServerHostVO> sc = InactiveSearch.create();
- sc.setParameters("lastUpdateTime", cutTime);
-
- return listIncludingRemovedBy(sc);
- }
-
- @Override
+ SearchCriteria<ManagementServerHostVO> sc = InactiveSearch.create();
+ sc.setParameters("lastUpdateTime", cutTime);
+
+ return listIncludingRemovedBy(sc);
+ }
+
+ @Override
@DB
- public int increaseAlertCount(long id) {
+ public int increaseAlertCount(long id) {
TransactionLegacy txn = TransactionLegacy.currentTxn();
PreparedStatement pstmt = null;
int changedRows = 0;
try {
txn.start();
-
+
pstmt = txn.prepareAutoCloseStatement("update mshost set alert_count=alert_count+1 where id=? and alert_count=0");
pstmt.setLong(1, id);
-
+
changedRows = pstmt.executeUpdate();
txn.commit();
- } catch(Exception e) {
+ } catch (Exception e) {
s_logger.warn("Unexpected exception, ", e);
- txn.rollback();
+ throw new RuntimeException(e.getMessage(), e);
}
-
+
return changedRows;
- }
-
- protected ManagementServerHostDaoImpl() {
- MsIdSearch = createSearchBuilder();
- MsIdSearch.and("msid", MsIdSearch.entity().getMsid(), SearchCriteria.Op.EQ);
- MsIdSearch.done();
-
- ActiveSearch = createSearchBuilder();
- ActiveSearch.and("lastUpdateTime", ActiveSearch.entity().getLastUpdateTime(), SearchCriteria.Op.GT);
- ActiveSearch.and("removed", ActiveSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
- ActiveSearch.done();
-
- InactiveSearch = createSearchBuilder();
- InactiveSearch.and("lastUpdateTime", InactiveSearch.entity().getLastUpdateTime(), SearchCriteria.Op.LTEQ);
- InactiveSearch.and("removed", InactiveSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
- InactiveSearch.done();
-
- StateSearch = createSearchBuilder();
- StateSearch.and("state", StateSearch.entity().getState(), SearchCriteria.Op.IN);
- StateSearch.done();
- }
-
- @Override
+ }
+
+ protected ManagementServerHostDaoImpl() {
+ MsIdSearch = createSearchBuilder();
+ MsIdSearch.and("msid", MsIdSearch.entity().getMsid(), SearchCriteria.Op.EQ);
+ MsIdSearch.done();
+
+ ActiveSearch = createSearchBuilder();
+ ActiveSearch.and("lastUpdateTime", ActiveSearch.entity().getLastUpdateTime(), SearchCriteria.Op.GT);
+ ActiveSearch.and("removed", ActiveSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
+ ActiveSearch.done();
+
+ InactiveSearch = createSearchBuilder();
+ InactiveSearch.and("lastUpdateTime", InactiveSearch.entity().getLastUpdateTime(), SearchCriteria.Op.LTEQ);
+ InactiveSearch.and("removed", InactiveSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
+ InactiveSearch.done();
+
+ StateSearch = createSearchBuilder();
+ StateSearch.and("state", StateSearch.entity().getState(), SearchCriteria.Op.IN);
+ StateSearch.done();
+ }
+
-
+ @Override
public void update(long id, long runId, State state, Date lastUpdate) {
- TransactionLegacy txn = TransactionLegacy.currentTxn();
+ TransactionLegacy txn = TransactionLegacy.currentTxn();
PreparedStatement pstmt = null;
try {
pstmt = txn.prepareAutoCloseStatement("update mshost set state=?, last_update=? where id=? and runid=?");
@@@ -218,58 -217,58 +218,58 @@@
pstmt.setString(2, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), lastUpdate));
pstmt.setLong(3, id);
pstmt.setLong(4, runId);
-
+
int count = pstmt.executeUpdate();
-
+
- if(count < 1) {
+ if (count < 1) {
throw new CloudRuntimeException("Invalid cluster session detected", new ClusterInvalidSessionException("runid " + runId + " is no longer valid"));
}
} catch (SQLException e) {
throw new CloudRuntimeException("DB exception on " + pstmt.toString(), e);
}
}
-
- @Override
+
+ @Override
- public List<ManagementServerHostVO> listBy(ManagementServerHost.State...states) {
+ public List<ManagementServerHostVO> listBy(ManagementServerHost.State... states) {
- SearchCriteria<ManagementServerHostVO> sc = StateSearch.create();
+ SearchCriteria<ManagementServerHostVO> sc = StateSearch.create();
- sc.setParameters("state", (Object[]) states);
+ sc.setParameters("state", (Object[])states);
-
+
return listBy(sc);
- }
-
- @Override
- public List<Long> listOrphanMsids() {
- List<Long> orphanList = new ArrayList<Long>();
-
- TransactionLegacy txn = TransactionLegacy.currentTxn();
+ }
+
+ @Override
+ public List<Long> listOrphanMsids() {
+ List<Long> orphanList = new ArrayList<Long>();
+
+ TransactionLegacy txn = TransactionLegacy.currentTxn();
PreparedStatement pstmt = null;
try {
- pstmt = txn.prepareAutoCloseStatement(
- "select t.mgmt_server_id from (select mgmt_server_id, count(*) as count from host group by mgmt_server_id) as t WHERE t.count > 0 AND t.mgmt_server_id NOT IN (select msid from mshost)");
+ pstmt =
+ txn.prepareAutoCloseStatement("select t.mgmt_server_id from (select mgmt_server_id, count(*) as count from host group by mgmt_server_id) as t WHERE t.count > 0 AND t.mgmt_server_id NOT IN (select msid from mshost)");
ResultSet rs = pstmt.executeQuery();
- while(rs.next()) {
+ while (rs.next()) {
- orphanList.add(rs.getLong(1));
+ orphanList.add(rs.getLong(1));
}
} catch (SQLException e) {
throw new CloudRuntimeException("DB exception on " + pstmt.toString(), e);
}
-
+
return orphanList;
- }
+ }
- @Override
- public ManagementServerHostVO findOneInUpState(Filter filter) {
- SearchCriteria<ManagementServerHostVO> sc = StateSearch.create();
+ @Override
+ public ManagementServerHostVO findOneInUpState(Filter filter) {
+ SearchCriteria<ManagementServerHostVO> sc = StateSearch.create();
sc.setParameters("state", ManagementServerHost.State.Up);
-
- List<ManagementServerHostVO> mshosts = listBy(sc, filter);
+
+ List<ManagementServerHostVO> mshosts = listBy(sc, filter);
- if(mshosts != null && mshosts.size() > 0){
+ if (mshosts != null && mshosts.size() > 0) {
- return mshosts.get(0);
+ return mshosts.get(0);
}
return null;
- }
-
+ }
+
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/433a6319/framework/jobs/src/org/apache/cloudstack/framework/jobs/AsyncJobExecutionContext.java
----------------------------------------------------------------------
diff --cc framework/jobs/src/org/apache/cloudstack/framework/jobs/AsyncJobExecutionContext.java
index 0263d3d,f0de4cd..6eaff88
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/AsyncJobExecutionContext.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/AsyncJobExecutionContext.java
@@@ -38,59 -39,51 +39,59 @@@ public class AsyncJobExecutionContext
_jobMgr = jobMgr;
_joinMapDao = joinMapDao;
}
+
+ private static ManagedThreadLocal<AsyncJobExecutionContext> s_currentExectionContext = new ManagedThreadLocal<AsyncJobExecutionContext>();
- private static ManagedThreadLocal<AsyncJobExecutionContext> s_currentExectionContext = new ManagedThreadLocal<AsyncJobExecutionContext>();
-
- public AsyncJobExecutionContext() {
- }
-
+ public AsyncJobExecutionContext() {
+ }
+
public AsyncJobExecutionContext(AsyncJob job) {
- _job = job;
- }
-
- public SyncQueueItem getSyncSource() {
- return _job.getSyncSource();
- }
-
- public void resetSyncSource() {
- _job.setSyncSource(null);
- }
-
+ _job = job;
+ }
+
+ public SyncQueueItem getSyncSource() {
+ return _job.getSyncSource();
+ }
+
+ public void resetSyncSource() {
+ _job.setSyncSource(null);
+ }
+
public AsyncJob getJob() {
- return _job;
- }
-
+ return _job;
+ }
+
public void setJob(AsyncJob job) {
- _job = job;
- }
-
+ _job = job;
+ }
+
+ public boolean isJobDispatchedBy(String jobDispatcherName) {
+ assert(jobDispatcherName != null);
+ if(_job != null && _job.getDispatcher() != null && _job.getDispatcher().equals(jobDispatcherName))
+ return true;
+
+ return false;
+ }
+
public void completeAsyncJob(JobInfo.Status jobStatus, int resultCode, String resultObject) {
- assert(_job != null);
+ assert (_job != null);
- _jobMgr.completeAsyncJob(_job.getId(), jobStatus, resultCode, resultObject);
+ _jobMgr.completeAsyncJob(_job.getId(), jobStatus, resultCode, resultObject);
}
-
+
public void updateAsyncJobStatus(int processStatus, String resultObject) {
- assert(_job != null);
+ assert (_job != null);
- _jobMgr.updateAsyncJobStatus(_job.getId(), processStatus, resultObject);
+ _jobMgr.updateAsyncJobStatus(_job.getId(), processStatus, resultObject);
}
-
+
public void updateAsyncJobAttachment(String instanceType, Long instanceId) {
- assert(_job != null);
+ assert (_job != null);
- _jobMgr.updateAsyncJobAttachment(_job.getId(), instanceType, instanceId);
+ _jobMgr.updateAsyncJobAttachment(_job.getId(), instanceType, instanceId);
}
-
+
public void logJobJournal(AsyncJob.JournalType journalType, String journalText, String journalObjJson) {
- assert(_job != null);
+ assert (_job != null);
- _jobMgr.logJobJournal(_job.getId(), journalType, journalText, journalObjJson);
- }
+ _jobMgr.logJobJournal(_job.getId(), journalType, journalText, journalObjJson);
+ }
public void log(Logger logger, String journalText) {
_jobMgr.logJobJournal(_job.getId(), AsyncJob.JournalType.SUCCESS, journalText, null);
@@@ -98,59 -91,57 +99,57 @@@
}
public void joinJob(long joinJobId) {
- assert(_job != null);
+ assert (_job != null);
- _jobMgr.joinJob(_job.getId(), joinJobId);
+ _jobMgr.joinJob(_job.getId(), joinJobId);
}
-
+
- public void joinJob(long joinJobId, String wakeupHandler, String wakeupDispatcher,
- String[] wakeupTopcisOnMessageBus, long wakeupIntervalInMilliSeconds, long timeoutInMilliSeconds) {
- assert(_job != null);
- _jobMgr.joinJob(_job.getId(), joinJobId, wakeupHandler, wakeupDispatcher, wakeupTopcisOnMessageBus,
- wakeupIntervalInMilliSeconds, timeoutInMilliSeconds);
+ public void joinJob(long joinJobId, String wakeupHandler, String wakeupDispatcher, String[] wakeupTopcisOnMessageBus, long wakeupIntervalInMilliSeconds,
+ long timeoutInMilliSeconds) {
+ assert (_job != null);
+ _jobMgr.joinJob(_job.getId(), joinJobId, wakeupHandler, wakeupDispatcher, wakeupTopcisOnMessageBus, wakeupIntervalInMilliSeconds, timeoutInMilliSeconds);
}
-
- //
- // check failure exception before we disjoin the worker job
- // TODO : it is ugly and this will become unnecessary after we switch to full-async mode
+
//
+ // check failure exception before we disjoin the worker job
+ // TODO : it is ugly and this will become unnecessary after we switch to full-async mode
+ //
- public void disjoinJob(long joinedJobId) throws InsufficientCapacityException,
- ConcurrentOperationException, ResourceUnavailableException {
- assert(_job != null);
+ public void disjoinJob(long joinedJobId) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException {
+ assert (_job != null);
-
- AsyncJobJoinMapVO record = _joinMapDao.getJoinRecord(_job.getId(), joinedJobId);
+
+ AsyncJobJoinMapVO record = _joinMapDao.getJoinRecord(_job.getId(), joinedJobId);
- if(record.getJoinStatus() == JobInfo.Status.FAILED && record.getJoinResult() != null) {
+ if (record.getJoinStatus() == JobInfo.Status.FAILED && record.getJoinResult() != null) {
- Object exception = JobSerializerHelper.fromObjectSerializedString(record.getJoinResult());
+ Object exception = JobSerializerHelper.fromObjectSerializedString(record.getJoinResult());
- if(exception != null && exception instanceof Exception) {
- if(exception instanceof InsufficientCapacityException)
+ if (exception != null && exception instanceof Exception) {
+ if (exception instanceof InsufficientCapacityException)
- throw (InsufficientCapacityException)exception;
+ throw (InsufficientCapacityException)exception;
- else if(exception instanceof ConcurrentOperationException)
+ else if (exception instanceof ConcurrentOperationException)
- throw (ConcurrentOperationException)exception;
+ throw (ConcurrentOperationException)exception;
- else if(exception instanceof ResourceUnavailableException)
+ else if (exception instanceof ResourceUnavailableException)
- throw (ResourceUnavailableException)exception;
- else
- throw new RuntimeException((Exception)exception);
- }
- }
-
- _jobMgr.disjoinJob(_job.getId(), joinedJobId);
- }
-
+ throw (ResourceUnavailableException)exception;
+ else
+ throw new RuntimeException((Exception)exception);
+ }
+ }
+
+ _jobMgr.disjoinJob(_job.getId(), joinedJobId);
+ }
+
public void completeJoin(JobInfo.Status joinStatus, String joinResult) {
- assert(_job != null);
+ assert (_job != null);
- _jobMgr.completeJoin(_job.getId(), joinStatus, joinResult);
+ _jobMgr.completeJoin(_job.getId(), joinStatus, joinResult);
}
-
+
public void completeJobAndJoin(JobInfo.Status joinStatus, String joinResult) {
- assert(_job != null);
+ assert (_job != null);
- _jobMgr.completeJoin(_job.getId(), joinStatus, joinResult);
- _jobMgr.completeAsyncJob(_job.getId(), joinStatus, 0, null);
- }
-
- public static AsyncJobExecutionContext getCurrentExecutionContext() {
- AsyncJobExecutionContext context = s_currentExectionContext.get();
- return context;
+ _jobMgr.completeJoin(_job.getId(), joinStatus, joinResult);
+ _jobMgr.completeAsyncJob(_job.getId(), joinStatus, 0, null);
}
+ public static AsyncJobExecutionContext getCurrentExecutionContext() {
+ AsyncJobExecutionContext context = s_currentExectionContext.get();
+ return context;
+ }
+
public static AsyncJobExecutionContext registerPseudoExecutionContext(long accountId, long userId) {
AsyncJobExecutionContext context = s_currentExectionContext.get();
if (context == null) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/433a6319/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
----------------------------------------------------------------------
diff --cc plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index f625eee,ad3adf9..834e26e
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@@ -2044,13 -1957,9 +1958,12 @@@ public class LibvirtComputingResource e
}
public Answer execute(IpAssocCommand cmd) {
- String routerName = cmd
- .getAccessDetail(NetworkElementCommand.ROUTER_NAME);
+ String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
String[] results = new String[cmd.getIpAddresses().length];
+ for (int i = 0; i < results.length; i++) {
+ results[i] = IpAssocAnswer.errorResult;
+ }
Connect conn;
try {
conn = LibvirtConnection.getConnectionByVmName(routerName);
@@@ -2087,13 -1994,15 +1998,12 @@@
}
nicNum = broadcastUriAllocatedToVM.get(ip.getBroadcastUri());
networkUsage(routerIp, "addVif", "eth" + nicNum);
- result = _virtRouterResource.assignPublicIpAddress(routerName,
- routerIp, ip.getPublicIp(), ip.isAdd(), ip.isFirstIP(),
- ip.isSourceNat(), ip.getBroadcastUri(), ip.getVlanGateway(),
- ip.getVlanNetmask(), ip.getVifMacAddress(), nicNum, newNic);
+ result =
+ _virtRouterResource.assignPublicIpAddress(routerName, routerIp, ip.getPublicIp(), ip.isAdd(), ip.isFirstIP(), ip.isSourceNat(), ip.getBroadcastUri(),
+ ip.getVlanGateway(), ip.getVlanNetmask(), ip.getVifMacAddress(), nicNum, newNic);
- if (result != null) {
- results[i++] = IpAssocAnswer.errorResult;
- } else {
+ if (result == null) {
results[i++] = ip.getPublicIp() + " - success";
- ;
}
}
return new IpAssocAnswer(cmd, results);
@@@ -2814,13 -2631,10 +2634,11 @@@
private AttachVolumeAnswer execute(AttachVolumeCommand cmd) {
try {
Connect conn = LibvirtConnection.getConnectionByVmName(cmd.getVmName());
- KVMStoragePool primary = _storagePoolMgr.getStoragePool(
- cmd.getPooltype(),
- cmd.getPoolUuid());
+ KVMStoragePool primary = _storagePoolMgr.getStoragePool(cmd.getPooltype(), cmd.getPoolUuid());
KVMPhysicalDisk disk = primary.getPhysicalDisk(cmd.getVolumePath());
- attachOrDetachDisk(conn, cmd.getAttach(), cmd.getVmName(), disk, cmd.getDeviceId().intValue(), cmd.getBytesReadRate(), cmd.getBytesWriteRate(),
- cmd.getIopsReadRate(), cmd.getIopsWriteRate());
+ attachOrDetachDisk(conn, cmd.getAttach(), cmd.getVmName(), disk,
- cmd.getDeviceId().intValue(), cmd.getBytesReadRate(), cmd.getBytesWriteRate(), cmd.getIopsReadRate(), cmd.getIopsWriteRate(),
- cmd.getCacheMode());
++ cmd.getDeviceId().intValue(), cmd.getBytesReadRate(), cmd.getBytesWriteRate(), cmd.getIopsReadRate(), cmd.getIopsWriteRate(),
++ cmd.getCacheMode());
} catch (LibvirtException e) {
return new AttachVolumeAnswer(cmd, e.toString());
} catch (InternalErrorException e) {
@@@ -3891,9 -3668,8 +3674,9 @@@
return result;
}
- protected synchronized String attachOrDetachDisk(Connect conn, boolean attach, String vmName, KVMPhysicalDisk attachingDisk, int devId, Long bytesReadRate,
- Long bytesWriteRate, Long iopsReadRate, Long iopsWriteRate) throws LibvirtException, InternalErrorException {
+ protected synchronized String attachOrDetachDisk(Connect conn,
- boolean attach, String vmName, KVMPhysicalDisk attachingDisk,
- int devId, Long bytesReadRate, Long bytesWriteRate, Long iopsReadRate, Long iopsWriteRate, String cacheMode) throws LibvirtException, InternalErrorException {
++ boolean attach, String vmName, KVMPhysicalDisk attachingDisk,
++ int devId, Long bytesReadRate, Long bytesWriteRate, Long iopsReadRate, Long iopsWriteRate, String cacheMode) throws LibvirtException, InternalErrorException {
List<DiskDef> disks = null;
Domain dm = null;
DiskDef diskdef = null;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/433a6319/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java
----------------------------------------------------------------------
diff --cc plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java
index d0b0b61,53f7fb0..127f648
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java
@@@ -69,8 -64,7 +64,7 @@@ public class LibvirtDomainXMLParser
String type = disk.getAttribute("type");
DiskDef def = new DiskDef();
if (type.equalsIgnoreCase("network")) {
-- String diskFmtType = getAttrValue("driver", "type", disk);
+ String diskCacheMode = getAttrValue("driver", "cache", disk);
String diskPath = getAttrValue("source", "name", disk);
String protocol = getAttrValue("source", "protocol", disk);
String authUserName = getAttrValue("auth", "username", disk);
@@@ -79,13 -73,10 +73,13 @@@
int port = Integer.parseInt(getAttrValue("host", "port", disk));
String diskLabel = getAttrValue("target", "dev", disk);
String bus = getAttrValue("target", "bus", disk);
- def.defNetworkBasedDisk(diskPath, host, port, authUserName, poolUuid, diskLabel, DiskDef.diskBus.valueOf(bus.toUpperCase()),
+ def.defNetworkBasedDisk(diskPath, host, port, authUserName, poolUuid, diskLabel,
- DiskDef.diskBus.valueOf(bus.toUpperCase()),
- DiskDef.diskProtocol.valueOf(protocol.toUpperCase()));
++ DiskDef.diskBus.valueOf(bus.toUpperCase()),
+ DiskDef.diskProtocol.valueOf(protocol.toUpperCase()));
+ def.setCacheMode(DiskDef.diskCacheMode.valueOf(diskCacheMode));
} else {
String diskFmtType = getAttrValue("driver", "type", disk);
+ String diskCacheMode = getAttrValue("driver", "cache", disk);
String diskFile = getAttrValue("source", "file", disk);
String diskDev = getAttrValue("source", "dev", disk);
@@@ -106,9 -95,7 +98,9 @@@
def.defISODisk(diskFile);
}
} else if (type.equalsIgnoreCase("block")) {
- def.defBlockBasedDisk(diskDev, diskLabel, DiskDef.diskBus.valueOf(bus.toUpperCase()));
+ def.defBlockBasedDisk(diskDev, diskLabel,
- DiskDef.diskBus.valueOf(bus.toUpperCase()));
++ DiskDef.diskBus.valueOf(bus.toUpperCase()));
+ def.setCacheMode(DiskDef.diskCacheMode.valueOf(diskCacheMode));
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/433a6319/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
----------------------------------------------------------------------
diff --cc plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
index 80dbb23,96fad19..49cf1b2
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
@@@ -57,7 -56,7 +56,7 @@@ public class LibvirtVMDef
private String _initrd;
private String _root;
private String _cmdline;
-- private List<bootOrder> _bootdevs = new ArrayList<bootOrder>();
++ private final List<bootOrder> _bootdevs = new ArrayList<bootOrder>();
private String _machine;
public void setGuestType(guestType type) {
@@@ -596,7 -563,7 +581,7 @@@
}
public void setDiskPath(String volPath) {
-- this._sourcePath = volPath;
++ _sourcePath = volPath;
}
public diskBus getBusType() {
@@@ -604,7 -571,7 +589,7 @@@
}
public int getDiskSeq() {
-- char suffix = this._diskLabel.charAt(this._diskLabel.length() - 1);
++ char suffix = _diskLabel.charAt(_diskLabel.length() - 1);
return suffix - 'a';
}
@@@ -637,8 -600,7 +622,8 @@@
}
diskBuilder.append(" type='" + _diskType + "'");
diskBuilder.append(">\n");
- diskBuilder.append("<driver name='qemu'" + " type='" + _diskFmtType + "' cache='none' " + "/>\n");
+ diskBuilder.append("<driver name='qemu'" + " type='" + _diskFmtType
- + "' cache='" + _diskCacheMode + "' " + "/>\n");
++ + "' cache='" + _diskCacheMode + "' " + "/>\n");
if (_diskType == diskType.FILE) {
diskBuilder.append("<source ");
if (_sourcePath != null) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/433a6319/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --cc plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index 69f1b74,b7a0a48..e34d5e1
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@@ -1263,22 -1278,22 +1278,22 @@@ public class VmwareResource implements
// when we dynamically plug in a new NIC into virtual router, it may take time to show up in guest OS
// we use a waiting loop here as a workaround to synchronize activities in systems
long startTick = System.currentTimeMillis();
- while(System.currentTimeMillis() - startTick < 15000) {
- if(result.first()) {
+ while (System.currentTimeMillis() - startTick < 15000) {
+ if (result.first()) {
String[] tokens = result.second().split("\\s+");
- for(String token : tokens) {
- if(!("all".equalsIgnoreCase(token) || "default".equalsIgnoreCase(token) || "lo".equalsIgnoreCase(token))) {
+ for (String token : tokens) {
+ if (!("all".equalsIgnoreCase(token) || "default".equalsIgnoreCase(token) || "lo".equalsIgnoreCase(token))) {
String cmd = String.format("ip address show %s | grep link/ether | sed -e 's/^[ \t]*//' | cut -d' ' -f2", token);
- if(s_logger.isDebugEnabled())
+ if (s_logger.isDebugEnabled())
s_logger.debug("Run domr script " + cmd);
Pair<Boolean, String> result2 = SshHelper.sshExecute(routerIp, DEFAULT_DOMR_SSHPORT, "root", mgr.getSystemVMKeyFile(), null,
- // TODO need to find the dev index inside router based on IP address
- cmd);
- if(s_logger.isDebugEnabled())
- // TODO need to find the dev index inside router based on IP address
++ // TODO need to find the dev index inside router based on IP address
+ cmd);
+ if (s_logger.isDebugEnabled())
s_logger.debug("result: " + result2.first() + ", output: " + result2.second());
- if(result2.first() && result2.second().trim().equalsIgnoreCase(mac.trim()))
+ if (result2.first() && result2.second().trim().equalsIgnoreCase(mac.trim()))
return Integer.parseInt(token.substring(3));
}
}
@@@ -1640,13 -1652,13 +1652,13 @@@
throw new Exception(msg);
}
- /*
+ /*
- if(!isVMWareToolsInstalled(vmMo)){
- String errMsg = "vmware tools is not installed or not running, cannot add nic to vm " + vmName;
- s_logger.debug(errMsg);
- return new PlugNicAnswer(cmd, false, "Unable to execute PlugNicCommand due to " + errMsg);
- }
+ if(!isVMWareToolsInstalled(vmMo)){
+ String errMsg = "vmware tools is not installed or not running, cannot add nic to vm " + vmName;
+ s_logger.debug(errMsg);
+ return new PlugNicAnswer(cmd, false, "Unable to execute PlugNicCommand due to " + errMsg);
+ }
- */
+ */
// TODO need a way to specify the control of NIC device type
VirtualEthernetCardType nicDeviceType = VirtualEthernetCardType.E1000;
@@@ -1721,15 -1734,15 +1734,15 @@@
throw new Exception(msg);
}
- /*
+ /*
- if(!isVMWareToolsInstalled(vmMo)){
- String errMsg = "vmware tools not installed or not running, cannot remove nic from vm " + vmName;
- s_logger.debug(errMsg);
- return new UnPlugNicAnswer(cmd, false, "Unable to execute unPlugNicCommand due to " + errMsg);
- }
+ if(!isVMWareToolsInstalled(vmMo)){
+ String errMsg = "vmware tools not installed or not running, cannot remove nic from vm " + vmName;
+ s_logger.debug(errMsg);
+ return new UnPlugNicAnswer(cmd, false, "Unable to execute unPlugNicCommand due to " + errMsg);
+ }
- */
+ */
VirtualDevice nic = findVirtualNicDevice(vmMo, cmd.getNic().getMac());
- if ( nic == null ) {
+ if (nic == null) {
return new UnPlugNicAnswer(cmd, true, "success");
}
VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec();
@@@ -6524,23 -6507,21 +6507,23 @@@
qSpecs.add(qSpec);
List<PerfEntityMetricBase> values = service.queryPerf(perfMgr, qSpecs);
- for(int i=0; i<values.size(); ++i) {
- List<PerfSampleInfo> infos = ((PerfEntityMetric)values.get(i)).getSampleInfo();
+ for (int i = 0; i < values.size(); ++i) {
+ List<PerfSampleInfo> infos = ((PerfEntityMetric)values.get(i)).getSampleInfo();
- int endMs = infos.get(infos.size() - 1).getTimestamp().getSecond() * 1000 + infos.get(infos.size() - 1).getTimestamp().getMillisecond();
- int beginMs = infos.get(0).getTimestamp().getSecond() * 1000 + infos.get(0).getTimestamp().getMillisecond();
- sampleDuration = (endMs - beginMs) / 1000;
- List<PerfMetricSeries> vals = ((PerfEntityMetric)values.get(i)).getValue();
- for (int vi = 0; ((vals != null) && (vi < vals.size())); ++vi) {
- if (vals.get(vi) instanceof PerfMetricIntSeries) {
- PerfMetricIntSeries val = (PerfMetricIntSeries)vals.get(vi);
- List<Long> perfValues = val.getValue();
- if (vals.get(vi).getId().getCounterId() == rxPerfCounterInfo.getKey()) {
- networkReadKBs = sampleDuration * perfValues.get(3); //get the average RX rate multiplied by sampled duration
- }
- if (vals.get(vi).getId().getCounterId() == txPerfCounterInfo.getKey()) {
- networkWriteKBs = sampleDuration * perfValues.get(3);//get the average TX rate multiplied by sampled duration
+ if (infos != null && infos.size() > 0) {
- int endMs = infos.get(infos.size()-1).getTimestamp().getSecond() * 1000 + infos.get(infos.size()-1).getTimestamp().getMillisecond();
++ int endMs = infos.get(infos.size() - 1).getTimestamp().getSecond() * 1000 + infos.get(infos.size() - 1).getTimestamp().getMillisecond();
+ int beginMs = infos.get(0).getTimestamp().getSecond() * 1000 + infos.get(0).getTimestamp().getMillisecond();
- sampleDuration = (endMs - beginMs) /1000;
++ sampleDuration = (endMs - beginMs) / 1000;
+ List<PerfMetricSeries> vals = ((PerfEntityMetric)values.get(i)).getValue();
- for(int vi = 0; ((vals!= null) && (vi < vals.size())); ++vi){
- if(vals.get(vi) instanceof PerfMetricIntSeries) {
++ for (int vi = 0; ((vals != null) && (vi < vals.size())); ++vi) {
++ if (vals.get(vi) instanceof PerfMetricIntSeries) {
+ PerfMetricIntSeries val = (PerfMetricIntSeries)vals.get(vi);
+ List<Long> perfValues = val.getValue();
+ if (vals.get(vi).getId().getCounterId() == rxPerfCounterInfo.getKey()) {
+ networkReadKBs = sampleDuration * perfValues.get(3); //get the average RX rate multiplied by sampled duration
+ }
+ if (vals.get(vi).getId().getCounterId() == txPerfCounterInfo.getKey()) {
+ networkWriteKBs = sampleDuration * perfValues.get(3);//get the average TX rate multiplied by sampled duration
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/433a6319/pom.xml
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/433a6319/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/433a6319/server/src/com/cloud/api/ApiServer.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/api/ApiServer.java
index 087508c,3eb5382..a752180
--- a/server/src/com/cloud/api/ApiServer.java
+++ b/server/src/com/cloud/api/ApiServer.java
@@@ -160,14 -159,17 +161,18 @@@ public class ApiServer extends ManagerB
public static boolean encodeApiResponse = false;
public static String jsonContentType = "text/javascript";
+ public static String controlCharacters = "[\000-\011\013-\014\016-\037\177]"; // Non-printable ASCII characters - numbers 0 to 31 and 127 decimal
- @Inject ApiDispatcher _dispatcher;
+ @Inject
+ ApiDispatcher _dispatcher;
- @Inject private AccountManager _accountMgr;
- @Inject private DomainManager _domainMgr;
+ @Inject
+ private AccountManager _accountMgr;
+ @Inject
+ private DomainManager _domainMgr;
@Inject
private AsyncJobManager _asyncMgr;
- @Inject private ConfigurationDao _configDao;
+ @Inject
+ private ConfigurationDao _configDao;
@Inject
private EntityManager _entityMgr;
@@@ -348,13 -349,13 +352,14 @@@
if ("command".equalsIgnoreCase(key)) {
continue;
}
- String[] value = (String[]) params.get(key);
+ String[] value = (String[])params.get(key);
// fail if parameter value contains ASCII control (non-printable) characters
if (value[0] != null) {
- String newValue = StringUtils.stripControlCharacters(value[0]);
- if (!newValue.equals(value[0])) {
+ Pattern pattern = Pattern.compile(controlCharacters);
+ Matcher matcher = pattern.matcher(value[0]);
+ if (matcher.find()) {
- throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Received value " + value[0] + " for parameter " + key + " is invalid, contains illegal ASCII non-printable characters");
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Received value " + value[0] + " for parameter " + key +
+ " is invalid, contains illegal ASCII non-printable characters");
}
}
paramMap.put(key, value[0]);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/433a6319/server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/433a6319/server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java
index e925cd1,dd3ccdd..9d81bc4
--- a/server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java
+++ b/server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java
@@@ -34,82 -34,79 +34,82 @@@ import com.cloud.utils.db.GenericDao
public class DiskOfferingJoinVO extends BaseViewVO implements InternalIdentity, Identity {
@Id
- @Column(name="id", updatable=false, nullable = false)
+ @Column(name = "id", updatable = false, nullable = false)
private long id;
- @Column(name="uuid")
+ @Column(name = "uuid")
private String uuid;
- @Column(name="name")
+ @Column(name = "name")
private String name;
- @Column(name="display_text")
+ @Column(name = "display_text")
private String displayText;
- @Column(name="disk_size")
+ @Column(name = "disk_size")
long diskSize;
- @Column(name="tags", length=4096)
+ @Column(name = "tags", length = 4096)
String tags;
- @Column(name="use_local_storage")
+ @Column(name = "use_local_storage")
private boolean useLocalStorage;
- @Column(name="system_use")
+ @Column(name = "system_use")
private boolean systemUse;
- @Column(name="customized")
+ @Column(name = "customized")
private boolean customized;
- @Column(name="customized_iops")
+ @Column(name = "customized_iops")
private Boolean customizedIops;
- @Column(name="min_iops")
+ @Column(name = "min_iops")
private Long minIops;
- @Column(name="max_iops")
+ @Column(name = "max_iops")
private Long maxIops;
- @Column(name="sort_key")
+ @Column(name = "sort_key")
int sortKey;
- @Column(name="bytes_read_rate")
+ @Column(name = "bytes_read_rate")
Long bytesReadRate;
- @Column(name="bytes_write_rate")
+ @Column(name = "bytes_write_rate")
Long bytesWriteRate;
- @Column(name="iops_read_rate")
+ @Column(name = "iops_read_rate")
Long iopsReadRate;
- @Column(name="iops_write_rate")
+ @Column(name = "iops_write_rate")
Long iopsWriteRate;
- @Column(name="cache_mode")
++ @Column(name = "cache_mode")
+ String cacheMode;
+
- @Column(name="type")
+ @Column(name = "type")
Type type;
- @Column(name=GenericDao.CREATED_COLUMN)
+ @Column(name = GenericDao.CREATED_COLUMN)
private Date created;
- @Column(name=GenericDao.REMOVED_COLUMN)
+ @Column(name = GenericDao.REMOVED_COLUMN)
private Date removed;
- @Column(name="domain_id")
+ @Column(name = "domain_id")
private long domainId;
- @Column(name="domain_uuid")
+ @Column(name = "domain_uuid")
private String domainUuid;
- @Column(name="domain_name")
- private String domainName = null;
+ @Column(name = "domain_name")
- private String domainName = null;
++ private final String domainName = null;
- @Column(name="domain_path")
- private String domainPath = null;
+ @Column(name = "domain_path")
- private String domainPath = null;
++ private final String domainPath = null;
- @Column(name="display_offering")
+ @Column(name = "display_offering")
boolean displayOffering;
public DiskOfferingJoinVO() {