Skip to content

Commit f82aa97

Browse files
author
Alex Huang
committed
bug 10799: propagate to main
1 parent 99e465f commit f82aa97

3 files changed

Lines changed: 67 additions & 68 deletions

File tree

‎api/src/com/cloud/exception/InsufficientCapacityException.java‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,28 @@
2525
*/
2626
public abstract class InsufficientCapacityException extends Exception {
2727
private static final long serialVersionUID = SerialVersionUID.InsufficientCapacityException;
28-
28+
2929
Long id;
3030
Class<?> scope;
3131

3232
protected InsufficientCapacityException() {
3333
super();
3434
}
35-
35+
3636
public InsufficientCapacityException(String msg, Class<?> scope, Long id) {
3737
super(msg);
3838
this.scope = scope;
3939
this.id = id;
4040
}
41-
41+
4242
/**
4343
* @return scope where we are insufficient. The possible classes are
4444
* Host, StoragePool, Cluster, Pod, DataCenter, NetworkConfiguration.
4545
*/
4646
public Class<?> getScope() {
4747
return scope;
4848
}
49-
49+
5050
/**
5151
* @return the id of the object that it is insufficient in. Note that this method is
5252
* marked such that if the id is not set, then it will throw NullPointerException.
@@ -56,4 +56,9 @@ public Class<?> getScope() {
5656
public long getId() {
5757
return id;
5858
}
59+
60+
@Override public String toString() {
61+
String str = super.toString();
62+
return str + "Scope=" + scope + "; id=" + id;
63+
}
5964
}

‎server/src/com/cloud/configuration/ConfigurationManagerImpl.java‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ protected void checkIfZoneIsDeletable(long zoneId) {
10091009
if (tableName.equals("host_pod_ref") || tableName.equals("host") || tableName.equals("volumes")) {
10101010
selectSql += " AND removed is NULL";
10111011
}
1012-
1012+
10131013
if (tableName.equals("vm_instance")) {
10141014
selectSql += " AND state != '" + VirtualMachine.State.Expunging.toString() + "'";
10151015
}
@@ -1570,7 +1570,7 @@ public ServiceOffering createServiceOffering(CreateServiceOfferingCmd cmd) {
15701570
throw new InvalidParameterValueException("Please specify a valid domain id");
15711571
}
15721572
}
1573-
1573+
15741574
boolean localStorageRequired = false;
15751575
String storageType = cmd.getStorageType();
15761576
if (storageType == null) {
@@ -1608,7 +1608,7 @@ else if (VirtualMachine.Type.DomainRouter.toString().toLowerCase().equals(vm_typ
16081608
vm_type = VirtualMachine.Type.DomainRouter;
16091609
}
16101610
}
1611-
1611+
16121612
return createServiceOffering(userId, cmd.getIsSystem(), vm_type, cmd.getServiceOfferingName(), cpuNumber.intValue(), memory.intValue(), cpuSpeed.intValue(), cmd.getDisplayText(), localStorageRequired, offerHA,
16131613
limitCpuUse, cmd.getTags(), cmd.getDomainId(), cmd.getHostTag());
16141614
}
@@ -1642,7 +1642,7 @@ public ServiceOffering updateServiceOffering(UpdateServiceOfferingCmd cmd) {
16421642

16431643
// Verify input parameters
16441644
ServiceOffering offeringHandle = getServiceOffering(id);
1645-
1645+
16461646
if (offeringHandle == null) {
16471647
throw new InvalidParameterValueException("unable to find service offering " + id);
16481648
}
@@ -1837,7 +1837,7 @@ public boolean deleteServiceOffering(DeleteServiceOfferingCmd cmd) {
18371837
if (offering == null) {
18381838
throw new InvalidParameterValueException("unable to find service offering " + offeringId);
18391839
}
1840-
1840+
18411841
if(offering.getDefaultUse()){
18421842
throw new InvalidParameterValueException("Default service offerings cannot be deleted");
18431843
}
@@ -2182,9 +2182,9 @@ public Vlan createVlanAndPublicIpRange(Long userId, Long zoneId, Long podId, Str
21822182
throw new InvalidParameterValueException("The IP range with tag: " + vlan.getVlanTag() + " in zone " + zone.getName()
21832183
+ " has the same subnet. Please specify a different gateway/netmask.");
21842184
}
2185-
2185+
21862186
boolean vlansUntaggedAndVirtual = (vlanId.equals(Vlan.UNTAGGED) && vlanId.equals(vlan.getVlanTag()) && forVirtualNetwork && vlan.getVlanType() == VlanType.VirtualNetwork);
2187-
2187+
21882188
if (vlansUntaggedAndVirtual && !newVlanSubnet.equals(otherVlanSubnet)) {
21892189
throw new InvalidParameterValueException("The Untagged ip range with different subnet already exists in zone " + zone.getId());
21902190
}
@@ -2400,9 +2400,9 @@ protected boolean savePublicIPRange(String startIP, String endIP, long zoneId, l
24002400
Transaction txn = Transaction.currentTxn();
24012401
txn.start();
24022402
IPRangeConfig config = new IPRangeConfig();
2403-
config.savePublicIPRange(txn, startIPLong, endIPLong, zoneId, vlanDbId, sourceNetworkid);
2403+
List<String> problemIps = config.savePublicIPRange(txn, startIPLong, endIPLong, zoneId, vlanDbId, sourceNetworkid);
24042404
txn.commit();
2405-
return true;
2405+
return problemIps != null && problemIps.size() == 0;
24062406
}
24072407

24082408
@DB
@@ -3152,7 +3152,7 @@ public ServiceOffering getServiceOffering(long serviceOfferingId) {
31523152
if (offering != null && offering.getRemoved() == null) {
31533153
return offering;
31543154
}
3155-
3155+
31563156
return null;
31573157
}
31583158

@@ -3185,14 +3185,14 @@ public Integer getServiceOfferingNetworkRate(long serviceOfferingId) {
31853185

31863186
return networkRate;
31873187
}
3188-
3188+
31893189
@Override
31903190
public DiskOffering getDiskOffering(long diskOfferingId) {
31913191
DiskOfferingVO offering = _diskOfferingDao.findById(diskOfferingId);
31923192
if (offering != null && offering.getRemoved() == null) {
31933193
return offering;
31943194
}
3195-
3195+
31963196
return null;
31973197
}
31983198

0 commit comments

Comments
 (0)