Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/4.18'
Browse files Browse the repository at this point in the history
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
  • Loading branch information
rohityadavcloud committed Jul 7, 2023
2 parents c956d32 + f0cc76a commit 5383bf6
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,13 @@ public Property<Integer> getWorkers() {
*/
public static final Property<Integer> IOTHREADS = new Property<>("iothreads", 1);

/**
* BGP controll CIDR
* Data type: String.<br>
* Default value: <code>169.254.0.0/16</code>
*/
public static final Property<String> CONTROL_CIDR = new Property<>("control.cidr", "169.254.0.0/16");

public static class Property <T>{
private String name;
private T defaultValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

import java.util.List;

import org.apache.commons.collections.CollectionUtils;

/**
* Unmanaged instances are those virtual machines which are present at hypervisor end but not available in CloudStack.
* Such virtual machines might have been created out of band, directly from hypervisor.
Expand Down Expand Up @@ -56,7 +58,7 @@ public void setManagedInstancesNames(List<String> managedInstancesNames) {
}

public boolean hasManagedInstance(String name) {
if (managedInstancesNames!=null && !managedInstancesNames.isEmpty()) {
if (CollectionUtils.isNotEmpty(managedInstancesNames)) {
return managedInstancesNames.contains(name);
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@ public void configure(Map<String, Object> params) throws ConfigurationException

String networkScriptsDir = AgentPropertiesFileHandler.getPropertyValue(AgentProperties.NETWORK_SCRIPTS_DIR);

String controlCidr = (String)params.get("control.cidr");
if (StringUtils.isNotBlank(controlCidr)) {
_controlCidr = controlCidr;
}
_controlCidr = getControlCidr(_controlCidr);

String value = (String)params.get("scripts.timeout");
_timeout = NumbersUtil.parseInt(value, 30 * 60) * 1000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

import javax.naming.ConfigurationException;

import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.libvirt.LibvirtException;

Expand Down Expand Up @@ -71,10 +70,7 @@ public void configure(Map<String, Object> params) throws ConfigurationException
}
_ivsIfUpPath = Script.findScript(utilScriptsDir, "qemu-ivs-ifup");

String controlCidr = (String)params.get("control.cidr");
if (StringUtils.isNotBlank(controlCidr)) {
_controlCidr = controlCidr;
}
_controlCidr = getControlCidr(_controlCidr);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@ public void configure(Map<String, Object> params) throws ConfigurationException
dpdkDriver = new DpdkDriverImpl();
}

String controlCidr = (String)params.get("control.cidr");
if (StringUtils.isNotBlank(controlCidr)) {
_controlCidr = controlCidr;
}
_controlCidr = getControlCidr(_controlCidr);

String value = (String)params.get("scripts.timeout");
_timeout = NumbersUtil.parseInt(value, 30 * 60) * 1000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

import javax.naming.ConfigurationException;

import com.cloud.agent.properties.AgentProperties;
import com.cloud.agent.properties.AgentPropertiesFileHandler;
import org.libvirt.LibvirtException;

import com.cloud.agent.api.to.NicTO;
Expand All @@ -41,6 +43,11 @@ public void configure(Map<String, Object> params) throws ConfigurationException
_pifs = (Map<String, String>)params.get("libvirt.host.pifs");
}

protected String getControlCidr(String defaultValue) {
String controlCidr = AgentPropertiesFileHandler.getPropertyValue(AgentProperties.CONTROL_CIDR);
return controlCidr;
}

@Override
public abstract LibvirtVMDef.InterfaceDef plug(NicTO nic, String guestOsType, String nicAdapter, Map<String, String> extraConfig) throws InternalErrorException, LibvirtException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Random;
import java.util.Set;
import java.util.TimeZone;
Expand All @@ -47,16 +48,6 @@
import javax.naming.ConfigurationException;
import javax.xml.datatype.XMLGregorianCalendar;

import com.cloud.agent.api.CheckGuestOsMappingAnswer;
import com.cloud.agent.api.CheckGuestOsMappingCommand;
import com.cloud.agent.api.GetHypervisorGuestOsNamesAnswer;
import com.cloud.agent.api.GetHypervisorGuestOsNamesCommand;
import com.cloud.agent.api.PatchSystemVmAnswer;
import com.cloud.agent.api.PatchSystemVmCommand;
import com.cloud.resource.ServerResourceBase;
import com.cloud.utils.FileUtil;
import com.cloud.utils.LogUtils;
import com.cloud.utils.validation.ChecksumUtil;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.storage.command.CopyCommand;
import org.apache.cloudstack.storage.command.StorageSubSystemCommand;
Expand All @@ -70,8 +61,8 @@
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.apache.log4j.NDC;
import org.joda.time.Duration;
Expand All @@ -82,6 +73,8 @@
import com.cloud.agent.api.AttachIsoCommand;
import com.cloud.agent.api.BackupSnapshotAnswer;
import com.cloud.agent.api.BackupSnapshotCommand;
import com.cloud.agent.api.CheckGuestOsMappingAnswer;
import com.cloud.agent.api.CheckGuestOsMappingCommand;
import com.cloud.agent.api.CheckHealthAnswer;
import com.cloud.agent.api.CheckHealthCommand;
import com.cloud.agent.api.CheckNetworkAnswer;
Expand All @@ -103,6 +96,8 @@
import com.cloud.agent.api.DeleteVMSnapshotCommand;
import com.cloud.agent.api.GetHostStatsAnswer;
import com.cloud.agent.api.GetHostStatsCommand;
import com.cloud.agent.api.GetHypervisorGuestOsNamesAnswer;
import com.cloud.agent.api.GetHypervisorGuestOsNamesCommand;
import com.cloud.agent.api.GetStoragePoolCapabilitiesAnswer;
import com.cloud.agent.api.GetStoragePoolCapabilitiesCommand;
import com.cloud.agent.api.GetStorageStatsAnswer;
Expand Down Expand Up @@ -141,6 +136,8 @@
import com.cloud.agent.api.ModifyTargetsCommand;
import com.cloud.agent.api.NetworkUsageAnswer;
import com.cloud.agent.api.NetworkUsageCommand;
import com.cloud.agent.api.PatchSystemVmAnswer;
import com.cloud.agent.api.PatchSystemVmCommand;
import com.cloud.agent.api.PingCommand;
import com.cloud.agent.api.PingRoutingCommand;
import com.cloud.agent.api.PingTestCommand;
Expand Down Expand Up @@ -264,6 +261,7 @@
import com.cloud.network.VmwareTrafficLabel;
import com.cloud.network.router.VirtualRouterAutoScale;
import com.cloud.resource.ServerResource;
import com.cloud.resource.ServerResourceBase;
import com.cloud.serializer.GsonHelper;
import com.cloud.storage.Storage;
import com.cloud.storage.Storage.StoragePoolType;
Expand All @@ -278,6 +276,8 @@
import com.cloud.template.TemplateManager;
import com.cloud.utils.DateUtil;
import com.cloud.utils.ExecutionResult;
import com.cloud.utils.FileUtil;
import com.cloud.utils.LogUtils;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.Pair;
import com.cloud.utils.Ternary;
Expand All @@ -290,6 +290,7 @@
import com.cloud.utils.nicira.nvp.plugin.NiciraNvpApiVersion;
import com.cloud.utils.script.Script;
import com.cloud.utils.ssh.SshHelper;
import com.cloud.utils.validation.ChecksumUtil;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachine.PowerState;
import com.cloud.vm.VirtualMachineName;
Expand Down Expand Up @@ -7380,7 +7381,10 @@ private Answer execute(GetUnmanagedInstancesCommand cmd) {
continue;
}
// Filter managed instances
if (cmd.hasManagedInstance(vmMo.getName())) {
if (cmd.hasManagedInstance(vmMo.getName()) ||
(StringUtils.isNotEmpty(vmMo.getInternalCSName())
&& Objects.equals(vmMo.getName(), vmMo.getInternalCSName())
&& cmd.hasManagedInstance(vmMo.getInternalCSName()))) {
continue;
}
// Filter instance if answer is requested for a particular instance name
Expand Down

0 comments on commit 5383bf6

Please sign in to comment.