Merge branch 'master' into ui-plugins

This commit is contained in:
Brian Federle 2012-12-27 13:48:04 -08:00
commit 8c1b3404ea
83 changed files with 1223 additions and 1175 deletions

View File

@ -69,6 +69,8 @@ public class UserResponse extends BaseResponse {
@SerializedName("accountid") @Param(description="the account ID of the user")
private IdentityProxy accountId = new IdentityProxy("account");
@SerializedName("iscallerchilddomain") @Param(description="the boolean value representing if the updating target is in caller's child domain")
private boolean isCallerChildDomain;
public Long getId() {
return id.getValue();
@ -188,4 +190,12 @@ public class UserResponse extends BaseResponse {
public void setAccountId(Long accountId) {
this.accountId.setValue(accountId);
}
public boolean getIsCallerSubdomain() {
return this.isCallerChildDomain;
}
public void setIsCallerChildDomain(boolean isCallerChildDomain) {
this.isCallerChildDomain = isCallerChildDomain;
}
}

View File

@ -44,7 +44,7 @@
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-user-authenticator-sha256salted</artifactId>
<version>${project.version}</version>
</dependency>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-network-nvp</artifactId>
@ -66,9 +66,9 @@
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-hypervisor-ovm</artifactId>
<version>${project.version}</version>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-hypervisor-ovm</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
@ -290,7 +290,7 @@
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
@ -324,6 +324,21 @@
</pluginManagement>
</build>
<profiles>
<profile>
<id>simulator</id>
<activation>
<property>
<name>simulator</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-hypervisor-simulator</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>netapp</id>
<activation>

View File

@ -31,7 +31,7 @@ markDefaultZoneForAccount=com.cloud.api.commands.MarkDefaultZoneForAccountCmd;1
#### User commands
createUser=com.cloud.api.commands.CreateUserCmd;3
deleteUser=com.cloud.api.commands.DeleteUserCmd;3
updateUser=com.cloud.api.commands.UpdateUserCmd;3
updateUser=com.cloud.api.commands.UpdateUserCmd;15
listUsers=com.cloud.api.commands.ListUsersCmd;7
####lockUser=com.cloud.api.commands.LockUserCmd;7
disableUser=com.cloud.api.commands.DisableUserCmd;7

View File

@ -5,9 +5,9 @@
# 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
#
#
# 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
@ -15,17 +15,5 @@
# specific language governing permissions and limitations
# under the License.
host=127.0.0.1
port=8250
workers=3
zone=1
pod=1
run=13
sequence=r
agent.save.path=/tmp/agents
latency=2
latency.start.range=2
latency.end.range=2
delay.distribution={(5,10); (5,10); (5,10); (5,10); (5,10); (5,10); (5,10); (5,10); (5,10); (10,120)}
property.scan.enabled=1
property.scan.interval=300
configureSimulator=com.cloud.api.commands.ConfigureSimulator;1

View File

@ -16,6 +16,8 @@
-- under the License.
-- Add a default ROOT domain
use cloud;
INSERT INTO `cloud`.`domain` (id, name, parent, path, owner) VALUES
(1, 'ROOT', NULL, '/', 2);

View File

@ -1,4 +1,4 @@
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements. See the NOTICE file distributed with this work for additional
information regarding copyright ownership. The ASF licenses this file to
you under the Apache License, Version 2.0 (the "License"); you may not use
@ -9,6 +9,7 @@
OF ANY KIND, either express or implied. See the License for the specific
language governing permissions and limitations 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">
<modelVersion>4.0.0</modelVersion>
<artifactId>cloud-developer</artifactId>
@ -101,6 +102,7 @@
</dependency>
</dependencies>
<configuration>
<driver>org.gjt.mm.mysql.Driver</driver>
<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}/cloud</url>
<username>${db.cloud.username}</username>
@ -109,7 +111,6 @@
<skip>${maven.test.skip}</skip>
<forceMojoExecution>true</forceMojoExecution>
</configuration>
<executions>
<execution>
<id>drop-database</id>
@ -310,9 +311,9 @@
</goals>
<configuration>
<autocommit>true</autocommit>
<srcFiles>
<srcFile>${basedir}/developer-prefill.sql</srcFile>
</srcFiles>
<srcFiles>
<srcFile>${basedir}/developer-prefill.sql</srcFile>
</srcFiles>
</configuration>
</execution>
</executions>
@ -320,5 +321,128 @@
</plugins>
</build>
</profile>
<!-- Simulator profile -->
<profile>
<id>simulator</id>
<activation>
<property><name>deploydb-simulator</name></property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${project.parent.basedir}/utils/conf/db.properties</file>
<file>${project.parent.basedir}/utils/conf/db.properties.override</file>
</files>
<quiet>true</quiet>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<version>1.5</version>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${cs.mysql.version}</version>
</dependency>
</dependencies>
<configuration>
<driver>org.gjt.mm.mysql.Driver</driver>
<url>jdbc:mysql://${db.simulator.host}:3306/simulator</url>
<username>${db.simulator.username}</username>
<password>${db.simulator.password}</password>
<skip>${maven.test.skip}</skip>
<forceMojoExecution>true</forceMojoExecution>
</configuration>
<executions>
<execution>
<id>drop-database</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<username>root</username>
<password>${db.root.password}</password>
<url>jdbc:mysql://${db.simulator.host}:3306</url>
<sqlCommand>drop database if exists `simulator`</sqlCommand>
</configuration>
</execution>
<execution>
<id>create-database</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<username>root</username>
<password>${db.root.password}</password>
<url>jdbc:mysql://${db.simulator.host}:3306</url>
<sqlCommand>create database `simulator`</sqlCommand>
</configuration>
</execution>
<execution>
<id>grant-user-cloud</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<username>root</username>
<password>${db.root.password}</password>
<url>jdbc:mysql://${db.simulator.host}:3306</url>
<sqlCommand>GRANT ALL ON simulator.* to
${db.simulator.username}@`localhost` identified by
'${db.simulator.password}';</sqlCommand>
</configuration>
</execution>
<execution>
<id>grant-user-cloud-all</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<username>root</username>
<password>${db.root.password}</password>
<url>jdbc:mysql://${db.simulator.host}:3306</url>
<sqlCommand>GRANT ALL ON simulator.* to
${db.simulator.username}@`%` identified by
'${db.simulator.password}';</sqlCommand>
</configuration>
</execution>
<execution>
<id>create-schema</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<srcFiles>
<srcFile>${basedir}/target/db/create-schema-simulator.sql</srcFile>
<srcFile>${basedir}/target/db/templates.simulator.sql</srcFile>
</srcFiles>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -477,6 +477,7 @@ setup_redundant_router() {
cp /root/redundant_router/check_bumpup.sh $rrouter_bin_path/
cp /root/redundant_router/disable_pubip.sh $rrouter_bin_path/
cp /root/redundant_router/checkrouter.sh.templ /opt/cloud/bin/checkrouter.sh
cp /root/redundant_router/services.sh $rrouter_bin_path/
sed -i "s/\[ROUTER_ID\]/$NAME/g" /etc/keepalived/keepalived.conf
sed -i "s/\[ROUTER_IP\]/$GUEST_GW\/$GUEST_CIDR_SIZE/g" /etc/keepalived/keepalived.conf
sed -i "s/\[BOARDCAST\]/$GUEST_BRD/g" /etc/keepalived/keepalived.conf

View File

@ -137,7 +137,7 @@ copy_routes_from_main() {
ip_addr_add() {
local dev="$1"
local ip="$2"
sudo ip addr add dev $dev $ip > /dev/null
sudo ip addr add dev $dev $ip brd + > /dev/null
}
@ -294,7 +294,7 @@ remove_an_ip () {
then
continue
fi
sudo ip addr add dev $ethDev $ipMask
sudo ip addr add dev $ethDev $ipMask brd +
done
remove_routing $1

View File

@ -19,5 +19,5 @@
ips=$(ip addr show dev eth0 | grep inet | grep eth0 | awk '{print $2}' ); echo $ips
for ip in $ips; do
addr=$(echo $ip | awk -F'/' '{print $1}')
/opt/cloud/bin/passwd_server_ip $addr &
/opt/cloud/bin/passwd_server_ip $addr >> /var/log/cloud.log 2>&1 &
done;

View File

@ -21,5 +21,3 @@ while read i
do
ifconfig $i down
done < /tmp/iflist
service cloud-passwd-srvr stop
service dnsmasq stop

View File

@ -30,6 +30,4 @@ do
ifconfig $i up
fi
done < /tmp/iflist
ip route add default via [GATEWAY] dev eth2 && \
service cloud-passwd-srvr restart && \
service dnsmasq restart
ip route add default via [GATEWAY] dev eth2

View File

@ -28,12 +28,18 @@ fi
echo To master called >> [RROUTER_LOG]
[RROUTER_BIN_PATH]/enable_pubip.sh >> [RROUTER_LOG] 2>&1
ret=$?
if [ $ret -eq 0 ]
then
[RROUTER_BIN_PATH]/services.sh restart >> [RROUTER_LOG] 2>&1
ret=$?
fi
last_msg=`tail -n 1 [RROUTER_LOG]`
echo Enable public ip returned $ret >> [RROUTER_LOG]
if [ $ret -ne 0 ]
then
echo Fail to enable public ip! >> [RROUTER_LOG]
[RROUTER_BIN_PATH]/disable_pubip.sh >> [RROUTER_LOG] 2>&1
[RROUTER_BIN_PATH]/services.sh stop >> [RROUTER_LOG] 2>&1
service keepalived stop >> [RROUTER_LOG] 2>&1
service conntrackd stop >> [RROUTER_LOG] 2>&1
echo Status: FAULT \($last_msg\) >> [RROUTER_LOG]

View File

@ -0,0 +1,68 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# 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
#
# 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
# specific language governing permissions and limitations
# under the License.
vpn_service() {
ps aux|grep ipsec | grep -v grep > /dev/null
no_vpn=$?
if [ $no_vpn -eq 1 ]
then
return 0
fi
r=0
case "$1" in
stop)
service ipsec stop && \
service xl2tpd stop
r=$?
;;
restart)
service ipsec restart && \
service xl2tpd restart
r=$?
;;
esac
return $r
}
ret=0
case "$1" in
start)
vpn_service restart && \
service cloud-passwd-srvr start && \
service dnsmasq start
ret=$?
;;
stop)
vpn_service stop && \
service cloud-passwd-srvr stop && \
service dnsmasq stop
ret=$?
;;
restart)
vpn_service restart && \
service cloud-passwd-srvr restart && \
service dnsmasq restart
ret=$?
;;
*)
echo "Usage: services {start|stop|restart}"
exit 1
;;
esac
exit $ret

View File

@ -24,7 +24,7 @@
source /root/func.sh
lock="biglock"
lock="passwdlock"
locked=$(getLockFile $lock)
if [ "$locked" != "1" ]
then

View File

@ -0,0 +1,45 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
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
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
specific language governing permissions and limitations
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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
<version>4.1.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-hypervisor-simulator</artifactId>
<version>4.1.0-SNAPSHOT</version>
<name>Apache CloudStack Plugin - Hypervisor Simulator</name>
<description>Simulator Hypervisor for Cloudstack</description>
<build>
<defaultGoal>install</defaultGoal>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
</build>
<dependencies>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-utils</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,66 @@
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
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
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
specific language governing permissions and limitations
under the License.
-->
<components-simulator.xml>
<system-integrity-checker class="com.cloud.upgrade.DatabaseUpgradeChecker">
<checker name="ManagementServerNode" class="com.cloud.cluster.ManagementServerNode"/>
<checker name="EncryptionSecretKeyChecker" class="com.cloud.utils.crypt.EncryptionSecretKeyChecker"/>
<checker name="DatabaseIntegrityChecker" class="com.cloud.upgrade.DatabaseIntegrityChecker"/>
<checker name="DatabaseUpgradeChecker" class="com.cloud.upgrade.PremiumDatabaseUpgradeChecker"/>
</system-integrity-checker>
<interceptor library="com.cloud.configuration.DefaultInterceptorLibrary"/>
<management-server class="com.cloud.server.ManagementServerSimulatorImpl" library="com.cloud.configuration.SimulatorComponentLibrary" extends="components.xml:management-server">
<dao name="Configuration configuration server" class="com.cloud.configuration.dao.ConfigurationDaoImpl">
<param name="premium">true</param>
</dao>
<adapters key="com.cloud.resource.Discoverer">
<adapter name="Simulator Agent" class="com.cloud.resource.SimulatorDiscoverer"/>
<adapter name="SimulatorSecondaryStorage" class="com.cloud.resource.SimulatorSecondaryDiscoverer"/>
</adapters>
<adapters key="com.cloud.hypervisor.HypervisorGuru">
<adapter name="SimulatorGuru" class="com.cloud.simulator.SimulatorGuru"/>
</adapters>
</management-server>
<configuration-server class="com.cloud.server.ConfigurationServerImpl" extends="components.xml:configuration-server">
<dao name="Configuration configuration server" class="com.cloud.configuration.dao.ConfigurationDaoImpl" singleton="false">
<param name="premium">true</param>
</dao>
<dao name="Snapshot policy defaults" class="com.cloud.storage.dao.SnapshotPolicyDaoImpl" singleton="false"/>
<dao name="DiskOffering configuration server" class="com.cloud.storage.dao.DiskOfferingDaoImpl" singleton="false"/>
<dao name="ServiceOffering configuration server" class="com.cloud.service.dao.ServiceOfferingDaoImpl" singleton="false"/>
<dao name="host zone configuration server" class="com.cloud.dc.dao.DataCenterDaoImpl" singleton="false"/>
<dao name="host pod configuration server" class="com.cloud.dc.dao.HostPodDaoImpl" singleton="false"/>
<dao name="DomainDao" class="com.cloud.domain.dao.DomainDaoImpl" singleton="false"/>
<dao name="NetworkOfferingDao" class="com.cloud.offerings.dao.NetworkOfferingDaoImpl" singleton="false"/>
<dao name="DataCenterDao" class="com.cloud.dc.dao.DataCenterDaoImpl" singleton="false"/>
<dao name="NetworkDao" class="com.cloud.network.dao.NetworkDaoImpl" singleton="false"/>
<dao name="IpAddressDao" class="com.cloud.network.dao.IPAddressDaoImpl" singleton="false"/>
<dao name="VlanDao" class="com.cloud.dc.dao.VlanDaoImpl" singleton="false"/>
<dao name="ResouceCountDao" class="com.cloud.configuration.dao.ResourceCountDaoImpl" singleton="false"/>
<dao name="AccountDao" class="com.cloud.user.dao.AccountDaoImpl" singleton="false"/>
<dao name="UserDao" class="com.cloud.user.dao.UserDaoImpl" singleton="false"/>
<dao name="NetworkOfferingServiceDao" class="com.cloud.offerings.dao.NetworkOfferingServiceMapDaoImpl" singleton="false"/>
<dao name="VirtualRouterProviderDao" class="com.cloud.network.dao.VirtualRouterProviderDaoImpl" singleton="false"/>
<dao name="IdentityDao" class="com.cloud.uuididentity.dao.IdentityDaoImpl" singleton="false"/>
<dao name="Site2SiteCustomerGatewayDao" class="com.cloud.network.dao.Site2SiteCustomerGatewayDaoImpl" singleton="false"/>
<dao name="Site2SiteVpnGatewayDao" class="com.cloud.network.dao.Site2SiteVpnGatewayDaoImpl" singleton="false"/>
<dao name="Site2SiteVpnConnectionDao" class="com.cloud.network.dao.Site2SiteVpnConnectionDaoImpl" singleton="false"/>
</configuration-server>
</components-simulator.xml>

View File

