mirror of https://github.com/apache/cloudstack.git
migration from 2.1 to 2.2 on account of new systemvm template
work in progress don't need the map
This commit is contained in:
parent
016b50181e
commit
1e6dbcbd3d
|
|
@ -45,7 +45,7 @@ public class CitrixHelper {
|
|||
_guestOsMap.put("CentOS 5.3 (64-bit)", "CentOS 5.3 x64");
|
||||
_guestOsMap.put("CentOS 5.4 (32-bit)", "CentOS 5.4");
|
||||
_guestOsMap.put("CentOS 5.4 (64-bit)", "CentOS 5.4 x64");
|
||||
_guestOsMap.put("Debian Lenny 5.0 (32-bit)", "Debian Lenny 5.0");
|
||||
_guestOsMap.put("Debian Lenny 5.0 (32-bit)", "Debian Lenny 5.0 (32-bit)");
|
||||
_guestOsMap.put("Oracle Enterprise Linux 5.0 (32-bit)", "Oracle Enterprise Linux 5.0");
|
||||
_guestOsMap.put("Oracle Enterprise Linux 5.0 (64-bit)", "Oracle Enterprise Linux 5.0 x64");
|
||||
_guestOsMap.put("Oracle Enterprise Linux 5.1 (32-bit)", "Oracle Enterprise Linux 5.1");
|
||||
|
|
@ -106,7 +106,7 @@ public class CitrixHelper {
|
|||
_guestOsList.add("CentOS 5.3 x64");
|
||||
_guestOsList.add("CentOS 5.4");
|
||||
_guestOsList.add("CentOS 5.4 x64");
|
||||
_guestOsList.add("Debian Lenny 5.0");
|
||||
_guestOsList.add("Debian Lenny 5.0 (32-bit)");
|
||||
_guestOsList.add("Oracle Enterprise Linux 5.0");
|
||||
_guestOsList.add("Oracle Enterprise Linux 5.0 x64");
|
||||
_guestOsList.add("Oracle Enterprise Linux 5.1");
|
||||
|
|
@ -158,6 +158,6 @@ public class CitrixHelper {
|
|||
}
|
||||
|
||||
public static String getGuestOsType(long guestOsId) {
|
||||
return _guestOsMap.get(guestOsId-1);
|
||||
return _guestOsList.get((int) (guestOsId-1));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -753,7 +753,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||
}
|
||||
|
||||
protected Pair<VM, String> createVmFromTemplate(Connection conn, VirtualMachineTO vmSpec, Host host) throws XenAPIException, XmlRpcException {
|
||||
String guestOsTypeName = CitrixHelper.getGuestOsType(vmSpec.getOs());
|
||||
String guestOsTypeName = getGuestOsType(vmSpec.getOs());
|
||||
Set<VM> templates = VM.getByNameLabel(conn, guestOsTypeName);
|
||||
assert templates.size() == 1 : "Should only have 1 template but found " + templates.size();
|
||||
VM template = templates.iterator().next();
|
||||
|
|
@ -2517,7 +2517,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||
Set<VM> templates;
|
||||
VM vm = null;
|
||||
String stdType = cmd.getGuestOSDescription();
|
||||
String guestOsTypeName = CitrixHelper.getGuestOsType(stdType);
|
||||
String guestOsTypeName = getGuestOsType(stdType);
|
||||
templates = VM.getByNameLabel(conn, guestOsTypeName);
|
||||
assert templates.size() == 1 : "Should only have 1 template but found " + templates.size();
|
||||
VM template = templates.iterator().next();
|
||||
|
|
|
|||
|
|
@ -234,5 +234,9 @@ public class DiskOfferingVO implements DiskOffering {
|
|||
buf.delete(buf.length() - 1, buf.length());
|
||||
|
||||
setTags(buf.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public void setUseLocalStorage(boolean useLocalStorage) {
|
||||
this.useLocalStorage = useLocalStorage;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ add_nat_entry() {
|
|||
ssh -p 3922 -o StrictHostKeyChecking=no -i $cert root@$dRIp "\
|
||||
ip addr add dev $correctVif $pubIp
|
||||
iptables -t nat -I POSTROUTING -j SNAT -o $correctVif --to-source $pubIp ;
|
||||
/sbin/arping -c 3 -I $correctVif -A -U -s $pubIp $pubIp;
|
||||
arping -c 3 -I $correctVif -A -U -s $pubIp $pubIp;
|
||||
"
|
||||
if [ $? -gt 0 -a $? -ne 2 ]
|
||||
then
|
||||
|
|
@ -91,7 +91,7 @@ add_an_ip () {
|
|||
ssh -p 3922 -o StrictHostKeyChecking=no -i $cert root@$dRIp "\
|
||||
ifconfig $correctVif up;
|
||||
ip addr add dev $correctVif $pubIp ;
|
||||
/sbin/arping -c 3 -I $correctVif -A -U -s $pubIp $pubIp;
|
||||
arping -c 3 -I $correctVif -A -U -s $pubIp $pubIp;
|
||||
"
|
||||
return $?
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1831,11 +1831,11 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
|||
_offering = new ServiceOfferingVO("Fake Offering For DomR", 1, _routerRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, useLocalStorage, true, null);
|
||||
_offering.setUniqueName("Cloud.Com-SoftwareRouter");
|
||||
_offering = _serviceOfferingDao.persistSystemServiceOffering(_offering);
|
||||
_template = _templateDao.findById(_routerTemplateId);
|
||||
_template = _templateDao.findRoutingTemplate();
|
||||
if (_template == null) {
|
||||
s_logger.error("Unable to find system vm template.");
|
||||
|
||||
// throw new ConfigurationException("Unable to find the template for the router: " + _routerTemplateId);
|
||||
} else {
|
||||
_routerTemplateId = _template.getId();
|
||||
}
|
||||
|
||||
_publicNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemVmPublicNetwork, TrafficType.Public, null);
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ public class LocalStoragePoolListener implements Listener {
|
|||
pool = new StoragePoolVO(poolId, name, pInfo.getUuid(), pInfo.getPoolType(), host.getDataCenterId(),
|
||||
host.getPodId(), pInfo.getAvailableBytes(), pInfo.getCapacityBytes(), pInfo.getHost(), 0,
|
||||
pInfo.getHostPath());
|
||||
pool.setStatus(Status.Up);
|
||||
pool.setClusterId(host.getClusterId());
|
||||
pool.setStatus(Status.Up);
|
||||
_storagePoolDao.persist(pool, pInfo.getDetails());
|
||||
|
|
|
|||
|
|
@ -771,6 +771,11 @@ public class DatabaseConfig {
|
|||
int diskSpace = Integer.parseInt(_currentObjectParams.get("diskSpace"));
|
||||
// boolean mirroring = Boolean.parseBoolean(_currentObjectParams.get("mirrored"));
|
||||
String tags = _currentObjectParams.get("tags");
|
||||
String useLocal = _currentObjectParams.get("useLocal");
|
||||
boolean local = false;
|
||||
if (useLocal != null) {
|
||||
local = Boolean.parseBoolean(useLocal);
|
||||
}
|
||||
|
||||
if (tags != null && tags.length() > 0) {
|
||||
String[] tokens = tags.split(",");
|
||||
|
|
@ -782,6 +787,7 @@ public class DatabaseConfig {
|
|||
tags = newTags.toString();
|
||||
}
|
||||
DiskOfferingVO diskOffering = new DiskOfferingVO(domainId, name, displayText, diskSpace, tags);
|
||||
diskOffering.setUseLocalStorage(local);
|
||||
DiskOfferingDaoImpl offering = ComponentLocator.inject(DiskOfferingDaoImpl.class);
|
||||
try {
|
||||
offering.persist(diskOffering);
|
||||
|
|
|
|||
|
|
@ -4,5 +4,9 @@ use cloud;
|
|||
START TRANSACTION;
|
||||
|
||||
DELETE FROM configuration where name='upgrade.url';
|
||||
DELETE FROM configuration where name='router.template.id';
|
||||
UPDATE vm_template set unique_name='routing_old' where id=1;
|
||||
INSERT INTO vm_template (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones)
|
||||
VALUES (10, 'routing', 'SystemVM Template', 0, now(), 'ext3', 0, 64, 1, 'http://download.cloud.com/releases/2.2/systemvm.vhd.bz2', 'bcc7f290f4c27ab4d0fe95d1012829ea', 0, 'SystemVM Template', 'VHD', 15, 0, 1);
|
||||
|
||||
COMMIT;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones)
|
||||
VALUES (1, 'routing', 'SystemVM Template', 0, now(), 'ext3', 0, 64, 1, 'http://download.cloud.com/releases/2.0.0RC5/systemvm.vhd.bz2', '31cd7ce94fe68c973d5dc37c3349d02e', 0, 'SystemVM Template', 'VHD', 12, 0, 1);
|
||||
VALUES (1, 'routing', 'SystemVM Template', 0, now(), 'ext3', 0, 64, 1, 'http://download.cloud.com/releases/2.2/systemvm.vhd.bz2', 'bcc7f290f4c27ab4d0fe95d1012829ea', 0, 'SystemVM Template', 'VHD', 15, 0, 1);
|
||||
INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones)
|
||||
VALUES (2, 'centos53-x86_64', 'CentOS 5.3(x86_64) no GUI', 1, now(), 'ext3', 0, 64, 1, 'http://download.cloud.com/templates/builtin/f59f18fb-ae94-4f97-afd2-f84755767aca.vhd.bz2', 'b63d854a9560c013142567bbae8d98cf', 0, 'CentOS 5.3(x86_64) no GUI', 'VHD', 12, 1, 1);
|
||||
|
||||
|
|
|
|||
|
|
@ -331,7 +331,7 @@ packages() {
|
|||
DEBCONF_DB_OVERRIDE=’File{/root/config.dat}’
|
||||
export DEBIAN_FRONTEND DEBIAN_PRIORITY DEBCONF_DB_OVERRIDE
|
||||
|
||||
chroot . apt-get --no-install-recommends -q -y --force-yes install rsyslog chkconfig insserv net-tools ifupdown vim-tiny netbase iptables openssh-server grub e2fsprogs dhcp3-client dnsmasq tcpdump socat wget apache2 ssl-cert python bzip2 sed gawk diff grep gzip less tar telnet xl2tpd traceroute openswan psmisc inetutils-ping arping httping dnsutils zip unzip ethtool uuid
|
||||
chroot . apt-get --no-install-recommends -q -y --force-yes install rsyslog chkconfig insserv net-tools ifupdown vim-tiny netbase iptables openssh-server grub e2fsprogs dhcp3-client dnsmasq tcpdump socat wget apache2 ssl-cert python bzip2 sed gawk diff grep gzip less tar telnet xl2tpd traceroute openswan psmisc inetutils-ping iputils-arping httping dnsutils zip unzip ethtool uuid
|
||||
|
||||
chroot . apt-get --no-install-recommends -q -y --force-yes install haproxy nfs-common
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
# If you just change the port or add more ports here, you will likely also
|
||||
# have to change the VirtualHost statement in
|
||||
# /etc/apache2/sites-enabled/000-default
|
||||
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
|
||||
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
|
||||
# README.Debian.gz
|
||||
|
||||
NameVirtualHost 10.1.1.1:80
|
||||
Listen 10.1.1.1:80
|
||||
|
||||
<IfModule mod_ssl.c>
|
||||
# If you add NameVirtualHost *:443 here, you will also have to change
|
||||
# the VirtualHost statement in /etc/apache2/sites-available/default-ssl
|
||||
# to <VirtualHost *:443>
|
||||
# Server Name Indication for SSL named virtual hosts is currently not
|
||||
# supported by MSIE on Windows XP.
|
||||
Listen 10.1.1.1:443
|
||||
</IfModule>
|
||||
|
||||
<IfModule mod_gnutls.c>
|
||||
Listen 10.1.1.1:443
|
||||
</IfModule>
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
<VirtualHost *:80>
|
||||
<VirtualHost 10.1.1.1:80>
|
||||
ServerAdmin webmaster@localhost
|
||||
|
||||
DocumentRoot /var/www/html
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<IfModule mod_ssl.c>
|
||||
<VirtualHost _default_:443>
|
||||
<VirtualHost 10.1.1.1:443>
|
||||
ServerAdmin webmaster@localhost
|
||||
|
||||
DocumentRoot /var/www/html
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
<VirtualHost *:80>
|
||||
ServerAdmin webmaster@localhost
|
||||
|
||||
DocumentRoot /var/www/html
|
||||
<Directory />
|
||||
Options FollowSymLinks
|
||||
AllowOverride None
|
||||
</Directory>
|
||||
<Directory /var/www/html>
|
||||
Options Indexes FollowSymLinks MultiViews
|
||||
AllowOverride All
|
||||
Order allow,deny
|
||||
allow from all
|
||||
</Directory>
|
||||
|
||||
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
|
||||
<Directory "/usr/lib/cgi-bin">
|
||||
AllowOverride None
|
||||
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</Directory>
|
||||
|
||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
|
||||
# Possible values include: debug, info, notice, warn, error, crit,
|
||||
# alert, emerg.
|
||||
LogLevel warn
|
||||
|
||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||
|
||||
Alias /doc/ "/usr/share/doc/"
|
||||
<Directory "/usr/share/doc/">
|
||||
Options Indexes MultiViews FollowSymLinks
|
||||
AllowOverride None
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
Allow from 127.0.0.0/255.0.0.0 ::1/128
|
||||
</Directory>
|
||||
|
||||
</VirtualHost>
|
||||
|
|
@ -22,5 +22,5 @@ defaults
|
|||
timeout server 50000
|
||||
|
||||
|
||||
listen 0.0.0.0:9
|
||||
listen cloud-default 0.0.0.0:35999
|
||||
option transparent
|
||||
|
|
|
|||
|
|
@ -162,17 +162,27 @@ setup_dnsmasq() {
|
|||
}
|
||||
|
||||
setup_sshd(){
|
||||
[ -f /etc/ssh/sshd_config ] && sed -i -e "s/^[#]*ListenAddress.*$/ListenAddress $ETH1_IP/" /etc/ssh/sshd_config
|
||||
local ip=$1
|
||||
[ -f /etc/ssh/sshd_config ] && sed -i -e "s/^[#]*ListenAddress.*$/ListenAddress $ip/" /etc/ssh/sshd_config
|
||||
}
|
||||
|
||||
setup_apache2() {
|
||||
[ -f /etc/apache2/sites-available/default ] && sed -i -e "s/<VirtualHost.*>/<VirtualHost $ETH0_IP:80>/" /etc/apache2/sites-available/default
|
||||
[ -f /etc/apache2/sites-available/default-ssl ] && sed -i -e "s/<VirtualHost.*>/<VirtualHost $ETH0_IP:443>/" /etc/apache2/sites-available/default-ssl
|
||||
[ -f /etc/apache2/ports.conf ] && sed -i -e "s/Listen .*:80/Listen $ETH0_IP:80/g" /etc/apache2/ports.conf
|
||||
[ -f /etc/apache2/ports.conf ] && sed -i -e "s/Listen .*:443/Listen $ETH0_IP:443/g" /etc/apache2/ports.conf
|
||||
[ -f /etc/apache2/ports.conf ] && sed -i -e "s/NameVirtualHost .*:80/NameVirtualHost $ETH0_IP:80/g" /etc/apache2/ports.conf
|
||||
}
|
||||
|
||||
setup_router() {
|
||||
setup_common eth0 eth1 eth2
|
||||
setup_dnsmasq
|
||||
setup_apache2
|
||||
|
||||
sed -i /gateway/d /etc/hosts
|
||||
echo "$ETH0_IP $NAME" >> /etc/hosts
|
||||
|
||||
setup_sshd
|
||||
setup_sshd $ETH1_IP
|
||||
|
||||
enable_svc dnsmasq 1
|
||||
enable_svc haproxy 1
|
||||
|
|
@ -185,11 +195,12 @@ setup_router() {
|
|||
setup_dhcpsrvr() {
|
||||
setup_common eth0 eth1
|
||||
setup_dnsmasq
|
||||
setup_apache2
|
||||
|
||||
sed -i /gateway/d /etc/hosts
|
||||
echo "$ETH0_IP $NAME" >> /etc/hosts
|
||||
|
||||
setup_sshd
|
||||
setup_sshd $ETH1_IP
|
||||
|
||||
enable_svc dnsmasq 1
|
||||
enable_svc haproxy 0
|
||||
|
|
@ -207,6 +218,8 @@ setup_secstorage() {
|
|||
echo "$public_ip $NAME" >> /etc/hosts
|
||||
|
||||
cp /etc/iptables/iptables-secstorage /etc/iptables/rules
|
||||
setup_sshd $ETH0_IP
|
||||
|
||||
enable_fwding 0
|
||||
enable_svc haproxy 0
|
||||
enable_svc dnsmasq 0
|
||||
|
|
@ -214,6 +227,7 @@ setup_secstorage() {
|
|||
enable_svc cloud 1
|
||||
}
|
||||
|
||||
|
||||
setup_console_proxy() {
|
||||
setup_common eth0 eth1 eth2
|
||||
public_ip=$ETH2_IP
|
||||
|
|
@ -221,6 +235,7 @@ setup_console_proxy() {
|
|||
sed -i /gateway/d /etc/hosts
|
||||
echo "$public_ip $NAME" >> /etc/hosts
|
||||
cp /etc/iptables/iptables-consoleproxy /etc/iptables/rules
|
||||
setup_sshd $ETH0_IP
|
||||
|
||||
enable_fwding 0
|
||||
enable_svc haproxy 0
|
||||
|
|
|
|||
Loading…
Reference in New Issue