Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions incubator-taverna-language
Submodule incubator-taverna-language added at 1a823c
54 changes: 15 additions & 39 deletions plugins/hypervisors/vmware/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>cloud-plugin-hypervisor-vmware</artifactId>
<name>Apache CloudStack Plugin - Hypervisor VMware</name>
Expand All @@ -27,48 +27,24 @@
<version>4.22.1.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

<dependencies>
<!-- Other dependencies can be listed here -->

<!-- JUnit Dependencies for Testing -->
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-vmware-base</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-secondary-storage</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine-storage</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine-orchestration</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.cloud.com.vmware</groupId>
<artifactId>vmware-vim25</artifactId>
<version>${cs.vmware.api.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sun.org.apache.xml.internal</groupId>
<artifactId>resolver</artifactId>
<version>20050927</version>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.7.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.cloud.com.vmware</groupId>
<artifactId>vmware-pbm</artifactId>
<version>${cs.vmware.api.version}</version>
<scope>compile</scope>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.7.0</version>
<scope>test</scope>
</dependency>

</dependencies>
Comment on lines 31 to 49
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This POM change removes all existing compile/runtime dependencies for the VMware plugin and replaces them with only JUnit Jupiter test dependencies. The module’s main sources reference many CloudStack and VMware classes, so it will no longer compile/build. Please restore the original plugin dependencies and, if JUnit 5 is required, add it in addition to (not instead of) the existing dependencies and align versions with the parent BOM/dependencyManagement.

Copilot uses AI. Check for mistakes.
</project>
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.network;
Expand All @@ -34,30 +34,22 @@ public class VmwareTrafficLabel implements TrafficLabel {
VirtualSwitchType _vSwitchType = VirtualSwitchType.StandardVirtualSwitch;
String _vSwitchName = DEFAULT_VSWITCH_NAME;
String _vlanId = Vlan.UNTAGGED;
boolean _isPrimaryNic = true; // Flag to identify if this is a primary NIC
int _rateLimit = 1000; // Default rate limit in Mbps
int _guaranteedBandwidth = 500; // Default guaranteed bandwidth in Mbps

public VmwareTrafficLabel(String networkLabel, TrafficType trafficType, VirtualSwitchType defVswitchType) {
public VmwareTrafficLabel(String networkLabel, TrafficType trafficType, VirtualSwitchType defVswitchType, boolean isPrimaryNic) {
_trafficType = trafficType;
_isPrimaryNic = isPrimaryNic;
_parseLabel(networkLabel, defVswitchType);
}

public VmwareTrafficLabel(String networkLabel, TrafficType trafficType) {
public VmwareTrafficLabel(String networkLabel, TrafficType trafficType, boolean isPrimaryNic) {
_trafficType = trafficType;
_isPrimaryNic = isPrimaryNic;
_parseLabel(networkLabel, VirtualSwitchType.StandardVirtualSwitch);
}
Comment on lines +41 to 51
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The constructors were changed to require an isPrimaryNic boolean and several existing constructors were removed. This is a breaking API change and currently breaks existing callers in this module (e.g., new VmwareTrafficLabel(TrafficType.Guest) and new VmwareTrafficLabel(label, trafficType, defaultVirtualSwitchType) in VmwareServerDiscoverer, VmwareResource, etc.). Keep the old constructors (delegating to the new one) or update all call sites accordingly.

Copilot uses AI. Check for mistakes.

public VmwareTrafficLabel(TrafficType trafficType, VirtualSwitchType defVswitchType) {
_trafficType = trafficType; // Define traffic label with specific traffic type
_parseLabel(null, defVswitchType);
}

public VmwareTrafficLabel(TrafficType trafficType) {
_trafficType = trafficType; // Define traffic label with specific traffic type
_parseLabel(null, VirtualSwitchType.StandardVirtualSwitch);
}

public VmwareTrafficLabel() {
}

private void _parseLabel(String networkLabel, VirtualSwitchType defVswitchType) {
// Set defaults for label in case of distributed vSwitch
if (defVswitchType.equals(VirtualSwitchType.VMwareDistributedVirtualSwitch)) {
Expand Down Expand Up @@ -91,6 +83,20 @@ private void _parseLabel(String networkLabel, VirtualSwitchType defVswitchType)
}
}

public void applyTrafficShaping() {
// Ensure traffic shaping is applied to secondary NICs
if (!_isPrimaryNic) {
// Apply lower rate limits or minimum bandwidth guarantees for secondary NICs
System.out.println("Applying traffic shaping to secondary NIC:");
System.out.println("Rate Limit: " + _rateLimit + " Mbps");
System.out.println("Guaranteed Bandwidth: " + _guaranteedBandwidth + " Mbps");
} else {
// For primary NIC, apply normal rate limits
System.out.println("Applying traffic shaping to primary NIC:");
System.out.println("Rate Limit: " + _rateLimit + " Mbps");
}
}
Comment on lines +86 to +98
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

applyTrafficShaping() currently only prints to stdout and uses hard-coded defaults (1000/500 Mbps). Production code should not use System.out.println; use the project logger and implement actual traffic-shaping integration (or remove this method if it is only for debugging). If these values are real configuration, they should be passed in or loaded from config rather than being magic numbers.

Copilot uses AI. Check for mistakes.

@Override
public TrafficType getTrafficType() {
return _trafficType;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;

import static org.mockito.Mockito.*;

@SpringBootTest
class ConfigurationServerTest {

@Mock
private ManagementServerHostPeerDao managementServerHostPeerDao;

@Mock
private ConfigurationDao configurationDao;

@Mock
private ConfigurationServer configurationServer;

@InjectMocks
private SomeService service; // The service you're testing, which interacts with the beans

@Test
void testGetConfiguration() {
// Arrange (setup mocks)
when(configurationDao.getConfiguration()).thenReturn(new Configuration());

// Act (execute method)
Configuration result = configurationServer.getConfiguration();

// Assert (verify results)
verify(configurationDao).getConfiguration(); // Verify that the method was called
assertNotNull(result); // Assert that the result is not null
Comment on lines +1 to +35
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test file is not a valid/compilable unit test as written: it has no package declaration and references undefined symbols (ManagementServerHostPeerDao, ConfigurationDao, ConfigurationServer, SomeService, Configuration, and assertNotNull is not imported). It also introduces @SpringBootTest even though the codebase does not appear to use Spring Boot tests elsewhere. Please either remove this file or convert it into a proper test with correct package/imports and existing project test infrastructure.

Suggested change
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import static org.mockito.Mockito.*;
@SpringBootTest
class ConfigurationServerTest {
@Mock
private ManagementServerHostPeerDao managementServerHostPeerDao;
@Mock
private ConfigurationDao configurationDao;
@Mock
private ConfigurationServer configurationServer;
@InjectMocks
private SomeService service; // The service you're testing, which interacts with the beans
@Test
void testGetConfiguration() {
// Arrange (setup mocks)
when(configurationDao.getConfiguration()).thenReturn(new Configuration());
// Act (execute method)
Configuration result = configurationServer.getConfiguration();
// Assert (verify results)
verify(configurationDao).getConfiguration(); // Verify that the method was called
assertNotNull(result); // Assert that the result is not null
package com.cloud.hypervisor.vmware;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertNotNull;
class SpringBeanIntegrationTest {
@Test
void testClassIsLoadable() {
assertNotNull(SpringBeanIntegrationTest.class);

Copilot uses AI. Check for mistakes.
}
}
Loading
Loading