Skip to content

Commit 8ff139e

Browse files
* xen-api: use https://mvnrepository.com/artifact/com.citrix.hypervisor/xen-api * xen: set Network.managed to true before creating the network This should fix ``` 2025-04-07 12:08:20,472 WARN [c.c.h.x.r.w.x.CitrixStartCommandWrapper] (DirectAgent-36:[ctx-a59ea070]) (logid:97c16f84) Catch Exception: class com.xensource.xenapi.Types$NetworkUnmanaged due to The network is not managed by xapi. The network is not managed by xapi. at com.xensource.xenapi.Types.checkResponse(Types.java:2514) at com.xensource.xenapi.Connection.dispatch(Connection.java:266) at com.cloud.hypervisor.xenserver.resource.XenServerConnectionPool$XenServerConnection.dispatch(XenServerConnectionPool.java:458) at com.xensource.xenapi.VLAN.create(VLAN.java:363) at com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.enableVlanNetwork(CitrixResourceBase.java:1736) at com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.getNetwork(CitrixResourceBase.java:2885) at com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.createVif(CitrixResourceBase.java:1280) at com.cloud.hypervisor.xenserver.resource.wrapper.xenbase.CitrixStartCommandWrapper.execute(CitrixStartCommandWrapper.java:106) at com.cloud.hypervisor.xenserver.resource.wrapper.xenbase.CitrixStartCommandWrapper.execute(CitrixStartCommandWrapper.java:56) at com.cloud.hypervisor.xenserver.resource.wrapper.xenbase.CitrixRequestWrapper.execute(CitrixRequestWrapper.java:122) at com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.executeRequest(CitrixResourceBase.java:1791) ``` refer to CA-387821: SDK Tests/JavaSDK failed. Set Network.managed to true before creating the network. xenserver/xenserver-samples@1684db5 * xenserver: test code to fix duplicated name in XMLRPC response CustomerMapParser is copied from org.apache.xmlrpc.parser.MapParser:3.1.3 just removed ``` if (this.map.containsKey(this.nameObject)) { throw new SAXParseException("Duplicate name: " + this.nameObject, this.getDocumentLocator()); } ``` ConnectionNew is copied from com.xensource.xenapi.Connection:8.1.0 * xenserver: fix XmlRpcClientException: Failed to parse server's response: Expected struct, got array
1 parent 75c9fff commit 8ff139e

File tree

7 files changed

+346
-8
lines changed

7 files changed

+346
-8
lines changed

plugins/hypervisors/ovm/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
</parent>
3030
<dependencies>
3131
<dependency>
32-
<groupId>net.java.dev.vcc.thirdparty</groupId>
32+
<groupId>com.citrix.hypervisor</groupId>
3333
<artifactId>xen-api</artifactId>
3434
<version>${cs.xapi.version}</version>
3535
</dependency>

plugins/hypervisors/xenserver/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
<scope>compile</scope>
4545
</dependency>
4646
<dependency>
47-
<groupId>net.java.dev.vcc.thirdparty</groupId>
47+
<groupId>com.citrix.hypervisor</groupId>
4848
<artifactId>xen-api</artifactId>
4949
<version>${cs.xapi.version}</version>
5050
</dependency>

plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/discoverer/XcpServerDiscoverer.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@ protected boolean poolHasHotFix(Connection conn, String hostIp, String hotFixUui
267267
} catch (Exception e) {
268268
logger.debug("Caught exception during logout", e);
269269
}
270-
conn.dispose();
271270
conn = null;
272271
}
273272

plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,6 +1699,7 @@ protected Network enableVlanNetwork(final Connection conn, final long tag, final
16991699
nwr.nameLabel = newName;
17001700
nwr.tags = new HashSet<>();
17011701
nwr.tags.add(generateTimeStamp());
1702+
nwr.managed = true;
17021703
vlanNetwork = Network.create(conn, nwr);
17031704
vlanNic = getNetworkByName(conn, newName);
17041705
if (vlanNic == null) { // Still vlanNic is null means we could not
@@ -2004,6 +2005,7 @@ public synchronized Network findOrCreateTunnelNetwork(final Connection conn, fin
20042005
// started
20052006
otherConfig.put("assume_network_is_shared", "true");
20062007
rec.otherConfig = otherConfig;
2008+
rec.managed = true;
20072009
nw = Network.create(conn, rec);
20082010
logger.debug("### XenServer network for tunnels created:" + nwName);
20092011
} else {
@@ -4829,6 +4831,7 @@ public void setupLinkLocalNetwork(final Connection conn) {
48294831
configs.put("netmask", NetUtils.getLinkLocalNetMask());
48304832
configs.put("vswitch-disable-in-band", "true");
48314833
rec.otherConfig = configs;
4834+
rec.managed = true;
48324835
linkLocal = Network.create(conn, rec);
48334836
} else {
48344837
linkLocal = networks.iterator().next();
@@ -5017,6 +5020,7 @@ public synchronized Network setupvSwitchNetwork(final Connection conn) {
50175020
if (networks.isEmpty()) {
50185021
rec.nameDescription = "vswitch network for " + nwName;
50195022
rec.nameLabel = nwName;
5023+
rec.managed = true;
50205024
vswitchNw = Network.create(conn, rec);
50215025
} else {
50225026
vswitchNw = networks.iterator().next();

plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/XenServerConnectionPool.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.cloud.utils.exception.CloudRuntimeException;
2222
import com.xensource.xenapi.APIVersion;
2323
import com.xensource.xenapi.Connection;
24+
import com.xensource.xenapi.ConnectionNew;
2425
import com.xensource.xenapi.Host;
2526
import com.xensource.xenapi.Pool;
2627
import com.xensource.xenapi.Session;
@@ -150,12 +151,12 @@ static void forceSleep(long sec) {
150151
}
151152

152153
public Connection getConnect(String ip, String username, Queue<String> password) {
153-
Connection conn = new Connection(getURL(ip), 10, _connWait);
154+
Connection conn = new ConnectionNew(getURL(ip), 10, _connWait);
154155
try {
155156
loginWithPassword(conn, username, password, APIVersion.latest().toString());
156157
} catch (Types.HostIsSlave e) {
157158
String maddress = e.masterIPAddress;
158-
conn = new Connection(getURL(maddress), 10, _connWait);
159+
conn = new ConnectionNew(getURL(maddress), 10, _connWait);
159160
try {
160161
loginWithPassword(conn, username, password, APIVersion.latest().toString());
161162
} catch (Exception e1) {
@@ -221,7 +222,7 @@ public Connection connect(String hostUuid, String poolUuid, String ipAddress,
221222

222223
if ( mConn == null ) {
223224
try {
224-
Connection conn = new Connection(getURL(ipAddress), 5, _connWait);
225+
Connection conn = new ConnectionNew(getURL(ipAddress), 5, _connWait);
225226
Session sess = loginWithPassword(conn, username, password, APIVersion.latest().toString());
226227
Host host = sess.getThisHost(conn);
227228
Boolean hostenabled = host.getEnabled(conn);
@@ -231,7 +232,6 @@ public Connection connect(String hostUuid, String poolUuid, String ipAddress,
231232
} catch (Exception e) {
232233
LOGGER.debug("Caught exception during logout", e);
233234
}
234-
conn.dispose();
235235
}
236236
if (!hostenabled) {
237237
String msg = "Unable to create master connection, due to master Host " + ipAddress + " is not enabled";

0 commit comments

Comments
 (0)