@ -30,43 +30,43 @@ import com.cloud.utils.concurrency.NamedThreadFactory;
public class MetricsCollector {
private static final Logger s_logger = Logger.getLogger(MetricsCollector.class);
private final Set<String> vmNames = new HashSet<String>();
private final Set<String> newVMnames = new HashSet<String>();
private final Map<String, MockVmMetrics> metricsMap = new HashMap<String, MockVmMetrics>();
private final transient ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1, new NamedThreadFactory("Metrics"));
private Set<String> _currentVms;
public MetricsCollector(Set<String> currentVms) {
_currentVms = currentVms;
getAllVMNames();
}
public MetricsCollector() {
}
public synchronized void getAllVMNames() {
Set<String> currentVMs = _currentVms;
newVMnames.clear();
newVMnames.addAll(currentVMs);
newVMnames.removeAll(vmNames); //leave only new vms
vmNames.removeAll(currentVMs); //old vms - current vms --> leave non-running vms;
for (String vm: vmNames) {
removeVM(vm);
removeVM(vm);
}
vmNames.clear();
vmNames.addAll(currentVMs);
}
public synchronized void submitMetricsJobs() {
s_logger.debug("Submit Metric Jobs called");
for (String vm : newVMnames) {
MockVmMetrics task = new MockVmMetrics(vm);
if (!metricsMap.containsKey(vm)) {
@ -77,30 +77,30 @@ public class MetricsCollector {
}
newVMnames.clear();
}
public synchronized void addVM(String vmName) {
newVMnames.add(vmName);
s_logger.debug("Added vm name= " + vmName);
}
public synchronized void removeVM(String vmName) {
newVMnames.remove(vmName);
vmNames.remove(vmName);
MockVmMetrics task = metricsMap.get(vmName);
if (task != null) {
task.stop();
boolean r1= task.getFuture().cancel(false);
metricsMap.remove(vmName);
s_logger.debug("removeVM: cancel returned " + r1 + " for VM " + vmName);
} else {
s_logger.warn("removeVM called for nonexistent VM " + vmName);
}
if (task != null) {
task.stop();
boolean r1= task.getFuture().cancel(false);
metricsMap.remove(vmName);
s_logger.debug("removeVM: cancel returned " + r1 + " for VM " + vmName);
} else {
s_logger.warn("removeVM called for nonexistent VM " + vmName);
}
}
public synchronized Set<String> getVMNames() {
return vmNames;
}
public synchronized Map<String, MockVmMetrics> getMetricsMap() {
return metricsMap;
}

View File

@ -25,52 +25,52 @@ import org.apache.log4j.Logger;
public class MockVmMetrics implements Runnable {
private static final Logger s_logger = Logger.getLogger(MockVmMetrics.class);
private String vmName;
public final int MAX_INTERFACES=1;
public final int MAX_DISKS=8;
//the last calculated traffic speed (transmit) per interface
private Map<String, Double> netTxKBps = new HashMap<String, Double>();
//the last calculated traffic speed (receive) per interface
private Map<String, Double> netRxKBps = new HashMap<String, Double>();
//the last calculated disk write speed per disk (Bytes Per Second)
private Map<String, Double> diskWriteKBytesPerSec = new HashMap<String, Double>();
//the last calculated disk read speed per disk (Bytes Per Second)
private Map<String, Double> diskReadKBytesPerSec = new HashMap<String, Double>();
//Total Bytes Transmitted on network interfaces
private Map<String, Long> netTxTotalBytes = new HashMap<String, Long>();
//Total Bytes Received on network interfaces
private Map<String, Long> netRxTotalBytes = new HashMap<String, Long>();
//Total Bytes read per disk
private Map<String, Long> diskReadTotalBytes = new HashMap<String, Long>();
//Total Bytes written per disk
private Map<String, Long> diskWriteTotalBytes = new HashMap<String, Long>();
//CPU time in seconds
private Double cpuSeconds = new Double(0.0);
//CPU percentage
private Float cpuPercent = new Float(0.0);
private Map<String, String> diskMap = new HashMap<String, String>();
private Map<String, String> vifMap = new HashMap<String, String>();
private Map<String, Long> diskStatTimestamp = new HashMap<String, Long>();
private Map<String, Long> netStatTimestamp = new HashMap<String, Long>();
private long cpuStatTimestamp = 0L;
private ScheduledFuture<?> future;
private boolean stopped = false;
private Random randSeed = new Random();
@ -80,44 +80,44 @@ public class MockVmMetrics implements Runnable {
vifMap.put("eth0", "eth0");
vifMap.put("eth1", "eth1");
vifMap.put("eth2", "eth2");
Long networkStart = 0L;
netTxTotalBytes.put("eth0", networkStart);
netRxTotalBytes.put("eth0", networkStart);
netTxTotalBytes.put("eth1", networkStart);
netRxTotalBytes.put("eth1", networkStart);
netTxTotalBytes.put("eth2", networkStart);
netRxTotalBytes.put("eth2", networkStart);
netRxTotalBytes.put("eth2", networkStart);
}
private int getIncrementor() {
return randSeed.nextInt(100);
}
@Override
public void run() {
if(s_logger.isDebugEnabled()) {
s_logger.debug("Generating MockVM metrics");
}
for (Map.Entry<String, Long> entry : netRxTotalBytes.entrySet()) {
entry.setValue(entry.getValue() + getIncrementor());
entry.setValue(entry.getValue() + getIncrementor());
}
for (Map.Entry<String, Long> entry : netTxTotalBytes.entrySet()) {
entry.setValue(entry.getValue() + getIncrementor());
}
}
public String getVmName() {
return vmName;
}
public Map<String, Double> getNetTxKBps() {
return netTxKBps;
}
public Map<String, Double> getNetRxKBps() {
return netRxKBps;
}
@ -125,11 +125,11 @@ public class MockVmMetrics implements Runnable {
public Map<String, Double> getDiskWriteBytesPerSec() {
return diskWriteKBytesPerSec;
}
public Map<String, Double> getDiskReadBytesPerSec() {
return diskReadKBytesPerSec;
}
public Map<String, Long> getNetTxTotalBytes() {
return netTxTotalBytes;
}
@ -137,7 +137,7 @@ public class MockVmMetrics implements Runnable {
public Map<String, Long> getNetRxTotalBytes() {
return netRxTotalBytes;
}
public Map<String, Long> getDiskReadTotalBytes() {
return diskReadTotalBytes;
}
@ -145,7 +145,7 @@ public class MockVmMetrics implements Runnable {
public Map<String, Long> getDiskWriteTotalBytes() {
return diskWriteTotalBytes;
}
public Double getNetTxKBps(String intf) {
return netTxKBps.get(intf);
}
@ -153,7 +153,7 @@ public class MockVmMetrics implements Runnable {
public Double getNetRxKBps(String intf) {
return netRxKBps.get(intf);
}
public Double getDiskWriteKBytesPerSec(String disk) {
return diskWriteKBytesPerSec.get(disk);
}
@ -161,7 +161,7 @@ public class MockVmMetrics implements Runnable {
public Double getDiskReadKBytesPerSec(String disk) {
return diskReadKBytesPerSec.get(disk);
}
public Long getNetTxTotalBytes(String intf) {
return netTxTotalBytes.get(intf);
}
@ -169,7 +169,7 @@ public class MockVmMetrics implements Runnable {
public Long getNetRxTotalBytes(String intf) {
return netRxTotalBytes.get(intf);
}
public Long getDiskReadTotalBytes(String disk) {
return diskReadTotalBytes.get(disk);
}
@ -177,7 +177,7 @@ public class MockVmMetrics implements Runnable {
public Long getDiskWriteTotalBytes(String disk) {
return diskWriteTotalBytes.get(disk);
}
public Double getCpuSeconds() {
return cpuSeconds;
}
@ -189,7 +189,7 @@ public class MockVmMetrics implements Runnable {
public Float getCpuPercent() {
return cpuPercent;
}
public void setFuture(ScheduledFuture<?> sf) {
this.future = sf;
}
@ -197,9 +197,8 @@ public class MockVmMetrics implements Runnable {
public ScheduledFuture<?> getFuture() {
return future;
}
public void stop() {
this.stopped = true;
}
}

View File

@ -30,49 +30,49 @@ import org.apache.log4j.Logger;
public class MultiCaster implements Runnable {
private static final Logger s_logger = Logger.getLogger(MultiCaster.class);
public final int MAX_PACKET_SIZE = 8096;
private List<MultiCasterListener> listeners;
private DatagramSocket socket;
private byte[] recvBuffer;
private Thread driver;
private volatile boolean stopRequested = false;
public MultiCaster() {
listeners = new ArrayList<MultiCasterListener>();
recvBuffer = new byte[MAX_PACKET_SIZE];
}
public void addListener(MultiCasterListener listener) {
synchronized(listeners) {
listeners.add(listener);
}
}
public void removeListener(MultiCasterListener listener) {
synchronized(listeners) {
listeners.remove(listener);
}
}
public void cast(byte[] buf, int off, int len,
public void cast(byte[] buf, int off, int len,
InetAddress toAddress, int nToPort) throws IOException {
if(socket == null)
throw new IOException("multi caster is not started");
if(len >= MAX_PACKET_SIZE)
throw new IOException("packet size exceeds limit of " + MAX_PACKET_SIZE);
DatagramPacket packet = new DatagramPacket(buf, off,
DatagramPacket packet = new DatagramPacket(buf, off,
len, toAddress, nToPort);
socket.send(packet);
}
public void start(String strOutboundAddress,
public void start(String strOutboundAddress,
String strClusterAddress, int nPort) throws SocketException {
assert(socket == null);
@ -82,22 +82,22 @@ public class MultiCaster implements Runnable {
} catch(IOException e) {
s_logger.error("Unexpected exception " , e);
}
if(addr != null && addr.isMulticastAddress()) {
try {
socket = new MulticastSocket(nPort);
socket.setReuseAddress(true);
if(s_logger.isInfoEnabled())
s_logger.info("Join multicast group : " + addr);
((MulticastSocket)socket).joinGroup(addr);
((MulticastSocket)socket).setTimeToLive(1);
if(strOutboundAddress != null) {
if(s_logger.isInfoEnabled())
s_logger.info("set outgoing interface to : " + strOutboundAddress);
InetAddress ia = InetAddress.getByName(strOutboundAddress);
NetworkInterface ni = NetworkInterface.getByInetAddress(ia);
((MulticastSocket)socket).setNetworkInterface(ni);
@ -109,16 +109,16 @@ public class MultiCaster implements Runnable {
socket = new DatagramSocket(nPort);
socket.setReuseAddress(true);
}
driver = new Thread(this, "Multi-caster");
driver.setDaemon(true);
driver.start();
}
public void stop() {
if(socket != null) {
stopRequested = true;
socket.close();
if(driver != null) {
try {
@ -128,17 +128,17 @@ public class MultiCaster implements Runnable {
driver = null;
}
}
socket = null;
stopRequested = false;
}
public void run() {
while(!stopRequested) {
try {
DatagramPacket packet = new DatagramPacket(recvBuffer, recvBuffer.length);
socket.receive(packet);
for(Object listener : listeners.toArray()) {
((MultiCasterListener)listener).onMultiCasting(packet.getData(),
packet.getOffset(), packet.getLength(), packet.getAddress());

View File

@ -20,17 +20,17 @@ import java.io.Serializable;
public class SimulatorCmd implements Serializable {
private static final long serialVersionUID = 1L;
private String testCase = "DEFAULT";
public SimulatorCmd(String testCase) {
this.testCase = testCase;
this.testCase = testCase;
}
public String getTestCase() {
return testCase;
}
public void setTestCase(String testCase) {
this.testCase = testCase;
}

View File

@ -21,12 +21,12 @@ public class SimulatorMigrateVmCmd extends SimulatorCmd {
private static final long serialVersionUID = 1L;
private String destIp;
private String vmName;
private long ramSize;
private int cpuCount;
private int utilization;
public SimulatorMigrateVmCmd(String testCase) {
super(testCase);
}
@ -38,7 +38,7 @@ public class SimulatorMigrateVmCmd extends SimulatorCmd {
public void setDestIp(String destIp) {
this.destIp = destIp;
}
public String getVmName() {
return vmName;
}
@ -70,14 +70,14 @@ public class SimulatorMigrateVmCmd extends SimulatorCmd {
public void setUtilization(int utilization) {
this.utilization = utilization;
}
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("SimulatorMigrateVmCmd {").append("vm: ").append(getVmName());
sb.append(", destIp: ").append(getDestIp()).append(", ramSize: ").append(getRamSize());
sb.append(", cpuCount: ").append(getCpuCount()).append(", utilization: ").append(getUtilization());
sb.append("}");
return sb.toString();
}
}

View File

@ -56,8 +56,6 @@ public interface MockAgentManager extends Manager {
Answer pingTest(PingTestCommand cmd);
Answer prepareForMigrate(PrepareForMigrationCommand cmd);
MockHost getHost(String guid);
Answer maintain(MaintainCommand cmd);

View File

@ -429,15 +429,6 @@ public class MockAgentManagerImpl implements MockAgentManager {
return new Answer(cmd);
}
@Override
public PrepareForMigrationAnswer prepareForMigrate(PrepareForMigrationCommand cmd) {
VirtualMachineTO vm = cmd.getVirtualMachine();
if (s_logger.isDebugEnabled()) {
s_logger.debug("Preparing host for migrating " + vm);
}
return new PrepareForMigrationAnswer(cmd);
}
@Override
public boolean start() {
return true;

View File

@ -35,35 +35,26 @@ import com.cloud.agent.api.ModifyStoragePoolCommand;
import com.cloud.agent.api.SecStorageSetupCommand;
import com.cloud.agent.api.SecStorageVMSetupCommand;
import com.cloud.agent.api.StoragePoolInfo;
import com.cloud.agent.api.storage.CopyVolumeAnswer;
import com.cloud.agent.api.storage.CopyVolumeCommand;
import com.cloud.agent.api.storage.CreateAnswer;
import com.cloud.agent.api.storage.CreateCommand;
import com.cloud.agent.api.storage.DeleteTemplateCommand;
import com.cloud.agent.api.storage.DestroyCommand;
import com.cloud.agent.api.storage.DownloadCommand;
import com.cloud.agent.api.storage.DownloadProgressCommand;
import com.cloud.agent.api.storage.ListTemplateCommand;
import com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer;
import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
import com.cloud.agent.api.storage.*;
import com.cloud.utils.component.Manager;
public interface MockStorageManager extends Manager {
public static final long DEFAULT_HOST_STORAGE_SIZE = 1 * 1024 * 1024 * 1024 * 1024L; //1T
public static final long DEFAULT_TEMPLATE_SIZE = 1 * 1000 * 1000 * 1000L; //1G
public PrimaryStorageDownloadAnswer primaryStorageDownload(PrimaryStorageDownloadCommand cmd);
public CreateAnswer createVolume(CreateCommand cmd);
public AttachVolumeAnswer AttachVolume(AttachVolumeCommand cmd);
public Answer AttachIso(AttachIsoCommand cmd);
public Answer DeleteStoragePool(DeleteStoragePoolCommand cmd);
public Answer ModifyStoragePool(ModifyStoragePoolCommand cmd);
public Answer CreateStoragePool(CreateStoragePoolCommand cmd);
public Answer SecStorageSetup(SecStorageSetupCommand cmd);
public Answer ListTemplates(ListTemplateCommand cmd);
public Answer ListVolumes(ListVolumeCommand cmd);
public Answer Destroy(DestroyCommand cmd);
public Answer Download(DownloadCommand cmd);
public Answer DownloadProcess(DownloadProgressCommand cmd);
@ -74,7 +65,7 @@ public interface MockStorageManager extends Manager {
public Answer CreateVolumeFromSnapshot(CreateVolumeFromSnapshotCommand cmd);
public Answer DeleteTemplate(DeleteTemplateCommand cmd);
public Answer SecStorageVMSetup(SecStorageVMSetupCommand cmd);
public void preinstallTemplates(String url, long zoneId);
StoragePoolInfo getLocalStorage(String hostGuid);

View File

@ -30,6 +30,7 @@ import java.util.UUID;
import javax.ejb.Local;
import javax.naming.ConfigurationException;
import com.cloud.agent.api.storage.*;
import org.apache.log4j.Logger;
import com.cloud.agent.api.Answer;
@ -56,20 +57,6 @@ import com.cloud.agent.api.SecStorageSetupAnswer;
import com.cloud.agent.api.SecStorageSetupCommand;
import com.cloud.agent.api.SecStorageVMSetupCommand;
import com.cloud.agent.api.StoragePoolInfo;
import com.cloud.agent.api.storage.CopyVolumeAnswer;
import com.cloud.agent.api.storage.CopyVolumeCommand;
import com.cloud.agent.api.storage.CreateAnswer;
import com.cloud.agent.api.storage.CreateCommand;
import com.cloud.agent.api.storage.CreatePrivateTemplateAnswer;
import com.cloud.agent.api.storage.DeleteTemplateCommand;
import com.cloud.agent.api.storage.DestroyCommand;
import com.cloud.agent.api.storage.DownloadAnswer;
import com.cloud.agent.api.storage.DownloadCommand;
import com.cloud.agent.api.storage.DownloadProgressCommand;
import com.cloud.agent.api.storage.ListTemplateAnswer;
import com.cloud.agent.api.storage.ListTemplateCommand;
import com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer;
import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
import com.cloud.agent.api.to.StorageFilerTO;
import com.cloud.agent.api.to.VolumeTO;
import com.cloud.simulator.MockHost;
@ -139,8 +126,8 @@ public class MockStorageManagerImpl implements MockStorageManager {
@Override
public PrimaryStorageDownloadAnswer primaryStorageDownload(PrimaryStorageDownloadCommand cmd) {
MockVolumeVO template = findVolumeFromSecondary(cmd.getUrl(), cmd.getSecondaryStorageUrl(),
MockVolumeType.TEMPLATE);
MockVolumeVO template = findVolumeFromSecondary(cmd.getUrl(), cmd.getSecondaryStorageUrl(),
MockVolumeType.TEMPLATE);
if (template == null) {
return new PrimaryStorageDownloadAnswer("Can't find primary storage");
}
@ -421,6 +408,49 @@ public class MockStorageManagerImpl implements MockStorageManager {
return new SecStorageSetupAnswer(storage.getMountPoint());
}
@Override
public Answer ListVolumes(ListVolumeCommand cmd) {
Transaction txn = Transaction.open(Transaction.SIMULATOR_DB);
MockSecStorageVO storage = null;
try {
txn.start();
storage = _mockSecStorageDao.findByUrl(cmd.getSecUrl());
if (storage == null) {
return new Answer(cmd, false, "Failed to get secondary storage");
}
txn.commit();
} catch (Exception ex) {
txn.rollback();
throw new CloudRuntimeException("Error when finding sec storage " + cmd.getSecUrl(), ex);
} finally {
txn.close();
txn = Transaction.open(Transaction.CLOUD_DB);
txn.close();
}
txn = Transaction.open(Transaction.SIMULATOR_DB);
try {
txn.start();
List<MockVolumeVO> volumes = _mockVolumeDao.findByStorageIdAndType(storage.getId(),
MockVolumeType.VOLUME);
Map<Long, TemplateInfo> templateInfos = new HashMap<Long, TemplateInfo>();
for (MockVolumeVO volume : volumes) {
templateInfos.put(volume.getId(), new TemplateInfo(volume.getName(), volume.getPath()
.replaceAll(storage.getMountPoint(), ""), volume.getSize(), volume.getSize(), true, false));
}
txn.commit();
return new ListVolumeAnswer(cmd.getSecUrl(), templateInfos);
} catch (Exception ex) {
txn.rollback();
throw new CloudRuntimeException("Error when finding template on sec storage " + storage.getId(), ex);
} finally {
txn.close();
txn = Transaction.open(Transaction.CLOUD_DB);
txn.close();
}
}
@Override
public Answer ListTemplates(ListTemplateCommand cmd) {
Transaction txn = Transaction.open(Transaction.SIMULATOR_DB);
@ -703,7 +733,7 @@ public class MockStorageManagerImpl implements MockStorageManager {
txn = Transaction.open(Transaction.CLOUD_DB);
txn.close();
}
MockVolumeVO newsnapshot = new MockVolumeVO();
String name = UUID.randomUUID().toString();
newsnapshot.setName(name);
@ -907,7 +937,7 @@ public class MockStorageManagerImpl implements MockStorageManager {
long defaultTemplateSize = 2 * 1024 * 1024 * 1024L;
MockVolumeVO template = new MockVolumeVO();
template.setName("simulator-domR");
template.setPath(storage.getMountPoint() + "template/tmpl/1/9/" + UUID.randomUUID().toString());
template.setPath(storage.getMountPoint() + "template/tmpl/1/10/" + UUID.randomUUID().toString());
template.setPoolId(storage.getId());
template.setSize(defaultTemplateSize);
template.setType(MockVolumeType.TEMPLATE);
@ -928,7 +958,7 @@ public class MockStorageManagerImpl implements MockStorageManager {
template = new MockVolumeVO();
template.setName("simulator-Centos");
template.setPath(storage.getMountPoint() + "template/tmpl/1/10/" + UUID.randomUUID().toString());
template.setPath(storage.getMountPoint() + "template/tmpl/1/11/" + UUID.randomUUID().toString());
template.setPoolId(storage.getId());
template.setSize(defaultTemplateSize);
template.setType(MockVolumeType.TEMPLATE);
@ -953,7 +983,7 @@ public class MockStorageManagerImpl implements MockStorageManager {
@Override
public StoragePoolInfo getLocalStorage(String hostGuid) {
Transaction txn = Transaction.open(Transaction.SIMULATOR_DB);
MockHost host = null;
MockHost host = null;
MockStoragePoolVO storagePool = null;
try {
txn.start();
@ -968,7 +998,7 @@ public class MockStorageManagerImpl implements MockStorageManager {
txn = Transaction.open(Transaction.CLOUD_DB);
txn.close();
}
if (storagePool == null) {
String uuid = UUID.randomUUID().toString();
storagePool = new MockStoragePoolVO();
@ -998,7 +1028,7 @@ public class MockStorageManagerImpl implements MockStorageManager {
@Override
public StoragePoolInfo getLocalStorage(String hostGuid, Long storageSize) {
Transaction txn = Transaction.open(Transaction.SIMULATOR_DB);
MockHost host = null;
MockHost host = null;
try {
txn.start();
host = _mockHostDao.findByGuid(hostGuid);

View File

@ -40,7 +40,7 @@ import com.cloud.vm.VirtualMachine.State;
public interface MockVmManager extends Manager {
public Answer stopVM(StopCommand cmd);
public Answer rebootVM(RebootCommand cmd);
public Answer checkVmState(CheckVirtualMachineCommand cmd);
public Map<String, State> getVmStates(String hostGuid);
public Answer getVncPort(GetVncPortCommand cmd);
@ -49,31 +49,32 @@ public interface MockVmManager extends Manager {
Answer getVmStats(GetVmStatsCommand cmd);
public CheckSshAnswer checkSshCommand(CheckSshCommand cmd);
Answer SetStaticNatRules(SetStaticNatRulesCommand cmd);
Answer SetPortForwardingRules(SetPortForwardingRulesCommand cmd);
Answer SetFirewallRules(SetFirewallRulesCommand cmd);
Answer getNetworkUsage(NetworkUsageCommand cmd);
Answer IpAssoc(IpAssocCommand cmd);
Answer LoadBalancerConfig(LoadBalancerConfigCommand cmd);
Answer AddDhcpEntry(DhcpEntryCommand cmd);
Answer setVmData(VmDataCommand cmd);
Answer CleanupNetworkRules(CleanupNetworkRulesCmd cmd, SimulatorInfo info);
Answer CheckConsoleProxyLoad(CheckConsoleProxyLoadCommand cmd);
Answer WatchConsoleProxyLoad(WatchConsoleProxyLoadCommand cmd);
Answer SavePassword(SavePasswordCommand cmd);
HashMap<String, Pair<Long, Long>> syncNetworkGroups(SimulatorInfo info);
SecurityGroupRuleAnswer AddSecurityGroupRules(SecurityGroupRulesCmd cmd, SimulatorInfo info);
MigrateAnswer Migrate(MigrateCommand cmd, SimulatorInfo info);
PrepareForMigrationAnswer prepareForMigrate(PrepareForMigrationCommand cmd);
GetDomRVersionAnswer getDomRVersion(GetDomRVersionCmd cmd);
Map<String, MockVMVO> getVms(String hostGuid);

View File

@ -60,20 +60,20 @@ public class MockVmManagerImpl implements MockVmManager {
@Inject MockHostDao _mockHostDao = null;
@Inject MockSecurityRulesDao _mockSecurityDao = null;
private Map<String, Map<String, Ternary<String, Long, Long>>> _securityRules = new ConcurrentHashMap<String, Map<String, Ternary<String, Long, Long>>>();
public MockVmManagerImpl() {
}
@Override
public boolean configure(String name, Map<String, Object> params)
throws ConfigurationException {
return true;
}
public String startVM(String vmName, NicTO[] nics,
int cpuHz, long ramSize,
String bootArgs, String hostGuid) {
int cpuHz, long ramSize,
String bootArgs, String hostGuid) {
Transaction txn = Transaction.open(Transaction.SIMULATOR_DB);
MockHost host = null;
@ -95,7 +95,7 @@ public class MockVmManagerImpl implements MockVmManager {
txn = Transaction.open(Transaction.CLOUD_DB);
txn.close();
}
if(vm == null) {
int vncPort = 0;
if(vncPort < 0)
@ -107,14 +107,15 @@ public class MockVmManagerImpl implements MockVmManager {
vm.setName(vmName);
vm.setVncPort(vncPort);
vm.setHostId(host.getId());
vm.setBootargs(bootArgs);
if(vmName.startsWith("s-")) {
vm.setType("SecondaryStorageVm");
vm.setType("SecondaryStorageVm");
} else if (vmName.startsWith("v-")) {
vm.setType("ConsoleProxy");
vm.setType("ConsoleProxy");
} else if (vmName.startsWith("r-")) {
vm.setType("DomainRouter");
vm.setType("DomainRouter");
} else if (vmName.startsWith("i-")) {
vm.setType("User");
vm.setType("User");
}
txn = Transaction.open(Transaction.SIMULATOR_DB);
try {
@ -133,18 +134,18 @@ public class MockVmManagerImpl implements MockVmManager {
if(vm.getState() == State.Stopped) {
vm.setState(State.Running);
txn = Transaction.open(Transaction.SIMULATOR_DB);
try {
txn.start();
_mockVmDao.update(vm.getId(), (MockVMVO)vm);
txn.commit();
} catch (Exception ex) {
txn.rollback();
throw new CloudRuntimeException("unable to update vm " + vm.getName(), ex);
} finally {
txn.close();
try {
txn.start();
_mockVmDao.update(vm.getId(), (MockVMVO)vm);
txn.commit();
} catch (Exception ex) {
txn.rollback();
throw new CloudRuntimeException("unable to update vm " + vm.getName(), ex);
} finally {
txn.close();
txn = Transaction.open(Transaction.CLOUD_DB);
txn.close();
}
}
}
}
@ -212,7 +213,7 @@ public class MockVmManagerImpl implements MockVmManager {
}
return true;
}
@Override
public Map<String, MockVMVO> getVms(String hostGuid) {
Transaction txn = Transaction.open(Transaction.SIMULATOR_DB);
@ -238,15 +239,16 @@ public class MockVmManagerImpl implements MockVmManager {
@Override
public CheckRouterAnswer checkRouter(CheckRouterCommand cmd) {
String router_name = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
int router_id = Integer.parseInt(router_name.split("-")[1]);
if (router_id % 2 == 0) {
s_logger.debug("Found even routerId, making it MASTER in RvR");
MockVm vm = _mockVmDao.findByVmName(router_name);
String args = vm.getBootargs();
if (args.indexOf("router_pr=100") > 0) {
s_logger.debug("Router priority is for MASTER");
CheckRouterAnswer ans = new CheckRouterAnswer(cmd, "Status: MASTER & Bumped: NO", true);
ans.setState(VirtualRouter.RedundantState.MASTER);
return ans;
} else {
s_logger.debug("Found odd routerId, making it BACKUP in RvR");
CheckRouterAnswer ans = new CheckRouterAnswer(cmd, "Status: MASTER & Bumped: NO", true);
s_logger.debug("Router priority is for BACKUP");
CheckRouterAnswer ans = new CheckRouterAnswer(cmd, "Status: BACKUP & Bumped: NO", true);
ans.setState(VirtualRouter.RedundantState.BACKUP);
return ans;
}
@ -255,13 +257,13 @@ public class MockVmManagerImpl implements MockVmManager {
@Override
public Answer bumpPriority(BumpUpPriorityCommand cmd) {
String router_name = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
int router_id = Integer.parseInt(router_name.split("-")[1]);
if (router_id % 2 == 0) {
return new Answer(cmd, true, "Status: MASTER & Bumped: YES");
} else {
MockVm vm = _mockVmDao.findByVmName(router_name);
String args = vm.getBootargs();
if (args.indexOf("router_pr=100") > 0) {
return new Answer(cmd, true, "Status: BACKUP & Bumped: YES");
} else {
return new Answer(cmd, true, "Status: MASTER & Bumped: YES");
}
}
@Override
@ -303,8 +305,8 @@ public class MockVmManagerImpl implements MockVmManager {
@Override
public String getName() {
return this.getClass().getSimpleName();
}
}
@Override
public Answer getVmStats(GetVmStatsCommand cmd) {
HashMap<String, VmStatsEntry> vmStatsNameMap = new HashMap<String, VmStatsEntry>();
@ -370,9 +372,9 @@ public class MockVmManagerImpl implements MockVmManager {
@Override
public Answer SetFirewallRules(SetFirewallRulesCommand cmd) {
return new Answer(cmd);
return new Answer(cmd);
}
@Override
public NetworkUsageAnswer getNetworkUsage(NetworkUsageCommand cmd) {
@ -388,8 +390,12 @@ public class MockVmManagerImpl implements MockVmManager {
String destGuid = cmd.getHostGuid();
MockVMVO vm = _mockVmDao.findByVmNameAndHost(vmName, info.getHostUuid());
if (vm == null) {
return new MigrateAnswer(cmd, false, "can;t find vm:" + vmName + " on host:" + info.getHostUuid(), null);
}
return new MigrateAnswer(cmd, false, "can't find vm:" + vmName + " on host:" + info.getHostUuid(), null);
} else {
if (vm.getState() == State.Migrating) {
vm.setState(State.Running);
}
}
MockHost destHost = _mockHostDao.findByGuid(destGuid);
if (destHost == null) {
@ -409,6 +415,27 @@ public class MockVmManagerImpl implements MockVmManager {
}
}
@Override
public PrepareForMigrationAnswer prepareForMigrate(PrepareForMigrationCommand cmd) {
Transaction txn = Transaction.open(Transaction.SIMULATOR_DB);
VirtualMachineTO vmTo = cmd.getVirtualMachine();
try {
txn.start();
MockVMVO vm = _mockVmDao.findById(vmTo.getId());
vm.setState(State.Migrating);
_mockVmDao.update(vm.getId(), vm);
txn.commit();
} catch (Exception ex) {
txn.rollback();
throw new CloudRuntimeException("unable to find vm " + vmTo.getName(), ex);
} finally {
txn.close();
txn = Transaction.open(Transaction.CLOUD_DB);
txn.close();
return new PrepareForMigrationAnswer(cmd);
}
}
@Override
public Answer IpAssoc(IpAssocCommand cmd) {
return new Answer(cmd);
@ -516,20 +543,20 @@ public class MockVmManagerImpl implements MockVmManager {
public Answer WatchConsoleProxyLoad(WatchConsoleProxyLoadCommand cmd) {
return Answer.createUnsupportedCommandAnswer(cmd);
}
@Override
public GetDomRVersionAnswer getDomRVersion(GetDomRVersionCmd cmd) {
return new GetDomRVersionAnswer(cmd, null, null, null);
return new GetDomRVersionAnswer(cmd, null, null, null);
}
@Override
public SecurityGroupRuleAnswer AddSecurityGroupRules(SecurityGroupRulesCmd cmd, SimulatorInfo info) {
if (!info.isEnabled()) {
return new SecurityGroupRuleAnswer(cmd, false, "Disabled", SecurityGroupRuleAnswer.FailureReason.CANNOT_BRIDGE_FIREWALL);
return new SecurityGroupRuleAnswer(cmd, false, "Disabled", SecurityGroupRuleAnswer.FailureReason.CANNOT_BRIDGE_FIREWALL);
}
Map<String, Ternary<String,Long, Long>> rules = _securityRules.get(info.getHostUuid());
if (rules == null) {
logSecurityGroupAction(cmd, null);
rules = new ConcurrentHashMap<String, Ternary<String, Long, Long>>();
@ -539,10 +566,10 @@ public class MockVmManagerImpl implements MockVmManager {
logSecurityGroupAction(cmd, rules.get(cmd.getVmName()));
rules.put(cmd.getVmName(), new Ternary<String, Long,Long>(cmd.getSignature(), cmd.getVmId(), cmd.getSeqNum()));
}
return new SecurityGroupRuleAnswer(cmd);
}
private boolean logSecurityGroupAction(SecurityGroupRulesCmd cmd, Ternary<String,Long, Long> rule) {
String action = ", do nothing";
String reason = ", reason=";
@ -554,13 +581,13 @@ public class MockVmManagerImpl implements MockVmManager {
s_logger.info("New seqno received: " + cmd.getSeqNum() + " curr=" + currSeqnum);
updateSeqnoAndSig = true;
if (!cmd.getSignature().equals(currSig)) {
s_logger.info("New seqno received: " + cmd.getSeqNum() + " curr=" + currSeqnum
s_logger.info("New seqno received: " + cmd.getSeqNum() + " curr=" + currSeqnum
+ " new signature received:" + cmd.getSignature() + " curr=" + currSig + ", updated iptables");
action = ", updated iptables";
reason = reason + "seqno_increased_sig_changed";
} else {
s_logger.info("New seqno received: " + cmd.getSeqNum() + " curr=" + currSeqnum
+ " no change in signature:" + cmd.getSignature() + ", do nothing");
s_logger.info("New seqno received: " + cmd.getSeqNum() + " curr=" + currSeqnum
+ " no change in signature:" + cmd.getSignature() + ", do nothing");
reason = reason + "seqno_increased_sig_same";
}
} else if (cmd.getSeqNum() < currSeqnum) {
@ -568,14 +595,14 @@ public class MockVmManagerImpl implements MockVmManager {
reason = reason + "seqno_decreased";
} else {
if (!cmd.getSignature().equals(currSig)) {
s_logger.info("Identical seqno received: " + cmd.getSeqNum()
s_logger.info("Identical seqno received: " + cmd.getSeqNum()
+ " new signature received:" + cmd.getSignature() + " curr=" + currSig + ", updated iptables");
action = ", updated iptables";
reason = reason + "seqno_same_sig_changed";
updateSeqnoAndSig = true;
} else {
s_logger.info("Identical seqno received: " + cmd.getSeqNum() + " curr=" + currSeqnum
+ " no change in signature:" + cmd.getSignature() + ", do nothing");
s_logger.info("Identical seqno received: " + cmd.getSeqNum() + " curr=" + currSeqnum
+ " no change in signature:" + cmd.getSignature() + ", do nothing");
reason = reason + "seqno_same_sig_same";
}
}
@ -585,8 +612,8 @@ public class MockVmManagerImpl implements MockVmManager {
action = ", updated iptables";
reason = ", seqno_new";
}
s_logger.info("Programmed network rules for vm " + cmd.getVmName() + " seqno=" + cmd.getSeqNum()
+ " signature=" + cmd.getSignature()
s_logger.info("Programmed network rules for vm " + cmd.getVmName() + " seqno=" + cmd.getSeqNum()
+ " signature=" + cmd.getSignature()
+ " guestIp=" + cmd.getGuestIp() + ", numIngressRules="
+ cmd.getIngressRuleSet().length + ", numEgressRules="
+ cmd.getEgressRuleSet().length + " total cidrs=" + cmd.getTotalNumCidrs() + action + reason);
@ -595,13 +622,13 @@ public class MockVmManagerImpl implements MockVmManager {
@Override
public Answer SavePassword(SavePasswordCommand cmd) {
return new Answer(cmd);
return new Answer(cmd);
}
@Override
public HashMap<String, Pair<Long, Long>> syncNetworkGroups(SimulatorInfo info) {
HashMap<String, Pair<Long, Long>> maps = new HashMap<String, Pair<Long, Long>>();
Map<String, Ternary<String, Long, Long>> rules = _securityRules.get(info.getHostUuid());
if (rules == null) {
return maps;

View File

@ -20,39 +20,39 @@ public class SimulatorInfo {
private boolean enabled;
private int timeout;
private String hostUuid;
public SimulatorInfo(boolean enabled, int timeout, String hostUuid) {
this.enabled = enabled;
this.timeout = timeout;
this.hostUuid = hostUuid;
}
public SimulatorInfo() {
this.enabled = true;
this.timeout = -1;
this.hostUuid = null;
}
public boolean isEnabled() {
return this.enabled;
}
public int getTimeout() {
return this.timeout;
}
public String getHostUuid() {
return this.hostUuid;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public void setTimeout(int timeout) {
this.timeout = timeout;
}
public void setHostUuid(String hostUuid) {
this.hostUuid = hostUuid;
}

View File

@ -23,7 +23,6 @@ import java.util.Map;
import com.cloud.agent.api.Answer;
import com.cloud.agent.api.Command;
import com.cloud.agent.api.StoragePoolInfo;
import com.cloud.agent.mockvm.MockVm;
import com.cloud.simulator.MockVMVO;
import com.cloud.utils.Pair;
import com.cloud.utils.component.Manager;
@ -31,10 +30,10 @@ import com.cloud.vm.VirtualMachine.State;
public interface SimulatorManager extends Manager {
public static final String Name = "simulator manager";
public enum AgentType {
Computing(0), // not used anymore
Routing(1),
Routing(1),
Storage(2);
int value;
@ -56,7 +55,7 @@ public interface SimulatorManager extends Manager {
Answer simulate(Command cmd, String hostGuid);
StoragePoolInfo getLocalStorage(String hostGuid);
boolean configureSimulator(Long zoneId, Long podId, Long clusterId, Long hostId, String command, String values);
public HashMap<String, Pair<Long, Long>> syncNetworkGroups(String hostGuid);

View File

@ -16,8 +16,6 @@
// under the License.
package com.cloud.agent.manager;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
@ -25,6 +23,7 @@ import javax.ejb.Local;
import javax.naming.ConfigurationException;
import com.cloud.agent.api.*;
import com.cloud.agent.api.storage.*;
import org.apache.log4j.Logger;
import com.cloud.agent.api.check.CheckSshCommand;
@ -38,14 +37,6 @@ import com.cloud.agent.api.routing.SetFirewallRulesCommand;
import com.cloud.agent.api.routing.SetPortForwardingRulesCommand;
import com.cloud.agent.api.routing.SetStaticNatRulesCommand;
import com.cloud.agent.api.routing.VmDataCommand;
import com.cloud.agent.api.storage.CopyVolumeCommand;
import com.cloud.agent.api.storage.CreateCommand;
import com.cloud.agent.api.storage.DeleteTemplateCommand;
import com.cloud.agent.api.storage.DestroyCommand;
import com.cloud.agent.api.storage.DownloadCommand;
import com.cloud.agent.api.storage.DownloadProgressCommand;
import com.cloud.agent.api.storage.ListTemplateCommand;
import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
import com.cloud.simulator.MockConfigurationVO;
import com.cloud.simulator.MockHost;
import com.cloud.simulator.MockVMVO;
@ -58,6 +49,7 @@ import com.cloud.utils.db.DB;
import com.cloud.utils.db.Transaction;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.vm.VirtualMachine.State;
@Local(value = { SimulatorManager.class })
public class SimulatorManagerImpl implements SimulatorManager {
private static final Logger s_logger = Logger.getLogger(SimulatorManagerImpl.class);
@ -121,83 +113,83 @@ public class SimulatorManagerImpl implements SimulatorManager {
public Answer simulate(Command cmd, String hostGuid) {
Transaction txn = Transaction.open(Transaction.SIMULATOR_DB);
// txn.transitToUserManagedConnection(_concierge.conn());
try {
MockHost host = _mockHost.findByGuid(hostGuid);
String cmdName = cmd.toString();
int index = cmdName.lastIndexOf(".");
if (index != -1) {
cmdName = cmdName.substring(index + 1);
cmdName = cmdName.substring(index + 1);
}
MockConfigurationVO config = _mockConfigDao.findByNameBottomUP(host.getDataCenterId(), host.getPodId(), host.getClusterId(), host.getId(), cmdName);
SimulatorInfo info = new SimulatorInfo();
info.setHostUuid(hostGuid);
if (config != null) {
Map<String, String> configParameters = config.getParameters();
for (Map.Entry<String, String> entry : configParameters.entrySet()) {
if (entry.getKey().equalsIgnoreCase("enabled")) {
info.setEnabled(Boolean.parseBoolean(entry.getValue()));
} else if (entry.getKey().equalsIgnoreCase("timeout")) {
try {
info.setTimeout(Integer.valueOf(entry.getValue()));
} catch (NumberFormatException e) {
s_logger.debug("invalid timeout parameter: " + e.toString());
}
} else if (entry.getKey().equalsIgnoreCase("wait")) {
try {
int wait = Integer.valueOf(entry.getValue());
Thread.sleep(wait * 1000);
} catch (NumberFormatException e) {
s_logger.debug("invalid timeout parameter: " + e.toString());
} catch (InterruptedException e) {
s_logger.debug("thread is interrupted: " + e.toString());
}
}
if (entry.getKey().equalsIgnoreCase("enabled")) {
info.setEnabled(Boolean.parseBoolean(entry.getValue()));
} else if (entry.getKey().equalsIgnoreCase("timeout")) {
try {
info.setTimeout(Integer.valueOf(entry.getValue()));
} catch (NumberFormatException e) {
s_logger.debug("invalid timeout parameter: " + e.toString());
}
} else if (entry.getKey().equalsIgnoreCase("wait")) {
try {
int wait = Integer.valueOf(entry.getValue());
Thread.sleep(wait * 1000);
} catch (NumberFormatException e) {
s_logger.debug("invalid timeout parameter: " + e.toString());
} catch (InterruptedException e) {
s_logger.debug("thread is interrupted: " + e.toString());
}
}
}
}
if (cmd instanceof GetHostStatsCommand) {
return _mockAgentMgr.getHostStatistic((GetHostStatsCommand)cmd);
return _mockAgentMgr.getHostStatistic((GetHostStatsCommand) cmd);
} else if (cmd instanceof CheckHealthCommand) {
return _mockAgentMgr.checkHealth((CheckHealthCommand)cmd);
return _mockAgentMgr.checkHealth((CheckHealthCommand) cmd);
} else if (cmd instanceof PingTestCommand) {
return _mockAgentMgr.pingTest((PingTestCommand)cmd);
return _mockAgentMgr.pingTest((PingTestCommand) cmd);
} else if (cmd instanceof PrepareForMigrationCommand) {
return _mockAgentMgr.prepareForMigrate((PrepareForMigrationCommand)cmd);
return _mockVmMgr.prepareForMigrate((PrepareForMigrationCommand) cmd);
} else if (cmd instanceof MigrateCommand) {
return _mockVmMgr.Migrate((MigrateCommand)cmd, info);
return _mockVmMgr.Migrate((MigrateCommand) cmd, info);
} else if (cmd instanceof StartCommand) {
return _mockVmMgr.startVM((StartCommand)cmd, info);
return _mockVmMgr.startVM((StartCommand) cmd, info);
} else if (cmd instanceof CheckSshCommand) {
return _mockVmMgr.checkSshCommand((CheckSshCommand)cmd);
return _mockVmMgr.checkSshCommand((CheckSshCommand) cmd);
} else if (cmd instanceof CheckVirtualMachineCommand) {
return _mockVmMgr.checkVmState((CheckVirtualMachineCommand)cmd);
return _mockVmMgr.checkVmState((CheckVirtualMachineCommand) cmd);
} else if (cmd instanceof SetStaticNatRulesCommand) {
return _mockVmMgr.SetStaticNatRules((SetStaticNatRulesCommand)cmd);
return _mockVmMgr.SetStaticNatRules((SetStaticNatRulesCommand) cmd);
} else if (cmd instanceof SetFirewallRulesCommand) {
return _mockVmMgr.SetFirewallRules((SetFirewallRulesCommand)cmd);
return _mockVmMgr.SetFirewallRules((SetFirewallRulesCommand) cmd);
} else if (cmd instanceof SetPortForwardingRulesCommand) {
return _mockVmMgr.SetPortForwardingRules((SetPortForwardingRulesCommand)cmd);
return _mockVmMgr.SetPortForwardingRules((SetPortForwardingRulesCommand) cmd);
} else if (cmd instanceof NetworkUsageCommand) {
return _mockVmMgr.getNetworkUsage((NetworkUsageCommand)cmd);
return _mockVmMgr.getNetworkUsage((NetworkUsageCommand) cmd);
} else if (cmd instanceof IpAssocCommand) {
return _mockVmMgr.IpAssoc((IpAssocCommand)cmd);
return _mockVmMgr.IpAssoc((IpAssocCommand) cmd);
} else if (cmd instanceof LoadBalancerConfigCommand) {
return _mockVmMgr.LoadBalancerConfig((LoadBalancerConfigCommand)cmd);
return _mockVmMgr.LoadBalancerConfig((LoadBalancerConfigCommand) cmd);
} else if (cmd instanceof DhcpEntryCommand) {
return _mockVmMgr.AddDhcpEntry((DhcpEntryCommand)cmd);
return _mockVmMgr.AddDhcpEntry((DhcpEntryCommand) cmd);
} else if (cmd instanceof VmDataCommand) {
return _mockVmMgr.setVmData((VmDataCommand)cmd);
return _mockVmMgr.setVmData((VmDataCommand) cmd);
} else if (cmd instanceof CleanupNetworkRulesCmd) {
return _mockVmMgr.CleanupNetworkRules((CleanupNetworkRulesCmd)cmd, info);
return _mockVmMgr.CleanupNetworkRules((CleanupNetworkRulesCmd) cmd, info);
} else if (cmd instanceof CheckNetworkCommand) {
return _mockAgentMgr.checkNetworkCommand((CheckNetworkCommand) cmd);
return _mockAgentMgr.checkNetworkCommand((CheckNetworkCommand) cmd);
}else if (cmd instanceof StopCommand) {
return _mockVmMgr.stopVM((StopCommand)cmd);
} else if (cmd instanceof RebootCommand) {
return _mockVmMgr.rebootVM((RebootCommand)cmd);
return _mockVmMgr.rebootVM((RebootCommand) cmd);
} else if (cmd instanceof GetVncPortCommand) {
return _mockVmMgr.getVncPort((GetVncPortCommand)cmd);
} else if (cmd instanceof CheckConsoleProxyLoadCommand) {
@ -226,6 +218,8 @@ public class SimulatorManagerImpl implements SimulatorManager {
return _mockStorageMgr.SecStorageSetup((SecStorageSetupCommand)cmd);
} else if (cmd instanceof ListTemplateCommand) {
return _mockStorageMgr.ListTemplates((ListTemplateCommand)cmd);
} else if (cmd instanceof ListVolumeCommand) {
return _mockStorageMgr.ListVolumes((ListVolumeCommand)cmd);
} else if (cmd instanceof DestroyCommand) {
return _mockStorageMgr.Destroy((DestroyCommand)cmd);
} else if (cmd instanceof DownloadProgressCommand) {
@ -261,12 +255,11 @@ public class SimulatorManagerImpl implements SimulatorManager {
} else if (cmd instanceof BumpUpPriorityCommand) {
return _mockVmMgr.bumpPriority((BumpUpPriorityCommand) cmd);
} else if (cmd instanceof GetDomRVersionCmd) {
return _mockVmMgr.getDomRVersion((GetDomRVersionCmd) cmd);
return _mockVmMgr.getDomRVersion((GetDomRVersionCmd) cmd);
} else if (cmd instanceof ClusterSyncCommand) {
return new Answer(cmd);
//return new ClusterSyncAnswer(((ClusterSyncCommand) cmd).getClusterId(), this.getVmStates(hostGuid));
return new Answer(cmd);
} else if (cmd instanceof CopyVolumeCommand) {
return _mockStorageMgr.CopyVolume((CopyVolumeCommand) cmd);
return _mockStorageMgr.CopyVolume((CopyVolumeCommand) cmd);
} else {
return Answer.createUnsupportedCommandAnswer(cmd);
}
@ -288,19 +281,19 @@ public class SimulatorManagerImpl implements SimulatorManager {
@Override
public Map<String, State> getVmStates(String hostGuid) {
return _mockVmMgr.getVmStates(hostGuid);
return _mockVmMgr.getVmStates(hostGuid);
}
@Override
public Map<String, MockVMVO> getVms(String hostGuid) {
return _mockVmMgr.getVms(hostGuid);
return _mockVmMgr.getVms(hostGuid);
}
@Override
public HashMap<String, Pair<Long, Long>> syncNetworkGroups(String hostGuid) {
SimulatorInfo info = new SimulatorInfo();
info.setHostUuid(hostGuid);
return _mockVmMgr.syncNetworkGroups(info);
SimulatorInfo info = new SimulatorInfo();
info.setHostUuid(hostGuid);
return _mockVmMgr.syncNetworkGroups(info);
}
@Override

View File

@ -37,25 +37,25 @@ import com.cloud.utils.component.ComponentLocator;
public class ConfigureSimulator extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(ConfigureSimulator.class.getName());
private static final String s_name = "configuresimulatorresponse";
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="configure range: in a zone")
private Long zoneId;
@Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="configure range: in a pod")
private Long podId;
@Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.LONG, description="configure range: in a cluster")
private Long clusterId;
@Parameter(name=ApiConstants.HOST_ID, type=CommandType.LONG, description="configure range: in a host")
private Long hostId;
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="which command needs to be configured")
private String command;
@Parameter(name=ApiConstants.VALUE, type=CommandType.STRING, required=true, description="configuration options for this command, which is seperated by ;")
private String values;
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
@ -64,7 +64,7 @@ public class ConfigureSimulator extends BaseCmd {
if (!result) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to configure simulator");
}
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
}

View File

@ -52,7 +52,7 @@ public class AgentResourceBase implements ServerResource {
protected String _name;
private List<String> _warnings = new LinkedList<String>();
private List<String> _errors = new LinkedList<String>();
private transient IAgentControl _agentControl;
protected long _instanceId;
@ -64,36 +64,36 @@ public class AgentResourceBase implements ServerResource {
protected MockHost agentHost = null;
protected boolean stopped = false;
protected String hostGuid = null;
public AgentResourceBase(long instanceId, AgentType agentType, SimulatorManager simMgr, String hostGuid) {
_instanceId = instanceId;
_instanceId = instanceId;
if(s_logger.isDebugEnabled()) {
s_logger.info("New Routing host instantiated with guid:" + hostGuid);
}
if (agentType == AgentType.Routing) {
_type = Host.Type.Routing;
} else {
_type = Host.Type.Storage;
}
this.hostGuid = hostGuid;
}
protected MockVmManager getVmMgr() {
return _simMgr.getVmMgr();
}
protected MockStorageManager getStorageMgr() {
return _simMgr.getStorageMgr();
}
protected MockAgentManager getAgentMgr() {
return _simMgr.getAgentMgr();
}
protected long getInstanceId() {
return _instanceId;
}
@ -102,7 +102,7 @@ public class AgentResourceBase implements ServerResource {
if(s_logger.isDebugEnabled()) {
s_logger.debug("Deserializing simulated agent on reconnect");
}
}
@Override
@ -113,18 +113,18 @@ public class AgentResourceBase implements ServerResource {
public void setName(String name) {
_name = name;
}
@Override
public boolean configure(String name, Map<String, Object> params)
throws ConfigurationException {
hostGuid = (String)params.get("guid");
_locator = ComponentLocator.getLocator("management-server");
_simMgr = _locator.getManager(SimulatorManager.class);
agentHost = getAgentMgr().getHost(hostGuid);
return true;
}
private void reconnect(MockHost host) {
if(s_logger.isDebugEnabled()) {
@ -244,7 +244,7 @@ public class AgentResourceBase implements ServerResource {
}
return file.getAbsolutePath();
}
@Override
public Answer executeRequest(Command cmd) {
@ -264,20 +264,20 @@ public class AgentResourceBase implements ServerResource {
public void setType(Host.Type _type) {
this._type = _type;
}
@Override
public StartupCommand[] initialize() {
return null;
}
public SimulatorManager getSimulatorManager() {
return _simMgr;
}
public void setSimulatorManager(SimulatorManager simMgr) {
_simMgr = simMgr;
}
public void setSimulatorManager(SimulatorManager simMgr) {
_simMgr = simMgr;
}
public boolean isStopped() {
return this.stopped;
}

View File

@ -91,7 +91,7 @@ public class AgentRoutingResource extends AgentStorageResource {
} else if (cmd instanceof ReadyCommand) {
return new ReadyAnswer((ReadyCommand)cmd);
} else if (cmd instanceof ShutdownCommand) {
return execute((ShutdownCommand)cmd);
return execute((ShutdownCommand)cmd);
} else {
return _simMgr.simulate(cmd, hostGuid);
}
@ -99,7 +99,7 @@ public class AgentRoutingResource extends AgentStorageResource {
return new Answer(cmd, false, e.getMessage());
}
}
@Override
public Type getType() {
return Host.Type.Routing;
@ -111,10 +111,10 @@ public class AgentRoutingResource extends AgentStorageResource {
return null;
}
synchronized (_vms) {
if (_vms.size() == 0) {
//load vms state from database
_vms.putAll(_simMgr.getVmStates(hostGuid));
}
if (_vms.size() == 0) {
//load vms state from database
_vms.putAll(_simMgr.getVmStates(hostGuid));
}
}
final HashMap<String, State> newStates = sync();
HashMap<String, Pair<Long, Long>> nwGrpStates = _simMgr.syncNetworkGroups(hostGuid);
@ -131,18 +131,18 @@ public class AgentRoutingResource extends AgentStorageResource {
totalCpu = agentHost.getCpuCount() * agentHost.getCpuSpeed();
totalMem = agentHost.getMemorySize();
for (Map.Entry<String, MockVMVO> entry : vmsMaps.entrySet()) {
MockVMVO vm = entry.getValue();
usedCpu += vm.getCpu();
usedMem += vm.getMemory();
_runningVms.put(entry.getKey(), new Pair<Long, Long>(Long.valueOf(vm.getCpu()), vm.getMemory()));
MockVMVO vm = entry.getValue();
usedCpu += vm.getCpu();
usedMem += vm.getMemory();
_runningVms.put(entry.getKey(), new Pair<Long, Long>(Long.valueOf(vm.getCpu()), vm.getMemory()));
}
List<Object> info = getHostInfo();
StartupRoutingCommand cmd = new StartupRoutingCommand((Integer) info.get(0), (Long) info.get(1), (Long) info.get(2), (Long) info.get(4), (String) info.get(3), HypervisorType.Simulator,
RouterPrivateIpStrategy.HostLocal);
cmd.setStateChanges(changes);
Map<String, String> hostDetails = new HashMap<String, String>();
hostDetails.put(RouterPrivateIpStrategy.class.getCanonicalName(), RouterPrivateIpStrategy.DcGlobal.toString());
@ -167,13 +167,13 @@ public class AgentRoutingResource extends AgentStorageResource {
cmd.setCluster(String.valueOf(agentHost.getClusterId()));
StartupStorageCommand ssCmd = initializeLocalSR();
return new StartupCommand[] { cmd, ssCmd };
}
private StartupStorageCommand initializeLocalSR() {
Map<String, TemplateInfo> tInfo = new HashMap<String, TemplateInfo>();
StoragePoolInfo poolInfo = _simMgr.getLocalStorage(hostGuid);
StartupStorageCommand cmd = new StartupStorageCommand(poolInfo.getHostPath(), poolInfo.getPoolType(), poolInfo.getCapacityBytes(), tInfo);
@ -183,14 +183,14 @@ public class AgentRoutingResource extends AgentStorageResource {
cmd.setResourceType(StorageResourceType.STORAGE_POOL);
return cmd;
}
protected synchronized Answer execute(StartCommand cmd)
throws IllegalArgumentException {
VirtualMachineTO vmSpec = cmd.getVirtualMachine();
String vmName = vmSpec.getName();
if (this.totalCpu < (vmSpec.getCpus() * vmSpec.getSpeed() + this.usedCpu) ||
this.totalMem < (vmSpec.getMaxRam() + this.usedMem)) {
return new StartAnswer(cmd, "Not enough resource to start the vm");
return new StartAnswer(cmd, "Not enough resource to start the vm");
}
State state = State.Stopped;
synchronized (_vms) {
@ -202,7 +202,7 @@ public class AgentRoutingResource extends AgentStorageResource {
if (!result.getResult()) {
return new StartAnswer(cmd, result.getDetails());
}
this.usedCpu += vmSpec.getCpus() * vmSpec.getSpeed();
this.usedMem += vmSpec.getMaxRam();
_runningVms.put(vmName, new Pair<Long, Long>(Long.valueOf(vmSpec.getCpus() * vmSpec.getSpeed()), vmSpec.getMaxRam()));
@ -217,7 +217,7 @@ public class AgentRoutingResource extends AgentStorageResource {
return new StartAnswer(cmd);
}
protected synchronized StopAnswer execute(StopCommand cmd) {
StopAnswer answer = null;
@ -230,11 +230,11 @@ public class AgentRoutingResource extends AgentStorageResource {
}
try {
Answer result = _simMgr.simulate(cmd, hostGuid);
if (!result.getResult()) {
return new StopAnswer(cmd, result.getDetails(), false);
}
answer = new StopAnswer(cmd, null, 0, true);
Pair<Long, Long> data = _runningVms.get(vmName);
if (data != null) {
@ -242,16 +242,16 @@ public class AgentRoutingResource extends AgentStorageResource {
this.usedMem -= data.second();
}
state = State.Stopped;
} finally {
synchronized (_vms) {
_vms.put(vmName, state);
}
}
return answer;
}
protected CheckVirtualMachineAnswer execute(final CheckVirtualMachineCommand cmd) {
final String vmName = cmd.getVmName();
CheckVirtualMachineAnswer result = (CheckVirtualMachineAnswer)_simMgr.simulate(cmd, hostGuid);
@ -346,7 +346,7 @@ public class AgentRoutingResource extends AgentStorageResource {
return changes;
}
private Answer execute(ShutdownCommand cmd) {
this.stopped = true;
return new Answer(cmd);

View File

@ -62,7 +62,7 @@ public class AgentStorageResource extends AgentResourceBase implements Secondary
return _simMgr.simulate(cmd, hostGuid);
}
}
@Override
public PingCommand getCurrentStatus(long id) {
if (isStopped()) {
@ -73,14 +73,14 @@ public class AgentStorageResource extends AgentResourceBase implements Secondary
@Override
public Type getType() {
if(SecondaryStorageVm.Role.templateProcessor.toString().equals(_role))
return Host.Type.SecondaryStorage;
return Host.Type.SecondaryStorageCmdExecutor;
if(SecondaryStorageVm.Role.templateProcessor.toString().equals(_role))
return Host.Type.SecondaryStorage;
return Host.Type.SecondaryStorageCmdExecutor;
}
@Override
public StartupCommand[] initialize() {
StartupSecondaryStorageCommand cmd = new StartupSecondaryStorageCommand();
StartupSecondaryStorageCommand cmd = new StartupSecondaryStorageCommand();
cmd.setPrivateIpAddress(agentHost.getPrivateIpAddress());
cmd.setPrivateNetmask(agentHost.getPrivateNetMask());
@ -97,15 +97,15 @@ public class AgentStorageResource extends AgentResourceBase implements Secondary
cmd.setPod(String.valueOf(agentHost.getPodId()));
cmd.setGuid(agentHost.getGuid());
return new StartupCommand[] { cmd };
}
}
@Override
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
if (!super.configure(name, params)) {
s_logger.warn("Base class was unable to configure");
return false;
}
return true;
}

View File

@ -60,7 +60,7 @@ import com.cloud.utils.component.Inject;
public class SimulatorDiscoverer extends DiscovererBase implements Discoverer, Listener, ResourceStateAdapter {
private static final Logger s_logger = Logger
.getLogger(SimulatorDiscoverer.class);
@Inject HostDao _hostDao;
@Inject VMTemplateDao _vmTemplateDao;
@Inject VMTemplateHostDao _vmTemplateHostDao;
@ -70,10 +70,10 @@ public class SimulatorDiscoverer extends DiscovererBase implements Discoverer, L
@Inject MockAgentManager _mockAgentMgr = null;
@Inject MockStorageManager _mockStorageMgr = null;
@Inject ResourceManager _resourceMgr;
/**
* Finds ServerResources of an in-process simulator
*
*
* @see com.cloud.resource.Discoverer#find(long, java.lang.Long,
* java.lang.Long, java.net.URI, java.lang.String, java.lang.String)
*/
@ -88,7 +88,7 @@ public class SimulatorDiscoverer extends DiscovererBase implements Discoverer, L
String scheme = uri.getScheme();
String host = uri.getAuthority();
String commands = URLDecoder.decode(uri.getPath());
long cpuSpeed = _mockAgentMgr.DEFAULT_HOST_SPEED_MHZ;
long cpuCores = _mockAgentMgr.DEFAULT_HOST_CPU_CORES;
long memory = _mockAgentMgr.DEFAULT_HOST_MEM_SIZE;
@ -145,7 +145,7 @@ public class SimulatorDiscoverer extends DiscovererBase implements Discoverer, L
if (s_logger.isInfoEnabled())
s_logger.info("invalid cluster id or cluster is not for Simulator hypervisors");
return null;
}
}
cluster = Long.toString(clusterId);
if(clu.getGuid() == null) {
clu.setGuid(UUID.randomUUID().toString());
@ -205,23 +205,23 @@ public class SimulatorDiscoverer extends DiscovererBase implements Discoverer, L
for (HostVO h : hosts) {
associateTemplatesToZone(h.getId(), h.getDataCenterId());
}
}
}
private void associateTemplatesToZone(long hostId, long dcId){
VMTemplateZoneVO tmpltZone;
VMTemplateZoneVO tmpltZone;
List<VMTemplateVO> allTemplates = _vmTemplateDao.listAll();
for (VMTemplateVO vt: allTemplates){
if (vt.isCrossZones()) {
tmpltZone = _vmTemplateZoneDao.findByZoneTemplate(dcId, vt.getId());
if (tmpltZone == null) {
VMTemplateZoneVO vmTemplateZone = new VMTemplateZoneVO(dcId, vt.getId(), new Date());
_vmTemplateZoneDao.persist(vmTemplateZone);
}
}
}
List<VMTemplateVO> allTemplates = _vmTemplateDao.listAll();
for (VMTemplateVO vt: allTemplates){
if (vt.isCrossZones()) {
tmpltZone = _vmTemplateZoneDao.findByZoneTemplate(dcId, vt.getId());
if (tmpltZone == null) {
VMTemplateZoneVO vmTemplateZone = new VMTemplateZoneVO(dcId, vt.getId(), new Date());
_vmTemplateZoneDao.persist(vmTemplateZone);
}
}
}
}
@Override
public HypervisorType getHypervisorType() {
return HypervisorType.Simulator;
@ -231,7 +231,7 @@ public class SimulatorDiscoverer extends DiscovererBase implements Discoverer, L
public boolean matchHypervisor(String hypervisor) {
return hypervisor.equalsIgnoreCase(HypervisorType.Simulator.toString());
}
@Override
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
super.configure(name, params);
@ -257,9 +257,9 @@ public class SimulatorDiscoverer extends DiscovererBase implements Discoverer, L
@Override
public void processConnect(HostVO host, StartupCommand cmd, boolean forRebalance) throws ConnectionException {
/*if(forRebalance)
return;
return;
if ( Host.Type.SecondaryStorage == host.getType() ) {
List<VMTemplateVO> tmplts = _vmTemplateDao.listAll();
for( VMTemplateVO tmplt : tmplts ) {
@ -275,7 +275,7 @@ public class SimulatorDiscoverer extends DiscovererBase implements Discoverer, L
}
}
}*/
}
@Override
@ -312,12 +312,12 @@ public class SimulatorDiscoverer extends DiscovererBase implements Discoverer, L
if (!(firstCmd instanceof StartupRoutingCommand)) {
return null;
}
StartupRoutingCommand ssCmd = ((StartupRoutingCommand) firstCmd);
if (ssCmd.getHypervisorType() != HypervisorType.Simulator) {
return null;
}
return _resourceMgr.fillRoutingHostVO(host, ssCmd, HypervisorType.Simulator, details, hostTags);
}
@ -326,11 +326,11 @@ public class SimulatorDiscoverer extends DiscovererBase implements Discoverer, L
boolean isForceDeleteStorage) throws UnableDeleteHostException {
return null;
}
@Override
public boolean stop() {
_resourceMgr.unregisterResourceStateAdapter(this.getClass().getSimpleName());
_resourceMgr.unregisterResourceStateAdapter(this.getClass().getSimpleName());
return super.stop();
}
}

View File

@ -16,6 +16,7 @@
// under the License.
package com.cloud.resource;
import java.net.URI;
import java.util.List;
import java.util.Map;
@ -39,24 +40,50 @@ import com.cloud.storage.dao.SnapshotDao;
import com.cloud.storage.secondary.SecondaryStorageDiscoverer;
import com.cloud.utils.component.Inject;
import com.cloud.utils.exception.CloudRuntimeException;
import org.apache.log4j.Logger;
@Local(value=Discoverer.class)
public class SimulatorSecondaryDiscoverer extends SecondaryStorageDiscoverer implements ResourceStateAdapter, Listener {
private static final Logger s_logger = Logger.getLogger(SimulatorSecondaryDiscoverer.class);
@Inject MockStorageManager _mockStorageMgr = null;
@Inject AgentManager _agentMgr;
@Inject ResourceManager _resourceMgr;
@Inject SnapshotDao _snapshotDao;
@Override
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
_agentMgr.registerForHostEvents(this, true, false, false);
_agentMgr.registerForHostEvents(this, true, false, false);
_resourceMgr.registerResourceStateAdapter(this.getClass().getSimpleName(), this);
return super.configure(name, params);
}
@Override
public Map<? extends ServerResource, Map<String, String>> find(long dcId, Long podId, Long clusterId, URI uri, String username, String password, List<String> hostTags) {
if (!uri.getScheme().equalsIgnoreCase("nfs") && !uri.getScheme().equalsIgnoreCase("file")
&& !uri.getScheme().equalsIgnoreCase("iso") && !uri.getScheme().equalsIgnoreCase("dummy")) {
s_logger.debug("It's not NFS or file or ISO, so not a secondary storage server: " + uri.toString());
return null;
}
if (uri.getScheme().equalsIgnoreCase("nfs") || uri.getScheme().equalsIgnoreCase("iso")) {
return createNfsSecondaryStorageResource(dcId, podId, uri);
} else if (uri.getScheme().equalsIgnoreCase("file")) {
return createLocalSecondaryStorageResource(dcId, podId, uri);
} else if (uri.getScheme().equalsIgnoreCase("dummy")) {
return createDummySecondaryStorageResource(dcId, podId, uri);
} else {
return null;
}
}
@Override
public void postDiscovery(List<HostVO> hosts, long msId) {
super.postDiscovery(hosts, msId);
for (HostVO host: hosts) {
if(s_logger.isDebugEnabled()) {
s_logger.debug("Preinstalling simulator templates");
}
_mockStorageMgr.preinstallTemplates(host.getStorageUrl(), host.getDataCenterId());
}
}
@ -74,9 +101,9 @@ public class SimulatorSecondaryDiscoverer extends SecondaryStorageDiscoverer imp
//for detecting SSVM dispatch
StartupCommand firstCmd = startup[0];
if (!(firstCmd instanceof StartupSecondaryStorageCommand)) {
return null;
return null;
}
host.setType(com.cloud.host.Host.Type.SecondaryStorageVM);
return host;
}
@ -103,7 +130,7 @@ public class SimulatorSecondaryDiscoverer extends SecondaryStorageDiscoverer imp
@Override
public boolean stop() {
_resourceMgr.unregisterResourceStateAdapter(this.getClass().getSimpleName());
_resourceMgr.unregisterResourceStateAdapter(this.getClass().getSimpleName());
return true;
}
@ -130,7 +157,7 @@ public class SimulatorSecondaryDiscoverer extends SecondaryStorageDiscoverer imp
@Override
public void processConnect(HostVO host, StartupCommand cmd,
boolean forRebalance) throws ConnectionException {
}
@Override

View File

@ -25,7 +25,7 @@ public class ManagementServerSimulatorImpl extends ManagementServerExtImpl {
for (int i = 0; i < apis.length; i++) {
newapis[i] = apis[i];
}
newapis[apis.length] = "commands-simulator.properties";
return newapis;
}

View File

@ -33,79 +33,79 @@ public class MockConfigurationVO {
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id")
private long id;
@Column(name="data_center_id", nullable=false)
private Long dataCenterId;
@Column(name="pod_id")
private Long podId;
@Column(name="cluster_id")
private Long clusterId;
@Column(name="host_id")
private Long hostId;
@Column(name="name")
private String name;
@Column(name="values")
private String values;
public long getId() {
return this.id;
}
public Long getDataCenterId() {
return this.dataCenterId;
}
public void setDataCenterId(Long dcId) {
this.dataCenterId = dcId;
}
public Long getPodId() {
return this.podId;
}
public void setPodId(Long podId) {
this.podId = podId;
}
public Long getClusterId() {
return this.clusterId;
}
public void setClusterId(Long clusterId) {
this.clusterId = clusterId;
}
public Long getHostId() {
return this.hostId;
}
public void setHostId(Long hostId) {
this.hostId = hostId;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getValues() {
return this.values;
}
public Map<String, String> getParameters() {
Map<String, String> maps = new HashMap<String, String>();
if (this.values == null) {
return maps;
}
String[] vals = this.values.split("\\|");
for (String val : vals) {
String[] paras = val.split(":");
@ -113,9 +113,8 @@ public class MockConfigurationVO {
}
return maps;
}
public void setValues(String values) {
this.values = values;
}
}

View File

@ -19,44 +19,44 @@ package com.cloud.simulator;
public interface MockHost {
public long getCpuSpeed();
public long getCpuCount();
public long getMemorySize();
public String getCapabilities();
public long getId();
public String getName();
public String getGuid();
public String getVersion();
public Long getDataCenterId();
public Long getPodId();
public Long getClusterId();
public String getPrivateIpAddress();
public String getPrivateNetMask();
public String getPrivateMacAddress();
public String getPublicIpAddress();
public String getPublicNetMask();
public String getPublicMacAddress();
public String getStorageIpAddress();
public String getStorageNetMask();
public String getStorageMacAddress();
}

View File

@ -31,245 +31,245 @@ public class MockHostVO implements MockHost {
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id")
private long id;
@Column(name="name", nullable=false)
private String name = null;
@Column(name="private_ip_address", nullable=false)
private String privateIpAddress;
@Column(name="private_mac_address", nullable=false)
private String privateMacAddress;
@Column(name="private_netmask", nullable=false)
private String privateNetmask;
@Column(name="public_netmask")
private String publicNetmask;
@Column(name="public_ip_address")
private String publicIpAddress;
@Column(name="public_mac_address")
private String publicMacAddress;
@Column(name="storage_ip_address")
private String storageIpAddress;
@Column(name="storage_mac_address")
private String storageMacAddress;
@Column(name="storage_netmask")
private String storageNetMask;
@Column(name="guid")
private String guid;
@Column(name="version")
private String version;
@Column(name="data_center_id", nullable=false)
private long dataCenterId;
@Column(name="pod_id")
private Long podId;
@Column(name="cluster_id")
private Long clusterId;
@Column(name="speed")
private long cpuSpeed;
@Column(name="cpus")
private long cpuCount;
@Column(name="ram")
private long memorySize;
@Column(name="capabilities")
private String capabilities;
@Column(name="vm_id")
private long vmId;
@Column(name="resource")
private String resource;
public MockHostVO() {
}
public long getVmId() {
return vmId;
}
public void setVmId(long vmId) {
this.vmId = vmId;
}
public String getResource() {
return this.resource;
}
public void setResource(String resource) {
this.resource = resource;
}
public long getCpuSpeed() {
return this.cpuSpeed;
}
public void setCpuSpeed(long cpuSpeed) {
this.cpuSpeed = cpuSpeed;
}
public long getCpuCount() {
return this.cpuCount;
}
public void setCpuCount(long cpuCount) {
this.cpuCount = cpuCount;
}
public long getMemorySize() {
return this.memorySize;
}
public void setMemorySize(long memorySize) {
this.memorySize = memorySize;
}
public String getCapabilities() {
return this.capabilities;
}
public void setCapabilities(String capabilities) {
this.capabilities = capabilities;
}
public long getId() {
return id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getGuid() {
return this.guid;
}
public void setGuid(String guid) {
this.guid = guid;
}
public String getVersion() {
return this.version;
}
public void setVersion(String version) {
this.version = version;
}
public Long getDataCenterId() {
return this.dataCenterId;
}
public void setDataCenterId(Long dataCenterId) {
this.dataCenterId = dataCenterId;
}
public Long getPodId() {
return this.podId;
}
public void setPodId(long podId) {
this.podId = podId;
}
public Long getClusterId() {
return this.clusterId;
}
public void setClusterId(Long clusterId) {
this.clusterId = clusterId;
}
public String getPrivateIpAddress() {
return privateIpAddress;
}
public void setPrivateIpAddress(String privateIpAddress) {
this.privateIpAddress = privateIpAddress;
}
public String getPrivateNetMask() {
return this.privateNetmask;
}
public void setPrivateNetMask(String privateNetmask) {
this.privateNetmask = privateNetmask;
}
public String getPrivateMacAddress() {
return this.privateMacAddress;
}
public void setPrivateMacAddress(String privateMacAddress) {
this.privateMacAddress = privateMacAddress;
}
public String getPublicIpAddress() {
return this.publicIpAddress;
}
public void setPublicIpAddress(String publicIpAddress) {
this.publicIpAddress = publicIpAddress;
}
public String getPublicNetMask() {
return this.publicNetmask;
}
public void setPublicNetMask(String publicNetMask) {
this.publicNetmask = publicNetMask;
}
public String getPublicMacAddress() {
return this.publicMacAddress;
}
public void setPublicMacAddress(String publicMacAddress) {
this.publicMacAddress = publicMacAddress;
}
public String getStorageIpAddress() {
return this.storageIpAddress;
}
public void setStorageIpAddress(String storageIpAddress) {
this.storageIpAddress = storageIpAddress;
}
public String getStorageNetMask() {
return this.storageNetMask;
}
public void setStorageNetMask(String storageNetMask) {
this.storageNetMask = storageNetMask;
}
public String getStorageMacAddress() {
return this.storageMacAddress;
}
public void setStorageMacAddress(String storageMacAddress) {
this.storageMacAddress = storageMacAddress;
}

View File

@ -31,45 +31,45 @@ public class MockSecStorageVO {
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id")
private long id;
@Column(name="url")
private String url;
@Column(name="capacity")
private long capacity;
@Column(name="mount_point")
private String mountPoint;
public MockSecStorageVO() {
}
public long getId() {
return this.id;
}
public String getMountPoint() {
return this.mountPoint;
}
public void setMountPoint(String mountPoint) {
this.mountPoint = mountPoint;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public long getCapacity() {
return this.capacity;
}
public void setCapacity(long capacity) {
this.capacity = capacity;
}

View File

@ -31,73 +31,73 @@ public class MockSecurityRulesVO {
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id")
private long id;
@Column(name="vmid")
private Long vmId;
@Column(name="signature")
private String signature;
@Column(name="seqnum")
private Long seqNum;
@Column(name="ruleset")
private String ruleSet;
@Column(name="hostid")
private String hostId;
@Column(name="vmname")
public String vmName;
public String getVmName() {
return this.vmName;
}
public void setVmName(String vmName) {
this.vmName = vmName;
}
public String getHostId() {
return this.hostId;
}
public void setHostId(String hostId) {
this.hostId = hostId;
}
public long getId() {
return this.id;
}
public Long getVmId() {
return this.vmId;
}
public void setVmId(Long vmId) {
this.vmId = vmId;
}
public String getSignature() {
return this.signature;
}
public void setSignature(String sig) {
this.signature = sig;
}
public Long getSeqNum() {
return this.seqNum;
}
public void setSeqNum(Long seqNum) {
this.seqNum = seqNum;
}
public String getRuleSet() {
return this.ruleSet;
}
public void setRuleSet(String ruleset) {
this.ruleSet = ruleset;
}

View File

@ -35,67 +35,67 @@ public class MockStoragePoolVO {
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id")
private long id;
@Column(name="guid")
private String uuid;
@Column(name="mount_point")
private String mountPoint;
@Column(name="capacity")
private long capacity;
@Column(name="hostguid")
private String hostGuid;
@Column(name="pool_type")
@Enumerated(value=EnumType.STRING)
private StoragePoolType poolType;
public MockStoragePoolVO() {
}
public String getHostGuid() {
return this.hostGuid;
}
public void setHostGuid(String hostGuid) {
this.hostGuid = hostGuid;
}
public long getId() {
return this.id;
}
public StoragePoolType getPoolType() {
return this.poolType;
}
public void setStorageType(StoragePoolType poolType) {
this.poolType = poolType;
}
public String getUuid() {
return this.uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public String getMountPoint() {
return this.mountPoint;
}
public void setMountPoint(String mountPoint) {
this.mountPoint = mountPoint;
}
public long getCapacity() {
return this.capacity;
}
public void setCapacity(long capacity) {
this.capacity = capacity;
}

View File

@ -33,98 +33,108 @@ public class MockVMVO implements MockVm{
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id")
private long id;
@Column(name="name")
private String name;
@Column(name="host_id")
private long hostId;
@Column(name="type")
private String vmType;
@Column(name="state")
private State state;
@Column(name="vnc_port")
private int vncPort;
@Column(name="memory")
private long memory;
@Column(name="cpu")
private int cpu;
@Column(name="bootargs")
private String bootargs;
public MockVMVO() {
}
public long getId() {
return this.id;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public long getHostId() {
return this.hostId;
}
public void setHostId(long hostId) {
this.hostId = hostId;
}
public String getVmType() {
return this.vmType;
}
public void setVmType(String vmType) {
this.vmType = vmType;
}
public State getState() {
return this.state;
}
public String getType() {
return this.vmType;
return this.vmType;
}
public void setState(State state) {
this.state = state;
}
public int getVncPort() {
return this.vncPort;
}
public void setVncPort(int vncPort) {
this.vncPort = vncPort;
}
public long getMemory() {
return this.memory;
}
public void setMemory(long memory) {
this.memory = memory;
}
public int getCpu() {
return this.cpu;
}
public void setCpu(int cpu) {
this.cpu = cpu;
}
public void setType(String type) {
this.vmType = type;
this.vmType = type;
}
public String getBootargs() {
return bootargs;
}
public void setBootargs(String bootargs) {
this.bootargs = bootargs;
}
}

View File

@ -20,26 +20,28 @@ import com.cloud.vm.VirtualMachine.State;
// As storage is mapped from storage device, can virtually treat that VM here does
public interface MockVm {
public String getName();
public State getState();
public void setState(State state);
public void setHostId(long hostId);
public long getMemory();
public int getCpu();
public String getType();
public int getVncPort();
public void setName(String name);
public void setMemory(long memory);
public void setCpu(int cpu);
public void setType(String type);
public void setVncPort(int vncPort);
public long getId();
}
public String getBootargs();
public void setBootargs(String bootargs);
}

View File

@ -43,76 +43,76 @@ public class MockVolumeVO {
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id")
private long id;
@Column(name="name")
private String name;
@Column(name="size")
private long size;
@Column(name="path")
private String path;
@Column(name="pool_id")
private long poolId;
@Column(name="type")
@Enumerated(value=EnumType.STRING)
private MockVolumeType type;
@Column(name="status")
@Enumerated(value=EnumType.STRING)
private VMTemplateStorageResourceAssoc.Status status;
public long getId() {
return id;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public long getSize() {
return this.size;
}
public void setSize(long size) {
this.size = size;
}
public String getPath() {
return this.path;
}
public void setPath(String path) {
this.path = path;
}
public long getPoolId() {
return this.poolId;
}
public void setPoolId(long poolId) {
this.poolId = poolId;
}
public MockVolumeType getType() {
return this.type;
}
public void setType(MockVolumeType type) {
this.type = type;
}
public Status getStatus() {
return this.status;
}
public void setStatus(Status status) {
this.status = status;
}
}

View File

@ -35,7 +35,7 @@ public class SimulatorGuru extends HypervisorGuruBase implements HypervisorGuru
protected SimulatorGuru() {
super();
}
@Override
public HypervisorType getHypervisorType() {
return HypervisorType.Simulator;
@ -44,11 +44,11 @@ public class SimulatorGuru extends HypervisorGuruBase implements HypervisorGuru
@Override
public <T extends VirtualMachine> VirtualMachineTO implement(VirtualMachineProfile<T> vm) {
VirtualMachineTO to = toVirtualMachineTO(vm);
// Determine the VM's OS description
GuestOSVO guestOS = _guestOsDao.findById(vm.getVirtualMachine().getGuestOSId());
to.setOs(guestOS.getDisplayName());
return to;
}

View File

@ -26,15 +26,15 @@ import com.cloud.utils.exception.RuntimeCloudException;
public class SimulatorRuntimeException extends RuntimeCloudException {
private static final long serialVersionUID = SerialVersionUID.CloudRuntimeException;
public SimulatorRuntimeException(String message) {
super(message);
}
public SimulatorRuntimeException(String message, Throwable th) {
super(message, th);
}
protected SimulatorRuntimeException() {
super();
}

View File

@ -35,8 +35,8 @@ public class MockConfigurationDaoImpl extends GenericDaoBase<MockConfigurationVO
private SearchBuilder<MockConfigurationVO> _searchByDcIDPodIdClusterIdName;
private SearchBuilder<MockConfigurationVO> _searchByDcIDPodIdClusterIdHostIdName;
private SearchBuilder<MockConfigurationVO> _searchByGlobalName;
public MockConfigurationDaoImpl() {
_searchByGlobalName = createSearchBuilder();
_searchByGlobalName.and("dcId", _searchByGlobalName.entity().getDataCenterId(), SearchCriteria.Op.NULL);
@ -45,7 +45,7 @@ public class MockConfigurationDaoImpl extends GenericDaoBase<MockConfigurationVO
_searchByGlobalName.and("hostId", _searchByGlobalName.entity().getHostId(), SearchCriteria.Op.NULL);
_searchByGlobalName.and("name", _searchByGlobalName.entity().getName(), SearchCriteria.Op.EQ);
_searchByGlobalName.done();
_searchByDcIdName = createSearchBuilder();
_searchByDcIdName.and("dcId", _searchByDcIdName.entity().getDataCenterId(), SearchCriteria.Op.EQ);
_searchByDcIdName.and("podId", _searchByDcIdName.entity().getPodId(), SearchCriteria.Op.NULL);
@ -53,7 +53,7 @@ public class MockConfigurationDaoImpl extends GenericDaoBase<MockConfigurationVO
_searchByDcIdName.and("hostId", _searchByDcIdName.entity().getHostId(), SearchCriteria.Op.NULL);
_searchByDcIdName.and("name", _searchByDcIdName.entity().getName(), SearchCriteria.Op.EQ);
_searchByDcIdName.done();
_searchByDcIDPodIdName = createSearchBuilder();
_searchByDcIDPodIdName.and("dcId", _searchByDcIDPodIdName.entity().getDataCenterId(), SearchCriteria.Op.EQ);
_searchByDcIDPodIdName.and("podId", _searchByDcIDPodIdName.entity().getPodId(), SearchCriteria.Op.EQ);
@ -61,7 +61,7 @@ public class MockConfigurationDaoImpl extends GenericDaoBase<MockConfigurationVO
_searchByDcIDPodIdName.and("hostId", _searchByDcIDPodIdName.entity().getHostId(), SearchCriteria.Op.NULL);
_searchByDcIDPodIdName.and("name", _searchByDcIDPodIdName.entity().getName(), SearchCriteria.Op.EQ);
_searchByDcIDPodIdName.done();
_searchByDcIDPodIdClusterIdName = createSearchBuilder();
_searchByDcIDPodIdClusterIdName.and("dcId", _searchByDcIDPodIdClusterIdName.entity().getDataCenterId(), SearchCriteria.Op.EQ);
_searchByDcIDPodIdClusterIdName.and("podId", _searchByDcIDPodIdClusterIdName.entity().getPodId(), SearchCriteria.Op.EQ);
@ -69,7 +69,7 @@ public class MockConfigurationDaoImpl extends GenericDaoBase<MockConfigurationVO
_searchByDcIDPodIdClusterIdName.and("hostId", _searchByDcIDPodIdClusterIdName.entity().getHostId(), SearchCriteria.Op.NULL);
_searchByDcIDPodIdClusterIdName.and("name", _searchByDcIDPodIdClusterIdName.entity().getName(), SearchCriteria.Op.EQ);
_searchByDcIDPodIdClusterIdName.done();
_searchByDcIDPodIdClusterIdHostIdName = createSearchBuilder();
_searchByDcIDPodIdClusterIdHostIdName.and("dcId", _searchByDcIDPodIdClusterIdHostIdName.entity().getDataCenterId(), SearchCriteria.Op.EQ);
_searchByDcIDPodIdClusterIdHostIdName.and("podId", _searchByDcIDPodIdClusterIdHostIdName.entity().getPodId(), SearchCriteria.Op.EQ);
@ -80,7 +80,7 @@ public class MockConfigurationDaoImpl extends GenericDaoBase<MockConfigurationVO
}
@Override
public MockConfigurationVO findByCommand(Long dcId, Long podId, Long clusterId, Long hostId, String name) {
if (dcId == null) {
SearchCriteria<MockConfigurationVO> sc = _searchByGlobalName.create();
sc.setParameters("name", name);
@ -113,19 +113,19 @@ public class MockConfigurationDaoImpl extends GenericDaoBase<MockConfigurationVO
return findOneBy(sc);
}
}
@Override
public MockConfigurationVO findByNameBottomUP(Long dcId, Long podId, Long clusterId, Long hostId, String name) {
Transaction txn = Transaction.currentTxn();
StringBuilder search = new StringBuilder();
Formatter formatter = new Formatter(search);
formatter.format("select * from mockconfiguration where (name='%s') and ((data_center_id = %d and pod_id = %d and cluster_id = %d and host_id = %d)", name, dcId, podId, clusterId, hostId);
formatter.format(" or (data_center_id = %d and pod_id = %d and cluster_id = %d and host_id is null)", dcId, podId, clusterId);
formatter.format(" or (data_center_id = %d and pod_id = %d and cluster_id is null and host_id is null)", dcId, podId);
formatter.format(" or (data_center_id = %d and pod_id is null and cluster_id is null and host_id is null)", dcId);
formatter.format(" or (data_center_id is null and pod_id is null and cluster_id is null and host_id is null)) LIMIT 1");
PreparedStatement pstmt = null;
Transaction txn = Transaction.currentTxn();
StringBuilder search = new StringBuilder();
Formatter formatter = new Formatter(search);
formatter.format("select * from mockconfiguration where (name='%s') and ((data_center_id = %d and pod_id = %d and cluster_id = %d and host_id = %d)", name, dcId, podId, clusterId, hostId);
formatter.format(" or (data_center_id = %d and pod_id = %d and cluster_id = %d and host_id is null)", dcId, podId, clusterId);
formatter.format(" or (data_center_id = %d and pod_id = %d and cluster_id is null and host_id is null)", dcId, podId);
formatter.format(" or (data_center_id = %d and pod_id is null and cluster_id is null and host_id is null)", dcId);
formatter.format(" or (data_center_id is null and pod_id is null and cluster_id is null and host_id is null)) LIMIT 1");
PreparedStatement pstmt = null;
try {
String sql = search.toString();
pstmt = txn.prepareAutoCloseStatement(sql);
@ -134,9 +134,9 @@ public class MockConfigurationDaoImpl extends GenericDaoBase<MockConfigurationVO
return toEntityBean(rs, false);
}
} catch (Exception e) {
}
return null;
}
}
}

View File

@ -26,7 +26,7 @@ import com.cloud.utils.db.SearchCriteria;
@Local(value={MockHostDao.class})
public class MockHostDaoImpl extends GenericDaoBase<MockHostVO, Long> implements MockHostDao {
protected final SearchBuilder<MockHostVO> GuidSearch;
protected final SearchBuilder<MockHostVO> GuidSearch;
public MockHostDaoImpl() {
GuidSearch = createSearchBuilder();
GuidSearch.and("guid", GuidSearch.entity().getGuid(), SearchCriteria.Op.EQ);

View File

@ -25,14 +25,14 @@ import com.cloud.utils.db.SearchCriteria;
@Local(value={MockSecStorageDao.class})
public class MockSecStorageDaoImpl extends GenericDaoBase<MockSecStorageVO, Long> implements MockSecStorageDao {
protected final SearchBuilder<MockSecStorageVO> urlSearch;
protected final SearchBuilder<MockSecStorageVO> urlSearch;
@Override
public MockSecStorageVO findByUrl(String url) {
SearchCriteria<MockSecStorageVO> sc = urlSearch.create();
sc.setParameters("url", url);
return findOneBy(sc);
}
public MockSecStorageDaoImpl() {
urlSearch = createSearchBuilder();
urlSearch.and("url", urlSearch.entity().getUrl(), SearchCriteria.Op.EQ);

View File

@ -29,7 +29,7 @@ import com.cloud.utils.db.SearchCriteria;
@Local(value={MockSecurityRulesDao.class})
public class MockSecurityRulesDaoImpl extends GenericDaoBase<MockSecurityRulesVO, Long> implements MockSecurityRulesDao {
protected SearchBuilder<MockSecurityRulesVO> vmIdSearch;
protected SearchBuilder<MockSecurityRulesVO> hostSearch;
protected SearchBuilder<MockSecurityRulesVO> hostSearch;
@Override
public MockSecurityRulesVO findByVmId(Long vmId) {
SearchCriteria<MockSecurityRulesVO> sc = vmIdSearch.create();
@ -43,18 +43,18 @@ public class MockSecurityRulesDaoImpl extends GenericDaoBase<MockSecurityRulesVO
sc.setParameters("host", hostGuid);
return listBy(sc);
}
@Override
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
vmIdSearch = createSearchBuilder();
vmIdSearch.and("vmId", vmIdSearch.entity().getVmId(), SearchCriteria.Op.EQ);
vmIdSearch.done();
hostSearch = createSearchBuilder();
hostSearch.and("host", hostSearch.entity().getHostId(), SearchCriteria.Op.EQ);
hostSearch.done();
return true;
}
}

View File

@ -34,12 +34,12 @@ public class MockStoragePoolDaoImpl extends GenericDaoBase<MockStoragePoolVO, Lo
sc.setParameters("uuid", uuid);
return findOneBy(sc);
}
public MockStoragePoolDaoImpl() {
uuidSearch = createSearchBuilder();
uuidSearch.and("uuid", uuidSearch.entity().getUuid(), SearchCriteria.Op.EQ);
uuidSearch.done();
hostguidSearch = createSearchBuilder();
hostguidSearch.and("hostguid", hostguidSearch.entity().getHostGuid(), SearchCriteria.Op.EQ);
hostguidSearch.and("type", hostguidSearch.entity().getPoolType(), SearchCriteria.Op.EQ);

View File

@ -34,7 +34,7 @@ import com.cloud.vm.VirtualMachine;
@Local(value={MockVMDao.class})
public class MockVMDaoImpl extends GenericDaoBase<MockVMVO, Long> implements MockVMDao {
protected SearchBuilder<MockVMVO> GuidSearch;
protected SearchBuilder<MockVMVO> GuidSearch;
protected SearchBuilder<MockVMVO> vmNameSearch;
protected SearchBuilder<MockVMVO> vmhostSearch;
@Inject MockHostDao _mockHostDao;
@ -57,7 +57,7 @@ public class MockVMDaoImpl extends GenericDaoBase<MockVMVO, Long> implements Moc
sc.setParameters("state", VirtualMachine.State.Running);
return listBy(sc);
}
@Override
public MockVMVO findByVmNameAndHost(String vmName, String hostGuid) {
SearchCriteria<MockVMVO> sc = vmhostSearch.create();
@ -65,28 +65,28 @@ public class MockVMDaoImpl extends GenericDaoBase<MockVMVO, Long> implements Moc
sc.setParameters("name", vmName);
return findOneBy(sc);
}
@Override
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
SearchBuilder<MockHostVO> host = _mockHostDao.createSearchBuilder();
host.and("guid", host.entity().getGuid(), SearchCriteria.Op.EQ);
GuidSearch = createSearchBuilder();
GuidSearch.join("host", host, host.entity().getId(), GuidSearch.entity().getHostId(), JoinBuilder.JoinType.INNER);
GuidSearch.and("state", GuidSearch.entity().getState(), SearchCriteria.Op.EQ);
GuidSearch.done();
vmNameSearch = createSearchBuilder();
vmNameSearch.and("name", vmNameSearch.entity().getName(), SearchCriteria.Op.EQ);
vmNameSearch.done();
SearchBuilder<MockHostVO> newhost = _mockHostDao.createSearchBuilder();
newhost.and("guid", newhost.entity().getGuid(), SearchCriteria.Op.EQ);
vmhostSearch = createSearchBuilder();
vmhostSearch.and("name", vmhostSearch.entity().getName(), SearchCriteria.Op.EQ);
vmhostSearch.join("host", newhost, newhost.entity().getId(), vmhostSearch.entity().getHostId(), JoinBuilder.JoinType.INNER);
vmhostSearch.done();
return true;
}
}

View File

@ -42,11 +42,11 @@ public class MockVolumeDaoImpl extends GenericDaoBase<MockVolumeVO, Long> implem
sc.setParameters("type", type);
return listBy(sc);
}
@Override
public Long findTotalStorageId(long id) {
SearchCriteria<Long> sc = totalSearch.create();
sc.setParameters("poolId", id);
return customSearch(sc, null).get(0);
}
@ -57,20 +57,20 @@ public class MockVolumeDaoImpl extends GenericDaoBase<MockVolumeVO, Long> implem
sc.setParameters("path", "%" + path + "%");
return findOneBy(sc);
}
@Override
public MockVolumeVO findByNameAndPool(String volumeName, String poolUUID) {
SearchCriteria<MockVolumeVO> sc = namePoolSearch.create();
sc.setParameters("name", volumeName);
sc.setParameters("poolUuid", poolUUID);
return findOneBy(sc);
return findOneBy(sc);
}
@Override
public MockVolumeVO findByName(String volumeName) {
SearchCriteria<MockVolumeVO> sc = nameSearch.create();
sc.setParameters("name", volumeName);
return findOneBy(sc);
return findOneBy(sc);
}
public MockVolumeDaoImpl() {
@ -78,24 +78,24 @@ public class MockVolumeDaoImpl extends GenericDaoBase<MockVolumeVO, Long> implem
idTypeSearch.and("storageId", idTypeSearch.entity().getPoolId(), SearchCriteria.Op.EQ);
idTypeSearch.and("type", idTypeSearch.entity().getType(), SearchCriteria.Op.EQ);
idTypeSearch.done();
pathTypeSearch = createSearchBuilder();
pathTypeSearch.and("path", pathTypeSearch.entity().getPath(), SearchCriteria.Op.LIKE);
pathTypeSearch.done();
namePoolSearch = createSearchBuilder();
namePoolSearch.and("name", namePoolSearch.entity().getName(), SearchCriteria.Op.EQ);
namePoolSearch.and("poolUuid", namePoolSearch.entity().getPoolId(), SearchCriteria.Op.EQ);
namePoolSearch.done();
nameSearch = createSearchBuilder();
nameSearch.and("name", nameSearch.entity().getName(), SearchCriteria.Op.EQ);
nameSearch.done();
totalSearch = createSearchBuilder(Long.class);
totalSearch.select(null, Func.SUM, totalSearch.entity().getSize());
totalSearch.and("poolId", totalSearch.entity().getPoolId(), SearchCriteria.Op.EQ);
totalSearch.done();
}
}
}

View File

@ -4333,8 +4333,13 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
}
XsLocalNetwork storageNic1 = null;
storageNic1 = getNetworkByName(conn, _storageNetworkName1);
_host.storageNetwork1 = storageNic1.getNetworkRecord(conn).uuid;
_host.storagePif1 = storageNic1.getPifRecord(conn).uuid;
if (storageNic1 == null) {
s_logger.warn("Unable to find storage network " + _storageNetworkName1 + " for host " + _host.ip);
throw new IllegalArgumentException("Unable to find storage network " + _storageNetworkName1 + " for host " + _host.ip);
} else {
_host.storageNetwork1 = storageNic1.getNetworkRecord(conn).uuid;
_host.storagePif1 = storageNic1.getPifRecord(conn).uuid;
}
XsLocalNetwork storageNic2 = null;
if (_storageNetworkName2 != null) {

View File

@ -38,6 +38,7 @@
<module>hypervisors/ovm</module>
<module>hypervisors/xen</module>
<module>hypervisors/kvm</module>
<module>hypervisors/simulator</module>
<module>network-elements/elastic-loadbalancer</module>
<module>network-elements/ovs</module>
<module>network-elements/nicira-nvp</module>
@ -124,6 +125,17 @@
<module>hypervisors/vmware</module>
</modules>
</profile>
<profile>
<id>simulator</id>
<activation>
<property>
<name>simulator</name>
</property>
</activation>
<modules>
<module>hypervisors/simulator</module>
</modules>
</profile>
</profiles>
</project>

View File

@ -384,7 +384,5 @@
<module>vmware-base</module>
</modules>
</profile>
</profiles>
</project>

View File

@ -469,6 +469,10 @@ public class ApiDBUtils {
public static DomainVO findDomainByIdIncludingRemoved(Long domainId) {
return _domainDao.findByIdIncludingRemoved(domainId);
}
public static boolean isChildDomain(long parentId, long childId) {
return _domainDao.isChildDomain(parentId, childId);
}
public static DomainRouterVO findDomainRouterById(Long routerId) {
return _domainRouterDao.findByIdIncludingRemoved(routerId);

View File

@ -423,6 +423,7 @@ public class ApiResponseHelper implements ResponseGenerator {
@Override
public UserResponse createUserResponse(UserAccount user) {
Account account = UserContext.current().getCaller();
UserResponse userResponse = new UserResponse();
userResponse.setAccountName(user.getAccountName());
userResponse.setAccountType(user.getType());
@ -439,8 +440,8 @@ public class ApiResponseHelper implements ResponseGenerator {
userResponse.setApiKey(user.getApiKey());
userResponse.setSecretKey(user.getSecretKey());
userResponse.setAccountId((user.getAccountId()));
userResponse.setIsCallerChildDomain(ApiDBUtils.isChildDomain(account.getDomainId(), user.getDomainId()));
userResponse.setObjectName("user");
return userResponse;
}

View File

@ -1409,15 +1409,31 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
offeringId = _offering.getId();
}
PublicIp sourceNatIp = null;
if (publicNetwork) {
sourceNatIp = _networkMgr.assignSourceNatIpAddressToGuestNetwork(owner, guestNetwork);
}
// 3) deploy virtual router(s)
int count = routerCount - routers.size();
DeploymentPlan plan = planAndRouters.first();
for (int i = 0; i < count; i++) {
PublicIp sourceNatIp = null;
if (publicNetwork) {
int failCount = 0;
// Generate different MAC for VR
while (sourceNatIp == null) {
sourceNatIp = _networkMgr.assignSourceNatIpAddressToGuestNetwork(owner, guestNetwork);
NicVO nic = _nicDao.findByMacAddress(sourceNatIp.getMacAddress());
// We got duplicate MAC here, so regenerate the mac
if (nic != null) {
s_logger.debug("Failed to find a different mac for redundant router. Try again. The current mac is " + sourceNatIp.getMacAddress());
sourceNatIp = null;
failCount ++;
}
//Prevent infinite loop
if (failCount > 3) {
s_logger.error("Failed to find a different mac for redundant router! Abort operation!");
throw new InsufficientAddressCapacityException("Failed to find a different mac for redundant router", null, offeringId);
}
}
}
List<Pair<NetworkVO, NicProfile>> networks = createRouterNetworks(owner, isRedundant, plan, guestNetwork,
new Pair<Boolean, PublicIp>(publicNetwork, sourceNatIp));
//don't start the router as we are holding the network lock that needs to be released at the end of router allocation
@ -2674,6 +2690,12 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
}
}
//After start network, check if it's already running
router = _routerDao.findById(routerId);
if (router.getState() == State.Running) {
return router;
}
UserVO user = _userDao.findById(UserContext.current().getCallerUserId());
Map<Param, Object> params = new HashMap<Param, Object>();
if (reprogramNetwork) {

View File

@ -58,4 +58,6 @@ public interface NicDao extends GenericDao<NicVO, Long> {
NicVO findByNetworkIdInstanceIdAndBroadcastUri(long networkId, long instanceId, String broadcastUri);
NicVO findByIp4AddressAndNetworkIdAndInstanceId(long networkId, long instanceId, String ip4Address);
NicVO findByMacAddress(String macAddress);
}

View File

@ -50,6 +50,7 @@ public class NicDaoImpl extends GenericDaoBase<NicVO, Long> implements NicDao {
AllFieldsSearch.and("address", AllFieldsSearch.entity().getIp4Address(), Op.EQ);
AllFieldsSearch.and("isDefault", AllFieldsSearch.entity().isDefaultNic(), Op.EQ);
AllFieldsSearch.and("broadcastUri", AllFieldsSearch.entity().getBroadcastUri(), Op.EQ);
AllFieldsSearch.and("macAddress", AllFieldsSearch.entity().getMacAddress(), Op.EQ);
AllFieldsSearch.done();
IpSearch = createSearchBuilder(String.class);
@ -199,4 +200,11 @@ public class NicDaoImpl extends GenericDaoBase<NicVO, Long> implements NicDao {
sc.setParameters("address", ip4Address);
return findOneBy(sc);
}
@Override
public NicVO findByMacAddress(String macAddress) {
SearchCriteria<NicVO> sc = AllFieldsSearch.create();
sc.setParameters("macAddress", macAddress);
return findOneBy(sc);
}
}

View File

@ -14,6 +14,7 @@
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
use simulator;
DROP TABLE IF EXISTS `simulator`.`mockhost`;
DROP TABLE IF EXISTS `simulator`.`mocksecstorage`;
@ -76,6 +77,7 @@ CREATE TABLE `simulator`.`mockvm` (
`vnc_port` bigint unsigned,
`memory` bigint unsigned,
`cpu` bigint unsigned,
`bootargs` varchar(255),
PRIMARY KEY (`id`),
INDEX `i_mockvm__host_id`(`host_id`),
INDEX `i_mockvm__state`(`state`),

View File

@ -17,439 +17,6 @@
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, hypervisor_type)
VALUES (1, 'routing-1', 'SystemVM Template (XenServer)', 0, now(), 'SYSTEM', 0, 64, 1, 'http://nfs1.lab.vmops.com/templates/routing/debian/latest/systemvm.vhd.bz2', 'c33dfaf0937b35c25ef6a0fdd98f24d3', 0, 'SystemVM Template (XenServer)', 'VHD', 15, 0, 1, 'XenServer');
VALUES (10, 'simulator-domR', 'SystemVM Template (simulator)', 0, now(), 'SYSTEM', 0, 64, 1, 'http://nfs1.lab.vmops.com/templates/routing/debian/latest/systemvm.vhd.bz2', '', 0, 'SystemVM Template (simulator)', 'VHD', 15, 0, 1, 'Simulator');
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, hypervisor_type)
VALUES (2, 'centos53-x86_64', 'CentOS 5.3(64-bit) no GUI (XenServer)', 1, now(), 'BUILTIN', 0, 64, 1, 'http://nfs1.lab.vmops.com/templates/centos53-x86_64/latest/f59f18fb-ae94-4f97-afd2-f84755767aca.vhd.bz2', 'b63d854a9560c013142567bbae8d98cf', 0, 'CentOS 5.3(64-bit) no GUI (XenServer)', 'VHD', 11, 1, 1, 'XenServer');
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, hypervisor_type)
VALUES (3, 'routing-3', 'SystemVM Template (KVM)', 0, now(), 'SYSTEM', 0, 64, 1, 'http://nfs1.lab.vmops.com/templates/kvm/eec2209b-9875-3c8d-92be-c001bd8a0faf.qcow2.bz2', 'fe80a229e3bf38a702e836236ed07f57', 0, 'SystemVM Template (KVM)', 'QCOW2', 15, 0, 1, 'KVM');
INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, display_text, enable_password, format, guest_os_id, featured, cross_zones, hypervisor_type)
VALUES (4, 'centos55-x86_64', 'CentOS 5.5(64-bit) no GUI (KVM)', 1, now(), 'BUILTIN', 0, 64, 1, 'http://download.cloud.com/templates/builtin/eec2209b-9875-3c8d-92be-c001bd8a0faf.qcow2.bz2', '1da20ae69b54f761f3f733dce97adcc0', 'CentOS 5.5(64-bit) no GUI (KVM)', 0, 'QCOW2', 112, 1, 1, 'KVM');
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, hypervisor_type)
VALUES (7, 'centos53-x64', 'CentOS 5.3(64-bit) no GUI (vSphere)', 1, now(), 'BUILTIN', 0, 64, 1, 'http://download.cloud.com/releases/2.2.0/CentOS5.3-x86_64.ova', 'f6f881b7f2292948d8494db837fe0f47', 0, 'CentOS 5.3(64-bit) no GUI (vSphere)', 'OVA', 12, 1, 1, 'VMware');
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, hypervisor_type)
VALUES (8, 'routing-8', 'SystemVM Template (vSphere)', 0, now(), 'SYSTEM', 0, 32, 1, 'http://download.cloud.com/releases/2.2.0/systemvm.ova', 'ee3dc55e94e23a0490310bb78cf8cc76', 0, 'SystemVM Template (vSphere)', 'OVA', 15, 0, 1, 'VMware');
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, hypervisor_type)
VALUES (9, 'simulator-domR', 'SystemVM Template (simulator)', 0, now(), 'SYSTEM', 0, 64, 1, 'http://nfs1.lab.vmops.com/templates/routing/debian/latest/systemvm.vhd.bz2', '', 0, 'SystemVM Template (simulator)', 'VHD', 15, 0, 1, 'Simulator');
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, hypervisor_type)
VALUES (10, 'simulator-Centos', 'CentOS 5.3(64-bit) no GUI (Simulator)', 1, now(), 'BUILTIN', 0, 64, 1, 'http://nfs1.lab.vmops.com/templates/centos53-x86_64/latest/f59f18fb-ae94-4f97-afd2-f84755767aca.vhd.bz2', '', 0, 'CentOS 5.3(64-bit) no GUI (Simulator)', 'VHD', 11, 1, 1, 'Simulator');
INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (1, 'CentOS');
INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (2, 'Debian');
INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (3, 'Oracle');
INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (4, 'RedHat');
INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (5, 'SUSE');
INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (6, 'Windows');
INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (7, 'Other');
INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (8, 'Novel');
INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (9, 'Unix');
INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (10, 'Ubuntu');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (1, 1, 'CentOS 4.5 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (2, 1, 'CentOS 4.6 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (3, 1, 'CentOS 4.7 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (4, 1, 'CentOS 4.8 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (5, 1, 'CentOS 5.0 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (6, 1, 'CentOS 5.0 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (7, 1, 'CentOS 5.1 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (8, 1, 'CentOS 5.1 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (9, 1, 'CentOS 5.2 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (10, 1, 'CentOS 5.2 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (11, 1, 'CentOS 5.3 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (12, 1, 'CentOS 5.3 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (13, 1, 'CentOS 5.4 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (14, 1, 'CentOS 5.4 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (15, 2, 'Debian GNU/Linux 5.0 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (16, 3, 'Oracle Enterprise Linux 5.0 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (17, 3, 'Oracle Enterprise Linux 5.0 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (18, 3, 'Oracle Enterprise Linux 5.1 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (19, 3, 'Oracle Enterprise Linux 5.1 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (20, 3, 'Oracle Enterprise Linux 5.2 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (21, 3, 'Oracle Enterprise Linux 5.2 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (22, 3, 'Oracle Enterprise Linux 5.3 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (23, 3, 'Oracle Enterprise Linux 5.3 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (24, 3, 'Oracle Enterprise Linux 5.4 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (25, 3, 'Oracle Enterprise Linux 5.4 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (26, 4, 'Red Hat Enterprise Linux 4.5 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (27, 4, 'Red Hat Enterprise Linux 4.6 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (28, 4, 'Red Hat Enterprise Linux 4.7 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (29, 4, 'Red Hat Enterprise Linux 4.8 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (30, 4, 'Red Hat Enterprise Linux 5.0 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (31, 4, 'Red Hat Enterprise Linux 5.0 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (32, 4, 'Red Hat Enterprise Linux 5.1 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (33, 4, 'Red Hat Enterprise Linux 5.1 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (34, 4, 'Red Hat Enterprise Linux 5.2 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (35, 4, 'Red Hat Enterprise Linux 5.2 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (36, 4, 'Red Hat Enterprise Linux 5.3 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (37, 4, 'Red Hat Enterprise Linux 5.3 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (38, 4, 'Red Hat Enterprise Linux 5.4 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (39, 4, 'Red Hat Enterprise Linux 5.4 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (40, 5, 'SUSE Linux Enterprise Server 9 SP4 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (41, 5, 'SUSE Linux Enterprise Server 10 SP1 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (42, 5, 'SUSE Linux Enterprise Server 10 SP1 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (43, 5, 'SUSE Linux Enterprise Server 10 SP2 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (44, 5, 'SUSE Linux Enterprise Server 10 SP2 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (45, 5, 'SUSE Linux Enterprise Server 10 SP3 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (46, 5, 'SUSE Linux Enterprise Server 11 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (47, 5, 'SUSE Linux Enterprise Server 11 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (48, 6, 'Windows 7 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (49, 6, 'Windows 7 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (50, 6, 'Windows Server 2003 Enterprise Edition(32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (51, 6, 'Windows Server 2003 Enterprise Edition(64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (52, 6, 'Windows Server 2008 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (53, 6, 'Windows Server 2008 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (54, 6, 'Windows Server 2008 R2 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (55, 6, 'Windows 2000 Server SP4 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (56, 6, 'Windows Vista (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (57, 6, 'Windows XP SP2 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (58, 6, 'Windows XP SP3 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (59, 10, 'Other Ubuntu (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (60, 7, 'Other (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (61, 6, 'Windows 2000 Server');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (62, 6, 'Windows 98');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (63, 6, 'Windows 95');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (64, 6, 'Windows NT 4');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (65, 6, 'Windows 3.1');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (66, 4, 'Red Hat Enterprise Linux 3(32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (67, 4, 'Red Hat Enterprise Linux 3(64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (68, 7, 'Open Enterprise Server');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (69, 7, 'Asianux 3(32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (70, 7, 'Asianux 3(64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (72, 2, 'Debian GNU/Linux 5(64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (73, 2, 'Debian GNU/Linux 4(32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (74, 2, 'Debian GNU/Linux 4(64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (75, 7, 'Other 2.6x Linux (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (76, 7, 'Other 2.6x Linux (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (77, 8, 'Novell Netware 6.x');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (78, 8, 'Novell Netware 5.1');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (79, 9, 'Sun Solaris 10(32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (80, 9, 'Sun Solaris 10(64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (81, 9, 'Sun Solaris 9(Experimental)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (82, 9, 'Sun Solaris 8(Experimental)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (83, 9, 'FreeBSD (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (84, 9, 'FreeBSD (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (85, 9, 'SCO OpenServer 5');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (86, 9, 'SCO UnixWare 7');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (87, 6, 'Windows Server 2003 DataCenter Edition(32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (88, 6, 'Windows Server 2003 DataCenter Edition(64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (89, 6, 'Windows Server 2003 Standard Edition(32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (90, 6, 'Windows Server 2003 Standard Edition(64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (91, 6, 'Windows Server 2003 Web Edition');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (92, 6, 'Microsoft Small Bussiness Server 2003');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (93, 6, 'Windows XP (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (94, 6, 'Windows XP (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (95, 6, 'Windows 2000 Advanced Server');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (96, 5, 'SUSE Linux Enterprise 8(32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (97, 5, 'SUSE Linux Enterprise 8(64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (98, 7, 'Other Linux (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (99, 7, 'Other Linux (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (100, 10, 'Other Ubuntu (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (101, 6, 'Windows Vista (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (102, 6, 'DOS');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (103, 7, 'Other (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (104, 7, 'OS/2');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (105, 6, 'Windows 2000 Professional');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (106, 4, 'Red Hat Enterprise Linux 4(64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (107, 5, 'SUSE Linux Enterprise 9(32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (108, 5, 'SUSE Linux Enterprise 9(64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (109, 5, 'SUSE Linux Enterprise 10(32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (110, 5, 'SUSE Linux Enterprise 10(64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (111, 1, 'CentOS 5.5 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (112, 1, 'CentOS 5.5 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (113, 4, 'Red Hat Enterprise Linux 5.5 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (114, 4, 'Red Hat Enterprise Linux 5.5 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (115, 4, 'Fedora 13');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (116, 4, 'Fedora 12');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (117, 4, 'Fedora 11');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (118, 4, 'Fedora 10');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (119, 4, 'Fedora 9');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (120, 4, 'Fedora 8');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (121, 10, 'Ubuntu 10.04 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (122, 10, 'Ubuntu 9.10 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (123, 10, 'Ubuntu 9.04 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (124, 10, 'Ubuntu 8.10 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (125, 10, 'Ubuntu 8.04 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (126, 10, 'Ubuntu 10.04 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (127, 10, 'Ubuntu 9.10 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (128, 10, 'Ubuntu 9.04 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (129, 10, 'Ubuntu 8.10 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (130, 10, 'Ubuntu 8.04 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (131, 4, 'Red Hat Enterprise Linux 2');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (132, 2, 'Debian GNU/Linux 6(32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (133, 2, 'Debian GNU/Linux 6(64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (134, 3, 'Oracle Enterprise Linux 5.5 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (135, 3, 'Oracle Enterprise Linux 5.5 (64-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (136, 4, 'Red Hat Enterprise Linux 6.0 (32-bit)');
INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (137, 4, 'Red Hat Enterprise Linux 6.0 (64-bit)');
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'CentOS 4.5 (32-bit)', 1);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'CentOS 4.6 (32-bit)', 2);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'CentOS 4.7 (32-bit)', 3);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'CentOS 4.8 (32-bit)', 4);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'CentOS 5.0 (32-bit)', 5);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'CentOS 5.0 (64-bit)', 6);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'CentOS 5.1 (32-bit)', 7);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'CentOS 5.1 (32-bit)', 8);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'CentOS 5.2 (32-bit)', 9);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'CentOS 5.2 (64-bit)', 10);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'CentOS 5.3 (32-bit)', 11);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'CentOS 5.3 (64-bit)', 12);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'CentOS 5.4 (32-bit)', 13);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'CentOS 5.4 (64-bit)', 14);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Debian Lenny 5.0 (32-bit)', 15);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Oracle Enterprise Linux 5.0 (32-bit)', 16);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Oracle Enterprise Linux 5.0 (64-bit)', 17);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Oracle Enterprise Linux 5.1 (32-bit)', 18);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Oracle Enterprise Linux 5.1 (64-bit)', 19);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Oracle Enterprise Linux 5.2 (32-bit)', 20);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Oracle Enterprise Linux 5.2 (64-bit)', 21);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Oracle Enterprise Linux 5.3 (32-bit)', 22);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Oracle Enterprise Linux 5.3 (64-bit)', 23);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Oracle Enterprise Linux 5.4 (32-bit)', 24);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Oracle Enterprise Linux 5.4 (64-bit)', 25);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Red Hat Enterprise Linux 4.5 (32-bit)', 26);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Red Hat Enterprise Linux 4.6 (32-bit)', 27);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Red Hat Enterprise Linux 4.7 (32-bit)', 28);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Red Hat Enterprise Linux 4.8 (32-bit)', 29);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Red Hat Enterprise Linux 5.0 (32-bit)', 30);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Red Hat Enterprise Linux 5.0 (64-bit)', 31);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Red Hat Enterprise Linux 5.1 (32-bit)', 32);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Red Hat Enterprise Linux 5.1 (64-bit)', 33);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Red Hat Enterprise Linux 5.2 (32-bit)', 34);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Red Hat Enterprise Linux 5.2 (64-bit)', 35);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Red Hat Enterprise Linux 5.3 (32-bit)', 36);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Red Hat Enterprise Linux 5.3 (64-bit)', 37);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Red Hat Enterprise Linux 5.4 (32-bit)', 38);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Red Hat Enterprise Linux 5.4 (64-bit)', 39);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'SUSE Linux Enterprise Server 9 SP4 (32-bit)', 40);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'SUSE Linux Enterprise Server 10 SP1 (32-bit)', 41);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'SUSE Linux Enterprise Server 10 SP1 (64-bit)', 42);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'SUSE Linux Enterprise Server 10 SP2 (32-bit)', 43);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'SUSE Linux Enterprise Server 10 SP2 (64-bit)', 44);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'SUSE Linux Enterprise Server 10 SP3 (64-bit)', 45);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'SUSE Linux Enterprise Server 11 (32-bit)', 46);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'SUSE Linux Enterprise Server 11 (64-bit)', 47);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Windows 7 (32-bit)', 48);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Windows 7 (64-bit)', 49);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Windows Server 2003 (32-bit)', 50);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Windows Server 2003 (64-bit)', 51);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Windows Server 2008 (32-bit)', 52);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Windows Server 2008 (64-bit)', 53);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Windows Server 2008 R2 (64-bit)', 54);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Windows 2000 SP4 (32-bit)', 55);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Windows Vista (32-bit)', 56);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Windows XP SP2 (32-bit)', 57);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Windows XP SP3 (32-bit)', 58);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Other install media', 59);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Other install media', 100);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Other install media', 60);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Other install media', 103);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('XenServer', 'Other install media', 121);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('XenServer', 'Other install media', 126);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('XenServer', 'Other install media', 122);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('XenServer', 'Other install media', 127);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('XenServer', 'Other install media', 123);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('XenServer', 'Other install media', 128);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('XenServer', 'Other install media', 124);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('XenServer', 'Other install media', 129);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('XenServer', 'Other install media', 125);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('XenServer', 'Other install media', 130);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Microsoft Windows 7(32-bit)', 48);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Microsoft Windows 7(64-bit)', 49);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Microsoft Windows Server 2008 R2(64-bit)', 54);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Microsoft Windows Server 2008(32-bit)', 52);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Microsoft Windows Server 2008(64-bit)', 53);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Microsoft Windows Server 2003, Enterprise Edition (32-bit)', 50);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Microsoft Windows Server 2003, Enterprise Edition (64-bit)', 51);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Microsoft Windows Server 2003, Datacenter Edition (32-bit)', 87);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Microsoft Windows Server 2003, Datacenter Edition (64-bit)', 88);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Microsoft Windows Server 2003, Standard Edition (32-bit)', 89);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Microsoft Windows Server 2003, Standard Edition (64-bit)', 90);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Microsoft Windows Server 2003, Web Edition', 91);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Microsoft Small Bussiness Server 2003', 92);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Microsoft Windows Vista (32-bit)', 56);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Microsoft Windows Vista (64-bit)', 101);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Microsoft Windows XP Professional (32-bit)', 93);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Microsoft Windows XP Professional (32-bit)', 57);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Microsoft Windows XP Professional (32-bit)', 58);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Microsoft Windows XP Professional (64-bit)', 94);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Microsoft Windows 2000 Advanced Server', 95);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Microsoft Windows 2000 Server', 61);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Microsoft Windows 2000 Professional', 105);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Microsoft Windows 2000 Server', 55);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Microsoft Windows 98', 62);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Microsoft Windows 95', 63);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Microsoft Windows NT 4', 64);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Microsoft Windows 3.1', 65);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Red Hat Enterprise Linux 5(32-bit)', 30);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Red Hat Enterprise Linux 5(32-bit)', 32);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Red Hat Enterprise Linux 5(32-bit)', 34);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Red Hat Enterprise Linux 5(32-bit)', 36);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Red Hat Enterprise Linux 5(32-bit)', 38);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Red Hat Enterprise Linux 5(64-bit)', 31);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Red Hat Enterprise Linux 5(64-bit)', 33);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Red Hat Enterprise Linux 5(64-bit)', 35);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Red Hat Enterprise Linux 5(64-bit)', 37);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Red Hat Enterprise Linux 5(64-bit)', 39);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Red Hat Enterprise Linux 4(32-bit)', 26);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Red Hat Enterprise Linux 4(32-bit)', 27);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Red Hat Enterprise Linux 4(32-bit)', 28);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Red Hat Enterprise Linux 4(32-bit)', 29);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Red Hat Enterprise Linux 4(64-bit)', 106);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Red Hat Enterprise Linux 3(32-bit)', 66);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Red Hat Enterprise Linux 3(64-bit)', 67);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Red Hat Enterprise Linux 2', 131);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Suse Linux Enterprise 11(32-bit)', 46);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Suse Linux Enterprise 11(64-bit)', 47);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Suse Linux Enterprise 10(32-bit)', 41);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Suse Linux Enterprise 10(32-bit)', 43);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Suse Linux Enterprise 10(64-bit)', 42);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Suse Linux Enterprise 10(64-bit)', 44);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Suse Linux Enterprise 10(64-bit)', 45);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Suse Linux Enterprise 10(32-bit)', 109);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Suse Linux Enterprise 10(64-bit)', 110);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Suse Linux Enterprise 8/9(32-bit)', 40);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Suse Linux Enterprise 8/9(32-bit)', 96);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Suse Linux Enterprise 8/9(64-bit)', 97);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Suse Linux Enterprise 8/9(32-bit)', 107);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Suse Linux Enterprise 8/9(64-bit)', 108);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Open Enterprise Server', 68);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Asianux 3(32-bit)', 69);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Asianux 3(64-bit)', 70);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Debian GNU/Linux 5(32-bit)', 15);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Debian GNU/Linux 5(64-bit)', 72);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Debian GNU/Linux 4(32-bit)', 73);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Debian GNU/Linux 4(64-bit)', 74);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Ubuntu Linux (32-bit)', 59);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Ubuntu Linux (32-bit)', 121);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Ubuntu Linux (32-bit)', 122);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Ubuntu Linux (32-bit)', 123);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Ubuntu Linux (32-bit)', 124);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Ubuntu Linux (32-bit)', 125);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Ubuntu Linux (64-bit)', 100);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Ubuntu Linux (64-bit)', 126);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Ubuntu Linux (64-bit)', 127);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Ubuntu Linux (64-bit)', 128);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Ubuntu Linux (64-bit)', 129);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Ubuntu Linux (64-bit)', 130);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Other 2.6x Linux (32-bit)', 75);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Other 2.6x Linux (64-bit)', 76);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Other Linux (32-bit)', 98);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Other Linux (64-bit)', 99);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Novell Netware 6.x', 77);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Novell Netware 5.1', 78);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Sun Solaris 10(32-bit)', 79);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Sun Solaris 10(64-bit)', 80);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Sun Solaris 9(Experimental)', 81);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Sun Solaris 8(Experimental)', 82);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'FreeBSD (32-bit)', 83);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'FreeBSD (64-bit)', 84);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'OS/2', 104);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'SCO OpenServer 5', 85);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'SCO UnixWare 7', 86);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'DOS', 102);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Other (32-bit)', 60);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Other (64-bit)', 103);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'CentOS 4.5', 1);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'CentOS 4.6', 2);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'CentOS 4.7', 3);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'CentOS 4.8', 4);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'CentOS 5.0', 5);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'CentOS 5.0', 6);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'CentOS 5.1', 7);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'CentOS 5.1', 8);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'CentOS 5.2', 9);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'CentOS 5.2', 10);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'CentOS 5.3', 11);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'CentOS 5.3', 12);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'CentOS 5.4', 13);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'CentOS 5.4', 14);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'CentOS 5.5', 111);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'CentOS 5.5', 112);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Red Hat Enterprise Linux 4.5', 26);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Red Hat Enterprise Linux 4.6', 27);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Red Hat Enterprise Linux 4.7', 28);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Red Hat Enterprise Linux 4.8', 29);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Red Hat Enterprise Linux 5.0', 30);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Red Hat Enterprise Linux 5.0', 31);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Red Hat Enterprise Linux 5.1', 32);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Red Hat Enterprise Linux 5.1', 33);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Red Hat Enterprise Linux 5.2', 34);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Red Hat Enterprise Linux 5.2', 35);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Red Hat Enterprise Linux 5.3', 36);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Red Hat Enterprise Linux 5.3', 37);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Red Hat Enterprise Linux 5.4', 38);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Red Hat Enterprise Linux 5.4', 39);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Red Hat Enterprise Linux 5.5', 113);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Red Hat Enterprise Linux 5.5', 114);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Red Hat Enterprise Linux 4', 106);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Red Hat Enterprise Linux 3', 66);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Red Hat Enterprise Linux 3', 67);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Red Hat Enterprise Linux 2', 131);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Fedora 13', 115);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Fedora 12', 116);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Fedora 11', 117);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Fedora 10', 118);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Fedora 9', 119);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Fedora 8', 120);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Ubuntu 10.04', 121);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Ubuntu 10.04', 126);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Ubuntu 9.10', 122);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Ubuntu 9.10', 127);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Ubuntu 9.04', 123);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Ubuntu 9.04', 128);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Ubuntu 8.10', 124);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Ubuntu 8.10', 129);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Ubuntu 8.04', 125);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Ubuntu 8.04', 130);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Debian GNU/Linux 5', 15);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Debian GNU/Linux 5', 72);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Debian GNU/Linux 4', 73);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Debian GNU/Linux 4', 74);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Other Linux 2.6x', 75);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Other Linux 2.6x', 76);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Other Ubuntu', 59);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Other Ubuntu', 100);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Other Linux', 98);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Other Linux', 99);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Windows 7', 48);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Windows 7', 49);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Windows Server 2003', 50);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Windows Server 2003', 51);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Windows Server 2003', 87);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Windows Server 2003', 88);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Windows Server 2003', 89);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Windows Server 2003', 90);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Windows Server 2003', 91);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Windows Server 2003', 92);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Windows Server 2008', 52);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Windows Server 2008', 53);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Windows 2000', 55);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Windows 2000', 61);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Windows 2000', 95);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Windows 98', 62);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Windows Vista', 56);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Windows Vista', 101);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Windows XP SP2', 57);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Windows XP SP3', 58);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Windows XP ', 93);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Windows XP ', 94);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'DOS', 102);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Other', 60);
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Other', 103);
VALUES (11, 'simulator-Centos', 'CentOS 5.3(64-bit) no GUI (Simulator)', 1, now(), 'BUILTIN', 0, 64, 1, 'http://nfs1.lab.vmops.com/templates/centos53-x86_64/latest/f59f18fb-ae94-4f97-afd2-f84755767aca.vhd.bz2', '', 0, 'CentOS 5.3(64-bit) no GUI (Simulator)', 'VHD', 11, 1, 1, 'Simulator');

View File

@ -26,7 +26,6 @@ try:
import logging
import os
import pdb
import sets
import shlex
import sys
import time
@ -332,8 +331,8 @@ class CloudMonkeyShell(cmd.Cmd, object):
setattr(api_cmd, attribute, args_dict[attribute])
command = api_cmd()
missing_args = list(sets.Set(command.required).difference(
sets.Set(args_dict.keys())))
missing_args = filter(lambda x: x not in args_dict.keys(),
command.required)
if len(missing_args) > 0:
self.print_shell("Missing arguments:", ' '.join(missing_args))

View File

@ -121,7 +121,7 @@ def getResultObj(returnObj, responsecls=None):
if len(returnObj) == 0:
return None
responseName = returnObj.keys()[0]
responseName = filter(lambda a: a!=u'cloudstack-version', returnObj.keys())[0]
response = returnObj[responseName]
if len(response) == 0:

View File

@ -148,10 +148,6 @@
"name": "workers",
"value": "10"
},
{
"name": "use.user.concentrated.pod.allocation",
"value": "false"
},
{
"name": "account.cleanup.interval",
"value": "600"

View File

@ -441,13 +441,20 @@ body.login {
div.list-view table tbody td span {
display: block;
float: left;
max-width: 210px;
max-width: 160px;
word-wrap: break-word;
text-indent: 0;
margin-left: 12px;
line-height: 15px;
overflow: auto;
overflow: hidden;
overflow-x: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
div.list-view table tbody td span:hover {
overflow: auto;
margin-top: 4px;
}
div.list-view div.toolbar div.section-switcher div.section-select label {
@ -3427,7 +3434,6 @@ Dialogs*/
display: inline;
padding: 0;
float: right;
text-decoration: underline;
color: #516374;
/*+text-shadow:0px -1px 1px #FFFFFF;*/
-moz-text-shadow: 0px -1px 1px #FFFFFF;
@ -3524,6 +3530,11 @@ Dialogs*/
-webkit-text-shadow: 0px -1px 1px #495968;
-o-text-shadow: 0px -1px 1px #495968;
text-shadow: 0px -1px 1px #495968;
background: url(../images/icons.png) no-repeat 0px -255px;
}
.notice .ui-dialog-title {
background-position: 0px -288px;
}
.ui-dialog.confirm .ui-dialog-title {
@ -7466,11 +7477,12 @@ div.ui-dialog div.multi-edit-add-list div.view div.data-table table.body tbody t
}
.multi-edit .data .data-body .data-item > table tbody tr td span {
overflow-x: auto;
overflow-y: hidden;
max-width: 88px;
overflow: hidden;
max-width: 78px;
display: block;
float: left;
text-overflow: ellipsis;
white-space: nowrap;
}
.multi-edit .data .data-body .data-item table tbody tr td.blank {
@ -8790,6 +8802,7 @@ div.ui-dialog div.multi-edit-add-list div.view div.data-table table.body tbody t
.project-selector .listing .data ul li {
padding: 10px 0 10px 7px;
cursor: pointer;
font-size: 12px;
}
.project-selector .listing .data ul li.odd {
@ -8813,8 +8826,8 @@ div.ui-dialog div.multi-edit-add-list div.view div.data-table table.body tbody t
text-shadow: 0px 1px 1px #FFFFFF;
text-align: left;
color: #4F6171;
font-size: 12px;
padding: 2px 2px 3px 7px;
font-size: 11px;
padding: 3px 2px 3px 7px;
border-bottom: 1px solid #FFFFFF;
position: absolute;
left: 0;
@ -8827,17 +8840,14 @@ div.ui-dialog div.multi-edit-add-list div.view div.data-table table.body tbody t
border-radius: 4px 4px 4px 4px;
font-size: 13px;
font-weight: bold;
padding: 8px 20px;
float: none;
cursor: pointer;
color: #838181;
/*+placement:shift 488px 9px;*/
position: relative;
left: 488px;
top: 9px;
left: 170px;
top: -8px;
margin: 19px 0 0 0px;
width: 54px;
margin: auto auto 17px;
}
.project-selector .button.cancel:hover {
@ -9202,9 +9212,9 @@ div.ui-dialog div.multi-edit-add-list div.view div.data-table table.body tbody t
}
.info-boxes .info-box ul li .date {
font-size: 13px;
font-size: 11px;
text-align: center;
margin: 0;
margin: 1px 0 0;
}
.info-boxes .info-box ul li .date span {
@ -9223,7 +9233,10 @@ div.ui-dialog div.multi-edit-add-list div.view div.data-table table.body tbody t
top: 8px;
display: inline-block;
padding-bottom: 13px;
max-width: 171px;
max-width: 153px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.info-boxes .info-box ul li .total span {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View File

@ -1248,22 +1248,20 @@
if (jsonObj.state == 'Destroyed') return [];
if(isAdmin()) {
allowedActions.push("edit"); //updating networkdomain is allowed on any account, including system-generated default admin account
if(!(jsonObj.domain == "ROOT" && jsonObj.name == "admin" && jsonObj.accounttype == 1)) { //if not system-generated default admin account
if(jsonObj.state == "enabled") {
allowedActions.push("disable");
allowedActions.push("lock");
allowedActions.push("edit"); //updating networkdomain is allowed on any account, including system-generated default admin account
if(!(jsonObj.domain == "ROOT" && jsonObj.name == "admin" && jsonObj.accounttype == 1)) { //if not system-generated default admin account
if(jsonObj.state == "enabled") {
allowedActions.push("disable");
allowedActions.push("lock");
} else if(jsonObj.state == "disabled" || jsonObj.state == "locked") {
allowedActions.push("enable");
}
allowedActions.push("remove");
}
else if(jsonObj.state == "disabled" || jsonObj.state == "locked") {
allowedActions.push("enable");
}
allowedActions.push("remove");
}
allowedActions.push("updateResourceCount");
}
else if(isDomainAdmin()) {
allowedActions.push("updateResourceCount");
}
allowedActions.push("updateResourceCount");
} else if(isDomainAdmin()) {
allowedActions.push("updateResourceCount");
}
return allowedActions;
}
@ -1281,6 +1279,10 @@
allowedActions.push("enable");
allowedActions.push("remove");
}
} else {
if(isSelfOrChildDomainUser(jsonObj.username, jsonObj.accounttype, jsonObj.domainid, jsonObj.iscallerchilddomain)) {
allowedActions.push("changePassword");
}
}
return allowedActions;
}

View File

@ -158,6 +158,22 @@ function isUser() {
return (g_role == 0);
}
function isSelfOrChildDomainUser(username, useraccounttype, userdomainid, iscallerchilddomain) {
if(username == g_username) { //is self
return true;
} else if(isDomainAdmin()
&& iscallerchilddomain
&& (useraccounttype == 0)) { //domain admin to user
return true;
} else if(isDomainAdmin()
&& iscallerchilddomain
&& (userdomainid != g_domainid) ) { //domain admin to subdomain admin and user
return true;
} else {
return false;
}
}
// FUNCTION: Handles AJAX error callbacks. You can pass in an optional function to
// handle errors that are not already handled by this method.
function handleError(XMLHttpResponse, handleErrorCallback) {

View File

@ -914,6 +914,8 @@
$('<span></span>').html(_s(content))
);
}
$td.attr('title', _s(content));
});
$tr.find('td:first').addClass('first');

View File

@ -57,3 +57,14 @@ db.usage.autoReconnect=true
# awsapi database settings
db.awsapi.name=cloudbridge
# Simulator database settings
db.simulator.username=cloud
db.simulator.password=cloud
db.simulator.host=localhost
db.simulator.port=3306
db.simulator.name=simulator
db.simulator.maxActive=250
db.simulator.maxIdle=30
db.simulator.maxWait=10000
db.simulator.autoReconnect=true