diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java b/server/src/com/cloud/network/NetworkServiceImpl.java index cade54f088c..73a35058812 100644 --- a/server/src/com/cloud/network/NetworkServiceImpl.java +++ b/server/src/com/cloud/network/NetworkServiceImpl.java @@ -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()); diff --git a/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java b/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java index 65cf25cd9e5..60424c1af3b 100644 --- a/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java +++ b/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java @@ -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 s3ListTemplate(S3TO s3) {