cloudstack-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CLOUDSTACK-10178) Hotfixes to make 4.10 work
Date Mon, 08 Jan 2018 07:35:00 GMT

    [ https://issues.apache.org/jira/browse/CLOUDSTACK-10178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16315784#comment-16315784
] 

ASF GitHub Bot commented on CLOUDSTACK-10178:
---------------------------------------------

bwsw closed pull request #2320: CLOUDSTACK-10178: Hotfixes to make 4.10 work
URL: https://github.com/apache/cloudstack/pull/2320
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/core/src/com/cloud/storage/template/TemplateLocation.java b/core/src/com/cloud/storage/template/TemplateLocation.java
index e52a635dc68..d10d05ae971 100644
--- a/core/src/com/cloud/storage/template/TemplateLocation.java
+++ b/core/src/com/cloud/storage/template/TemplateLocation.java
@@ -26,6 +26,7 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.Properties;
+import java.util.Arrays;
 
 import org.apache.log4j.Logger;
 
@@ -81,12 +82,12 @@ public boolean purge() {
         boolean purged = true;
         String[] files = _storage.listFiles(_templatePath);
         for (String file : files) {
-            boolean r = _storage.delete(file);
-            if (!r) {
+            boolean isRemoved = _storage.delete(file);
+            if (!isRemoved) {
                 purged = false;
             }
             if (s_logger.isDebugEnabled()) {
-                s_logger.debug((r ? "R" : "Unable to r") + "emove " + file);
+                s_logger.debug((isRemoved ? "Removed " : "Unable to remove") + file);
             }
         }
 
@@ -97,43 +98,60 @@ public boolean load() throws IOException {
         try (FileInputStream strm = new FileInputStream(_file);) {
             _props.load(strm);
         } catch (IOException e) {
-            s_logger.warn("Unable to load the template properties", e);
+            s_logger.warn("Unable to load the template properties for '" + _file + "': ",
e);
         }
 
         for (ImageFormat format : ImageFormat.values()) {
-            String ext = _props.getProperty(format.getFileExtension());
+            String currentExtension = format.getFileExtension();
+            String ext = _props.getProperty(currentExtension);
             if (ext != null) {
+                if (s_logger.isDebugEnabled()) {
+                    s_logger.debug("File extension '" + currentExtension + "' was found in
'" + _file + "'.");
+                }
                 FormatInfo info = new FormatInfo();
                 info.format = format;
-                info.filename = _props.getProperty(format.getFileExtension() + ".filename");
+                info.filename = _props.getProperty(currentExtension + ".filename");
                 if (info.filename == null) {
+                    if (s_logger.isDebugEnabled()) {
+                        s_logger.debug("Property '" + currentExtension + ".filename' was
not found in '" + _file + "'. Current format is ignored.");
+                    }
                     continue;
                 }
-                info.size = NumbersUtil.parseLong(_props.getProperty(format.getFileExtension()
+ ".size"), -1);
+                if (s_logger.isDebugEnabled()) {
+                    s_logger.debug("Property '" + currentExtension + ".filename' was found
in '" + _file + "'. Current format will be parsed.");
+                }
+                info.size = NumbersUtil.parseLong(_props.getProperty(currentExtension + ".size"),
-1);
                 _props.setProperty("physicalSize", Long.toString(info.size));
-                info.virtualSize = NumbersUtil.parseLong(_props.getProperty(format.getFileExtension()
+ ".virtualsize"), -1);
+                info.virtualSize = NumbersUtil.parseLong(_props.getProperty(currentExtension
+ ".virtualsize"), -1);
                 _formats.add(info);
 
                 if (!checkFormatValidity(info)) {
                     _isCorrupted = true;
                     s_logger.warn("Cleaning up inconsistent information for " + format);
                 }
+            } else {
+                if (s_logger.isDebugEnabled()) {
+                    s_logger.debug("Format extension '" + currentExtension + "' wasn't found
in '" + _file + "'.");
+                }
             }
         }
 
         if (_props.getProperty("uniquename") == null || _props.getProperty("virtualsize")
== null) {
+            if (s_logger.isDebugEnabled()) {
+                s_logger.debug("Property 'uniquename' or 'virtualsize' weren't found in '"
+ _file + "'. Loading failed.");
+            }
             return false;
         }
-
         return (_formats.size() > 0);
     }
 
     public boolean save() {
         for (FormatInfo info : _formats) {
-            _props.setProperty(info.format.getFileExtension(), "true");
-            _props.setProperty(info.format.getFileExtension() + ".filename", info.filename);
-            _props.setProperty(info.format.getFileExtension() + ".size", Long.toString(info.size));
-            _props.setProperty(info.format.getFileExtension() + ".virtualsize", Long.toString(info.virtualSize));
+            String formatExtension = info.format.getFileExtension();
+            _props.setProperty(formatExtension, "true");
+            _props.setProperty(formatExtension + ".filename", info.filename);
+            _props.setProperty(formatExtension + ".size", Long.toString(info.size));
+            _props.setProperty(formatExtension + ".virtualsize", Long.toString(info.virtualSize));
         }
         try (FileOutputStream strm =  new FileOutputStream(_file);) {
             _props.store(strm, "");
@@ -205,10 +223,11 @@ protected FormatInfo deleteFormat(ImageFormat format) {
             FormatInfo info = it.next();
             if (info.format == format) {
                 it.remove();
-                _props.remove(format.getFileExtension());
-                _props.remove(format.getFileExtension() + ".filename");
-                _props.remove(format.getFileExtension() + ".size");
-                _props.remove(format.getFileExtension() + ".virtualsize");
+                String formatExtension = format.getFileExtension();
+                _props.remove(formatExtension);
+                for(String propertySuffix : Arrays.asList("filename","size","virtualsize"))
{
+                        _props.remove(formatExtension + "." + propertySuffix);
+                }
                 return info;
             }
         }
diff --git a/debian/cloudstack-agent.postinst b/debian/cloudstack-agent.postinst
index 9cb178d4f12..a9b8b687fab 100644
--- a/debian/cloudstack-agent.postinst
+++ b/debian/cloudstack-agent.postinst
@@ -35,6 +35,15 @@ case "$1" in
             done
         fi
 
+        BR_NETFILTER_MODULE=br_netfilter
+        MODULES_FILE=/etc/modules
+        if /sbin/modinfo $BR_NETFILTER_MODULE >/dev/null 2>&1; then
+            /sbin/modprobe $BR_NETFILTER_MODULE
+            if ! grep $BR_NETFILTER_MODULE $MODULES_FILE >/dev/null 2>&1; then
+                echo "$BR_NETFILTER_MODULE" >> $MODULES_FILE
+            fi
+        fi
+
         # Running cloudstack-agent-upgrade to update bridge name for upgrade from CloudStack
4.0.x (and before) to CloudStack 4.1 (and later)
         /usr/bin/cloudstack-agent-upgrade
         if [ ! -d "/etc/libvirt/hooks" ] ; then
diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
index 8cc8de12433..122f550474b 100755
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -2572,9 +2572,7 @@ protected void runInContext() {
             s_logger.trace("VM Operation Thread Running");
             try {
                 _workDao.cleanup(VmOpCleanupWait.value());
-
-                // TODO. hard-coded to one hour after job has been completed
-                final Date cutDate = new Date(new Date().getTime() - 3600000);
+                final Date cutDate = new Date(DateUtil.currentGMTTime().getTime() - VmOpCleanupInterval.value()
* 1000);
                 _workJobDao.expungeCompletedWorkJobs(cutDate);
             } catch (final Exception e) {
                 s_logger.error("VM Operations failed due to ", e);
@@ -2944,7 +2942,7 @@ protected void runInContext() {
             try {
                 scanStalledVMInTransitionStateOnDisconnectedHosts();
 
-                final List<VMInstanceVO> instances = _vmDao.findVMInTransition(new
Date(new Date().getTime() - AgentManager.Wait.value() * 1000), State.Starting, State.Stopping);
+                final List<VMInstanceVO> instances = _vmDao.findVMInTransition(new
Date(DateUtil.currentGMTTime().getTime() - AgentManager.Wait.value() * 1000), State.Starting,
State.Stopping);
                 for (final VMInstanceVO instance : instances) {
                     final State state = instance.getState();
                     if (state == State.Stopping) {
diff --git a/plugins/database/quota/src/org/apache/cloudstack/api/response/QuotaResponseBuilderImpl.java
b/plugins/database/quota/src/org/apache/cloudstack/api/response/QuotaResponseBuilderImpl.java
index 5748de58965..76a68cf7f0e 100644
--- a/plugins/database/quota/src/org/apache/cloudstack/api/response/QuotaResponseBuilderImpl.java
+++ b/plugins/database/quota/src/org/apache/cloudstack/api/response/QuotaResponseBuilderImpl.java
@@ -16,15 +16,22 @@
 //under the License.
 package org.apache.cloudstack.api.response;
 
-import com.cloud.domain.DomainVO;
-import com.cloud.domain.dao.DomainDao;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.user.Account;
-import com.cloud.user.AccountManager;
-import com.cloud.user.AccountVO;
-import com.cloud.user.User;
-import com.cloud.user.dao.AccountDao;
-import com.cloud.user.dao.UserDao;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+import javax.inject.Inject;
 
 import org.apache.cloudstack.api.command.QuotaBalanceCmd;
 import org.apache.cloudstack.api.command.QuotaEmailTemplateListCmd;
@@ -53,24 +60,17 @@
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
-import javax.ejb.Local;
-import javax.inject.Inject;
-
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
+import com.cloud.domain.DomainVO;
+import com.cloud.domain.dao.DomainDao;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.user.Account;
+import com.cloud.user.AccountManager;
+import com.cloud.user.AccountVO;
+import com.cloud.user.User;
+import com.cloud.user.dao.AccountDao;
+import com.cloud.user.dao.UserDao;
 
 @Component
-@Local(value = QuotaResponseBuilderImpl.class)
 public class QuotaResponseBuilderImpl implements QuotaResponseBuilder {
     private static final Logger s_logger = Logger.getLogger(QuotaResponseBuilderImpl.class);
 
@@ -141,7 +141,9 @@ public QuotaTariffResponse createQuotaTariffResponse(QuotaTariffVO tariff)
{
         } else {
             for (final QuotaAccountVO quotaAccount : _quotaAccountDao.listAllQuotaAccount())
{
                 AccountVO account = _accountDao.findById(quotaAccount.getId());
-                if (account == null) continue;
+                if (account == null) {
+                    continue;
+                }
                 QuotaSummaryResponse qr = getQuotaSummaryResponse(account);
                 result.add(qr);
             }
@@ -181,6 +183,7 @@ public QuotaBalanceResponse createQuotaBalanceResponse(List<QuotaBalanceVO>
quot
             throw new InvalidParameterValueException("The request period does not contain
balance entries.");
         }
         Collections.sort(quotaBalance, new Comparator<QuotaBalanceVO>() {
+            @Override
             public int compare(QuotaBalanceVO o1, QuotaBalanceVO o2) {
                 o1 = o1 == null ? new QuotaBalanceVO() : o1;
                 o2 = o2 == null ? new QuotaBalanceVO() : o2;
@@ -287,13 +290,15 @@ public QuotaStatementResponse createQuotaStatementResponse(final List<QuotaUsage
         if (s_logger.isDebugEnabled()) {
             s_logger.debug(
                     "createQuotaStatementResponse Type=" + quotaUsage.get(0).getUsageType()
+ " usage=" + quotaUsage.get(0).getQuotaUsed().setScale(2, RoundingMode.HALF_EVEN)
-                            + " rec.id=" + quotaUsage.get(0).getUsageItemId() + " SD=" +
quotaUsage.get(0).getStartDate() + " ED=" + quotaUsage.get(0).getEndDate());
+                    + " rec.id=" + quotaUsage.get(0).getUsageItemId() + " SD=" + quotaUsage.get(0).getStartDate()
+ " ED=" + quotaUsage.get(0).getEndDate());
         }
 
         Collections.sort(quotaUsage, new Comparator<QuotaUsageVO>() {
+            @Override
             public int compare(QuotaUsageVO o1, QuotaUsageVO o2) {
-                if (o1.getUsageType() == o2.getUsageType())
+                if (o1.getUsageType() == o2.getUsageType()) {
                     return 0;
+                }
                 return o1.getUsageType() < o2.getUsageType() ? -1 : 1;
             }
         });
@@ -508,29 +513,21 @@ public QuotaBalanceResponse createQuotaLastBalanceResponse(List<QuotaBalanceVO>
     public List<QuotaBalanceVO> getQuotaBalance(QuotaBalanceCmd cmd) {
         return _quotaService.findQuotaBalanceVO(cmd.getAccountId(), cmd.getAccountName(),
cmd.getDomainId(), cmd.getStartDate(), cmd.getEndDate());
     }
-
     @Override
-    public Date startOfNextDay(Date dt) {
-        Calendar c = Calendar.getInstance();
-        c.setTime(dt);
-        c.add(Calendar.DATE, 1);
-        c.set(Calendar.HOUR, 0);
-        c.set(Calendar.MINUTE, 0);
-        c.set(Calendar.SECOND, 0);
-        c.set(Calendar.MILLISECOND, 0);
-        return c.getTime();
+    public Date startOfNextDay(Date date) {
+        LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
+        return createDateAtTheStartOfNextDay(localDate);
     }
 
     @Override
     public Date startOfNextDay() {
-        Calendar c = Calendar.getInstance();
-        c.setTime(new Date());
-        c.add(Calendar.DATE, 1);
-        c.set(Calendar.HOUR, 0);
-        c.set(Calendar.MINUTE, 0);
-        c.set(Calendar.SECOND, 0);
-        c.set(Calendar.MILLISECOND, 0);
-        return c.getTime();
+        LocalDate localDate = LocalDate.now();
+        return createDateAtTheStartOfNextDay(localDate);
+    }
+
+    private Date createDateAtTheStartOfNextDay(LocalDate localDate) {
+        LocalDate nextDayLocalDate = localDate.plusDays(1);
+        return Date.from(nextDayLocalDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant());
     }
 
 }
diff --git a/plugins/database/quota/test/org/apache/cloudstack/api/response/QuotaResponseBuilderImplTest.java
b/plugins/database/quota/test/org/apache/cloudstack/api/response/QuotaResponseBuilderImplTest.java
index 4a76052f69f..de961f63b20 100644
--- a/plugins/database/quota/test/org/apache/cloudstack/api/response/QuotaResponseBuilderImplTest.java
+++ b/plugins/database/quota/test/org/apache/cloudstack/api/response/QuotaResponseBuilderImplTest.java
@@ -16,14 +16,17 @@
 // under the License.
 package org.apache.cloudstack.api.response;
 
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.user.Account;
-import com.cloud.user.AccountManager;
-import com.cloud.user.AccountVO;
-import com.cloud.user.dao.AccountDao;
-import com.cloud.user.dao.UserDao;
-import com.cloud.utils.db.TransactionLegacy;
-import junit.framework.TestCase;
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import javax.inject.Inject;
+
 import org.apache.cloudstack.api.command.QuotaEmailTemplateListCmd;
 import org.apache.cloudstack.api.command.QuotaEmailTemplateUpdateCmd;
 import org.apache.cloudstack.quota.QuotaService;
@@ -36,7 +39,7 @@
 import org.apache.cloudstack.quota.vo.QuotaCreditsVO;
 import org.apache.cloudstack.quota.vo.QuotaEmailTemplatesVO;
 import org.apache.cloudstack.quota.vo.QuotaTariffVO;
-import org.joda.time.DateTime;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -44,13 +47,15 @@
 import org.mockito.Mockito;
 import org.mockito.runners.MockitoJUnitRunner;
 
-import java.lang.reflect.Field;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.user.Account;
+import com.cloud.user.AccountManager;
+import com.cloud.user.AccountVO;
+import com.cloud.user.dao.AccountDao;
+import com.cloud.user.dao.UserDao;
+import com.cloud.utils.db.TransactionLegacy;
 
-import javax.inject.Inject;
+import junit.framework.TestCase;
 
 @RunWith(MockitoJUnitRunner.class)
 public class QuotaResponseBuilderImplTest extends TestCase {
@@ -218,13 +223,24 @@ public void testCreateQuotaLastBalanceResponse() {
     }
 
     @Test
-    public void testStartOfNextDay() {
-        DateTime now = new DateTime();
-        DateTime nextDay = new DateTime(quotaResponseBuilder.startOfNextDay(now.toDate()));
-        DateTime nextDay2 = new DateTime(quotaResponseBuilder.startOfNextDay());
-        assertTrue(now.toLocalDate().equals(nextDay.minusDays(1).toLocalDate()));
-        assertTrue(now.toLocalDate().equals(nextDay2.minusDays(1).toLocalDate()));
+    public void testStartOfNextDayWithoutParameters() {
+        Date nextDate = quotaResponseBuilder.startOfNextDay();
+
+        LocalDateTime tomorrowAtStartOfTheDay = LocalDate.now().atStartOfDay().plusDays(1);
+        Date expectedNextDate = Date.from(tomorrowAtStartOfTheDay.atZone(ZoneId.systemDefault()).toInstant());
+
+        Assert.assertEquals(expectedNextDate, nextDate);
     }
 
+    @Test
+    public void testStartOfNextDayWithParameter() {
+        Date anyDate = new Date(1242421545757532l);
+
+        Date nextDayDate = quotaResponseBuilder.startOfNextDay(anyDate);
 
+        LocalDateTime nextDayLocalDateTimeAtStartOfTheDay = anyDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate().plusDays(1).atStartOfDay();
+        Date expectedNextDate = Date.from(nextDayLocalDateTimeAtStartOfTheDay.atZone(ZoneId.systemDefault()).toInstant());
+
+        Assert.assertEquals(expectedNextDate, nextDayDate);
+    }
 }
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index 58db46609cf..7075bb505a3 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -3419,7 +3419,9 @@ public boolean addNetworkRules(final String vmName, final String vmId,
final Str
         cmd.add("--vmname", vmName);
         cmd.add("--vmid", vmId);
         cmd.add("--vmip", guestIP);
-        cmd.add("--vmip6", guestIP6);
+        if (guestIP6 != null) {
+            cmd.add("--vmip6", guestIP6);
+        }
         cmd.add("--sig", sig);
         cmd.add("--seq", seq);
         cmd.add("--vmmac", mac);
diff --git a/scripts/vm/network/security_group.py b/scripts/vm/network/security_group.py
index d95e35ddfad..e448dcb8ece 100755
--- a/scripts/vm/network/security_group.py
+++ b/scripts/vm/network/security_group.py
@@ -38,8 +38,11 @@
 bash = Command("/bin/bash")
 ebtables = Command("ebtables")
 driver = "qemu:///system"
+br_netfilter_module = "br_netfilter"
+
 cfo = configFileOps("/etc/cloudstack/agent/agent.properties")
 hyper = cfo.getEntry("hypervisor.type")
+
 if hyper == "lxc":
     driver = "lxc:///"
 
@@ -61,6 +64,15 @@ def execute(cmd):
     logging.debug(cmd)
     return bash("-c", cmd).stdout
 
+def load_kernel_module(module_name):
+    module_proc_file = "/proc/modules"
+    idx = execute("grep -E '^%s' %s | cut -f1 -d' '" % (module_name, module_proc_file)).find(module_name)
+    if idx == -1:
+        logging.debug("Module %s is absent. Load it." % (module_name))
+        execute("modprobe %s" % (module_name))
+    else:
+        logging.debug("Module %s is loaded. Skip loading." % (module_name,))
+
 def can_bridge_firewall(privnic):
     try:
         execute("which iptables")
@@ -1039,21 +1051,27 @@ def add_network_rules(vm_name, vm_id, vm_ip, vm_ip6, signature, seqno,
vmMac, ru
                 range = 'any'
 
         for ip in rule['ipv4']:
-            if protocol == 'all':
-                execute('iptables -I ' + vmchain + ' -m state --state NEW ' + direction +
' ' + ip + ' -j ' + action)
-            elif protocol != 'icmp':
-                execute('iptables -I ' + vmchain + ' -p ' + protocol + ' -m ' + protocol
+ ' --dport ' + range + ' -m state --state NEW ' + direction + ' ' + ip + ' -j ' + action)
-            else:
-                execute('iptables -I ' + vmchain + ' -p icmp --icmp-type ' + range + ' '
+ direction + ' ' + ip + ' -j ' + action)
-
+            try:
+                if protocol == 'all':
+                    execute('iptables -I ' + vmchain + ' -m state --state NEW ' + direction
+ ' ' + ip + ' -j ' + action)
+                elif protocol != 'icmp':
+                    execute('iptables -I ' + vmchain + ' -p ' + protocol + ' -m ' + protocol
+ ' --dport ' + range + ' -m state --state NEW ' + direction + ' ' + ip + ' -j ' + action)
+                else:
+                    execute('iptables -I ' + vmchain + ' -p icmp --icmp-type ' + range +
' ' + direction + ' ' + ip + ' -j ' + action)
+            except:
+                pass
+                    
         for ip in rule['ipv6']:
-            if protocol == 'all':
-                execute('ip6tables -I ' + vmchain + ' -m state --state NEW ' + direction
+ ' ' + ip + ' -j ' + action)
-            elif 'icmp' != protocol:
-                execute('ip6tables -I ' + vmchain + ' -p ' + protocol + ' -m ' + protocol
+ ' --dport ' + range + ' -m state --state NEW ' + direction + ' ' + ip + ' -j ' + action)
-            else:
-                execute('ip6tables -I ' + vmchain + ' -p icmpv6 --icmpv6-type ' + range +
' ' + direction + ' ' + ip + ' -j ' + action)
-
+            try:
+                if protocol == 'all':
+                    execute('ip6tables -I ' + vmchain + ' -m state --state NEW ' + direction
+ ' ' + ip + ' -j ' + action)
+                elif 'icmp' != protocol:
+                    execute('ip6tables -I ' + vmchain + ' -p ' + protocol + ' -m ' + protocol
+ ' --dport ' + range + ' -m state --state NEW ' + direction + ' ' + ip + ' -j ' + action)
+                else:
+                    execute('ip6tables -I ' + vmchain + ' -p icmpv6 --icmpv6-type ' + range
+ ' ' + direction + ' ' + ip + ' -j ' + action)
+            except:
+                pass
+                    
     egress_vmchain = egress_chain_name(vm_name)
     if egressrule_v4 == 0 :
         execute('iptables -A ' + egress_vmchain + ' -j RETURN')
@@ -1145,8 +1163,13 @@ def getBrfw(brname):
         brfwname = "BF-" + brname
     return brfwname
 
+
 def addFWFramework(brname):
     try:
+        # Check if br_netfilter module is present. Further sysctl ops require it online.
+        # Load if absent
+        load_kernel_module(br_netfilter_module)
+
         execute("sysctl -w net.bridge.bridge-nf-call-arptables=1")
         execute("sysctl -w net.bridge.bridge-nf-call-iptables=1")
         execute("sysctl -w net.bridge.bridge-nf-call-ip6tables=1")
diff --git a/server/src/com/cloud/test/DatabaseConfig.java b/server/src/com/cloud/test/DatabaseConfig.java
index a27f6710631..b60a48c35d0 100644
--- a/server/src/com/cloud/test/DatabaseConfig.java
+++ b/server/src/com/cloud/test/DatabaseConfig.java
@@ -54,6 +54,7 @@
 import com.cloud.storage.DiskOfferingVO;
 import com.cloud.storage.dao.DiskOfferingDaoImpl;
 import com.cloud.storage.Storage.ProvisioningType;
+import com.cloud.utils.DateUtil;
 import com.cloud.utils.PropertiesUtil;
 import com.cloud.utils.component.ComponentContext;
 import com.cloud.utils.db.DB;
@@ -641,7 +642,7 @@ public void saveStoragePool() {
             stmt.setLong(8, 0);
             stmt.setString(9, hostAddress);
             stmt.setString(10, hostPath);
-            stmt.setDate(11, new Date(new java.util.Date().getTime()));
+            stmt.setDate(11, new Date(DateUtil.currentGMTTime().getTime()));
             stmt.setLong(12, podId);
             stmt.setString(13, Status.Up.toString());
             stmt.setLong(14, clusterId);
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 60424c1af3b..5c6847b2044 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
@@ -460,7 +460,7 @@ protected Answer copySnapshotToTemplateFromNfsToNfsXenserver(CopyCommand
cmd, Sn
             FormatInfo info = processor.process(destPath, null, templateUuid);
 
             TemplateLocation loc = new TemplateLocation(_storage, destPath);
-            loc.create(1, true, templateUuid);
+            loc.create(destData.getId(), true, templateUuid);
             loc.addFormat(info);
             loc.save();
             TemplateProp prop = loc.getTemplateInfo();
@@ -522,10 +522,8 @@ protected Answer copySnapshotToTemplateFromNfsToNfs(CopyCommand cmd,
SnapshotObj
                     bufferWriter.write("uniquename=" + destData.getName());
                     bufferWriter.write("\n");
                     bufferWriter.write("filename=" + fileName);
-                    bufferWriter.write("\n");
-                    long size = _storage.getSize(destFileFullPath);
-                    bufferWriter.write("size=" + size);
-
+                }
+                try {
                     /**
                      * Snapshots might be in either QCOW2 or RAW image format
                      *
@@ -548,7 +546,7 @@ protected Answer copySnapshotToTemplateFromNfsToNfs(CopyCommand cmd, SnapshotObj
 
                     FormatInfo info = processor.process(destPath, null, templateName);
                     TemplateLocation loc = new TemplateLocation(_storage, destPath);
-                    loc.create(1, true, destData.getName());
+                    loc.create(destData.getId(), true, destData.getName());
                     loc.addFormat(info);
                     loc.save();
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Hotfixes to make 4.10 work
> --------------------------
>
>                 Key: CLOUDSTACK-10178
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10178
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the default.) 
>            Reporter: Ivan Kudryavtsev
>
> # Fixes absent IPv6 network definition bugs for basic zone which lead to exceptions on
KVM agent if it uses SGs (management and agent affected)
> # Fixes the case when template is created from a snapshot (CLOUDSTACK-10140, merged https://github.com/apache/cloudstack/pull/2322)
> # Fixes ubuntu/debian br_netfilter dependency (CLOUDSTACK-10138, merged CLOUDSTACK-10138:
Load br_netfilter in security_group management script)
> # Fixes quota plugin bug (https://github.com/apache/cloudstack/pull/2326)



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message