mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge release branch 4.9 to master
* 4.9: Do not set gateway to 0.0.0.0 for windows clients CLOUDSTACK-9904: Fix log4j to have @AGENTLOG@ replaced ignore bogus default gateway when a shared network is secondary the default gateway gets overwritten by a bogus one dnsmasq does the right thing and replaces it with its own default which is not good for us so check for '0.0.0.0' Activate NioTest following changes in CLOUDSTACK-9348 PR #1549 CLOUDSTACK-9828: GetDomRVersionCommand fails to get the correct version as output Fix tries to return the output as a single command, instead of appending output from two commands CLOUDSTACK-3223 Exception observed while creating CPVM in VMware Setup with DVS CLOUDSTACK-9787: Fix wrong return value in NetUtils.isNetworkAWithinNetworkB
This commit is contained in:
commit
8b3cadb55e
@ -96,6 +96,35 @@
|
||||
<skipTests>${skipTests}</skipTests>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-resource</id>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<copy overwrite="true"
|
||||
todir="${basedir}/target/classes">
|
||||
<fileset dir="${basedir}/conf">
|
||||
<include name="*.in"/>
|
||||
</fileset>
|
||||
<filterchain>
|
||||
<filterreader
|
||||
classname="org.apache.tools.ant.filters.ReplaceTokens">
|
||||
<param type="propertiesfile"
|
||||
value="${project.basedir}/../../../${cs.replace.properties}" />
|
||||
</filterreader>
|
||||
</filterchain>
|
||||
</copy>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<profiles>
|
||||
|
||||
@ -108,8 +108,6 @@ import com.cloud.offering.NetworkOffering;
|
||||
import com.cloud.offerings.NetworkOfferingVO;
|
||||
import com.cloud.offerings.dao.NetworkOfferingDao;
|
||||
import com.cloud.service.dao.ServiceOfferingDao;
|
||||
import com.cloud.storage.GuestOSVO;
|
||||
import com.cloud.storage.dao.GuestOSDao;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.uservm.UserVm;
|
||||
import com.cloud.utils.Pair;
|
||||
@ -174,8 +172,6 @@ public class CommandSetupHelper {
|
||||
private VlanDao _vlanDao;
|
||||
@Inject
|
||||
private IPAddressDao _ipAddressDao;
|
||||
@Inject
|
||||
private GuestOSDao _guestOSDao;
|
||||
|
||||
@Inject
|
||||
private RouterControlHelper _routerControlHelper;
|
||||
@ -219,12 +215,6 @@ public class CommandSetupHelper {
|
||||
_networkModel.getExecuteInSeqNtwkElmtCmd());
|
||||
|
||||
String gatewayIp = nic.getIPv4Gateway();
|
||||
if (!nic.isDefaultNic()) {
|
||||
final GuestOSVO guestOS = _guestOSDao.findById(vm.getGuestOSId());
|
||||
if (guestOS == null || !guestOS.getDisplayName().toLowerCase().contains("windows")) {
|
||||
gatewayIp = "0.0.0.0";
|
||||
}
|
||||
}
|
||||
|
||||
final DataCenterVO dcVo = _dcDao.findById(router.getDataCenterId());
|
||||
|
||||
|
||||
@ -89,6 +89,7 @@ class CsDhcp(CsDataBag):
|
||||
gateway = gn.get_gateway()
|
||||
else:
|
||||
gateway = i['gateway']
|
||||
if gateway != '0.0.0.0':
|
||||
sline = "dhcp-option=tag:interface-%s-%s,3," % (device, idx)
|
||||
line = "dhcp-option=tag:interface-%s-%s,3,%s" % (device, idx, gateway)
|
||||
self.conf.search(sline, line)
|
||||
|
||||
@ -42,5 +42,6 @@ then
|
||||
exit
|
||||
fi
|
||||
|
||||
echo -n `cat /etc/cloudstack-release`'&'
|
||||
cat /var/cache/cloud/cloud-scripts-signature
|
||||
release=`cat /etc/cloudstack-release`
|
||||
sig=`cat /var/cache/cloud/cloud-scripts-signature`
|
||||
echo "${release}&${sig}"
|
||||
|
||||
@ -208,7 +208,6 @@
|
||||
<excludes>
|
||||
<exclude>com/cloud/utils/testcase/*TestCase*</exclude>
|
||||
<exclude>com/cloud/utils/db/*Test*</exclude>
|
||||
<exclude>com/cloud/utils/testcase/NioTest.java</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
@ -891,7 +891,7 @@ public class NetUtils {
|
||||
Long[] cidrBLong = cidrToLong(cidrB);
|
||||
|
||||
long shift = MAX_CIDR - cidrBLong[1];
|
||||
return cidrALong[0] >> shift == cidrBLong[0] >> shift;
|
||||
return (cidrALong[0] >> shift == cidrBLong[0] >> shift) && (cidrALong[1] >= cidrBLong[1]);
|
||||
}
|
||||
|
||||
static boolean areCidrsNotEmpty(String cidrA, String cidrB) {
|
||||
|
||||
@ -98,10 +98,9 @@ public abstract class NioConnection implements Callable<Boolean> {
|
||||
}
|
||||
_isStartup = true;
|
||||
|
||||
_threadExecutor = Executors.newSingleThreadExecutor();
|
||||
_futureTask = _threadExecutor.submit(this);
|
||||
|
||||
_threadExecutor = Executors.newSingleThreadExecutor(new NamedThreadFactory(this._name + "-NioConnectionHandler"));
|
||||
_isRunning = true;
|
||||
_futureTask = _threadExecutor.submit(this);
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
|
||||
@ -523,6 +523,19 @@ public class NetUtilsTest {
|
||||
assertEquals(false, NetUtils.isNetworkAWithinNetworkB("", null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsNetworkAWithinNetworkB() {
|
||||
assertTrue(NetUtils.isNetworkAWithinNetworkB("192.168.30.0/24", "192.168.30.0/23"));
|
||||
assertTrue(NetUtils.isNetworkAWithinNetworkB("192.168.30.0/24", "192.168.30.0/22"));
|
||||
assertFalse(NetUtils.isNetworkAWithinNetworkB("192.168.30.0/23", "192.168.30.0/24"));
|
||||
assertFalse(NetUtils.isNetworkAWithinNetworkB("192.168.30.0/22", "192.168.30.0/24"));
|
||||
assertTrue(NetUtils.isNetworkAWithinNetworkB("192.168.28.0/24", "192.168.28.0/23"));
|
||||
assertTrue(NetUtils.isNetworkAWithinNetworkB("192.168.28.0/24", "192.168.28.0/22"));
|
||||
assertFalse(NetUtils.isNetworkAWithinNetworkB("192.168.28.0/23", "192.168.28.0/24"));
|
||||
assertFalse(NetUtils.isNetworkAWithinNetworkB("192.168.28.0/22", "192.168.28.0/24"));
|
||||
assertTrue(NetUtils.isNetworkAWithinNetworkB("192.168.30.0/24", "192.168.28.0/22"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsNetworksOverlapWithEmptyValues() {
|
||||
assertEquals(false, NetUtils.isNetworksOverlap("", null));
|
||||
|
||||
@ -20,6 +20,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
@ -36,24 +37,67 @@ import com.cloud.hypervisor.vmware.util.VmwareContext;
|
||||
public class DistributedVirtualSwitchMO extends BaseMO {
|
||||
@SuppressWarnings("unused")
|
||||
private static final Logger s_logger = Logger.getLogger(DistributedVirtualSwitchMO.class);
|
||||
private static ConcurrentHashMap<String, List<String>> s_dvPortGroupCacheMap = null;
|
||||
|
||||
public DistributedVirtualSwitchMO(VmwareContext context, ManagedObjectReference morDvs) {
|
||||
super(context, morDvs);
|
||||
s_dvPortGroupCacheMap = new ConcurrentHashMap<String, List<String>>();
|
||||
}
|
||||
|
||||
public DistributedVirtualSwitchMO(VmwareContext context, String morType, String morValue) {
|
||||
super(context, morType, morValue);
|
||||
s_dvPortGroupCacheMap = new ConcurrentHashMap<String, List<String>>();
|
||||
}
|
||||
|
||||
public void createDVPortGroup(DVPortgroupConfigSpec dvPortGroupSpec) throws Exception {
|
||||
List<DVPortgroupConfigSpec> dvPortGroupSpecArray = new ArrayList<DVPortgroupConfigSpec>();
|
||||
dvPortGroupSpecArray.add(dvPortGroupSpec);
|
||||
_context.getService().addDVPortgroupTask(_mor, dvPortGroupSpecArray);
|
||||
boolean dvPortGroupExists = false;
|
||||
String dvSwitchInstance = _mor.getValue();
|
||||
String dvPortGroupName = dvPortGroupSpec.getName();
|
||||
String uniquedvPortGroupPerDvs = dvSwitchInstance + dvPortGroupName;
|
||||
List<String> dvPortGroupList = null;
|
||||
synchronized (uniquedvPortGroupPerDvs.intern()) {
|
||||
// Looking up local cache rather than firing another API call to see if dvPortGroup exists already.
|
||||
if (s_dvPortGroupCacheMap.containsKey(dvSwitchInstance)) {
|
||||
dvPortGroupList = s_dvPortGroupCacheMap.get(dvSwitchInstance);
|
||||
if (dvPortGroupList != null && dvPortGroupList.contains(dvPortGroupName)) {
|
||||
dvPortGroupExists = true;
|
||||
}
|
||||
}
|
||||
if (!dvPortGroupExists) {
|
||||
ManagedObjectReference task = _context.getService().addDVPortgroupTask(_mor, dvPortGroupSpecArray);
|
||||
if (!_context.getVimClient().waitForTask(task)) {
|
||||
throw new Exception("Failed to create dvPortGroup " + dvPortGroupSpec.getName());
|
||||
} else {
|
||||
if (s_dvPortGroupCacheMap.containsKey(dvSwitchInstance)) {
|
||||
dvPortGroupList = s_dvPortGroupCacheMap.get(dvSwitchInstance);
|
||||
if (dvPortGroupList == null) {
|
||||
dvPortGroupList = new ArrayList<String>();
|
||||
}
|
||||
dvPortGroupList.add(dvPortGroupName); //does this update map?
|
||||
} else {
|
||||
dvPortGroupList = new ArrayList<String>();
|
||||
dvPortGroupList.add(dvPortGroupName);
|
||||
s_dvPortGroupCacheMap.put(dvSwitchInstance, dvPortGroupList);
|
||||
}
|
||||
}
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace("Created dvPortGroup. dvPortGroup cache is :" + s_dvPortGroupCacheMap);
|
||||
}
|
||||
} else if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Detected dvPortGroup [" + dvPortGroupName + "] already present. Not attempting to create again.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateDvPortGroup(ManagedObjectReference dvPortGroupMor, DVPortgroupConfigSpec dvPortGroupSpec) throws Exception {
|
||||
// TODO(sateesh): Update numPorts
|
||||
_context.getService().reconfigureDVPortgroupTask(dvPortGroupMor, dvPortGroupSpec);
|
||||
synchronized (dvPortGroupMor.getValue().intern()) {
|
||||
ManagedObjectReference task = _context.getService().reconfigureDVPortgroupTask(dvPortGroupMor, dvPortGroupSpec);
|
||||
if (!_context.getVimClient().waitForTask(task)) {
|
||||
throw new Exception("Failed to update dvPortGroup " + dvPortGroupMor.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateVMWareDVSwitch(ManagedObjectReference dvSwitchMor, VMwareDVSConfigSpec dvsSpec) throws Exception {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user