Skip to content

Commit bb274a1

Browse files
committed
Merge release branch 4.9 to master
* 4.9: CLOUDSTACK-9789: Fix releasing secondary guest IP fails with associated static nat which is actually not used CLOUDSTACK-9628: Use correct virtualsize with Swift as secondary storage
2 parents 87f1104 + c6f0ba7 commit bb274a1

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

server/src/com/cloud/network/NetworkServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ public boolean releaseSecondaryIpFromNic(long ipAddressId) {
846846
}
847847
}
848848
//check if the secondary ip associated with any static nat rule
849-
IPAddressVO publicIpVO = _ipAddressDao.findByVmIp(secondaryIp);
849+
IPAddressVO publicIpVO = _ipAddressDao.findByIpAndNetworkId(secIpVO.getNetworkId(), secondaryIp);
850850
if (publicIpVO != null) {
851851
s_logger.debug("VM nic IP " + secondaryIp + " is associated with the static NAT rule public IP address id " + publicIpVO.getId());
852852
throw new InvalidParameterValueException("Can' remove the ip " + secondaryIp + "is associate with static NAT rule public IP address id " + publicIpVO.getId());

services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,19 +1599,28 @@ Map<String, TemplateProp> swiftListTemplate(SwiftTO swift) {
15991599
String line = null;
16001600
String uniqName = null;
16011601
Long size = null;
1602+
Long physicalSize = null;
16021603
String name = null;
16031604
while ((line = brf.readLine()) != null) {
16041605
if (line.startsWith("uniquename=")) {
16051606
uniqName = line.split("=")[1];
16061607
} else if (line.startsWith("size=")) {
1608+
physicalSize = Long.parseLong(line.split("=")[1]);
1609+
} else if (line.startsWith("virtualsize=")){
16071610
size = Long.parseLong(line.split("=")[1]);
16081611
} else if (line.startsWith("filename=")) {
16091612
name = line.split("=")[1];
16101613
}
16111614
}
1615+
1616+
//fallback
1617+
if (size == null) {
1618+
size = physicalSize;
1619+
}
1620+
16121621
tempFile.delete();
16131622
if (uniqName != null) {
1614-
TemplateProp prop = new TemplateProp(uniqName, container + File.separator + name, size, size, true, false);
1623+
TemplateProp prop = new TemplateProp(uniqName, container + File.separator + name, size, physicalSize, true, false);
16151624
tmpltInfos.put(uniqName, prop);
16161625
}
16171626
} catch (IOException ex)
@@ -1629,7 +1638,6 @@ Map<String, TemplateProp> swiftListTemplate(SwiftTO swift) {
16291638
}
16301639
}
16311640
return tmpltInfos;
1632-
16331641
}
16341642

16351643
Map<String, TemplateProp> s3ListTemplate(S3TO s3) {

0 commit comments

Comments
 (0)