cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [cloudstack] 01/01: Merge branch '4.9' into 4.10
Date Fri, 28 Jul 2017 09:26:58 GMT
This is an automated email from the ASF dual-hosted git repository.

bhaisaab pushed a commit to branch 4.10
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit e9f526e221480ea783f704db947fa030c40a9578
Merge: c1f30d9 0ead11e
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
AuthorDate: Fri Jul 28 10:47:47 2017 +0200

    Merge branch '4.9' into 4.10
    
    Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

 agent/conf/agent.properties                        |  4 ++
 .../affinitygroup/UpdateVMAffinityGroupCmd.java    | 12 +++--
 .../virtualnetwork/VirtualRoutingResource.java     |  9 ++--
 .../network/guru/NuageVspGuestNetworkGuru.java     | 36 +++++++-------
 .../src/com/cloud/util/NuageVspEntityBuilder.java  | 56 +++++++++++++++-------
 .../com/cloud/util/NuageVspEntityBuilderTest.java  | 33 ++++++-------
 server/src/com/cloud/server/StatsCollector.java    |  4 +-
 systemvm/patches/debian/config/etc/vpcdnsmasq.conf |  2 +-
 test/integration/component/test_affinity_groups.py | 27 ++++++++++-
 9 files changed, 121 insertions(+), 62 deletions(-)

diff --cc agent/conf/agent.properties
index c15b78e,8b99ee3..3ed382a
--- a/agent/conf/agent.properties
+++ b/agent/conf/agent.properties
@@@ -158,21 -153,6 +158,25 @@@ hypervisor.type=kv
  # Some newer linux kernels are incapable of reliably migrating vms with kvmclock
  # This is a workaround for the bug, admin can set this to true per-host
  #
 -#router.aggregation.command.each.timeout=600
 -#timeout value for aggregation commands send to virtual router
 +# vm.rng.enable=false
 +# This enabled the VirtIO Random Number Generator device for guests.
 +#
 +# vm.rng.model=random
 +# The model of VirtIO Random Number Generator (RNG) to present to the Guest.
 +# Currently only 'random' is supported.
 +#
 +# vm.rng.path=/dev/random
 +# Local Random Number Device Generator to use for VirtIO RNG for Guests.
 +# This is usually /dev/random, but per platform this might be different
 +#
 +# vm.rng.rate.bytes=2048
 +# The amount of bytes the Guest may request/obtain from the RNG in the period
 +# specified below.
 +#
 +# vm.rng.rate.period=1000
 +# The number of milliseconds in which the guest is allowed to obtain the bytes
 +# specified above.
