From e76266e39bc1396880caa86f5e232ef4538e3f5a Mon Sep 17 00:00:00 2001 From: ustcweizhou Date: Wed, 26 Jun 2019 12:56:05 +0200 Subject: [PATCH 1/2] systemvm: Fix hostname is localhost in some VRs (#3422) In some virtual routers, 'hostname -f' returns 'localhost'. The hostname is also 'localhost' in `/var/log/messages`. This change can fix the issue in new VRs. --- systemvm/debian/opt/cloud/bin/cs/CsDhcp.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/systemvm/debian/opt/cloud/bin/cs/CsDhcp.py b/systemvm/debian/opt/cloud/bin/cs/CsDhcp.py index e7abb902046..56b44195f6d 100755 --- a/systemvm/debian/opt/cloud/bin/cs/CsDhcp.py +++ b/systemvm/debian/opt/cloud/bin/cs/CsDhcp.py @@ -139,7 +139,8 @@ class CsDhcp(CsDataBag): logging.error("Caught error while trying to delete entries from dnsmasq.leases file: %s" % e) def preseed(self): - self.add_host("127.0.0.1", "localhost %s" % CsHelper.get_hostname()) + self.add_host("127.0.0.1", "localhost") + self.add_host("127.0.1.1", "%s" % CsHelper.get_hostname()) self.add_host("::1", "localhost ip6-localhost ip6-loopback") self.add_host("ff02::1", "ip6-allnodes") self.add_host("ff02::2", "ip6-allrouters") From 240878335570edb8fed657e92f74500109b4bc0a Mon Sep 17 00:00:00 2001 From: ustcweizhou Date: Wed, 26 Jun 2019 12:57:07 +0200 Subject: [PATCH 2/2] ssvm: use secstorage.ssl.cert.domain as hostname if it does not start with '*' when upload a template or volume from local (#3420) If secstorage.ssl.cert.domain does not start with '*', we should use it as host name in url when upload template/volume from local Fixes #3305 --- .../apache/cloudstack/utils/imagestore/ImageStoreUtil.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utils/src/main/java/org/apache/cloudstack/utils/imagestore/ImageStoreUtil.java b/utils/src/main/java/org/apache/cloudstack/utils/imagestore/ImageStoreUtil.java index e754a8e1d52..f87669b4bf5 100644 --- a/utils/src/main/java/org/apache/cloudstack/utils/imagestore/ImageStoreUtil.java +++ b/utils/src/main/java/org/apache/cloudstack/utils/imagestore/ImageStoreUtil.java @@ -30,9 +30,11 @@ public class ImageStoreUtil { //if ssvm url domain is present, use it to construct hostname in the format 1-2-3-4.domain // if the domain name is not present, ssl validation fails and has to be ignored - if(StringUtils.isNotBlank(ssvmUrlDomain)) { + if(StringUtils.isNotBlank(ssvmUrlDomain) && ssvmUrlDomain.startsWith("*")) { hostname = ipAddress.replace(".", "-"); hostname = hostname + ssvmUrlDomain.substring(1); + } else if (StringUtils.isNotBlank(ssvmUrlDomain)) { + hostname = ssvmUrlDomain; } //only https works with postupload and url format is fixed