diff --git a/build/build-cloud.xml b/build/build-cloud.xml
index db9e5a7c5af..4d52d08bb01 100755
--- a/build/build-cloud.xml
+++ b/build/build-cloud.xml
@@ -107,6 +107,10 @@
+
+
+
+
@@ -519,7 +523,8 @@
-
+
+
@@ -531,8 +536,26 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build/developer.xml b/build/developer.xml
index 77d760b2af7..33d77a6c85a 100755
--- a/build/developer.xml
+++ b/build/developer.xml
@@ -100,7 +100,7 @@
-
+
@@ -114,7 +114,6 @@
-
diff --git a/build/package.xml b/build/package.xml
index 82781c61a2f..fce58ddcd5e 100755
--- a/build/package.xml
+++ b/build/package.xml
@@ -94,7 +94,7 @@
-
+
@@ -103,6 +103,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -123,7 +135,7 @@
-
+
diff --git a/client/tomcatconf/components.xml.in b/client/tomcatconf/components.xml.in
index ce698854bbe..91141cff203 100755
--- a/client/tomcatconf/components.xml.in
+++ b/client/tomcatconf/components.xml.in
@@ -110,7 +110,9 @@
-
+
+
+
diff --git a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index d88b50528cd..cf552dabc4c 100644
--- a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -152,6 +152,7 @@ import com.cloud.host.Host.Type;
import com.cloud.hypervisor.Hypervisor;
import com.cloud.network.Network.BroadcastDomainType;
import com.cloud.network.Network.TrafficType;
+import com.cloud.hypervisor.xen.resource.XenServerConnectionPool.XenServerConnection;
import com.cloud.resource.ServerResource;
import com.cloud.storage.Storage;
import com.cloud.storage.Storage.ImageFormat;
@@ -1063,29 +1064,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
}
protected Answer execute(ModifySshKeysCommand cmd) {
- String publickey = cmd.getPubKey();
- String privatekey = cmd.getPrvKey();
-
- com.trilead.ssh2.Connection sshConnection = new com.trilead.ssh2.Connection(_host.ip, 22);
- try {
- sshConnection.connect(null, 60000, 60000);
- if (!sshConnection.authenticateWithPassword(_username, _password)) {
- throw new Exception("Unable to authenticate");
- }
- SCPClient scp = new SCPClient(sshConnection);
-
- scp.put(publickey.getBytes(), "id_rsa.pub", "/opt/xensource/bin", "0600");
- scp.put(privatekey.getBytes(), "id_rsa", "/opt/xensource/bin", "0600");
- scp.put(privatekey.getBytes(), "id_rsa.cloud", "/root/.ssh", "0600");
- return new Answer(cmd);
-
- } catch (Exception e) {
- String msg = " scp ssh key failed due to " + e.toString() + " - " + e.getMessage();
- s_logger.warn(msg);
- } finally {
- sshConnection.close();
- }
- return new Answer(cmd, false, "modifySshkeys failed");
+ return new Answer(cmd);
}
private boolean doPingTest(final String computingHostIp) {
@@ -3187,13 +3166,6 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
Ternary mount = mounts.get(0);
- if (!patchSystemVm(mount.second(), vmName)) { // FIXME make this
- // nonspecific
- String msg = "patch system vm failed";
- s_logger.warn(msg);
- return msg;
- }
-
Set templates = VM.getByNameLabel(conn, "CentOS 5.3");
if (templates.size() == 0) {
templates = VM.getByNameLabel(conn, "CentOS 5.3 (64-bit)");
@@ -3232,6 +3204,17 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
vbdr.type = Types.VbdType.DISK;
VBD.create(conn, vbdr);
+
+ /* create CD-ROM VBD */
+ VBD.Record cdromVBDR = new VBD.Record();
+ cdromVBDR.VM = vm;
+ cdromVBDR.empty = true;
+ cdromVBDR.bootable = false;
+ cdromVBDR.userdevice = "3";
+ cdromVBDR.mode = Types.VbdMode.RO;
+ cdromVBDR.type = Types.VbdType.CD;
+ VBD cdromVBD = VBD.create(conn, cdromVBDR);
+ cdromVBD.insert(conn, VDI.getByUuid(conn, _host.systemvmisouuid));
/* create VIF0 */
VIF.Record vifr = new VIF.Record();
@@ -3508,8 +3491,6 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
s_logger.debug("Slave logon successful. session= " + slaveSession);
}
Host host = Host.getByUuid(slaveConn, _host.uuid);
-
-
for (int i = 0; i < params.length; i += 2) {
args.put(params[i], params[i + 1]);
}
@@ -4013,7 +3994,38 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
try {
Host myself = Host.getByUuid(conn, _host.uuid);
_host.pool = getPoolUuid();
+
+ boolean findsystemvmiso = false;
+ Set srs = SR.getByNameLabel(conn, "XenServer Tools");
+ if( srs.size() != 1 ) {
+ throw new CloudRuntimeException("There are " + srs.size() + " SRs with name XenServer Tools");
+ }
+ SR sr = srs.iterator().next();
+ sr.scan(conn);
+ SR.Record srr = sr.getRecord(conn);
+ _host.systemvmisouuid = null;
+ for( VDI vdi : srr.VDIs ) {
+ VDI.Record vdir = vdi.getRecord(conn);
+ if(vdir.nameLabel.contains("systemvm-premium")){
+ _host.systemvmisouuid = vdir.uuid;
+ break;
+ }
+ }
+ if( _host.systemvmisouuid == null ) {
+ for( VDI vdi : srr.VDIs ) {
+ VDI.Record vdir = vdi.getRecord(conn);
+ if(vdir.nameLabel.contains("systemvm")){
+ _host.systemvmisouuid = vdir.uuid;
+ break;
+ }
+ }
+ }
+
+ if( _host.systemvmisouuid == null ) {
+ throw new CloudRuntimeException("can not find systemvmiso");
+ }
+
String name = "cloud-private";
if (_privateNetworkName != null) {
name = _privateNetworkName;
@@ -4344,17 +4356,13 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
scp.put(f, d, p);
}
+
} catch (IOException e) {
throw new CloudRuntimeException("Unable to setup the server correctly", e);
} finally {
sshConnection.close();
}
- try {
- // wait 2 seconds before call plugin
- Thread.sleep(2000);
- } catch (final InterruptedException ex) {
- }
if (!setIptables()) {
s_logger.warn("set xenserver Iptable failed");
}
@@ -6639,6 +6647,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
// the resource first connects to XenServer. These UUIDs do
// not change over time.
protected class XenServerHost {
+ public String systemvmisouuid;
public String uuid;
public String ip;
public String publicNetwork;
diff --git a/patches/xenserver/etc/sysconfig/iptables-domr b/patches/xenserver/etc/sysconfig/iptables-domr
new file mode 100644
index 00000000000..3bc7b50f74a
--- /dev/null
+++ b/patches/xenserver/etc/sysconfig/iptables-domr
@@ -0,0 +1,24 @@
+*nat
+:PREROUTING ACCEPT [0:0]
+:POSTROUTING ACCEPT [0:0]
+:OUTPUT ACCEPT [0:0]
+COMMIT
+*filter
+:INPUT DROP [0:0]
+:FORWARD DROP [0:0]
+:OUTPUT ACCEPT [0:0]
+-A INPUT -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
+-A INPUT -i eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
+-A INPUT -i eth2 -m state --state RELATED,ESTABLISHED -j ACCEPT
+-A INPUT -p icmp -j ACCEPT
+-A INPUT -i lo -j ACCEPT
+-A INPUT -i eth0 -p udp -m udp --dport 67 -j ACCEPT
+-A INPUT -i eth0 -p udp -m udp --dport 53 -j ACCEPT
+-A INPUT -i eth1 -p tcp -m state --state NEW --dport 3922 -j ACCEPT
+-A INPUT -i eth0 -p tcp -m state --state NEW --dport 8080 -j ACCEPT
+-A INPUT -i eth0 -p tcp -m state --state NEW --dport 80 -j ACCEPT
+-A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
+-A FORWARD -i eth0 -o eth2 -j ACCEPT
+-A FORWARD -i eth2 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
+COMMIT
+
diff --git a/patches/xenserver/root/.ssh/authorized_keys b/patches/xenserver/root/.ssh/authorized_keys
new file mode 100644
index 00000000000..2cb275c2582
--- /dev/null
+++ b/patches/xenserver/root/.ssh/authorized_keys
@@ -0,0 +1 @@
+ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA3VD1tGRDn3stlJvPNXmQZdQCNjqcfY+xlitd5q0n3KYqJ5OBrty3/00XBUdLt31TbQ4dv+GR7uEr+ex7rm0jjmTFKV4rHYPi882CuC5+bkBp5R4k+mpcyKbxb+IoNS9ItbiExQxMiiRQpHvNem0GGnNFO3lElRPwUFs8evTvZu5HcTj4k4RJLJ66jeIGJ3sMAJ03SICGwfEZjrsyeOMwJk7cH8WNeuNzxzoZd9v02eI0lHdK9O5z7FwrxvRBbzsmJ0EwuhbH8pR7WR6kGLTNP9KEwtrnzV1LYWd+rFoSeh6ImExG7fma3Ldydg8CPTQsjvCEQUxiuV1/x5am5VJlUw== root@r-6-TEST
diff --git a/patches/xenserver/root/patchsystemvm.sh b/patches/xenserver/root/patchsystemvm.sh
new file mode 100755
index 00000000000..f878ea11aa8
--- /dev/null
+++ b/patches/xenserver/root/patchsystemvm.sh
@@ -0,0 +1,121 @@
+#/bin/bash
+# $Id: patchsystemvm.sh 10800 2010-07-16 13:48:39Z edison $ $HeadURL: svn://svn.lab.vmops.com/repos/branches/2.1.x/java/scripts/vm/hypervisor/xenserver/prepsystemvm.sh $
+
+#set -x
+logfile="/var/log/patchsystemvm.log"
+#
+# To use existing console proxy .zip-based package file
+#
+patch_console_proxy() {
+ local patchfile=$1
+ rm /usr/local/cloud/systemvm -rf
+ mkdir -p /usr/local/cloud/systemvm
+ echo "All" | unzip $patchfile -d /usr/local/cloud/systemvm >$logfile 2>&1
+ find /usr/local/cloud/systemvm/ -name \*.sh | xargs chmod 555
+ return 0
+}
+
+consoleproxy_svcs() {
+ chkconfig cloud on
+ chkconfig postinit on
+ chkconfig domr_webserver off
+ chkconfig haproxy off ;
+ chkconfig dnsmasq off
+ chkconfig sshd on
+ chkconfig httpd off
+ chkconfig nfs off
+ chkconfig nfslock off
+ chkconfig rpcbind off
+ chkconfig rpcidmap off
+ cp /etc/sysconfig/iptables-consoleproxy /etc/sysconfig/iptables
+ mkdir -p /var/log/cloud
+}
+
+secstorage_svcs() {
+ chkconfig cloud on
+ chkconfig postinit on
+ chkconfig domr_webserver off
+ chkconfig haproxy off ;
+ chkconfig dnsmasq off
+ chkconfig sshd on
+ chkconfig httpd off
+ cp /etc/sysconfig/iptables-secstorage /etc/sysconfig/iptables
+ mkdir -p /var/log/cloud
+}
+
+routing_svcs() {
+ chkconfig cloud off
+ chkconfig domr_webserver on ;
+ chkconfig haproxy on ;
+ chkconfig dnsmasq on
+ chkconfig sshd on
+ chkconfig nfs off
+ chkconfig nfslock off
+ chkconfig rpcbind off
+ chkconfig rpcidmap off
+ cp /etc/sysconfig/iptables-domr /etc/sysconfig/iptables
+}
+
+CMDLINE=$(cat /proc/cmdline)
+TYPE="router"
+
+for i in $CMDLINE
+ do
+ # search for foo=bar pattern and cut out foo
+ KEY=$(echo $i | cut -d= -f1)
+ VALUE=$(echo $i | cut -d= -f2)
+ case $KEY in
+ type)
+ TYPE=$VALUE
+ ;;
+ *)
+ ;;
+ esac
+done
+
+if [ "$TYPE" == "consoleproxy" ] || [ "$TYPE" == "secstorage" ] && [ -f /media/cdrom/systemvm.zip ]
+then
+ patch_console_proxy /media/cdrom/systemvm.zip
+ if [ $? -gt 0 ]
+ then
+ printf "Failed to apply patch systemvm\n" >$logfile
+ exit 5
+ fi
+fi
+
+
+#empty known hosts
+echo "" > /root/.ssh/known_hosts
+
+if [ "$TYPE" == "router" ]
+then
+ routing_svcs
+ if [ $? -gt 0 ]
+ then
+ printf "Failed to execute routing_svcs\n" >$logfile
+ exit 6
+ fi
+fi
+
+
+if [ "$TYPE" == "consoleproxy" ]
+then
+ consoleproxy_svcs
+ if [ $? -gt 0 ]
+ then
+ printf "Failed to execute consoleproxy_svcs\n" >$logfile
+ exit 7
+ fi
+fi
+
+if [ "$TYPE" == "secstorage" ]
+then
+ secstorage_svcs
+ if [ $? -gt 0 ]
+ then
+ printf "Failed to execute secstorage_svcs\n" >$logfile
+ exit 8
+ fi
+fi
+
+exit $?
diff --git a/scripts/vm/hypervisor/xenserver/id_rsa.cloud b/scripts/vm/hypervisor/xenserver/id_rsa.cloud
new file mode 100644
index 00000000000..ea46a3cebb6
--- /dev/null
+++ b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tjkXIaLR1wDJ+K8IGJQ19sqCzv3/kBCDXA6mqXkkPR80xRi4wuZ3lETOdL
+OBXPffuQaKxk32esqsxK6As1LgH4+048JS23EQKBgQCpCSf7pc7cV7f0yTm8q5fo
+QgSVEvg0da87dQo6gFTPlKFhY8rl25X+WvgrvLQ726D6x12DLzwhJVXpu5cY2+Dl
+/qNC0+XrEqsF5MsRGIh4oVKCr6SzTYOVPDLlaJz7IElpkRbKe4QYCPNfecpLmTpf
+0Rvse0zlvZa8l4Tm+QIqmwKBgBOzQZeMFPnMAV1q1r1is8gvEZl5maTHHTqXrXu1
+2cxhoyqGkBOmxVCL09eH8WBvXEc0irUyjAC2C32QH7kZz1K/QOAF/Hl6zao6TP6e
+K0k7N861AdJ6QFPTBoqlj6w0wUBeXPfRm3gvXrSbQfoEhTqvjdqI6wSO6jnpp57B
+W7CbAoGABFHMVXEyT3SliMSRtiCuDOrtl9E/aiOByPulXolqth5WDSel31Lz+iY7
+ldOLNQO/oononTStdd0fDGChl3WXBSOToJJ/HjIWH05bDY9n2EDAyZvmaW9rX3JQ
+pH9c/1vlD9lxDEBvq4JXmTtdL0Ho00F5vVHnWnwINtfx6c5BIjg=
+-----END RSA PRIVATE KEY-----
diff --git a/scripts/vm/hypervisor/xenserver/xenserver56/patch b/scripts/vm/hypervisor/xenserver/xenserver56/patch
index 15b8908ddb5..14b4039c5a2 100644
--- a/scripts/vm/hypervisor/xenserver/xenserver56/patch
+++ b/scripts/vm/hypervisor/xenserver/xenserver56/patch
@@ -18,9 +18,12 @@ nfs.py=/opt/xensource/sm
patch.tgz=..,0775,/opt/xensource/bin
vmops=..,0755,/etc/xapi.d/plugins
vmopsSnapshot=..,0755,/etc/xapi.d/plugins
-systemvm-premium.zip=../../../../../vms,0755,/opt/xensource/bin
-hostvmstats.py=..,0755,/opt/xensource/sm
xs_cleanup.sh=..,0755,/opt/xensource/bin
+systemvm-premium.iso=../../../../../vms,0644,/opt/xensource/packages/iso
+systemvm.iso=../../../../../vms,0644,/opt/xensource/packages/iso
+hostvmstats.py=..,0755,/opt/xensource/sm
+id_rsa.cloud=..,0600,/opt/xensource/bin
+id_rsa.cloud=..,0600,/root/.ssh
network_info.sh=..,0755,/opt/xensource/bin
prepsystemvm.sh=..,0755,/opt/xensource/bin
setupxenserver.sh=..,0755,/opt/xensource/bin
diff --git a/server/src/com/cloud/alert/AlertManagerImpl.java b/server/src/com/cloud/alert/AlertManagerImpl.java
index 378bc5dc699..033b1ba3282 100644
--- a/server/src/com/cloud/alert/AlertManagerImpl.java
+++ b/server/src/com/cloud/alert/AlertManagerImpl.java
@@ -153,7 +153,8 @@ public class AlertManagerImpl implements AlertManager {
smtpDebug = Boolean.parseBoolean(smtpDebugStr);
}
- _emailAlert = new EmailAlert(emailAddresses, smtpHost, smtpPort, useAuth, smtpUsername, smtpPassword, emailSender, smtpDebug);
+ _emailAlert = new EmailAlert(emailAddresses, smtpHost, smtpPort, useAuth, smtpUsername, smtpPassword, emailSender, smtpDebug);
+ _emailAlert = null;
String storageCapacityThreshold = configs.get("storage.capacity.threshold");
String cpuCapacityThreshold = configs.get("cpu.capacity.threshold");
diff --git a/server/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java b/server/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
index 049d9a70923..e7dc2a20fbb 100644
--- a/server/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
+++ b/server/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
@@ -52,6 +52,7 @@ import com.cloud.host.Status;
import com.cloud.host.dao.HostDao;
import com.cloud.hypervisor.xen.resource.CitrixResourceBase;
import com.cloud.hypervisor.xen.resource.XcpServerResource;
+import com.cloud.hypervisor.xen.resource.XenServerResource;
import com.cloud.hypervisor.xen.resource.XenServerConnectionPool;
import com.cloud.resource.Discoverer;
import com.cloud.resource.DiscovererBase;
@@ -382,10 +383,10 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
if(prodBrand.equals("XenCloudPlatform") && prodVersion.equals("0.1.1"))
return new XcpServerResource();
-// if(prodBrand.equals("XenServer") && prodVersion.equals("5.6.0"))
-// return new XenServerResource();
+ if(prodBrand.equals("XenServer") && prodVersion.equals("5.6.0"))
+ return new XenServerResource();
- String msg = "Only support XCP 0.1.1 and Xerver 5.6.0, but this one is " + prodBrand + " " + prodVersion;
+ String msg = "Only support XCP 0.1.1 and XenServer 5.6.0, but this one is " + prodBrand + " " + prodVersion;
_alertMgr.sendAlert(AlertManager.ALERT_TYPE_HOST, dcId, podId, msg, msg);
s_logger.debug(msg);
throw new RuntimeException(msg);