++
++# router.aggregation.command.each.timeout=600
++# timeout value for aggregation commands send to virtual router
+ #
diff --cc core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
index 1ea007e,e424bac..75f55f9
--- a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
+++ b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
@@@ -387,11 -390,11 +390,11 @@@ public class VirtualRoutingResource 
                  ScriptConfigItem scriptConfigItem = new ScriptConfigItem(VRScripts.VR_CFG,
"-c " + VRScripts.CONFIG_CACHE_LOCATION + cfgFileName);
                  // 120s is the minimal timeout
                  Duration timeout = _eachTimeout.withDurationAdded(_eachTimeout.getStandardSeconds(),
answerCounts);
-                 if (timeout.isShorterThan(VRScripts.VR_SCRIPT_EXEC_TIMEOUT)) {
-                     timeout = VRScripts.VR_SCRIPT_EXEC_TIMEOUT;
+                 if (s_logger.isDebugEnabled()){
+                     s_logger.debug("Aggregate action timeout in seconds is " + timeout.getStandardSeconds());
                  }
  
 -                ExecutionResult result = applyConfigToVR(cmd.getRouterAccessIp(), fileConfigItem);
 +                ExecutionResult result = applyConfigToVR(cmd.getRouterAccessIp(), fileConfigItem,
timeout);
                  if (!result.isSuccess()) {
                      return new Answer(cmd, false, result.getDetails());
                  }
diff --cc plugins/network-elements/nuage-vsp/src/com/cloud/network/guru/NuageVspGuestNetworkGuru.java
index 80f6aab,d99c71d..735356a
--- a/plugins/network-elements/nuage-vsp/src/com/cloud/network/guru/NuageVspGuestNetworkGuru.java
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/guru/NuageVspGuestNetworkGuru.java
@@@ -25,25 -23,17 +25,9 @@@ import java.util.Set
  
  import javax.inject.Inject;
  
- import com.google.common.collect.FluentIterable;
- import net.nuage.vsp.acs.client.api.model.VspDhcpDomainOption;
- import net.nuage.vsp.acs.client.api.model.VspDhcpVMOption;
- import net.nuage.vsp.acs.client.api.model.VspDomain;
--import net.nuage.vsp.acs.client.api.model.VspNetwork;
--import net.nuage.vsp.acs.client.api.model.VspNic;
--import net.nuage.vsp.acs.client.api.model.VspStaticNat;
--import net.nuage.vsp.acs.client.api.model.VspVm;
--
--import org.apache.log4j.Logger;
--
--import com.google.common.base.Strings;
- import com.google.common.collect.Iterables;
- import com.google.common.collect.LinkedListMultimap;
- import com.google.common.collect.Lists;
- import com.google.common.collect.Maps;
--
  import org.apache.cloudstack.resourcedetail.VpcDetailVO;
  import org.apache.cloudstack.resourcedetail.dao.VpcDetailsDao;
++import org.apache.log4j.Logger;
  
  import com.cloud.agent.AgentManager;
  import com.cloud.agent.api.Answer;
@@@ -94,10 -82,7 +78,24 @@@ import com.cloud.vm.Nic
  import com.cloud.vm.NicProfile;
  import com.cloud.vm.NicVO;
  import com.cloud.vm.ReservationContext;
 +import com.cloud.vm.VMInstanceVO;
 +import com.cloud.vm.VirtualMachine;
  import com.cloud.vm.VirtualMachineProfile;
 +import com.cloud.vm.dao.VMInstanceDao;
++import com.google.common.base.Strings;
++import com.google.common.collect.FluentIterable;
++import com.google.common.collect.Iterables;
++import com.google.common.collect.LinkedListMultimap;
++import com.google.common.collect.Lists;
++import com.google.common.collect.Maps;
++
++import net.nuage.vsp.acs.client.api.model.VspDhcpDomainOption;
++import net.nuage.vsp.acs.client.api.model.VspDhcpVMOption;
++import net.nuage.vsp.acs.client.api.model.VspDomain;
++import net.nuage.vsp.acs.client.api.model.VspNetwork;
++import net.nuage.vsp.acs.client.api.model.VspNic;
++import net.nuage.vsp.acs.client.api.model.VspStaticNat;
++import net.nuage.vsp.acs.client.api.model.VspVm;
  
  public class NuageVspGuestNetworkGuru extends GuestNetworkGuru {
      public static final Logger s_logger = Logger.getLogger(NuageVspGuestNetworkGuru.class);
@@@ -335,12 -261,11 +333,12 @@@
              VspStaticNat vspStaticNat = null;
              if (staticNatIp != null) {
                  VlanVO staticNatVlan = _vlanDao.findById(staticNatIp.getVlanId());
-                 vspStaticNat = _nuageVspEntityBuilder.buildVspStaticNat(null, staticNatIp,
staticNatVlan, null);
+                 vspStaticNat = _nuageVspEntityBuilder.buildVspStaticNat(null, staticNatIp,
staticNatVlan, vspNic);
              }
  
 -            HostVO nuageVspHost = getNuageVspHost(network.getPhysicalNetworkId());
 -            ReserveVmInterfaceVspCommand cmd = new ReserveVmInterfaceVspCommand(vspNetwork,
vspVm, vspNic, vspStaticNat);
 +            boolean defaultHasDns = getDefaultHasDns(networkHasDnsCache, nicFromDb);
 +            VspDhcpVMOption dhcpOption = _nuageVspEntityBuilder.buildVmDhcpOption(nicFromDb,
defaultHasDns, networkHasDns);
 +            ReserveVmInterfaceVspCommand cmd = new ReserveVmInterfaceVspCommand(vspNetwork,
vspVm, vspNic, vspStaticNat, dhcpOption);
              Answer answer = _agentMgr.easySend(nuageVspHost.getId(), cmd);
  
              if (answer == null || !answer.getResult()) {
@@@ -563,36 -396,16 +561,36 @@@
          return super.trash(network, offering);
      }
  
 -    private HostVO getNuageVspHost(long physicalNetworkId) {
 -        HostVO nuageVspHost;
 -        List<NuageVspDeviceVO> nuageVspDevices = _nuageVspDao.listByPhysicalNetwork(physicalNetworkId);
 -        if (nuageVspDevices != null && (!nuageVspDevices.isEmpty())) {
 -            NuageVspDeviceVO config = nuageVspDevices.iterator().next();
 -            nuageVspHost = _hostDao.findById(config.getHostId());
 -            _hostDao.loadDetails(nuageVspHost);
 -        } else {
 -            throw new CloudRuntimeException("There is no Nuage VSP device configured on
physical network " + physicalNetworkId);
 +    private boolean networkHasDns(Network network) {
 +
 +        if (network != null) {
 +            List<String> dnsProviders = _ntwkOfferingSrvcDao.listProvidersForServiceForNetworkOffering(network.getNetworkOfferingId(),
Network.Service.Dns);
 +            return dnsProviders.contains(Network.Provider.VirtualRouter.getName())
 +                || dnsProviders.contains(Network.Provider.VPCVirtualRouter.getName());
 +
          }
 -        return nuageVspHost;
 +
 +        return false;
      }
 -}
 +
 +    private boolean getDefaultHasDns(Map<Long, Boolean> cache, Nic nic) {
 +        Long networkId = nic.isDefaultNic()
 +                ? Long.valueOf(nic.getNetworkId())
 +                : getDefaultNetwork(nic.getInstanceId());
 +
 +        Boolean hasDns = cache.get(networkId);
 +        if (hasDns == null) {
 +            hasDns = networkHasDns(_networkDao.findById(networkId));
 +            cache.put(networkId, hasDns);
 +        }
 +        return hasDns;
 +    }
 +
 +    private Long getDefaultNetwork(long vmId) {
 +        NicVO defaultNic = _nicDao.findDefaultNicForVM(vmId);
 +        if (defaultNic != null) return defaultNic.getNetworkId();
 +        return  null;
 +    }
 +
 +
- }
++}
diff --cc plugins/network-elements/nuage-vsp/src/com/cloud/util/NuageVspEntityBuilder.java
index 84afa29,db24050..4e6ccb3
--- a/plugins/network-elements/nuage-vsp/src/com/cloud/util/NuageVspEntityBuilder.java
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/util/NuageVspEntityBuilder.java
@@@ -19,10 -19,32 +19,24 @@@
  
  package com.cloud.util;
  
+ import java.util.HashSet;
+ import java.util.Iterator;
+ import java.util.List;
++import java.util.Map;
+ import java.util.Set;
+ import java.util.TreeSet;
+ 
++import javax.annotation.Nullable;
+ import javax.inject.Inject;
+ 
 -import net.nuage.vsp.acs.client.api.model.VspAclRule;
 -import net.nuage.vsp.acs.client.api.model.VspDomain;
 -import net.nuage.vsp.acs.client.api.model.VspNetwork;
 -import net.nuage.vsp.acs.client.api.model.VspNic;
 -import net.nuage.vsp.acs.client.api.model.VspStaticNat;
 -import net.nuage.vsp.acs.client.api.model.VspVm;
 -import net.nuage.vsp.acs.client.common.model.Pair;
 -
++import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+ import org.apache.commons.lang.StringUtils;
+ import org.apache.log4j.Logger;
+ 
 -import com.google.common.collect.Iterables;
 -import com.google.common.collect.Lists;
 -
 -import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 -
 +import com.cloud.dc.Vlan;
  import com.cloud.dc.VlanVO;
  import com.cloud.dc.dao.VlanDao;
 +import com.cloud.dc.dao.VlanDetailsDao;
  import com.cloud.domain.Domain;
  import com.cloud.domain.DomainVO;
  import com.cloud.domain.dao.DomainDao;
@@@ -49,37 -67,7 +63,26 @@@ import com.cloud.utils.exception.CloudR
  import com.cloud.utils.net.NetUtils;
  import com.cloud.vm.NicProfile;
  import com.cloud.vm.NicVO;
 +import com.cloud.vm.VMInstanceVO;
  import com.cloud.vm.VirtualMachine;
 +import com.cloud.vm.dao.VMInstanceDao;
 +import com.google.common.base.Function;
 +import com.google.common.base.Predicate;
 +import com.google.common.collect.Iterables;
 +import com.google.common.collect.Lists;
 +import com.google.common.collect.Maps;
++
 +import net.nuage.vsp.acs.client.api.model.VspAclRule;
- import net.nuage.vsp.acs.client.api.model.VspDhcpDomainOption;
 +import net.nuage.vsp.acs.client.api.model.VspAddressRange;
++import net.nuage.vsp.acs.client.api.model.VspDhcpDomainOption;
 +import net.nuage.vsp.acs.client.api.model.VspDhcpVMOption;
 +import net.nuage.vsp.acs.client.api.model.VspDomain;
 +import net.nuage.vsp.acs.client.api.model.VspDomainCleanUp;
 +import net.nuage.vsp.acs.client.api.model.VspNetwork;
 +import net.nuage.vsp.acs.client.api.model.VspNic;
 +import net.nuage.vsp.acs.client.api.model.VspStaticNat;
 +import net.nuage.vsp.acs.client.api.model.VspVm;
 +import net.nuage.vsp.acs.client.common.model.Pair;
- import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
- import org.apache.commons.lang.StringUtils;
- import org.apache.log4j.Logger;
- 
- import javax.annotation.Nullable;
- import javax.inject.Inject;
- import java.util.HashSet;
- import java.util.Iterator;
- import java.util.List;
- import java.util.Map;
- import java.util.Set;
- import java.util.TreeSet;
  
  public class NuageVspEntityBuilder {
      private static final Logger s_logger = Logger.getLogger(NuageVspEntityBuilder.class);
@@@ -386,13 -281,12 +389,13 @@@
                  .ipAddress(staticNatIp.getAddress().addr())
                  .revoke(forRevoke)
                  .oneToOneNat(staticNatIp.isOneToOneNat())
+                 .state(getEnumValue(staticNatIp.getState(), VspStaticNat.State.class))
                  .vlanUuid(staticNatVlan.getUuid())
                  .vlanGateway(staticNatVlan.getVlanGateway())
 -                .vlanNetmask(staticNatVlan.getVlanNetmask());
 +                .vlanNetmask(staticNatVlan.getVlanNetmask())
 +                .vlanUnderlay(NuageVspUtil.isUnderlayEnabledForVlan(_vlanDetailsDao, staticNatVlan));
  
-         if (nic != null) {
-             VspNic vspNic = buildVspNic(nic);
+         if (vspNic != null) {
              vspStaticNatBuilder.nic(vspNic);
          }
  
@@@ -479,31 -378,19 +487,47 @@@
          return vspAclRuleBuilder.build();
      }
  
 +    /** Build VspDhcpVMOption to put on the VM interface */
 +    public VspDhcpVMOption buildVmDhcpOption (NicVO userNic, boolean defaultHasDns, boolean
networkHasDns) {
 +        VMInstanceVO userVm  = _vmInstanceDao.findById(userNic.getInstanceId());
 +        VspDhcpVMOption.Builder vspDhcpVMOptionBuilder = new VspDhcpVMOption.Builder()
 +                .nicUuid(userNic.getUuid())
 +                .defaultHasDns(defaultHasDns)
 +                .hostname(userVm.getHostName())
 +                .networkHasDns(networkHasDns)
 +                .isDefaultInterface(userNic.isDefaultNic())
 +                .domainRouter(VirtualMachine.Type.DomainRouter.equals(userNic.getVmType()));
 +        return vspDhcpVMOptionBuilder.build();
 +    }
 +
 +    /** Build VspDhcpVMOption to put on the subnet */
 +    public VspDhcpDomainOption buildNetworkDhcpOption(Network network, NetworkOffering offering)
{
 +        List<String> dnsProvider = _ntwkOfferingSrvcDao.listProvidersForServiceForNetworkOffering(offering.getId(),
Network.Service.Dns);
 +        boolean isVrDnsProvider = dnsProvider.contains("VirtualRouter") || dnsProvider.contains("VpcVirtualRouter");
 +        VspDhcpDomainOption.Builder vspDhcpDomainBuilder = new VspDhcpDomainOption.Builder()
 +                .dnsServers(_nuageVspManager.getDnsDetails(network.getDataCenterId()))
 +                .vrIsDnsProvider(isVrDnsProvider);
 +
 +        if (isVrDnsProvider) {
 +            vspDhcpDomainBuilder.networkDomain(network.getVpcId() != null ? _vpcDao.findById(network.getVpcId()).getNetworkDomain()
: network.getNetworkDomain());
 +        }
 +
 +        return vspDhcpDomainBuilder.build();
 +    }
++
+     private <E extends Enum<E>> E getEnumValue(Enum cloudstackValue, Class<E>
target) {
+         try {
+             return Enum.valueOf(target, cloudstackValue.name());
+         } catch (IllegalArgumentException e) {
+             return null;
+         }
+     }
+ 
+     private <E extends Enum<E>> E getEnumValue(Enum cloudstackValue, E defaultValue)
{
+         try {
+             return Enum.valueOf(defaultValue.getDeclaringClass(), cloudstackValue.name());
+         } catch (IllegalArgumentException e) {
+             return defaultValue;
+         }
+     }
  }
diff --cc plugins/network-elements/nuage-vsp/test/com/cloud/util/NuageVspEntityBuilderTest.java
index a3f8752,ef63220..7ebdeb3
--- a/plugins/network-elements/nuage-vsp/test/com/cloud/util/NuageVspEntityBuilderTest.java
+++ b/plugins/network-elements/nuage-vsp/test/com/cloud/util/NuageVspEntityBuilderTest.java
@@@ -19,26 -19,12 +19,25 @@@
  
  package com.cloud.util;
  
- import net.nuage.vsp.acs.client.api.model.Protocol;
- import net.nuage.vsp.acs.client.api.model.VspAclRule;
- import net.nuage.vsp.acs.client.api.model.VspDomain;
- import net.nuage.vsp.acs.client.api.model.VspNetwork;
- import net.nuage.vsp.acs.client.api.model.VspNic;
- import net.nuage.vsp.acs.client.api.model.VspStaticNat;
- import net.nuage.vsp.acs.client.api.model.VspVm;
++import static org.junit.Assert.assertEquals;
++import static org.junit.Assert.assertNotNull;
++import static org.junit.Assert.assertNull;
++import static org.mockito.Matchers.anyLong;
++import static org.mockito.Matchers.anyString;
++import static org.mockito.Mockito.mock;
++import static org.mockito.Mockito.when;
 +
 +import org.junit.Before;
 +import org.junit.Test;
 +
- import com.google.common.collect.Lists;
- 
  import com.cloud.NuageTest;
 +import com.cloud.dc.VlanDetailsVO;
  import com.cloud.dc.VlanVO;
  import com.cloud.dc.dao.VlanDao;
 +import com.cloud.dc.dao.VlanDetailsDao;
  import com.cloud.domain.DomainVO;
  import com.cloud.domain.dao.DomainDao;
+ import com.cloud.network.IpAddress;
  import com.cloud.network.Network;
  import com.cloud.network.dao.IPAddressDao;
  import com.cloud.network.dao.IPAddressVO;
@@@ -58,14 -43,24 +57,15 @@@ import com.cloud.utils.net.Ip
  import com.cloud.vm.NicProfile;
  import com.cloud.vm.NicVO;
  import com.cloud.vm.VirtualMachine;
+ import com.google.common.collect.Lists;
 +
- import static org.junit.Assert.assertEquals;
- import static org.junit.Assert.assertNotNull;
- import static org.junit.Assert.assertNull;
- import static org.mockito.Matchers.anyLong;
- import static org.mockito.Matchers.anyString;
- import static org.mockito.Mockito.mock;
- import static org.mockito.Mockito.when;
++import net.nuage.vsp.acs.client.api.model.Protocol;
+ import net.nuage.vsp.acs.client.api.model.VspAclRule;
+ import net.nuage.vsp.acs.client.api.model.VspDomain;
+ import net.nuage.vsp.acs.client.api.model.VspNetwork;
+ import net.nuage.vsp.acs.client.api.model.VspNic;
+ import net.nuage.vsp.acs.client.api.model.VspStaticNat;
+ import net.nuage.vsp.acs.client.api.model.VspVm;
 -import net.nuage.vsp.acs.client.common.model.Pair;
 -import org.junit.Before;
 -import org.junit.Test;
 -
 -import java.util.List;
 -
 -import static org.junit.Assert.assertEquals;
 -import static org.junit.Assert.assertNotNull;
 -import static org.junit.Assert.assertNull;
 -import static org.mockito.Mockito.mock;
 -import static org.mockito.Mockito.when;
  
  public class NuageVspEntityBuilderTest extends NuageTest {
  

-- 
To stop receiving notification emails like this one, please contact
"commits@cloudstack.apache.org" <commits@cloudstack.apache.org>.

Mime
View raw message