From 79f4177212c7d0ac09887fea2ae9f1e2e2820412 Mon Sep 17 00:00:00 2001 From: Syed Date: Fri, 9 Dec 2016 15:48:08 -0500 Subject: [PATCH 1/2] CLOUDSTACK-9628: Use correct virtualsize with Swift as secondary storage --- .../resource/NfsSecondaryStorageResource.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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 420842f2290..b38e0b72b64 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 @@ -1585,19 +1585,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) @@ -1615,7 +1624,6 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S } } return tmpltInfos; - } Map s3ListTemplate(S3TO s3) { From 0f054246b65d003ae7f024b6ef125b2ec1846879 Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Thu, 16 Feb 2017 14:18:56 +0100 Subject: [PATCH 2/2] CLOUDSTACK-9789: Fix releasing secondary guest IP fails with associated static nat which is actually not used --- server/src/com/cloud/network/NetworkServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java b/server/src/com/cloud/network/NetworkServiceImpl.java index b6dac872f30..e77b40e1818 100644 --- a/server/src/com/cloud/network/NetworkServiceImpl.java +++ b/server/src/com/cloud/network/NetworkServiceImpl.java @@ -835,7 +835,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());