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
This commit is contained in:
Rajani Karuturi 2017-02-23 06:07:52 +05:30
commit bb274a1865
2 changed files with 11 additions and 3 deletions

View File

@ -846,7 +846,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
}
}
//check if the secondary ip associated with any static nat rule
IPAddressVO publicIpVO = _ipAddressDao.findByVmIp(secondaryIp);
IPAddressVO publicIpVO = _ipAddressDao.findByIpAndNetworkId(secIpVO.getNetworkId(), secondaryIp);
if (publicIpVO != null) {
s_logger.debug("VM nic IP " + secondaryIp + " is associated with the static NAT rule public IP address id " + publicIpVO.getId());
throw new InvalidParameterValueException("Can' remove the ip " + secondaryIp + "is associate with static NAT rule public IP address id " + publicIpVO.getId());

View File

@ -1599,19 +1599,28 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
String line = null;
String uniqName = null;
Long size = null;
Long physicalSize = null;
String name = null;
while ((line = brf.readLine()) != null) {
if (line.startsWith("uniquename=")) {
uniqName = line.split("=")[1];
} else if (line.startsWith("size=")) {
physicalSize = Long.parseLong(line.split("=")[1]);
} else if (line.startsWith("virtualsize=")){
size = Long.parseLong(line.split("=")[1]);
} else if (line.startsWith("filename=")) {
name = line.split("=")[1];
}
}
//fallback
if (size == null) {
size = physicalSize;
}
tempFile.delete();
if (uniqName != null) {
TemplateProp prop = new TemplateProp(uniqName, container + File.separator + name, size, size, true, false);
TemplateProp prop = new TemplateProp(uniqName, container + File.separator + name, size, physicalSize, true, false);
tmpltInfos.put(uniqName, prop);
}
} catch (IOException ex)
@ -1629,7 +1638,6 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
}
}
return tmpltInfos;
}
Map<String, TemplateProp> s3ListTemplate(S3TO s3) {