mirror of https://github.com/apache/cloudstack.git
Compare commits
15 Commits
befce0c484
...
db5742701c
| Author | SHA1 | Date |
|---|---|---|
|
|
db5742701c | |
|
|
cd5bb09d0d | |
|
|
b5e9178078 | |
|
|
f9ca9bef5f | |
|
|
304a3eb4f6 | |
|
|
b1026a226c | |
|
|
a3f3918db9 | |
|
|
4d5f819413 | |
|
|
f42149960e | |
|
|
ff5902cceb | |
|
|
5967128527 | |
|
|
666105b168 | |
|
|
0526416e4b | |
|
|
ca9fc493c4 | |
|
|
43162bfce8 |
|
|
@ -188,6 +188,7 @@ environmnet
|
|||
equivalant
|
||||
erro
|
||||
erronous
|
||||
errorprone
|
||||
everthing
|
||||
everytime
|
||||
excetion
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ public class MockVmMgr implements VmMgr {
|
|||
public MockVm createVmFromSpec(VirtualMachineTO vmSpec) {
|
||||
String vmName = vmSpec.getName();
|
||||
long ramSize = vmSpec.getMinRam();
|
||||
int utilizationPercent = randSeed.nextInt() % 100;
|
||||
int utilizationPercent = randSeed.nextInt(100);
|
||||
MockVm vm = null;
|
||||
|
||||
synchronized (this) {
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ public class UpdateBackupOfferingCmd extends BaseCmd {
|
|||
public void execute() {
|
||||
try {
|
||||
if (StringUtils.isAllEmpty(getName(), getDescription()) && getAllowUserDrivenBackups() == null) {
|
||||
throw new InvalidParameterValueException(String.format("Can't update Backup Offering [id: %s] because there are no parameters to be updated, at least one of the",
|
||||
throw new InvalidParameterValueException(String.format("Can't update Backup Offering [id: %s] because there are no parameters to be updated, at least one of the " +
|
||||
"following should be informed: name, description or allowUserDrivenBackups.", id));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import static org.junit.Assert.assertFalse;
|
|||
public class IsolationMethodTest {
|
||||
@After
|
||||
public void cleanTheRegistry() {
|
||||
PhysicalNetwork.IsolationMethod.registeredIsolationMethods.removeAll(PhysicalNetwork.IsolationMethod.registeredIsolationMethods);
|
||||
PhysicalNetwork.IsolationMethod.registeredIsolationMethods.clear();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ public abstract class AbstractConfigItemFacade {
|
|||
|
||||
public static AbstractConfigItemFacade getInstance(final Class<? extends NetworkElementCommand> key) {
|
||||
if (!flyweight.containsKey(key)) {
|
||||
throw new CloudRuntimeException("Unable to process the configuration for " + key.getClass().getName());
|
||||
throw new CloudRuntimeException("Unable to process the configuration for " + key.getName());
|
||||
}
|
||||
|
||||
final AbstractConfigItemFacade instance = flyweight.get(key);
|
||||
|
|
|
|||
|
|
@ -514,7 +514,7 @@ public class HAProxyConfigurator implements LoadBalancerConfigurator {
|
|||
}
|
||||
dstSubRule.add(sb.toString());
|
||||
if (stickinessSubRule != null) {
|
||||
sb.append(" cookie ").append(dest.getDestIp().replace(".", "_")).append('-').append(dest.getDestPort()).toString();
|
||||
sb.append(" cookie ").append(dest.getDestIp().replace(".", "_")).append('-').append(dest.getDestPort());
|
||||
dstWithCookieSubRule.add(sb.toString());
|
||||
}
|
||||
destsAvailable = true;
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ public abstract class RequestWrapper {
|
|||
|
||||
keepCommandClass = commandClass2;
|
||||
} catch (final ClassCastException e) {
|
||||
throw new CommandNotSupported("No key found for '" + keepCommandClass.getClass() + "' in the Map!");
|
||||
throw new CommandNotSupported("No key found for '" + keepCommandClass + "' in the Map!");
|
||||
} catch (final NullPointerException e) {
|
||||
// Will now traverse all the resource hierarchy. Returning null
|
||||
// is not a problem.
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ public abstract class DirectDownloadCommand extends StorageSubSystemCommand {
|
|||
final Integer soTimeout, final Integer connectionRequestTimeout, final boolean followRedirects) {
|
||||
this.url = url;
|
||||
this.templateId = templateId;
|
||||
this.destData = destData;
|
||||
this.destPool = destPool;
|
||||
this.checksum = checksum;
|
||||
this.headers = headers;
|
||||
|
|
|
|||
|
|
@ -182,36 +182,36 @@ public class ServerResourceBaseTest {
|
|||
@Test
|
||||
public void defineResourceNetworkInterfacesTestUseXenbr0WhenPrivateNetworkInterfaceNotConfigured() {
|
||||
Map<String, Object> params = createParamsMap(null, "cloudbr1", "cloudbr2", "cloudbr3");
|
||||
try (MockedStatic<NetUtils> ignored = Mockito.mockStatic(NetUtils.class)) {
|
||||
Mockito.when(NetUtils.getNetworkInterface(Mockito.anyString())).thenReturn(networkInterfaceMock1, networkInterfaceMock2, networkInterfaceMock3, networkInterfaceMock4);
|
||||
try (MockedStatic<NetUtils> mockedNetUtils = Mockito.mockStatic(NetUtils.class)) {
|
||||
mockedNetUtils.when(() -> NetUtils.getNetworkInterface(Mockito.anyString())).thenReturn(networkInterfaceMock1, networkInterfaceMock2, networkInterfaceMock3, networkInterfaceMock4);
|
||||
|
||||
serverResourceBaseSpy.defineResourceNetworkInterfaces(params);
|
||||
|
||||
verifyAndAssertNetworkInterfaces("xenbr0", "cloudbr1", "cloudbr2", "cloudbr3");
|
||||
verifyAndAssertNetworkInterfaces(mockedNetUtils, "xenbr0", "cloudbr1", "cloudbr2", "cloudbr3");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defineResourceNetworkInterfacesTestUseXenbr1WhenPublicNetworkInterfaceNotConfigured() {
|
||||
Map<String, Object> params = createParamsMap("cloudbr0", null, "cloudbr2", "cloudbr3");
|
||||
try (MockedStatic<NetUtils> ignored = Mockito.mockStatic(NetUtils.class)) {
|
||||
Mockito.when(NetUtils.getNetworkInterface(Mockito.anyString())).thenReturn(networkInterfaceMock1, networkInterfaceMock2, networkInterfaceMock3, networkInterfaceMock4);
|
||||
try (MockedStatic<NetUtils> mockedNetUtils = Mockito.mockStatic(NetUtils.class)) {
|
||||
mockedNetUtils.when(() -> NetUtils.getNetworkInterface(Mockito.anyString())).thenReturn(networkInterfaceMock1, networkInterfaceMock2, networkInterfaceMock3, networkInterfaceMock4);
|
||||
|
||||
serverResourceBaseSpy.defineResourceNetworkInterfaces(params);
|
||||
|
||||
verifyAndAssertNetworkInterfaces("cloudbr0", "xenbr1", "cloudbr2", "cloudbr3");
|
||||
verifyAndAssertNetworkInterfaces(mockedNetUtils, "cloudbr0", "xenbr1", "cloudbr2", "cloudbr3");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defineResourceNetworkInterfacesTestUseConfiguredNetworkInterfaces() {
|
||||
Map<String, Object> params = createParamsMap("cloudbr0", "cloudbr1", "cloudbr2", "cloudbr3");
|
||||
try (MockedStatic<NetUtils> ignored = Mockito.mockStatic(NetUtils.class)) {
|
||||
Mockito.when(NetUtils.getNetworkInterface(Mockito.anyString())).thenReturn(networkInterfaceMock1, networkInterfaceMock2, networkInterfaceMock3, networkInterfaceMock4);
|
||||
try (MockedStatic<NetUtils> mockedNetUtils = Mockito.mockStatic(NetUtils.class)) {
|
||||
mockedNetUtils.when(() -> NetUtils.getNetworkInterface(Mockito.anyString())).thenReturn(networkInterfaceMock1, networkInterfaceMock2, networkInterfaceMock3, networkInterfaceMock4);
|
||||
|
||||
serverResourceBaseSpy.defineResourceNetworkInterfaces(params);
|
||||
|
||||
verifyAndAssertNetworkInterfaces("cloudbr0", "cloudbr1", "cloudbr2", "cloudbr3");
|
||||
verifyAndAssertNetworkInterfaces(mockedNetUtils, "cloudbr0", "cloudbr1", "cloudbr2", "cloudbr3");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -224,9 +224,8 @@ public class ServerResourceBaseTest {
|
|||
return result;
|
||||
}
|
||||
|
||||
private void verifyAndAssertNetworkInterfaces(String... expectedResults) {
|
||||
Mockito.verify(NetUtils.class, Mockito.times(4));
|
||||
NetUtils.getNetworkInterface(keyCaptor.capture());
|
||||
private void verifyAndAssertNetworkInterfaces(MockedStatic<NetUtils> mockedNetUtils, String... expectedResults) {
|
||||
mockedNetUtils.verify(() -> NetUtils.getNetworkInterface(keyCaptor.capture()), Mockito.times(4));
|
||||
List<String> keys = keyCaptor.getAllValues();
|
||||
|
||||
for (int i = 0; i < expectedResults.length; i++) {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import java.util.Iterator;
|
|||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
|
@ -497,6 +498,11 @@ public abstract class AgentAttache {
|
|||
*/
|
||||
protected abstract boolean isClosed();
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(_id, _uuid, _name);
|
||||
}
|
||||
|
||||
protected class Alarm extends ManagedContextRunnable {
|
||||
long _seq;
|
||||
|
||||
|
|
|
|||
|
|
@ -148,6 +148,11 @@ public class DirectAgentAttache extends AgentAttache {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode();
|
||||
}
|
||||
|
||||
protected class PingTask extends ManagedContextRunnable {
|
||||
@Override
|
||||
protected synchronized void runInContext() {
|
||||
|
|
|
|||
|
|
@ -1730,7 +1730,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
} catch (final OperationTimedoutException e) {
|
||||
throw new AgentUnavailableException(String.format("Unable to stop vm [%s] because the operation to stop timed out", vmUuid), e.getAgentId(), e);
|
||||
} catch (final ConcurrentOperationException e) {
|
||||
throw new CloudRuntimeException(String.format("Unable to stop vm because of a concurrent operation", vmUuid), e);
|
||||
throw new CloudRuntimeException(String.format("Unable to stop vm: %s because of a concurrent operation", vmUuid), e);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1737,7 +1737,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||
final List<FirewallRuleVO> firewallEgressRulesToApply = _firewallDao.listByNetworkPurposeTrafficType(networkId, Purpose.Firewall, FirewallRule.TrafficType.Egress);
|
||||
final NetworkOfferingVO offering = _networkOfferingDao.findById(network.getNetworkOfferingId());
|
||||
final DataCenter zone = _dcDao.findById(network.getDataCenterId());
|
||||
if (_networkModel.areServicesSupportedInNetwork(network.getId(), Service.Firewall) && _networkModel.areServicesSupportedInNetwork(network.getId(), Service.Firewall)
|
||||
if (_networkModel.areServicesSupportedInNetwork(network.getId(), Service.Firewall)
|
||||
&& (network.getGuestType() == Network.GuestType.Isolated || network.getGuestType() == Network.GuestType.Shared && zone.getNetworkType() == NetworkType.Advanced)) {
|
||||
// add default egress rule to accept the traffic
|
||||
_firewallMgr.applyDefaultEgressFirewallRule(network.getId(), offering.isEgressDefaultPolicy(), true);
|
||||
|
|
|
|||
|
|
@ -460,7 +460,7 @@ public class NetworkOfferingVO implements NetworkOffering {
|
|||
true,
|
||||
Availability.Optional,
|
||||
null,
|
||||
Network.GuestType.Isolated,
|
||||
guestType,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
|
|
|
|||
|
|
@ -324,38 +324,33 @@ public class SystemVmTemplateRegistration {
|
|||
|
||||
public static final Map<String, MetadataTemplateDetails> NewTemplateMap = new HashMap<>();
|
||||
|
||||
public static final Map<Hypervisor.HypervisorType, String> RouterTemplateConfigurationNames = new HashMap<>() {
|
||||
{
|
||||
put(Hypervisor.HypervisorType.KVM, "router.template.kvm");
|
||||
put(Hypervisor.HypervisorType.VMware, "router.template.vmware");
|
||||
put(Hypervisor.HypervisorType.XenServer, "router.template.xenserver");
|
||||
put(Hypervisor.HypervisorType.Hyperv, "router.template.hyperv");
|
||||
put(Hypervisor.HypervisorType.LXC, "router.template.lxc");
|
||||
put(Hypervisor.HypervisorType.Ovm3, "router.template.ovm3");
|
||||
}
|
||||
};
|
||||
public static final Map<Hypervisor.HypervisorType, String> RouterTemplateConfigurationNames = Map.of(
|
||||
Hypervisor.HypervisorType.KVM, "router.template.kvm",
|
||||
Hypervisor.HypervisorType.VMware, "router.template.vmware",
|
||||
Hypervisor.HypervisorType.XenServer, "router.template.xenserver",
|
||||
Hypervisor.HypervisorType.Hyperv, "router.template.hyperv",
|
||||
Hypervisor.HypervisorType.LXC, "router.template.lxc",
|
||||
Hypervisor.HypervisorType.Ovm3, "router.template.ovm3"
|
||||
);
|
||||
|
||||
public static Map<Hypervisor.HypervisorType, Integer> hypervisorGuestOsMap = new HashMap<>() {
|
||||
{
|
||||
put(Hypervisor.HypervisorType.KVM, LINUX_12_ID);
|
||||
put(Hypervisor.HypervisorType.XenServer, OTHER_LINUX_ID);
|
||||
put(Hypervisor.HypervisorType.VMware, OTHER_LINUX_ID);
|
||||
put(Hypervisor.HypervisorType.Hyperv, LINUX_12_ID);
|
||||
put(Hypervisor.HypervisorType.LXC, LINUX_12_ID);
|
||||
put(Hypervisor.HypervisorType.Ovm3, LINUX_12_ID);
|
||||
}
|
||||
};
|
||||
public static Map<Hypervisor.HypervisorType, Integer> hypervisorGuestOsMap = new HashMap<>();
|
||||
static {
|
||||
hypervisorGuestOsMap.put(Hypervisor.HypervisorType.KVM, LINUX_12_ID);
|
||||
hypervisorGuestOsMap.put(Hypervisor.HypervisorType.XenServer, OTHER_LINUX_ID);
|
||||
hypervisorGuestOsMap.put(Hypervisor.HypervisorType.VMware, OTHER_LINUX_ID);
|
||||
hypervisorGuestOsMap.put(Hypervisor.HypervisorType.Hyperv, LINUX_12_ID);
|
||||
hypervisorGuestOsMap.put(Hypervisor.HypervisorType.LXC, LINUX_12_ID);
|
||||
hypervisorGuestOsMap.put(Hypervisor.HypervisorType.Ovm3, LINUX_12_ID);
|
||||
}
|
||||
|
||||
public static final Map<Hypervisor.HypervisorType, ImageFormat> hypervisorImageFormat = new HashMap<Hypervisor.HypervisorType, ImageFormat>() {
|
||||
{
|
||||
put(Hypervisor.HypervisorType.KVM, ImageFormat.QCOW2);
|
||||
put(Hypervisor.HypervisorType.XenServer, ImageFormat.VHD);
|
||||
put(Hypervisor.HypervisorType.VMware, ImageFormat.OVA);
|
||||
put(Hypervisor.HypervisorType.Hyperv, ImageFormat.VHD);
|
||||
put(Hypervisor.HypervisorType.LXC, ImageFormat.QCOW2);
|
||||
put(Hypervisor.HypervisorType.Ovm3, ImageFormat.RAW);
|
||||
}
|
||||
};
|
||||
public static final Map<Hypervisor.HypervisorType, ImageFormat> hypervisorImageFormat = Map.of(
|
||||
Hypervisor.HypervisorType.KVM, ImageFormat.QCOW2,
|
||||
Hypervisor.HypervisorType.XenServer, ImageFormat.VHD,
|
||||
Hypervisor.HypervisorType.VMware, ImageFormat.OVA,
|
||||
Hypervisor.HypervisorType.Hyperv, ImageFormat.VHD,
|
||||
Hypervisor.HypervisorType.LXC, ImageFormat.QCOW2,
|
||||
Hypervisor.HypervisorType.Ovm3, ImageFormat.RAW
|
||||
);
|
||||
|
||||
public boolean validateIfSeeded(TemplateDataStoreVO templDataStoreVO, String url, String path, String nfsVersion) {
|
||||
String filePath = null;
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ public class DatabaseAccessObject {
|
|||
return true;
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
logger.debug(String.format("Index %s doesn't exist, ignoring exception:", indexName, e.getMessage()));
|
||||
logger.debug(String.format("Index %s doesn't exist, ignoring exception:", indexName), e.getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import java.sql.Connection;
|
|||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
|
@ -98,49 +97,41 @@ public class Upgrade41500to41510 extends DbUpgradeAbstractImpl implements DbUpgr
|
|||
throw new CloudRuntimeException("updateSystemVmTemplates:Exception while getting hypervisor types from clusters", e);
|
||||
}
|
||||
|
||||
final Map<Hypervisor.HypervisorType, String> NewTemplateNameList = new HashMap<Hypervisor.HypervisorType, String>() {
|
||||
{
|
||||
put(KVM, "systemvm-kvm-4.15.1");
|
||||
put(VMware, "systemvm-vmware-4.15.1");
|
||||
put(XenServer, "systemvm-xenserver-4.15.1");
|
||||
put(Hyperv, "systemvm-hyperv-4.15.1");
|
||||
put(LXC, "systemvm-lxc-4.15.1");
|
||||
put(Ovm3, "systemvm-ovm3-4.15.1");
|
||||
}
|
||||
};
|
||||
final Map<Hypervisor.HypervisorType, String> NewTemplateNameList = Map.of(
|
||||
KVM, "systemvm-kvm-4.15.1",
|
||||
VMware, "systemvm-vmware-4.15.1",
|
||||
XenServer, "systemvm-xenserver-4.15.1",
|
||||
Hyperv, "systemvm-hyperv-4.15.1",
|
||||
LXC, "systemvm-lxc-4.15.1",
|
||||
Ovm3, "systemvm-ovm3-4.15.1"
|
||||
);
|
||||
|
||||
final Map<Hypervisor.HypervisorType, String> routerTemplateConfigurationNames = new HashMap<Hypervisor.HypervisorType, String>() {
|
||||
{
|
||||
put(KVM, "router.template.kvm");
|
||||
put(VMware, "router.template.vmware");
|
||||
put(XenServer, "router.template.xenserver");
|
||||
put(Hyperv, "router.template.hyperv");
|
||||
put(LXC, "router.template.lxc");
|
||||
put(Ovm3, "router.template.ovm3");
|
||||
}
|
||||
};
|
||||
final Map<Hypervisor.HypervisorType, String> routerTemplateConfigurationNames = Map.of(
|
||||
KVM, "router.template.kvm",
|
||||
VMware, "router.template.vmware",
|
||||
XenServer, "router.template.xenserver",
|
||||
Hyperv, "router.template.hyperv",
|
||||
LXC, "router.template.lxc",
|
||||
Ovm3, "router.template.ovm3"
|
||||
);
|
||||
|
||||
final Map<Hypervisor.HypervisorType, String> newTemplateUrl = new HashMap<Hypervisor.HypervisorType, String>() {
|
||||
{
|
||||
put(KVM, "https://download.cloudstack.org/systemvm/4.15/systemvmtemplate-4.15.1-kvm.qcow2.bz2");
|
||||
put(VMware, "https://download.cloudstack.org/systemvm/4.15/systemvmtemplate-4.15.1-vmware.ova");
|
||||
put(XenServer, "https://download.cloudstack.org/systemvm/4.15/systemvmtemplate-4.15.1-xen.vhd.bz2");
|
||||
put(Hyperv, "https://download.cloudstack.org/systemvm/4.15/systemvmtemplate-4.15.1-hyperv.vhd.zip");
|
||||
put(LXC, "https://download.cloudstack.org/systemvm/4.15/systemvmtemplate-4.15.1-kvm.qcow2.bz2");
|
||||
put(Ovm3, "https://download.cloudstack.org/systemvm/4.15/systemvmtemplate-4.15.1-ovm.raw.bz2");
|
||||
}
|
||||
};
|
||||
final Map<Hypervisor.HypervisorType, String> newTemplateUrl = Map.of(
|
||||
KVM, "https://download.cloudstack.org/systemvm/4.15/systemvmtemplate-4.15.1-kvm.qcow2.bz2",
|
||||
VMware, "https://download.cloudstack.org/systemvm/4.15/systemvmtemplate-4.15.1-vmware.ova",
|
||||
XenServer, "https://download.cloudstack.org/systemvm/4.15/systemvmtemplate-4.15.1-xen.vhd.bz2",
|
||||
Hyperv, "https://download.cloudstack.org/systemvm/4.15/systemvmtemplate-4.15.1-hyperv.vhd.zip",
|
||||
LXC, "https://download.cloudstack.org/systemvm/4.15/systemvmtemplate-4.15.1-kvm.qcow2.bz2",
|
||||
Ovm3, "https://download.cloudstack.org/systemvm/4.15/systemvmtemplate-4.15.1-ovm.raw.bz2"
|
||||
);
|
||||
|
||||
final Map<Hypervisor.HypervisorType, String> newTemplateChecksum = new HashMap<Hypervisor.HypervisorType, String>() {
|
||||
{
|
||||
put(KVM, "0e9f9a7d0957c3e0a2088e41b2da2cec");
|
||||
put(XenServer, "86373992740b1eca8aff8b08ebf3aea5");
|
||||
put(VMware, "4006982765846d373eb3719b2fe4d720");
|
||||
put(Hyperv, "0b9514e4b6cba1f636fea2125f0f7a5f");
|
||||
put(LXC, "0e9f9a7d0957c3e0a2088e41b2da2cec");
|
||||
put(Ovm3, "ae3977e696b3e6c81bdcbb792d514d29");
|
||||
}
|
||||
};
|
||||
final Map<Hypervisor.HypervisorType, String> newTemplateChecksum = Map.of(
|
||||
KVM, "0e9f9a7d0957c3e0a2088e41b2da2cec",
|
||||
XenServer, "86373992740b1eca8aff8b08ebf3aea5",
|
||||
VMware, "4006982765846d373eb3719b2fe4d720",
|
||||
Hyperv, "0b9514e4b6cba1f636fea2125f0f7a5f",
|
||||
LXC, "0e9f9a7d0957c3e0a2088e41b2da2cec",
|
||||
Ovm3, "ae3977e696b3e6c81bdcbb792d514d29"
|
||||
);
|
||||
|
||||
for (final Map.Entry<Hypervisor.HypervisorType, String> hypervisorAndTemplateName : NewTemplateNameList.entrySet()) {
|
||||
logger.debug("Updating " + hypervisorAndTemplateName.getKey() + " System Vms");
|
||||
|
|
|
|||
|
|
@ -44,8 +44,15 @@ public class AutoScaleVmProfileVOTest {
|
|||
AutoScaleVmProfileVO profile = new AutoScaleVmProfileVO();
|
||||
|
||||
Map<String, LinkedHashMap<String, String>> counterParamList = new LinkedHashMap<>();
|
||||
counterParamList.put("0", new LinkedHashMap<>() {{ put("name", "snmpcommunity"); put("value", "public"); }});
|
||||
counterParamList.put("1", new LinkedHashMap<>() {{ put("name", "snmpport"); put("value", "161"); }});
|
||||
LinkedHashMap<String, String> param0 = new LinkedHashMap<>();
|
||||
param0.put("name", "snmpcommunity");
|
||||
param0.put("value", "public");
|
||||
counterParamList.put("0", param0);
|
||||
|
||||
LinkedHashMap<String, String> param1 = new LinkedHashMap<>();
|
||||
param1.put("name", "snmpport");
|
||||
param1.put("value", "161");
|
||||
counterParamList.put("1", param1);
|
||||
|
||||
profile.setCounterParamsForUpdate(counterParamList);
|
||||
Assert.assertEquals("snmpcommunity=public&snmpport=161", profile.getCounterParamsString());
|
||||
|
|
@ -63,8 +70,15 @@ public class AutoScaleVmProfileVOTest {
|
|||
AutoScaleVmProfileVO profile = new AutoScaleVmProfileVO();
|
||||
|
||||
Map<String, HashMap<String, String>> otherDeployParamsMap = new HashMap<>();
|
||||
otherDeployParamsMap.put("0", new HashMap<>() {{ put("name", "serviceofferingid"); put("value", "a7fb50f6-01d9-11ed-8bc1-77f8f0228926"); }});
|
||||
otherDeployParamsMap.put("1", new HashMap<>() {{ put("name", "rootdisksize"); put("value", "10"); }});
|
||||
HashMap<String, String> deployParam0 = new HashMap<>();
|
||||
deployParam0.put("name", "serviceofferingid");
|
||||
deployParam0.put("value", "a7fb50f6-01d9-11ed-8bc1-77f8f0228926");
|
||||
otherDeployParamsMap.put("0", deployParam0);
|
||||
|
||||
HashMap<String, String> deployParam1 = new HashMap<>();
|
||||
deployParam1.put("name", "rootdisksize");
|
||||
deployParam1.put("value", "10");
|
||||
otherDeployParamsMap.put("1", deployParam1);
|
||||
|
||||
profile.setOtherDeployParamsForUpdate(otherDeployParamsMap);
|
||||
|
||||
|
|
|
|||
|
|
@ -363,6 +363,7 @@ public class SystemVmTemplateRegistrationTest {
|
|||
systemVmTemplateRegistration.validateTemplates(list);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidateTemplates_downloadableFileNotFound() {
|
||||
CPU.CPUArch arch = SystemVmTemplateRegistration.DOWNLOADABLE_TEMPLATE_ARCH_TYPES.get(0);
|
||||
List<Pair<Hypervisor.HypervisorType, CPU.CPUArch>> list = new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ public class ScaleIOVMSnapshotStrategy extends ManagerBase implements VMSnapshot
|
|||
for (VolumeObjectTO volumeTO : volumeTOs) {
|
||||
Long poolId = volumeTO.getPoolId();
|
||||
Storage.StoragePoolType poolType = vmSnapshotHelper.getStoragePoolType(poolId);
|
||||
if (poolType != Storage.StoragePoolType.PowerFlex || volumeTO.getFormat() != ImageFormat.RAW || poolId != rootPoolId) {
|
||||
if (poolType != Storage.StoragePoolType.PowerFlex || volumeTO.getFormat() != ImageFormat.RAW || !poolId.equals(rootPoolId)) {
|
||||
return StrategyPriority.CANT_HANDLE;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import java.sql.ResultSet;
|
|||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
|
@ -198,12 +197,7 @@ public class DefaultEndPointSelector implements EndPointSelector {
|
|||
Pair<List<DedicatedResourceVO>, Integer> hostIds = dedicatedResourceDao.searchDedicatedHosts(null, null, account.getId(), null, null);
|
||||
List<DedicatedResourceVO> accountDedicatedHosts = hostIds.first();
|
||||
for (DedicatedResourceVO accountDedicatedResource: accountDedicatedHosts){
|
||||
Iterator<Long> dedicatedHostsIterator = dedicatedHosts.iterator();
|
||||
while (dedicatedHostsIterator.hasNext()) {
|
||||
if (dedicatedHostsIterator.next() == accountDedicatedResource.getHostId()) {
|
||||
dedicatedHostsIterator.remove();
|
||||
}
|
||||
}
|
||||
dedicatedHosts.removeIf(hostId -> hostId.equals(accountDedicatedResource.getHostId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public class OnwireClassRegistry {
|
|||
}
|
||||
|
||||
public OnwireClassRegistry(List<String> packages) {
|
||||
packages.addAll(packages);
|
||||
this.packages.addAll(packages);
|
||||
}
|
||||
|
||||
public List<String> getPackages() {
|
||||
|
|
|
|||
|
|
@ -121,11 +121,12 @@ public class ModuleBasedContextFactoryTest {
|
|||
|
||||
public static class InstantiationCounter {
|
||||
public static Integer count = 0;
|
||||
private static final Object countLock = new Object();
|
||||
|
||||
int myCount;
|
||||
|
||||
public InstantiationCounter() {
|
||||
synchronized (count) {
|
||||
synchronized (countLock) {
|
||||
myCount = count + 1;
|
||||
count = myCount;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -440,7 +440,7 @@ public final class RootCAProvider extends AdapterBase implements CAProvider, Con
|
|||
@Override
|
||||
public boolean start() {
|
||||
managementCertificateCustomSAN = CAManager.CertManagementCustomSubjectAlternativeName.value();
|
||||
return loadRootCAKeyPair() && loadRootCAKeyPair() && loadManagementKeyStore();
|
||||
return loadRootCAKeyPair() && loadManagementKeyStore();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public class HypervInvestigator extends AdapterBase implements Investigator {
|
|||
if (status == null) {
|
||||
throw new UnknownVM();
|
||||
}
|
||||
return status == Status.Up ? true : null;
|
||||
return status == Status.Up;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ import org.apache.logging.log4j.LogManager;
|
|||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
|
|
@ -248,6 +249,7 @@ public class HypervDirectConnectResourceTest {
|
|||
Assert.assertTrue(ans.getDetails(), ans.getResult());
|
||||
}
|
||||
|
||||
@Ignore
|
||||
public final void testStartupCommand() {
|
||||
StartupRoutingCommand defaultStartRoutCmd =
|
||||
new StartupRoutingCommand(0, 0, 0, 0, null, Hypervisor.HypervisorType.Hyperv, RouterPrivateIpStrategy.HostLocal);
|
||||
|
|
@ -278,6 +280,7 @@ public class HypervDirectConnectResourceTest {
|
|||
}
|
||||
|
||||
// @Test
|
||||
@Ignore
|
||||
public final void testJson() {
|
||||
StartupStorageCommand sscmd = null;
|
||||
com.cloud.agent.api.StoragePoolInfo pi = new com.cloud.agent.api.StoragePoolInfo("test123", "192.168.0.1", "c:\\", "c:\\", StoragePoolType.Filesystem, 100L, 50L);
|
||||
|
|
|
|||
|
|
@ -3882,12 +3882,12 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||
LOGGER.info(String.format("Host uses control group [%s].", output));
|
||||
|
||||
if (!CGROUP_V2.equals(output)) {
|
||||
LOGGER.info(String.format("Setting host CPU max capacity to 0, as it uses cgroup v1.", getHostCpuMaxCapacity()));
|
||||
LOGGER.info("Setting host CPU max capacity: {} to 0, as it uses cgroup v1.", getHostCpuMaxCapacity());
|
||||
setHostCpuMaxCapacity(0);
|
||||
return;
|
||||
}
|
||||
|
||||
LOGGER.info(String.format("Calculating the max shares of the host."));
|
||||
LOGGER.info("Calculating the max shares of the host.");
|
||||
setHostCpuMaxCapacity(cpuCores * cpuSpeed.intValue());
|
||||
LOGGER.info(String.format("The max shares of the host is [%d].", getHostCpuMaxCapacity()));
|
||||
}
|
||||
|
|
@ -5302,7 +5302,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||
}
|
||||
for (String snapshotName: snapshotNames) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(String.format("Cleaning snapshot [%s] of VM [%s] metadata.", snapshotNames, dm.getName()));
|
||||
LOGGER.debug("Cleaning snapshot {} of VM {} metadata.", Arrays.toString(snapshotNames), dm.getName());
|
||||
}
|
||||
DomainSnapshot snapshot = dm.snapshotLookupByName(snapshotName);
|
||||
snapshot.delete(flags); // clean metadata of vm snapshot
|
||||
|
|
|
|||
|
|
@ -794,7 +794,7 @@ public class KVMStorageProcessor implements StorageProcessor {
|
|||
if (path == null) {
|
||||
path = srcData.getPath();
|
||||
if (path == null) {
|
||||
new CloudRuntimeException("The 'path' or 'iqn' field must be specified.");
|
||||
throw new CloudRuntimeException("The 'path' or 'iqn' field must be specified.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2261,7 +2261,7 @@ public class KVMStorageProcessor implements StorageProcessor {
|
|||
if (path == null) {
|
||||
path = details != null ? details.get(DiskTO.IQN) : null;
|
||||
if (path == null) {
|
||||
new CloudRuntimeException("The 'path' or 'iqn' field must be specified.");
|
||||
throw new CloudRuntimeException("The 'path' or 'iqn' field must be specified.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -228,21 +228,21 @@ public abstract class MultipathSCSIAdapterBase implements StorageAdaptor {
|
|||
|
||||
@Override
|
||||
public boolean disconnectPhysicalDisk(String volumePath, KVMStoragePool pool) {
|
||||
if (LOGGER.isDebugEnabled()) LOGGER.debug(String.format("disconnectPhysicalDisk(volumePath,pool) called with args (%s, %s) START", volumePath, pool.getUuid()));
|
||||
if (LOGGER.isDebugEnabled()) LOGGER.debug("disconnectPhysicalDisk(volumePath,pool) called with args ({}, {}) START", volumePath, pool.getUuid());
|
||||
AddressInfo address = this.parseAndValidatePath(volumePath);
|
||||
if (address.getAddress() == null) {
|
||||
if (LOGGER.isDebugEnabled()) LOGGER.debug(String.format("disconnectPhysicalDisk(volumePath,pool) returning FALSE, volume path has no address field", volumePath, pool.getUuid()));
|
||||
if (LOGGER.isDebugEnabled()) LOGGER.debug("disconnectPhysicalDisk(volumePath,pool) called with args ({}, {}) returning FALSE, volume path has no address field", volumePath, pool.getUuid());
|
||||
return false;
|
||||
}
|
||||
ScriptResult result = runScript(disconnectScript, 60000L, address.getAddress().toLowerCase());
|
||||
|
||||
if (result.getExitCode() != 0) {
|
||||
LOGGER.warn(String.format("Disconnect failed for path [%s] with return code [%s]", address.getAddress().toLowerCase(), result.getExitCode()));
|
||||
LOGGER.warn("Disconnect failed for path {} with return code {}", address.getAddress().toLowerCase(), result.getExitCode());
|
||||
}
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("multipath flush output: " + result.getResult());
|
||||
LOGGER.debug(String.format("disconnectPhysicalDisk(volumePath,pool) called with args (%s, %s) COMPLETE [rc=%s]", volumePath, pool.getUuid(), result.getResult()));
|
||||
LOGGER.debug("multipath flush output: {}", result.getResult());
|
||||
LOGGER.debug("disconnectPhysicalDisk(volumePath,pool) called with args ({}, {}) COMPLETE [rc={}]", volumePath, pool.getUuid(), result.getResult());
|
||||
}
|
||||
|
||||
return (result.getExitCode() == 0);
|
||||
|
|
@ -250,7 +250,7 @@ public abstract class MultipathSCSIAdapterBase implements StorageAdaptor {
|
|||
|
||||
@Override
|
||||
public boolean disconnectPhysicalDisk(Map<String, String> volumeToDisconnect) {
|
||||
LOGGER.debug(String.format("disconnectPhysicalDisk(volumeToDisconnect) called with arg bag [not implemented]:") + " " + volumeToDisconnect);
|
||||
LOGGER.debug("disconnectPhysicalDisk(volumeToDisconnect) called with arg bag [not implemented]: {}", volumeToDisconnect);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ import org.apache.logging.log4j.Logger;
|
|||
import org.joda.time.Duration;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.libvirt.Connect;
|
||||
|
|
@ -5607,6 +5608,7 @@ public class LibvirtComputingResourceTest {
|
|||
Mockito.verify(vmDef, times(1)).addComp(Mockito.any());
|
||||
}
|
||||
|
||||
@Ignore
|
||||
public void validateGetCurrentMemAccordingToMemBallooningWithoutMemBalooning(){
|
||||
VirtualMachineTO vmTo = Mockito.mock(VirtualMachineTO.class);
|
||||
Mockito.when(vmTo.getType()).thenReturn(Type.User);
|
||||
|
|
@ -5692,6 +5694,7 @@ public class LibvirtComputingResourceTest {
|
|||
Assert.assertEquals(valueExpected, result);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
public void setDiskIoDriverTestIoUring() {
|
||||
DiskDef diskDef = configureAndTestSetDiskIoDriverTest(HYPERVISOR_LIBVIRT_VERSION_SUPPORTS_IOURING, HYPERVISOR_QEMU_VERSION_SUPPORTS_IOURING);
|
||||
Assert.assertEquals(IoDriverPolicy.IO_URING, diskDef.getIoDriver());
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import org.apache.cloudstack.utils.qemu.QemuImg;
|
|||
import org.apache.cloudstack.utils.qemu.QemuImg.PhysicalDiskFormat;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.MockedConstruction;
|
||||
|
|
@ -140,6 +141,7 @@ public class ScaleIOStoragePoolTest {
|
|||
assertTrue(pool.isExternalSnapshot());
|
||||
}
|
||||
|
||||
@Ignore
|
||||
public void testGetPhysicalDiskWithWildcardFileFilter() throws Exception {
|
||||
final String volumePath = "6c3362b500000001:vol-139-3d2c-12f0";
|
||||
final String systemId = "218ce1797566a00f";
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public class ConnectionTest extends Connection {
|
|||
logger.debug("methodresponse call: " + method + " - " + params);
|
||||
logger.trace("methodresponse reply: " + result);
|
||||
}
|
||||
if (result == null && multiRes.size() >= 0) {
|
||||
if (result == null && !multiRes.isEmpty()) {
|
||||
result = getResult();
|
||||
logger.debug("getresult call: " + method + " - " + params);
|
||||
logger.trace("getresult reply: " + result);
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import static org.junit.Assert.assertEquals;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
public class NtpTest {
|
||||
|
|
@ -42,6 +43,7 @@ public class NtpTest {
|
|||
+ "</data>\n"
|
||||
+ "</array>\n");
|
||||
|
||||
@Ignore
|
||||
public void testGetNtp() throws Ovm3ResourceException {
|
||||
con.setResult(results.getNil());
|
||||
results.basicBooleanTest(nTp.getDetails());
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
|||
import org.apache.cloudstack.test.utils.SpringUtils;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
|
|
@ -240,12 +241,16 @@ public class VmwareDatacenterApiUnitTest {
|
|||
}
|
||||
|
||||
//@Test(expected = InvalidParameterValueException.class)
|
||||
@Test
|
||||
@Ignore
|
||||
public void testAddVmwareDcToInvalidZone() throws ResourceInUseException, IllegalArgumentException, DiscoveryException, Exception {
|
||||
Mockito.when(addCmd.getZoneId()).thenReturn(2L);
|
||||
_vmwareDatacenterService.addVmwareDatacenter(addCmd);
|
||||
}
|
||||
|
||||
//@Test(expected = ResourceInUseException.class)
|
||||
@Test
|
||||
@Ignore
|
||||
public void testAddVmwareDcToZoneWithClusters() throws ResourceInUseException, IllegalArgumentException, DiscoveryException, Exception {
|
||||
Mockito.when(_clusterDao.listByZoneId(1L)).thenReturn(clusterList);
|
||||
_vmwareDatacenterService.addVmwareDatacenter(addCmd);
|
||||
|
|
@ -264,36 +269,48 @@ public class VmwareDatacenterApiUnitTest {
|
|||
}
|
||||
|
||||
//@Test(expected = ResourceInUseException.class)
|
||||
@Test
|
||||
@Ignore
|
||||
public void testAddVmwareDcToZoneWithVmwareDc() throws ResourceInUseException, IllegalArgumentException, DiscoveryException, Exception {
|
||||
Mockito.when(_vmwareDcDao.getVmwareDatacenterByNameAndVcenter(vmwareDcName, vCenterHost)).thenReturn(vmwareDcs);
|
||||
_vmwareDatacenterService.addVmwareDatacenter(addCmd);
|
||||
}
|
||||
|
||||
//@Test(expected = InvalidParameterValueException.class)
|
||||
@Test
|
||||
@Ignore
|
||||
public void testAddVmwareDcWithNullUser() throws ResourceInUseException, IllegalArgumentException, DiscoveryException, Exception {
|
||||
Mockito.when(addCmd.getUsername()).thenReturn(null);
|
||||
_vmwareDatacenterService.addVmwareDatacenter(addCmd);
|
||||
}
|
||||
|
||||
//@Test(expected = InvalidParameterValueException.class)
|
||||
@Test
|
||||
@Ignore
|
||||
public void testAddVmwareDcWithNullPassword() throws ResourceInUseException, IllegalArgumentException, DiscoveryException, Exception {
|
||||
Mockito.when(addCmd.getPassword()).thenReturn(null);
|
||||
_vmwareDatacenterService.addVmwareDatacenter(addCmd);
|
||||
}
|
||||
|
||||
//@Test(expected = InvalidParameterValueException.class)
|
||||
@Test
|
||||
@Ignore
|
||||
public void testAddVmwareDcWithNullUrl() throws ResourceInUseException, IllegalArgumentException, DiscoveryException, Exception {
|
||||
Mockito.when(addCmd.getVcenter()).thenReturn(null);
|
||||
_vmwareDatacenterService.addVmwareDatacenter(addCmd);
|
||||
}
|
||||
|
||||
//@Test(expected = InvalidParameterValueException.class)
|
||||
@Test
|
||||
@Ignore
|
||||
public void testAddVmwareDcWithNullDcName() throws ResourceInUseException, IllegalArgumentException, DiscoveryException, Exception {
|
||||
Mockito.when(addCmd.getName()).thenReturn(null);
|
||||
_vmwareDatacenterService.addVmwareDatacenter(addCmd);
|
||||
}
|
||||
|
||||
//@Test(expected = CloudRuntimeException.class)
|
||||
@Test
|
||||
@Ignore
|
||||
public void testReAddVmwareDc() throws ResourceInUseException, IllegalArgumentException, DiscoveryException, Exception {
|
||||
Mockito.when(_vmwareDcZoneMapDao.findByZoneId(1L)).thenReturn(dcZoneMap);
|
||||
_vmwareDatacenterService.addVmwareDatacenter(addCmd);
|
||||
|
|
|
|||
|
|
@ -181,10 +181,9 @@ public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru,
|
|||
logger.debug("We are returning the default host to execute commands because the target hypervisor of the source data is not XenServer.");
|
||||
return defaultHostToExecuteCommands;
|
||||
}
|
||||
// only now can we decide, now we now we're only deciding for ourselves
|
||||
if (cmd instanceof StorageSubSystemCommand) {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace(String.format("XenServer StrorageSubSystemCommand re always executed in sequence (command of type %s to host %l).", cmd.getClass(), hostId));
|
||||
logger.trace(String.format("XenServer StrorageSubSystemCommand is always executed in sequence (command of type %s to host %s).", cmd.getClass(), hostId));
|
||||
}
|
||||
StorageSubSystemCommand c = (StorageSubSystemCommand)cmd;
|
||||
c.setExecuteInSequence(true);
|
||||
|
|
@ -223,7 +222,7 @@ public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru,
|
|||
return defaultHostToExecuteCommands;
|
||||
}
|
||||
logger.debug(String.format("We are changing the hostId to executed command from %d to %d.", hostId, hostCandidateToExecutedCommand.getId()));
|
||||
return new Pair<Boolean, Long>(Boolean.TRUE, new Long(hostCandidateToExecutedCommand.getId()));
|
||||
return new Pair<>(Boolean.TRUE, hostCandidateToExecutedCommand.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import org.apache.xmlrpc.XmlRpcException;
|
|||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.BDDMockito;
|
||||
|
|
@ -112,6 +113,7 @@ public class CitrixResourceBaseTest {
|
|||
|
||||
}
|
||||
|
||||
@Ignore
|
||||
public void testGetPathFilesException() {
|
||||
String patch = citrixResourceBase.getPatchFilePath();
|
||||
|
||||
|
|
@ -122,6 +124,7 @@ public class CitrixResourceBaseTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Ignore
|
||||
public void testGetPathFilesListReturned() {
|
||||
String patch = citrixResourceBase.getPatchFilePath();
|
||||
|
||||
|
|
|
|||
|
|
@ -231,7 +231,6 @@ public class BrocadeVcsGuestNetworkGuruTest {
|
|||
|
||||
when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(true);
|
||||
|
||||
mock(DeploymentPlan.class);
|
||||
|
||||
final NetworkVO network = mock(NetworkVO.class);
|
||||
when(network.getName()).thenReturn("testnetwork");
|
||||
|
|
@ -291,7 +290,6 @@ public class BrocadeVcsGuestNetworkGuruTest {
|
|||
|
||||
when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(false);
|
||||
|
||||
mock(DeploymentPlan.class);
|
||||
|
||||
final NetworkVO network = mock(NetworkVO.class);
|
||||
when(network.getName()).thenReturn("testnetwork");
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
// under the License.
|
||||
package com.cloud.network.cisco;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.Map;
|
||||
|
|
@ -136,7 +137,7 @@ public class CiscoVnmcConnectionTest {
|
|||
@Test
|
||||
public void testListUnassocAsa1000v() throws ExecutionException {
|
||||
Map<String, String> response = connection.listUnAssocAsa1000v();
|
||||
assertTrue(response.size() >= 0);
|
||||
assertFalse(response.isEmpty());
|
||||
fwDns = response;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import java.util.Map;
|
|||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.cloud.agent.api.Answer;
|
||||
|
|
@ -79,6 +80,7 @@ public class CiscoVnmcResourceTest {
|
|||
}
|
||||
|
||||
//@Test
|
||||
@Ignore
|
||||
public void resourceConfigure() throws ConfigurationException {
|
||||
_resource.configure("CiscoVnmcResource", _parameters);
|
||||
assertTrue("CiscoVnmc".equals(_resource.getName()));
|
||||
|
|
@ -86,6 +88,7 @@ public class CiscoVnmcResourceTest {
|
|||
}
|
||||
|
||||
//@Test
|
||||
@Ignore
|
||||
public void testInitialization() throws ConfigurationException {
|
||||
_resource.configure("CiscoVnmcResource", _parameters);
|
||||
StartupCommand[] sc = _resource.initialize();
|
||||
|
|
|
|||
|
|
@ -180,7 +180,6 @@ public class NiciraNvpGuestNetworkGuruTest {
|
|||
when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] {"STT", "VXLAN"}));
|
||||
when(physnet.getId()).thenReturn(NETWORK_ID);
|
||||
|
||||
mock(NiciraNvpDeviceVO.class);
|
||||
when(nvpdao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Collections.<NiciraNvpDeviceVO> emptyList());
|
||||
|
||||
final NetworkOffering offering = mock(NetworkOffering.class);
|
||||
|
|
@ -203,7 +202,6 @@ public class NiciraNvpGuestNetworkGuruTest {
|
|||
when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] {"VLAN"}));
|
||||
when(physnet.getId()).thenReturn(NETWORK_ID);
|
||||
|
||||
mock(NiciraNvpDeviceVO.class);
|
||||
when(nvpdao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Collections.<NiciraNvpDeviceVO> emptyList());
|
||||
|
||||
final NetworkOffering offering = mock(NetworkOffering.class);
|
||||
|
|
@ -263,7 +261,6 @@ public class NiciraNvpGuestNetworkGuruTest {
|
|||
|
||||
when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(false);
|
||||
|
||||
mock(DeploymentPlan.class);
|
||||
|
||||
final NetworkVO network = mock(NetworkVO.class);
|
||||
when(network.getName()).thenReturn("testnetwork");
|
||||
|
|
@ -318,7 +315,6 @@ public class NiciraNvpGuestNetworkGuruTest {
|
|||
|
||||
when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(false);
|
||||
|
||||
mock(DeploymentPlan.class);
|
||||
|
||||
final NetworkVO network = mock(NetworkVO.class);
|
||||
when(network.getName()).thenReturn("testnetwork");
|
||||
|
|
@ -377,7 +373,6 @@ public class NiciraNvpGuestNetworkGuruTest {
|
|||
|
||||
when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(false);
|
||||
|
||||
mock(DeploymentPlan.class);
|
||||
|
||||
final NetworkVO network = mock(NetworkVO.class);
|
||||
when(network.getName()).thenReturn("testnetwork");
|
||||
|
|
@ -432,7 +427,6 @@ public class NiciraNvpGuestNetworkGuruTest {
|
|||
|
||||
when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(false);
|
||||
|
||||
mock(DeploymentPlan.class);
|
||||
|
||||
final NetworkVO network = mock(NetworkVO.class);
|
||||
when(network.getName()).thenReturn("testnetwork");
|
||||
|
|
|
|||
|
|
@ -273,8 +273,6 @@ public class NiciraNvpApiIT {
|
|||
}
|
||||
}
|
||||
|
||||
UUID.randomUUID().toString();
|
||||
|
||||
// Test CRUD for Nat Rules
|
||||
SourceNatRule snr = new SourceNatRule();
|
||||
snr.setToSourceIpAddressMin("192.168.10.10");
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ public class NsxNetworkCommand extends NsxCommand {
|
|||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
NsxNetworkCommand that = (NsxNetworkCommand) o;
|
||||
return networkResourceId == that.networkResourceId && vmId == that.vmId &&
|
||||
return networkResourceId.equals(that.networkResourceId) && vmId.equals(that.vmId) &&
|
||||
Objects.equals(networkResourceName, that.networkResourceName) && Objects.equals(publicIp, that.publicIp)
|
||||
&& Objects.equals(vmIp, that.vmIp);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import com.cloud.exception.ResourceUnavailableException;
|
|||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.network.tungsten.api.response.TungstenFabricRuleResponse;
|
||||
import org.apache.cloudstack.network.tungsten.service.TungstenService;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
|
@ -67,6 +68,7 @@ public class AddTungstenFabricPolicyRuleCmdTest {
|
|||
ReflectionTestUtils.setField(addTungstenFabricPolicyRuleCmd, "destEndPort", 1);
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
closeable.close();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import com.cloud.exception.ResourceUnavailableException;
|
|||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.network.tungsten.api.response.TungstenFabricFirewallRuleResponse;
|
||||
import org.apache.cloudstack.network.tungsten.service.TungstenService;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
|
@ -66,6 +67,7 @@ public class CreateTungstenFabricFirewallRuleCmdTest {
|
|||
ReflectionTestUtils.setField(createTungstenFabricFirewallRuleCmd, "sequence", 1);
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
closeable.close();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import com.cloud.network.TungstenProvider;
|
|||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.network.tungsten.api.response.TungstenFabricProviderResponse;
|
||||
import org.apache.cloudstack.network.tungsten.service.TungstenProviderService;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
|
@ -60,6 +61,7 @@ public class CreateTungstenFabricProviderCmdTest {
|
|||
ReflectionTestUtils.setField(createTungstenFabricProviderCmd, "introspectPort", "test");
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
closeable.close();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ package org.apache.cloudstack.network.tungsten.api.command;
|
|||
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.cloudstack.network.tungsten.service.TungstenService;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
|
@ -47,6 +48,7 @@ public class DeleteTungstenFabricTagCmdTest {
|
|||
ReflectionTestUtils.setField(deleteTungstenFabricTagCmd, "tagUuid", "test");
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
closeable.close();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import com.cloud.exception.ResourceUnavailableException;
|
|||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.network.tungsten.api.response.TungstenFabricTagResponse;
|
||||
import org.apache.cloudstack.network.tungsten.service.TungstenService;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
|
@ -61,6 +62,7 @@ public class RemoveTungstenFabricTagCmdTest {
|
|||
ReflectionTestUtils.setField(removeTungstenFabricTagCmd, "tagUuid", "test");
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
closeable.close();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public class RedfishWrapper {
|
|||
case SOFT:
|
||||
return RedfishClient.RedfishResetCmd.GracefulShutdown;
|
||||
case STATUS:
|
||||
throw new IllegalStateException(String.format("%s is not a valid Redfish Reset command [%s]", operation));
|
||||
throw new IllegalStateException(String.format("%s is not a valid Redfish Reset command", operation));
|
||||
default:
|
||||
throw new IllegalStateException(String.format("Redfish does not support operation [%s]", operation));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ package org.apache.cloudstack.storage.datastore.util;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.apache.cloudstack.storage.datastore.util.NexentaNmsClient.NmsResponse;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
|
@ -132,6 +133,11 @@ public class NexentaStorAppliance {
|
|||
public boolean equals(Object other) {
|
||||
return other instanceof CreateIscsiTargetRequestParams && targetName.equals(((CreateIscsiTargetRequestParams) other).targetName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(targetName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -242,7 +248,7 @@ public class NexentaStorAppliance {
|
|||
return response!= null && response.getResult() > 0;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@SuppressWarnings({"unused", "EqualsHashCode", "EqualsAndHashCode", "java:S2160", "errorprone"})
|
||||
static final class LuParams {
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
|
|
@ -309,6 +315,11 @@ public class NexentaStorAppliance {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(targetGroup, lun, zvol, hostGroup, entryNumber);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
|
|
|
|||
|
|
@ -399,7 +399,7 @@ public class StorPoolPrimaryDataStoreDriver implements PrimaryDataStoreDriver {
|
|||
private String resizeVolume(DataObject data, String path, VolumeObject vol) {
|
||||
String err = null;
|
||||
ResizeVolumePayload payload = (ResizeVolumePayload)vol.getpayload();
|
||||
boolean needResize = vol.getSize() != payload.newSize;
|
||||
boolean needResize = !vol.getSize().equals(payload.newSize);
|
||||
|
||||
final String name = StorPoolStorageAdaptor.getVolumeNameFromPath(path, true);
|
||||
final long oldSize = vol.getSize();
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ public class StorPoolDataMotionStrategy implements DataMotionStrategy {
|
|||
if (answer != null && answer.getResult()) {
|
||||
SpApiResponse resSnapshot = StorPoolUtil.volumeSnapshot(volumeName, template.getUuid(), null, "template", null, conn);
|
||||
if (resSnapshot.getError() != null) {
|
||||
logger.debug(String.format("Could not snapshot volume with ID={}", snapshot.getId()));
|
||||
logger.debug("Could not snapshot volume with ID={}", snapshot.getId());
|
||||
StorPoolUtil.spLog("VolumeSnapshot failed with error=%s", resSnapshot.getError().getDescr());
|
||||
err = resSnapshot.getError().getDescr();
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ public class ADLdapUserManagerImpl extends OpenLdapUserManagerImpl implements Ld
|
|||
private static final String MICROSOFT_AD_MEMBERS_FILTER = "memberOf";
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("BanJNDI")
|
||||
public List<LdapUser> getUsersInGroup(String groupName, LdapContext context, Long domainId) throws NamingException {
|
||||
if (StringUtils.isBlank(groupName)) {
|
||||
throw new IllegalArgumentException("ldap group name cannot be blank");
|
||||
|
|
|
|||
|
|
@ -135,8 +135,7 @@ public class OpenLdapUserManagerImpl implements LdapUserManager {
|
|||
final StringBuilder memberOfFilter = new StringBuilder();
|
||||
if (null != group) {
|
||||
if(logger.isDebugEnabled()) {
|
||||
logger.debug("adding search filter for '" + group +
|
||||
"', using '" + memberOfAttribute + "'");
|
||||
logger.debug("adding search filter for '{}', using '{}'", group, memberOfAttribute);
|
||||
}
|
||||
memberOfFilter.append("(" + memberOfAttribute + "=");
|
||||
memberOfFilter.append(group);
|
||||
|
|
@ -235,6 +234,7 @@ public class OpenLdapUserManagerImpl implements LdapUserManager {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("BanJNDI")
|
||||
public List<LdapUser> getUsersInGroup(String groupName, LdapContext context, Long domainId) throws NamingException {
|
||||
String attributeName = _ldapConfiguration.getGroupUniqueMemberAttribute(domainId);
|
||||
final SearchControls controls = new SearchControls();
|
||||
|
|
@ -264,6 +264,7 @@ public class OpenLdapUserManagerImpl implements LdapUserManager {
|
|||
return users;
|
||||
}
|
||||
|
||||
@SuppressWarnings("BanJNDI")
|
||||
private LdapUser getUserForDn(String userdn, LdapContext context, Long domainId) throws NamingException {
|
||||
final SearchControls controls = new SearchControls();
|
||||
controls.setSearchScope(_ldapConfiguration.getScope());
|
||||
|
|
@ -286,6 +287,7 @@ public class OpenLdapUserManagerImpl implements LdapUserManager {
|
|||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("BanJNDI")
|
||||
public LdapUser searchUser(final String basedn, final String searchString, final LdapContext context, Long domainId) throws NamingException, IOException {
|
||||
final SearchControls searchControls = new SearchControls();
|
||||
|
||||
|
|
@ -310,6 +312,7 @@ public class OpenLdapUserManagerImpl implements LdapUserManager {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("BanJNDI")
|
||||
public List<LdapUser> searchUsers(final String username, final LdapContext context, Long domainId) throws NamingException, IOException {
|
||||
|
||||
final SearchControls searchControls = new SearchControls();
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import org.junit.After;
|
|||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.InjectMocks;
|
||||
|
|
@ -136,6 +137,7 @@ public class LdapDirectoryServerConnectionTest {
|
|||
}
|
||||
|
||||
// @Test
|
||||
@Ignore
|
||||
public void testEmbeddedLdapAvailable() {
|
||||
try {
|
||||
List<LdapUser> usahs = ldapManager.getUsers(1L);
|
||||
|
|
@ -157,6 +159,7 @@ public class LdapDirectoryServerConnectionTest {
|
|||
}
|
||||
|
||||
// @Test
|
||||
@Ignore
|
||||
public void testUserCreation() {
|
||||
LdapConnection connection = new LdapNetworkConnection( "localhost", 10389 );
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ public class LdapUnboundidZapdotConnectionTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("BanJNDI")
|
||||
public void testDirContext() throws Exception {
|
||||
|
||||
// Test using the good ol' JDNI-LDAP integration
|
||||
|
|
@ -78,7 +79,9 @@ public class LdapUnboundidZapdotConnectionTest {
|
|||
dirContext.search(DOMAIN_DSN, "(objectClass=person)", searchControls);
|
||||
assertEquals(24, Iterators.size(Iterators.forEnumeration(resultNamingEnumeration)));
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("BanJNDI")
|
||||
public void testContext() throws Exception {
|
||||
|
||||
// Another test using the good ol' JDNI-LDAP integration, this time with the Context interface
|
||||
|
|
|
|||
|
|
@ -411,7 +411,7 @@ public class ApiXmlDocWriter {
|
|||
xs.alias("alert", Alert.class);
|
||||
try(ObjectOutputStream out = xs.createObjectOutputStream(new FileWriter(dirName + "/alert_types.xml"), "alerts");) {
|
||||
for (Field f : AlertManager.class.getFields()) {
|
||||
if (f.getClass().isAssignableFrom(Number.class)) {
|
||||
if (Number.class.isAssignableFrom(f.getType())) {
|
||||
String name = f.getName().substring(11);
|
||||
Alert alert = new Alert(name, f.getInt(null));
|
||||
out.writeObject(alert);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ package com.cloud.api.doc;
|
|||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class Argument implements Comparable<Object>, Serializable {
|
||||
public class Argument implements Comparable<Argument>, Serializable {
|
||||
private static final long serialVersionUID = 2L;
|
||||
private String name;
|
||||
private String description;
|
||||
|
|
@ -101,11 +101,11 @@ public class Argument implements Comparable<Object>, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Object anotherAgrument) throws ClassCastException {
|
||||
if (!(anotherAgrument instanceof Argument))
|
||||
throw new ClassCastException("An Argument object expected.");
|
||||
Argument argument = (Argument)anotherAgrument;
|
||||
return this.getName().compareToIgnoreCase(argument.getName());
|
||||
public int compareTo(Argument anotherArgument) {
|
||||
if (anotherArgument == null) {
|
||||
throw new NullPointerException("Cannot compare to null Argument");
|
||||
}
|
||||
return this.getName().compareToIgnoreCase(anotherArgument.getName());
|
||||
}
|
||||
|
||||
public boolean hasArguments() {
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ import com.cloud.storage.VnfTemplateNicVO;
|
|||
import com.cloud.storage.dao.VnfTemplateDetailsDao;
|
||||
import com.cloud.storage.dao.VnfTemplateNicDao;
|
||||
import com.cloud.user.dao.UserDataDao;
|
||||
import com.google.common.primitives.Ints;
|
||||
import org.apache.cloudstack.annotation.AnnotationService;
|
||||
import org.apache.cloudstack.annotation.dao.AnnotationDao;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
|
|
@ -340,7 +341,7 @@ public class TemplateJoinDaoImpl extends GenericDaoBaseWithTagInformation<Templa
|
|||
ChildTemplateResponse childTempl = new ChildTemplateResponse();
|
||||
childTempl.setId(tmpl.getUuid());
|
||||
childTempl.setName(tmpl.getName());
|
||||
childTempl.setSize(Math.round(tmpl.getSize() / (1024 * 1024 * 1024)));
|
||||
childTempl.setSize(Ints.saturatedCast(tmpl.getSize() / (1024 * 1024 * 1024)));
|
||||
childTemplatesSet.add(childTempl);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5391,7 +5391,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
}
|
||||
|
||||
final Boolean isRangeForSystemVM = checkIfVlanRangeIsForSystemVM(id);
|
||||
if (forSystemVms != null && isRangeForSystemVM != forSystemVms) {
|
||||
if (forSystemVms != null && !isRangeForSystemVM.equals(forSystemVms)) {
|
||||
if (VlanType.DirectAttached.equals(vlanRange.getVlanType())) {
|
||||
throw new InvalidParameterValueException("forSystemVms is not available for this IP range with vlan type: " + VlanType.DirectAttached);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1041,7 +1041,7 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements Configur
|
|||
try {
|
||||
if (vm != null && !VmHaEnabled.valueIn(vm.getDataCenterId())) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(String.format("VM high availability manager is disabled, rescheduling the HA work %s, for the VM %s (id) to retry later in case VM high availability manager is enabled on retry attempt", work, vm.getName(), vm.getId()));
|
||||
logger.debug("VM high availability manager is disabled, rescheduling the HA work {}, for the VM {} (id: {}) to retry later in case VM high availability manager is enabled on retry attempt", work, vm.getName(), vm.getId());
|
||||
}
|
||||
long nextTime = getRescheduleTime(wt);
|
||||
rescheduleWork(work, nextTime);
|
||||
|
|
|
|||
|
|
@ -1311,7 +1311,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
|
|||
try {
|
||||
_privateIPAddressDao.releasePodIpAddress(id);
|
||||
} catch (Exception e) {
|
||||
new CloudRuntimeException(e.getMessage());
|
||||
throw new CloudRuntimeException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1443,7 +1443,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||
|
||||
protected boolean zoneWideVolumeRequiresStorageMotion(PrimaryDataStore volumeDataStore,
|
||||
final Host sourceHost, final Host destinationHost) {
|
||||
if (volumeDataStore.isManaged() && sourceHost.getClusterId() != destinationHost.getClusterId()) {
|
||||
if (volumeDataStore.isManaged() && !sourceHost.getClusterId().equals(destinationHost.getClusterId())) {
|
||||
PrimaryDataStoreDriver driver = (PrimaryDataStoreDriver)volumeDataStore.getDriver();
|
||||
// Depends on the storage driver. For some storages simply
|
||||
// changing volume access to host should work: grant access on destination
|
||||
|
|
|
|||
|
|
@ -3689,7 +3689,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
|
|||
} else {
|
||||
result = CollectionUtils.isSubCollection(Arrays.asList(newDiskOfferingTagsAsStringArray), storageTagsList);
|
||||
}
|
||||
logger.debug(String.format("Destination storage pool [{}] accepts tags [{}]? {}", destPool.getUuid(), diskOfferingTags, result));
|
||||
logger.debug("Destination storage pool [{}] accepts tags [{}]? {}", destPool.getUuid(), diskOfferingTags, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2140,7 +2140,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
|||
}
|
||||
|
||||
protected void validateDiskOfferingChecks(ServiceOfferingVO currentServiceOffering, ServiceOfferingVO newServiceOffering) {
|
||||
if (currentServiceOffering.getDiskOfferingStrictness() != newServiceOffering.getDiskOfferingStrictness()) {
|
||||
if (!currentServiceOffering.getDiskOfferingStrictness().equals(newServiceOffering.getDiskOfferingStrictness())) {
|
||||
throw new InvalidParameterValueException("Unable to Scale VM, since disk offering strictness flag is not same for new service offering and old service offering");
|
||||
}
|
||||
|
||||
|
|
@ -2391,7 +2391,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
|||
|
||||
_executor = Executors.newScheduledThreadPool(wrks, new NamedThreadFactory("UserVm-Scavenger"));
|
||||
|
||||
String vmIpWorkers = configs.get(VmIpFetchTaskWorkers.value());
|
||||
String vmIpWorkers = configs.get(VmIpFetchTaskWorkers.key());
|
||||
int vmipwrks = NumbersUtil.parseInt(vmIpWorkers, 10);
|
||||
|
||||
_vmIpFetchExecutor = Executors.newScheduledThreadPool(vmipwrks, new NamedThreadFactory("UserVm-ipfetch"));
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ public class RoutedIpv4ManagerImpl extends ComponentLifecycleBase implements Rou
|
|||
|
||||
DataCenterIpv4GuestSubnetVO subnetVO = dataCenterIpv4GuestSubnetDao.findById(id);
|
||||
if (subnetVO == null) {
|
||||
throw new InvalidParameterValueException(String.format("Cannot find subnet with id: ", id));
|
||||
throw new InvalidParameterValueException(String.format("Cannot find subnet with id: %s", id));
|
||||
}
|
||||
Long accountId = null;
|
||||
if (accountName != null || (projectId != null && projectId != -1L)) {
|
||||
|
|
@ -430,7 +430,7 @@ public class RoutedIpv4ManagerImpl extends ComponentLifecycleBase implements Rou
|
|||
final Long id = cmd.getId();
|
||||
DataCenterIpv4GuestSubnetVO subnetVO = dataCenterIpv4GuestSubnetDao.findById(id);
|
||||
if (subnetVO == null) {
|
||||
throw new InvalidParameterValueException(String.format("Cannot find subnet with id: ", id));
|
||||
throw new InvalidParameterValueException(String.format("Cannot find subnet with id: %s", id));
|
||||
}
|
||||
|
||||
// update domain_id and account_id to null via dataCenterIpv4GuestSubnetDao, to release the dedication
|
||||
|
|
@ -1278,7 +1278,7 @@ public class RoutedIpv4ManagerImpl extends ComponentLifecycleBase implements Rou
|
|||
|
||||
BgpPeerVO bgpPeerVO = bgpPeerDao.findById(id);
|
||||
if (bgpPeerVO == null) {
|
||||
throw new InvalidParameterValueException(String.format("Cannot find BGP peer with id: ", id));
|
||||
throw new InvalidParameterValueException(String.format("Cannot find BGP peer with id: %s", id));
|
||||
}
|
||||
Long accountId = null;
|
||||
if (accountName != null || (projectId != null && projectId != -1L)) {
|
||||
|
|
@ -1326,7 +1326,7 @@ public class RoutedIpv4ManagerImpl extends ComponentLifecycleBase implements Rou
|
|||
final Long id = releaseDedicatedBgpPeerCmd.getId();
|
||||
BgpPeerVO bgpPeerVO = bgpPeerDao.findById(id);
|
||||
if (bgpPeerVO == null) {
|
||||
throw new InvalidParameterValueException(String.format("Cannot find BGP peer with id: ", id));
|
||||
throw new InvalidParameterValueException(String.format("Cannot find BGP peer with id: %s", id));
|
||||
}
|
||||
|
||||
// update domain_id and account_id to null via bgpPeerDao, to release the dedication
|
||||
|
|
|
|||
|
|
@ -673,7 +673,7 @@ public class GlobalLoadBalancingRulesServiceImpl implements GlobalLoadBalancingR
|
|||
// set site as 'local' for the site in that zone
|
||||
for (Pair<Long, Long> innerLoopZoneId : gslbSiteIds) {
|
||||
SiteLoadBalancerConfig siteLb = zoneSiteLoadbalancerMap.get(innerLoopZoneId.first());
|
||||
siteLb.setLocal(zoneId.first() == innerLoopZoneId.first());
|
||||
siteLb.setLocal(zoneId.first().equals(innerLoopZoneId.first()));
|
||||
slbs.add(siteLb);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -456,6 +456,7 @@ public class QueryManagerImplTest {
|
|||
Assert.assertTrue(CollectionUtils.isNotEmpty(result));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testListAffectedVmsForScopeChange() {
|
||||
Long clusterId = 1L;
|
||||
Long poolId = 2L;
|
||||
|
|
|
|||
|
|
@ -449,6 +449,7 @@ public class ConfigurationManagerImplTest {
|
|||
Assert.assertNotNull(offering);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidateInvalidConfiguration() {
|
||||
Mockito.doReturn(null).when(configDao).findByName(Mockito.anyString());
|
||||
String msg = configurationManagerImplSpy.validateConfigurationValue("test.config.name", "testvalue", ConfigKey.Scope.Global.toString());
|
||||
|
|
|
|||
|
|
@ -553,9 +553,8 @@ public class DeploymentPlanningManagerImplTest {
|
|||
@Test
|
||||
public void passEncRootProvidedHostSupportingEncryptionTest() {
|
||||
HostVO host = new HostVO("host");
|
||||
Map<String, String> hostDetails = new HashMap<>() {{
|
||||
put(Host.HOST_VOLUME_ENCRYPTION, "true");
|
||||
}};
|
||||
Map<String, String> hostDetails = new HashMap<>();
|
||||
hostDetails.put(Host.HOST_VOLUME_ENCRYPTION, "true");
|
||||
host.setDetails(hostDetails);
|
||||
|
||||
VolumeVO vol1 = new VolumeVO("vol1", dataCenterId, podId, 1L, 1L, instanceId, "folder", "path", Storage.ProvisioningType.THIN, (long) 10 << 30, Volume.Type.ROOT);
|
||||
|
|
@ -578,9 +577,8 @@ public class DeploymentPlanningManagerImplTest {
|
|||
@Test
|
||||
public void failEncRootProvidedHostNotSupportingEncryptionTest() {
|
||||
HostVO host = new HostVO("host");
|
||||
Map<String, String> hostDetails = new HashMap<>() {{
|
||||
put(Host.HOST_VOLUME_ENCRYPTION, "false");
|
||||
}};
|
||||
Map<String, String> hostDetails = new HashMap<>();
|
||||
hostDetails.put(Host.HOST_VOLUME_ENCRYPTION, "false");
|
||||
host.setDetails(hostDetails);
|
||||
|
||||
VolumeVO vol1 = new VolumeVO("vol1", dataCenterId, podId, 1L, 1L, instanceId, "folder", "path", Storage.ProvisioningType.THIN, (long) 10 << 30, Volume.Type.ROOT);
|
||||
|
|
@ -603,9 +601,8 @@ public class DeploymentPlanningManagerImplTest {
|
|||
@Test
|
||||
public void passNoEncRootProvidedHostNotSupportingEncryptionTest() {
|
||||
HostVO host = new HostVO("host");
|
||||
Map<String, String> hostDetails = new HashMap<>() {{
|
||||
put(Host.HOST_VOLUME_ENCRYPTION, "false");
|
||||
}};
|
||||
Map<String, String> hostDetails = new HashMap<>();
|
||||
hostDetails.put(Host.HOST_VOLUME_ENCRYPTION, "false");
|
||||
host.setDetails(hostDetails);
|
||||
|
||||
VolumeVO vol1 = new VolumeVO("vol1", dataCenterId, podId, 1L, 1L, instanceId, "folder", "path", Storage.ProvisioningType.THIN, (long) 10 << 30, Volume.Type.ROOT);
|
||||
|
|
@ -627,9 +624,8 @@ public class DeploymentPlanningManagerImplTest {
|
|||
@Test
|
||||
public void passNoEncRootProvidedHostSupportingEncryptionTest() {
|
||||
HostVO host = new HostVO("host");
|
||||
Map<String, String> hostDetails = new HashMap<>() {{
|
||||
put(Host.HOST_VOLUME_ENCRYPTION, "true");
|
||||
}};
|
||||
Map<String, String> hostDetails = new HashMap<>();
|
||||
hostDetails.put(Host.HOST_VOLUME_ENCRYPTION, "true");
|
||||
host.setDetails(hostDetails);
|
||||
|
||||
VolumeVO vol1 = new VolumeVO("vol1", dataCenterId, podId, 1L, 1L, instanceId, "folder", "path", Storage.ProvisioningType.THIN, (long) 10 << 30, Volume.Type.ROOT);
|
||||
|
|
@ -651,9 +647,8 @@ public class DeploymentPlanningManagerImplTest {
|
|||
@Test
|
||||
public void passEncRootLastHostSupportingEncryptionTest() {
|
||||
HostVO host = Mockito.spy(new HostVO("host"));
|
||||
Map<String, String> hostDetails = new HashMap<>() {{
|
||||
put(Host.HOST_VOLUME_ENCRYPTION, "true");
|
||||
}};
|
||||
Map<String, String> hostDetails = new HashMap<>();
|
||||
hostDetails.put(Host.HOST_VOLUME_ENCRYPTION, "true");
|
||||
host.setDetails(hostDetails);
|
||||
Mockito.when(host.getStatus()).thenReturn(Status.Up);
|
||||
|
||||
|
|
@ -681,9 +676,8 @@ public class DeploymentPlanningManagerImplTest {
|
|||
@Test
|
||||
public void failEncRootLastHostNotSupportingEncryptionTest() {
|
||||
HostVO host = Mockito.spy(new HostVO("host"));
|
||||
Map<String, String> hostDetails = new HashMap<>() {{
|
||||
put(Host.HOST_VOLUME_ENCRYPTION, "false");
|
||||
}};
|
||||
Map<String, String> hostDetails = new HashMap<>();
|
||||
hostDetails.put(Host.HOST_VOLUME_ENCRYPTION, "false");
|
||||
host.setDetails(hostDetails);
|
||||
Mockito.when(host.getStatus()).thenReturn(Status.Up);
|
||||
|
||||
|
|
@ -707,9 +701,8 @@ public class DeploymentPlanningManagerImplTest {
|
|||
@Test
|
||||
public void passEncRootPlannerHostSupportingEncryptionTest() {
|
||||
HostVO host = Mockito.spy(new HostVO("host"));
|
||||
Map<String, String> hostDetails = new HashMap<>() {{
|
||||
put(Host.HOST_VOLUME_ENCRYPTION, "true");
|
||||
}};
|
||||
Map<String, String> hostDetails = new HashMap<>();
|
||||
hostDetails.put(Host.HOST_VOLUME_ENCRYPTION, "true");
|
||||
host.setDetails(hostDetails);
|
||||
Mockito.when(host.getStatus()).thenReturn(Status.Up);
|
||||
|
||||
|
|
@ -732,9 +725,8 @@ public class DeploymentPlanningManagerImplTest {
|
|||
@Test
|
||||
public void failEncRootPlannerHostSupportingEncryptionTest() {
|
||||
HostVO host = Mockito.spy(new HostVO("host"));
|
||||
Map<String, String> hostDetails = new HashMap<>() {{
|
||||
put(Host.HOST_VOLUME_ENCRYPTION, "false");
|
||||
}};
|
||||
Map<String, String> hostDetails = new HashMap<>();
|
||||
hostDetails.put(Host.HOST_VOLUME_ENCRYPTION, "false");
|
||||
host.setDetails(hostDetails);
|
||||
Mockito.when(host.getStatus()).thenReturn(Status.Up);
|
||||
|
||||
|
|
@ -758,11 +750,8 @@ public class DeploymentPlanningManagerImplTest {
|
|||
public void findSuitablePoolsForVolumesTest() throws Exception {
|
||||
Long diskOfferingId = 1L;
|
||||
HostVO host = Mockito.spy(new HostVO("host"));
|
||||
Map<String, String> hostDetails = new HashMap<>() {
|
||||
{
|
||||
put(Host.HOST_VOLUME_ENCRYPTION, "true");
|
||||
}
|
||||
};
|
||||
Map<String, String> hostDetails = new HashMap<>();
|
||||
hostDetails.put(Host.HOST_VOLUME_ENCRYPTION, "true");
|
||||
host.setDetails(hostDetails);
|
||||
Mockito.when(host.getStatus()).thenReturn(Status.Up);
|
||||
|
||||
|
|
@ -851,9 +840,8 @@ public class DeploymentPlanningManagerImplTest {
|
|||
|
||||
StoragePool pool = new StoragePoolVO();
|
||||
|
||||
Map<Volume, List<StoragePool>> suitableVolumeStoragePools = new HashMap<>() {{
|
||||
put(vol1, List.of(pool));
|
||||
}};
|
||||
Map<Volume, List<StoragePool>> suitableVolumeStoragePools = new HashMap<>();
|
||||
suitableVolumeStoragePools.put(vol1, List.of(pool));
|
||||
|
||||
Pair<Map<Volume, List<StoragePool>>, List<Volume>> suitable = new Pair<>(suitableVolumeStoragePools, volumes);
|
||||
|
||||
|
|
@ -881,9 +869,8 @@ public class DeploymentPlanningManagerImplTest {
|
|||
ArgumentMatchers.anyInt()
|
||||
);
|
||||
|
||||
Map<Volume, StoragePool> suitableVolumeStoragePoolMap = new HashMap<>() {{
|
||||
put(vol1, pool);
|
||||
}};
|
||||
Map<Volume, StoragePool> suitableVolumeStoragePoolMap = new HashMap<>();
|
||||
suitableVolumeStoragePoolMap.put(vol1, pool);
|
||||
Mockito.doReturn(true).when(_dpm).hostCanAccessSPool(ArgumentMatchers.any(Host.class), ArgumentMatchers.any(StoragePool.class));
|
||||
|
||||
Pair<Host, Map<Volume, StoragePool>> potentialResources = new Pair<>(host, suitableVolumeStoragePoolMap);
|
||||
|
|
|
|||
|
|
@ -417,7 +417,10 @@ public class AutoScaleManagerImplTest {
|
|||
|
||||
when(asPolicyDao.persist(any(AutoScalePolicyVO.class))).thenReturn(asScaleUpPolicyMock);
|
||||
|
||||
userDataDetails.put("0", new HashMap<>() {{ put("key1", "value1"); put("key2", "value2"); }});
|
||||
HashMap<String, String> mapValues = new HashMap<>();
|
||||
mapValues.put("key1", "value1");
|
||||
mapValues.put("key2", "value2");
|
||||
userDataDetails.put("0", mapValues);
|
||||
Mockito.doReturn(userDataFinal).when(userVmMgr).finalizeUserData(any(), any(), any());
|
||||
Mockito.doReturn(userDataFinal).when(userDataMgr).validateUserData(eq(userDataFinal), nullable(BaseCmd.HTTPMethod.class));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ import org.apache.logging.log4j.Logger;
|
|||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.InjectMocks;
|
||||
|
|
@ -255,6 +256,7 @@ public class HypervisorTemplateAdapterTest {
|
|||
}
|
||||
|
||||
//@Test
|
||||
@Ignore
|
||||
public void testEmitDeleteEventUuid() throws InterruptedException, ExecutionException {
|
||||
//All the mocks required for this test to work.
|
||||
ImageStoreEntity store = mock(ImageStoreEntity.class);
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ import org.apache.cloudstack.test.utils.SpringUtils;
|
|||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mockito;
|
||||
|
|
@ -251,6 +252,7 @@ public class TemplateManagerImplTest {
|
|||
templateManager.verifyTemplateId(1L);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
public void testVerifyTemplateIdOfNonSystemTemplate() {
|
||||
templateManager.verifyTemplateId(1L);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -319,11 +319,10 @@ public class DomainManagerImplTest {
|
|||
|
||||
@Test
|
||||
public void validateNetworkDomainTestNullNetworkDomainDoesNotCallVerifyDomainName() {
|
||||
try (MockedStatic<NetUtils> ignored = Mockito.mockStatic(NetUtils.class)) {
|
||||
Mockito.when(NetUtils.verifyDomainName(Mockito.anyString())).thenReturn(true);
|
||||
try (MockedStatic<NetUtils> mockedNetUtils = Mockito.mockStatic(NetUtils.class)) {
|
||||
mockedNetUtils.when(() -> NetUtils.verifyDomainName(Mockito.anyString())).thenReturn(true);
|
||||
domainManager.validateNetworkDomain(null);
|
||||
Mockito.verify(NetUtils.class, Mockito.never());
|
||||
NetUtils.verifyDomainName(Mockito.anyString());
|
||||
mockedNetUtils.verify(() -> NetUtils.verifyDomainName(Mockito.anyString()), Mockito.never());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1677,6 +1677,7 @@ public class UserVmManagerImplTest {
|
|||
userVmManagerImpl.validateStrictHostTagCheck(vm, destinationHostVO);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetRootVolumeSizeForVmRestore() {
|
||||
VMTemplateVO template = Mockito.mock(VMTemplateVO.class);
|
||||
Mockito.when(template.getSize()).thenReturn(10L * GiB_TO_BYTES);
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
|
|||
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.InjectMocks;
|
||||
|
|
@ -348,6 +349,7 @@ public class UserVmManagerTest {
|
|||
|
||||
// Test scaleVm for Stopped vm.
|
||||
//@Test(expected=InvalidParameterValueException.class)
|
||||
@Ignore
|
||||
public void testScaleVMF3() throws Exception {
|
||||
|
||||
ScaleVMCmd cmd = new ScaleVMCmd();
|
||||
|
|
@ -389,6 +391,7 @@ public class UserVmManagerTest {
|
|||
}
|
||||
|
||||
// Test scaleVm for Running vm. Full positive test.
|
||||
@Ignore
|
||||
public void testScaleVMF4() throws Exception {
|
||||
|
||||
ScaleVMCmd cmd = new ScaleVMCmd();
|
||||
|
|
|
|||
|
|
@ -384,10 +384,9 @@ public class VMSnapshotManagerTest {
|
|||
|
||||
@Test
|
||||
public void testUpgradeUserVmServiceOffering() throws ConcurrentOperationException, ResourceUnavailableException, ManagementServerException, VirtualMachineMigrationException {
|
||||
Map<String, String> details = new HashMap<String, String>() {{
|
||||
put(userVmDetailCpuNumber.getName(), userVmDetailCpuNumber.getValue());
|
||||
put(userVmDetailMemory.getName(), userVmDetailMemory.getValue());
|
||||
}};
|
||||
Map<String, String> details = new HashMap<>();
|
||||
details.put(userVmDetailCpuNumber.getName(), userVmDetailCpuNumber.getValue());
|
||||
details.put(userVmDetailMemory.getName(), userVmDetailMemory.getValue());
|
||||
when(_userVmManager.upgradeVirtualMachine(TEST_VM_ID, SERVICE_OFFERING_ID, details)).thenReturn(true);
|
||||
_vmSnapshotMgr.upgradeUserVmServiceOffering(userVm, SERVICE_OFFERING_ID, details);
|
||||
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ public class RouterDeploymentDefinitionTest extends RouterDeploymentDefinitionTe
|
|||
// Assert
|
||||
verify(mockNwDao, times(1)).acquireInLockTable(NW_ID_1, 600);
|
||||
assertNotNull(LOCK_NOT_CORRECTLY_GOT, deployment.tableLockId);
|
||||
assertEquals(LOCK_NOT_CORRECTLY_GOT, NW_ID_1, NW_ID_1, deployment.tableLockId.longValue());
|
||||
assertEquals(LOCK_NOT_CORRECTLY_GOT, NW_ID_1, deployment.tableLockId);
|
||||
}
|
||||
|
||||
@Test(expected = ConcurrentOperationException.class)
|
||||
|
|
|
|||
|
|
@ -287,8 +287,9 @@ public class ServerNtlmsspChallenge extends OneTimeSwitch implements NtlmConstan
|
|||
if (state.serverChallenge == null)
|
||||
throw new RuntimeException("Challenge was not extracted from server NTLMSSP Challenge packet.");
|
||||
if (!Arrays.equals(challenge, state.serverChallenge))
|
||||
throw new RuntimeException("Challenge was extracted from server NTLMSSP Challenge packet is not equal to expected. Actual value: "
|
||||
+ state.serverChallenge + ", expected value: " + challenge + ".");
|
||||
throw new RuntimeException(String.format("Challenge was extracted from server NTLMSSP Challenge packet is not" +
|
||||
" equal to expected. Actual value: %s, expected value: %s.",
|
||||
Arrays.toString(state.serverChallenge), Arrays.toString(challenge)));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ public class ByteBuffer {
|
|||
|
||||
public void extend(int newLength) {
|
||||
if (data.length < newLength)
|
||||
Arrays.copyOf(data, newLength);
|
||||
data = Arrays.copyOf(data, newLength);
|
||||
}
|
||||
|
||||
public void ref() {
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ public class ByteBufferTest {
|
|||
// and was used to remove these cases from the production code.
|
||||
// Don't try to fix it
|
||||
@Test
|
||||
@SuppressWarnings("BadShiftAmount")
|
||||
public void testShiftByteBy32BitsDoesNothing() throws Exception {
|
||||
for (byte b : data) {
|
||||
assertEquals(b, b << 32);
|
||||
|
|
|
|||
|
|
@ -2527,7 +2527,7 @@
|
|||
"label.vnf.app.action.reinstall": "Reinstall VNF Appliance",
|
||||
"label.vnf.cidr.list": "CIDR from which access to the VNF appliance's Management interface should be allowed from",
|
||||
"label.vnf.cidr.list.tooltip": "the CIDR list to forward traffic from to the VNF management interface. Multiple entries must be separated by a single comma character (,). The default value is 0.0.0.0/0.",
|
||||
"label.vnf.configure.management": "Configure Firewall and Port Forwarding rules for VNF's management interfaces",
|
||||
"label.vnf.configure.management": "Configure network rules for VNF's management interfaces",
|
||||
"label.vnf.configure.management.tooltip": "True by default, security group or network rules (source nat and firewall rules) will be configured for VNF management interfaces. False otherwise. Learn what rules are configured at http://docs.cloudstack.apache.org/en/latest/adminguide/networking/vnf_templates_appliances.html#deploying-vnf-appliances",
|
||||
"label.vnf.detail.add": "Add VNF detail",
|
||||
"label.vnf.detail.remove": "Remove VNF detail",
|
||||
|
|
|
|||
|
|
@ -356,7 +356,10 @@ export default {
|
|||
permission: ['listVnfAppliances'],
|
||||
resourceType: 'UserVm',
|
||||
params: () => {
|
||||
return { details: 'servoff,tmpl,nics', isvnf: true }
|
||||
return {
|
||||
details: 'group,nics,secgrp,tmpl,servoff,diskoff,iso,volume,affgrp,backoff,vnfnics',
|
||||
isvnf: true
|
||||
}
|
||||
},
|
||||
columns: () => {
|
||||
const fields = ['name', 'state', 'ipaddress']
|
||||
|
|
|
|||
|
|
@ -1305,7 +1305,7 @@ export default {
|
|||
for (const deviceId of managementDeviceIds) {
|
||||
if (this.vnfNicNetworks && this.vnfNicNetworks[deviceId] &&
|
||||
((this.vnfNicNetworks[deviceId].type === 'Isolated' && this.vnfNicNetworks[deviceId].vpcid === undefined) ||
|
||||
(this.vnfNicNetworks[deviceId].type === 'Shared' && this.zone.securitygroupsenabled))) {
|
||||
(this.vnfNicNetworks[deviceId].type === 'Shared' && this.vnfNicNetworks[deviceId].service.filter(svc => svc.name === 'SecurityGroupProvider')))) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ export default {
|
|||
methods: {
|
||||
fetchData () {
|
||||
var params = {
|
||||
details: 'servoff,tmpl,nics',
|
||||
details: 'group,nics,secgrp,tmpl,servoff,diskoff,iso,volume,affgrp,backoff,vnfnics',
|
||||
isVnf: true,
|
||||
listAll: true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,9 +40,11 @@ import java.util.concurrent.ScheduledExecutorService;
|
|||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.cloudstack.utils.security.KeyStoreUtils;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
|
@ -708,13 +710,31 @@ public class Script implements Callable<String> {
|
|||
return executeCommandForExitValue(0, command);
|
||||
}
|
||||
|
||||
private static void cleanupProcesses(AtomicReference<List<Process>> processesRef) {
|
||||
List<Process> processes = processesRef.get();
|
||||
if (CollectionUtils.isNotEmpty(processes)) {
|
||||
for (Process process : processes) {
|
||||
if (process == null) {
|
||||
continue;
|
||||
}
|
||||
LOGGER.trace(String.format("Cleaning up process [%s] from piped commands.", process.pid()));
|
||||
IOUtils.closeQuietly(process.getErrorStream());
|
||||
IOUtils.closeQuietly(process.getOutputStream());
|
||||
IOUtils.closeQuietly(process.getInputStream());
|
||||
process.destroyForcibly();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Pair<Integer, String> executePipedCommands(List<String[]> commands, long timeout) {
|
||||
if (timeout <= 0) {
|
||||
timeout = DEFAULT_TIMEOUT;
|
||||
}
|
||||
final AtomicReference<List<Process>> processesRef = new AtomicReference<>();
|
||||
Callable<Pair<Integer, String>> commandRunner = () -> {
|
||||
List<ProcessBuilder> builders = commands.stream().map(ProcessBuilder::new).collect(Collectors.toList());
|
||||
List<Process> processes = ProcessBuilder.startPipeline(builders);
|
||||
processesRef.set(processes);
|
||||
Process last = processes.get(processes.size()-1);
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(last.getInputStream()))) {
|
||||
String line;
|
||||
|
|
@ -741,6 +761,8 @@ public class Script implements Callable<String> {
|
|||
result.second(ERR_TIMEOUT);
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
LOGGER.error("Error executing piped commands", e);
|
||||
} finally {
|
||||
cleanupProcesses(processesRef);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -870,7 +870,7 @@ public class HypervisorHostHelper {
|
|||
|
||||
private static boolean areBoolPoliciesDifferent(BoolPolicy currentPolicy, BoolPolicy newPolicy) {
|
||||
return eitherObjectNull(currentPolicy, newPolicy) ||
|
||||
(newPolicy != null && newPolicy.isValue() != currentPolicy.isValue());
|
||||
(newPolicy != null && !newPolicy.isValue().equals(currentPolicy.isValue()));
|
||||
}
|
||||
|
||||
private static boolean areDVSSecurityPoliciesDifferent(DVSSecurityPolicy currentSecurityPolicy, DVSSecurityPolicy newSecurityPolicy) {
|
||||
|
|
@ -889,9 +889,9 @@ public class HypervisorHostHelper {
|
|||
private static boolean areDVSMacManagementPoliciesDifferent(DVSMacManagementPolicy currentMacManagementPolicy, DVSMacManagementPolicy newMacManagementPolicy) {
|
||||
return eitherObjectNull(currentMacManagementPolicy, newMacManagementPolicy) ||
|
||||
(newMacManagementPolicy != null &&
|
||||
(currentMacManagementPolicy.isAllowPromiscuous() != newMacManagementPolicy.isAllowPromiscuous() ||
|
||||
currentMacManagementPolicy.isForgedTransmits() != newMacManagementPolicy.isForgedTransmits() ||
|
||||
currentMacManagementPolicy.isMacChanges() != newMacManagementPolicy.isMacChanges() ||
|
||||
(!currentMacManagementPolicy.isAllowPromiscuous().equals(newMacManagementPolicy.isAllowPromiscuous()) ||
|
||||
!currentMacManagementPolicy.isForgedTransmits().equals(newMacManagementPolicy.isForgedTransmits()) ||
|
||||
!currentMacManagementPolicy.isMacChanges().equals(newMacManagementPolicy.isMacChanges()) ||
|
||||
areDVSMacLearningPoliciesDifferent(currentMacManagementPolicy.getMacLearningPolicy(), newMacManagementPolicy.getMacLearningPolicy())));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue