Skip to content

Commit 33c0d6c

Browse files
author
Anthony Xu
committed
CLOUDSTACK-6438
CLOUDSTACK-6442 XAPI plugins must be copied to XS master first.
1 parent 52f4043 commit 33c0d6c

2 files changed

Lines changed: 13 additions & 8 deletions

File tree

‎plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4666,8 +4666,16 @@ protected boolean launchHeartBeat(Connection conn) {
46664666

46674667
protected SetupAnswer execute(SetupCommand cmd) {
46684668
Connection conn = getConnection();
4669-
setupServer(conn);
46704669
try {
4670+
Map<Pool, Pool.Record> poolRecs = Pool.getAllRecords(conn);
4671+
if (poolRecs.size() != 1) {
4672+
throw new CloudRuntimeException("There are " + poolRecs.size() + " pool for host :" + _host.uuid);
4673+
}
4674+
Host master = poolRecs.values().iterator().next().master;
4675+
setupServer(conn, master);
4676+
Host host = Host.getByUuid(conn, _host.uuid);
4677+
setupServer(conn, host);
4678+
46714679
if (!setIptables(conn)) {
46724680
s_logger.warn("set xenserver Iptable failed");
46734681
return null;
@@ -4690,7 +4698,6 @@ protected SetupAnswer execute(SetupCommand cmd) {
46904698
return null;
46914699
}
46924700
cleanupTemplateSR(conn);
4693-
Host host = Host.getByUuid(conn, _host.uuid);
46944701
try {
46954702
if (cmd.useMultipath()) {
46964703
// the config value is set to true
@@ -4804,14 +4811,11 @@ protected SetupAnswer execute(SetupCommand cmd) {
48044811
}
48054812

48064813
/* return : if setup is needed */
4807-
protected boolean setupServer(Connection conn) {
4814+
protected boolean setupServer(Connection conn, Host host) {
48084815
String packageVersion = CitrixResourceBase.class.getPackage().getImplementationVersion();
48094816
String version = this.getClass().getName() + "-" + (packageVersion == null ? Long.toString(System.currentTimeMillis()) : packageVersion);
48104817

48114818
try {
4812-
Host host = Host.getByUuid(conn, _host.uuid);
4813-
/* enable host in case it is disabled somehow */
4814-
host.enable(conn);
48154819
/* push patches to XenServer */
48164820
Host.Record hr = host.getRecord(conn);
48174821

‎plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/Xenserver625Resource.java‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import com.xensource.xenapi.Connection;
3131
import com.xensource.xenapi.Types;
3232
import com.xensource.xenapi.VM;
33+
import com.xensource.xenapi.Host;
3334

3435
import org.apache.cloudstack.hypervisor.xenserver.XenServerResourceNewBase;
3536

@@ -107,7 +108,7 @@ protected void umountSnapshotDir(Connection conn, Long dcId) {
107108
}
108109

109110
@Override
110-
protected boolean setupServer(Connection conn) {
111+
protected boolean setupServer(Connection conn,Host host) {
111112
com.trilead.ssh2.Connection sshConnection = new com.trilead.ssh2.Connection(_host.ip, 22);
112113
try {
113114
sshConnection.connect(null, 60000, 60000);
@@ -131,7 +132,7 @@ protected boolean setupServer(Connection conn) {
131132
} finally {
132133
sshConnection.close();
133134
}
134-
return super.setupServer(conn);
135+
return super.setupServer(conn, host);
135136
}
136137

137138
@Override

0 commit comments

Comments
 (0)