diff --git a/HACKING b/HACKING
index 140ae446134..990e6898c4f 100644
--- a/HACKING
+++ b/HACKING
@@ -1,49 +1,24 @@
---------------------------------------------------------------------
-THE QUICK GUIDE TO CLOUDSTACK DEVELOPMENT
+QUICK GUIDE TO DEVELOPING, BUILDING AND INSTALLING FROM SOURCE
---------------------------------------------------------------------
-=== Overview of the development lifecycle ===
-
-To hack on a CloudStack component, you will generally:
-
-1. Configure the source code:
- ./waf configure --prefix=/home/youruser/cloudstack
- (see below, "./waf configure")
-
-2. Build and install the CloudStack
- ./waf install
- (see below, "./waf install")
-
-3. Set the CloudStack component up
- (see below, "Running the CloudStack components from source")
-
-4. Run the CloudStack component
- (see below, "Running the CloudStack components from source")
-
-5. Modify the source code
-
-6. Build and install the CloudStack again
- ./waf install --preserve-config
- (see below, "./waf install")
-
-7. GOTO 4
-
-
-=== What is this waf thing in my development lifecycle? ===
-
-waf is a self-contained, advanced build system written by Thomas Nagy,
-in the spirit of SCons or the GNU autotools suite.
-
-* To run waf on Linux / Mac: ./waf [...commands...]
-* To run waf on Windows: waf.bat [...commands...]
+It all starts with waf.
./waf --help should be your first discovery point to find out both the
configure-time options and the different processes that you can run
-using waf.
+using waf. Your second discovery point should be the files:
+1. wscript: contains the processes you can run when invoking waf
+2. wscript_build: contains a manifest of *what* is built and installed
-=== What do the different waf commands above do? ===
+Your normal development process should be:
+
+1. ./waf configure --prefix=/some/path, ONCE
+2. ./waf, then hack, then ./waf, then hack, then ./waf
+3. ./waf install, then hack, then ./waf install
+
+In detail:
1. ./waf configure --prefix=/some/path
@@ -54,10 +29,15 @@ using waf.
variables and options that waf will use for compilation and
installation, including the installation directory (PREFIX).
+ If you have already configured your source, and you are reconfiguring
+ it, then you *must* run ./waf clean so the source files are rebuilt
+ with the proper variables. Otherwise, ./waf install will install
+ stale files.
+
For convenience reasons, if you forget to run configure, waf
will proceed with some default configuration options. By
default, PREFIX is /usr/local, but you can set it e.g. to
- /home/youruser/cloudstack if you plan to do a non-root
+ /home/yourusername/cloudstack if you plan to do a non-root
install. Be ware that you can later install the stack as a
regular user, but most components need to *run* as root.
@@ -130,64 +110,65 @@ using waf.
=== Running the CloudStack components from source (for debugging / coding) ===
It is not technically possible to run the CloudStack components from
-the source. That, however, is fine -- each component can be run
-independently from the install directory:
+the source. That, however, is fine -- you do not have to stop and start
+the services each time you run ./waf install. Each component can be run
+independently:
- Management Server
- 1) Execute ./waf install as your current user (or as root if the
+ Execute ./waf install as your current user (or as root if the
installation path is only writable by root).
- WARNING: if any CloudStack configuration files have been
- already configured / altered, they will be *overwritten* by this
- process. Append --preserve-config to ./waf install to prevent this
- from happening. Or resort to the override method discussed
- above (search for "override" in this document).
-
- 2) If you haven't done so yet, set up the management server database:
-
- - either run ./waf deploydb_kvm, or
- - run $BINDIR/cloud-setup-databases
-
- 3) Execute ./waf run as your current user (or as root if the
+ Then execute ./waf run as your current user (or as root if the
installation path is only writable by root). Alternatively,
you can use ./waf debug and this will run with debugging enabled.
+ This will compile the stack, reinstall it, then run the Management
+ Server in the installed environment, as your current user, in
+ the foreground.
-- Agent (Linux-only):
-
- 1) Execute ./waf install as your current user (or as root if the
- installation path is only writable by root).
+ NOTE: if you have not yet deployed a database to the local MySQL
+ server, you should ./waf deploydb_kvm once so the database is
+ deployed. Failure to do that will cause the Management Server
+ to fail on startup.
WARNING: if any CloudStack configuration files have been
already configured / altered, they will be *overwritten* by this
process. Append --preserve-config to ./waf install to prevent this
from happening. Or resort to the override method discussed
above (search for "override" in this document).
-
- 2) If you haven't done so yet, set the Console Proxy up:
-
- - run $BINDIR/cloud-setup-agent
-
- 3) Execute $LIBEXECDIR/agent-runner as root
+- Agent:
-- Console Proxy (Linux-only):
-
- 1) Execute ./waf install as your current user (or as root if the
+ Execute ./waf install as your current user (or as root if the
installation path is only writable by root).
+ Then execute $LIBEXECDIR/agent-runner as root
+
+ These steps, will compile, reinstall and run the Agent in the
+ foreground. You must run this runner as root.
+
WARNING: if any CloudStack configuration files have been
already configured / altered, they will be *overwritten* by this
process. Append --preserve-config to ./waf install to prevent this
from happening. Or resort to the override method discussed
above (search for "override" in this document).
-
- 2) If you haven't done so yet, set the Console Proxy up:
- - run $BINDIR/cloud-setup-console-proxy
+- Console Proxy:
- 3) Execute $LIBEXECDIR/console-proxy-runner as root
+ Execute ./waf install as your current user (or as root if the
+ installation path is only writable by root).
+
+ Then execute $LIBEXECDIR/console-proxy-runner as root
+
+ These steps, will compile, reinstall and run the Console Proxy in the
+ foreground. You must run this runner as root.
+
+ WARNING: if any CloudStack configuration files have been
+ already configured / altered, they will be *overwritten* by this
+ process. Append --preserve-config to ./waf install to prevent this
+ from happening. Or resort to the override method discussed
+ above (search for "override" in this document).
---------------------------------------------------------------------
@@ -219,17 +200,6 @@ other later-generation build systems:
language is available to use in the build process.
-=== Hacking on the build system: what are these wscript files? ===
-
-1. wscript: contains most commands you can run from within waf
-2. wscript_configure: contains the process that discovers the software
- on the system and configures the build to fit that
-2. wscript_build: contains a manifest of *what* is built and installed
-
-Refer to the waf book for general information on waf:
- http://freehackers.org/~tnagy/wafbook/index.html
-
-
=== What happens when waf runs ===
When you run waf, this happens behind the scenes:
diff --git a/agent/.classpath b/agent/.classpath
index f36c50ee1f6..109ab5e2e8c 100644
--- a/agent/.classpath
+++ b/agent/.classpath
@@ -1,16 +1,15 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/agent/bindir/cloud-setup-agent.in b/agent/bindir/cloud-setup-agent.in
index c9aeea6d146..be8b4123017 100755
--- a/agent/bindir/cloud-setup-agent.in
+++ b/agent/bindir/cloud-setup-agent.in
@@ -83,7 +83,7 @@ try:
stderr(str(e))
bail(cloud_utils.E_SETUPFAILED,"Cloud Agent setup failed")
- setup_agent_config(configfile)
+ setup_agent_config(configfile,brname)
stderr("Enabling and starting the Cloud Agent")
stop_service(servicename)
enable_service(servicename)
diff --git a/agent/conf/agent.properties b/agent/conf/agent.properties
index 60222277f33..7ce362493aa 100644
--- a/agent/conf/agent.properties
+++ b/agent/conf/agent.properties
@@ -19,12 +19,10 @@ pod=default
zone=default
#private.network.device= the private nic device
-# if this is commented, it is autodetected on service startup
-# private.network.device=cloudbr0
+private.network.device=cloudbr0
#public.network.device= the public nic device
-# if this is commented, it is autodetected on service startup
-# public.network.device=cloudbr0
+public.network.device=cloudbr0
#guid= a GUID to identify the agent
diff --git a/agent/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-agent.in b/agent/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-agent.in
old mode 100755
new mode 100644
diff --git a/agent/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-agent.in b/agent/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-agent.in
old mode 100755
new mode 100644
diff --git a/agent/libexec/agent-runner.in b/agent/libexec/agent-runner.in
index fd2819b84f9..1dbd4f01d77 100755
--- a/agent/libexec/agent-runner.in
+++ b/agent/libexec/agent-runner.in
@@ -23,20 +23,6 @@ cd "@AGENTLIBDIR@"
echo Current directory is "$PWD"
echo CLASSPATH to run the agent: "$CLASSPATH"
-export PATH=/sbin:/usr/sbin:"$PATH"
-SERVICEARGS=
-for x in private public ; do
- configuration=`grep -q "^$x.network.device" "@AGENTSYSCONFDIR@"/agent.properties || true`
- if [ -n "$CONFIGURATION" ] ; then
- echo "Using manually-configured network device $CONFIGURATION"
- else
- defaultroute=`ip route | grep ^default | cut -d ' ' -f 5`
- test -n "$defaultroute"
- echo "Using auto-discovered network device $defaultroute which is the default route"
- SERVICEARGS="$SERVICEARGS -D$x.network.device="$defaultroute
- fi
-done
-
function termagent() {
if [ "$agentpid" != "" ] ; then
echo Killing VMOps Agent "(PID $agentpid)" with SIGTERM >&2
@@ -52,7 +38,7 @@ function termagent() {
trap termagent TERM
while true ; do
- java -Xms128M -Xmx384M -cp "$CLASSPATH" $SERVICEARGS "$@" com.cloud.agent.AgentShell &
+ java -Xms128M -Xmx384M -cp "$CLASSPATH" "$@" com.cloud.agent.AgentShell &
agentpid=$!
echo "Agent started. PID: $!" >&2
wait $agentpid
diff --git a/agent/scripts/run.sh b/agent/scripts/run.sh
index 3acaf64f128..69c93378a9d 100755
--- a/agent/scripts/run.sh
+++ b/agent/scripts/run.sh
@@ -1,3 +1,3 @@
#!/usr/bin/env bash
#run.sh runs the agent client.
-java $1 -Xms128M -Xmx384M -cp cglib-nodep-2.2.jar:xenserver-5.5.0-1.jar:trilead-ssh2-build213.jar:cloud-api.jar:cloud-core-extras.jar:cloud-utils.jar:cloud-agent.jar:cloud-console-proxy.jar:cloud-console-common.jar:freemarker.jar:log4j-1.2.15.jar:ws-commons-util-1.0.2.jar:xmlrpc-client-3.1.3.jar:cloud-core.jar:xmlrpc-common-3.1.3.jar:javaee-api-5.0-1.jar:gson-1.3.jar:commons-httpclient-3.1.jar:commons-logging-1.1.1.jar:commons-codec-1.4.jar:commons-collections-3.2.1.jar:commons-pool-1.4.jar:apache-log4j-extras-1.0.jar:libvirt-0.4.5.jar:jna.jar:.:/etc/cloud:./conf com.cloud.agent.AgentShell
+java $1 -Xms128M -Xmx384M -cp cglib-nodep-2.2.jar:xenserver-5.5.0-1.jar:trilead-ssh2-build213.jar:cloud-core-extras.jar:cloud-utils.jar:cloud-agent.jar:cloud-console-proxy.jar:cloud-console-common.jar:freemarker.jar:log4j-1.2.15.jar:ws-commons-util-1.0.2.jar:xmlrpc-client-3.1.3.jar:cloud-core.jar:xmlrpc-common-3.1.3.jar:javaee-api-5.0-1.jar:gson-1.3.jar:commons-httpclient-3.1.jar:commons-logging-1.1.1.jar:commons-codec-1.4.jar:commons-collections-3.2.1.jar:commons-pool-1.4.jar:apache-log4j-extras-1.0.jar:libvirt-0.4.5.jar:jna.jar:.:/etc/cloud:./conf com.cloud.agent.AgentShell
diff --git a/agent/src/com/cloud/agent/Agent.java b/agent/src/com/cloud/agent/Agent.java
index 6d3f9df9403..eed1c63855f 100755
--- a/agent/src/com/cloud/agent/Agent.java
+++ b/agent/src/com/cloud/agent/Agent.java
@@ -157,8 +157,7 @@ public class Agent implements HandlerFactory, IAgentControl {
_shell.getPort(),
_shell.getWorkers(),
this);
-
- // ((NioClient)_connection).setBindAddress(_shell.getPrivateIp());
+ ((NioClient)_connection).setBindAddress(_shell.getPrivateIp());
s_logger.debug("Adding shutdown hook");
Runtime.getRuntime().addShutdownHook(new ShutdownThread(this));
diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java b/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java
index 0421dcfbeb3..2fff2c9a9ce 100644
--- a/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java
+++ b/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java
@@ -55,7 +55,6 @@ import org.libvirt.Connect;
import org.libvirt.Domain;
import org.libvirt.DomainInfo;
import org.libvirt.DomainInterfaceStats;
-import org.libvirt.DomainSnapshot;
import org.libvirt.LibvirtException;
import org.libvirt.Network;
import org.libvirt.NodeInfo;
@@ -69,20 +68,12 @@ import com.cloud.agent.api.Answer;
import com.cloud.agent.api.AttachIsoCommand;
import com.cloud.agent.api.AttachVolumeAnswer;
import com.cloud.agent.api.AttachVolumeCommand;
-import com.cloud.agent.api.BackupSnapshotAnswer;
-import com.cloud.agent.api.BackupSnapshotCommand;
import com.cloud.agent.api.CheckHealthAnswer;
import com.cloud.agent.api.CheckHealthCommand;
import com.cloud.agent.api.CheckStateCommand;
import com.cloud.agent.api.CheckVirtualMachineAnswer;
import com.cloud.agent.api.CheckVirtualMachineCommand;
import com.cloud.agent.api.Command;
-import com.cloud.agent.api.CreatePrivateTemplateFromSnapshotCommand;
-import com.cloud.agent.api.CreateVolumeFromSnapshotAnswer;
-import com.cloud.agent.api.CreateVolumeFromSnapshotCommand;
-import com.cloud.agent.api.DeleteSnapshotBackupAnswer;
-import com.cloud.agent.api.DeleteSnapshotBackupCommand;
-import com.cloud.agent.api.DeleteSnapshotsDirCommand;
import com.cloud.agent.api.DeleteStoragePoolCommand;
import com.cloud.agent.api.GetHostStatsAnswer;
import com.cloud.agent.api.GetHostStatsCommand;
@@ -159,7 +150,6 @@ import com.cloud.hypervisor.Hypervisor;
import com.cloud.network.NetworkEnums.RouterPrivateIpStrategy;
import com.cloud.resource.ServerResource;
import com.cloud.resource.ServerResourceBase;
-import com.cloud.storage.StorageLayer;
import com.cloud.storage.StoragePoolVO;
import com.cloud.storage.Volume;
import com.cloud.storage.VolumeVO;
@@ -167,15 +157,9 @@ import com.cloud.storage.Storage.ImageFormat;
import com.cloud.storage.Storage.StoragePoolType;
import com.cloud.storage.Volume.StorageResourceType;
import com.cloud.storage.Volume.VolumeType;
-import com.cloud.storage.template.Processor;
-import com.cloud.storage.template.QCOW2Processor;
import com.cloud.storage.template.TemplateInfo;
-import com.cloud.storage.template.TemplateLocation;
-import com.cloud.storage.template.Processor.FormatInfo;
import com.cloud.utils.NumbersUtil;
-import com.cloud.utils.Pair;
import com.cloud.utils.PropertiesUtil;
-import com.cloud.utils.component.ComponentLocator;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.net.NetUtils;
import com.cloud.utils.script.OutputInterpreter;
@@ -214,8 +198,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
private String _versionstringpath;
private String _patchdomrPath;
private String _createvmPath;
- private String _manageSnapshotPath;
- private String _createTmplPath;
private String _host;
private String _dcId;
private String _pod;
@@ -224,7 +206,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
private final String _SSHPRVKEYPATH = _SSHKEYSPATH + File.separator + "id_rsa.cloud";
private final String _SSHPUBKEYPATH = _SSHKEYSPATH + File.separator + "id_rsa.pub.cloud";
private final String _mountPoint = "/mnt";
- StorageLayer _storage;
private static final class KeyValueInterpreter extends OutputInterpreter {
private final Map map = new HashMap();
@@ -400,14 +381,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
" " +
" ");
- protected static MessageFormat SnapshotXML = new MessageFormat(
- " " +
- " {0}" +
- " " +
- " {1}" +
- " " +
- " ");
-
protected Connect _conn;
protected String _hypervisorType;
protected String _hypervisorURI;
@@ -422,7 +395,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
protected String _domrRamdisk;
protected String _pool;
private boolean _can_bridge_firewall;
- private Pair _pifs;
private final Map _vmStats = new ConcurrentHashMap();
protected boolean _disconnected = true;
@@ -588,16 +560,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
if (_createvmPath == null) {
throw new ConfigurationException("Unable to find the createvm.sh");
}
-
- _manageSnapshotPath = Script.findScript(storageScriptsDir, "managesnapshot.sh");
- if (_manageSnapshotPath == null) {
- throw new ConfigurationException("Unable to find the managesnapshot.sh");
- }
-
- _createTmplPath = Script.findScript(storageScriptsDir, "createtmplt.sh");
- if (_createTmplPath == null) {
- throw new ConfigurationException("Unable to find the createtmplt.sh");
- }
+ s_logger.info("createvm.sh found in " + _createvmPath);
String value = (String)params.get("developer");
boolean isDeveloper = Boolean.parseBoolean(value);
@@ -719,15 +682,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
}
- try {
- Class> clazz = Class.forName("com.cloud.storage.JavaStorageLayer");
- _storage = (StorageLayer)ComponentLocator.inject(clazz);
- _storage.configure("StorageLayer", params);
- } catch (ClassNotFoundException e) {
- throw new ConfigurationException("Unable to find class " + "com.cloud.storage.JavaStorageLayer");
- }
-
- //_can_bridge_firewall = can_bridge_firewall();
+ _can_bridge_firewall = can_bridge_firewall();
Network vmopsNw = null;
try {
@@ -763,34 +718,12 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
s_logger.info("Found private network " + _privNwName + " already defined");
}
- _pifs = getPifs();
- if (_pifs.first() == null) {
- s_logger.debug("Failed to get private nic name");
- throw new ConfigurationException("Failed to get private nic name");
- }
-
- if (_pifs.second() == null) {
- s_logger.debug("Failed to get public nic name");
- throw new ConfigurationException("Failed to get public nic name");
- }
- s_logger.debug("Found pif: " + _pifs.first() + " on " + _privBridgeName + ", pif: " + _pifs.second() + " on " + _publicBridgeName);
return true;
}
- private Pair getPifs() {
- /*get pifs from bridge*/
- String pubPif = null;
- String privPif = null;
- if (_publicBridgeName != null) {
- pubPif = Script.runSimpleBashScript("ls /sys/class/net/" + _publicBridgeName + "/brif/ |egrep eth[0-9]+");
- }
- if (_privBridgeName != null) {
- privPif = Script.runSimpleBashScript("ls /sys/class/net/" + _privBridgeName + "/brif/ |egrep eth[0-9]+");
- }
- return new Pair(privPif, pubPif);
- }
private String getVnetId(String vnetId) {
- return vnetId;
+ String id = "0000" + vnetId;
+ return id.substring(id.length() - 4);
}
private void patchSystemVm(String cmdLine, String dataDiskPath, String vmName) throws InternalErrorException {
@@ -914,7 +847,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
guestDef guest = new guestDef();
guest.setGuestType(guestDef.guestType.KVM);
guest.setGuestArch(arch);
- guest.setMachineType("pc");
+
guest.setBootOrder(guestDef.bootOrder.CDROM);
guest.setBootOrder(guestDef.bootOrder.HARDISK);
@@ -1057,6 +990,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
s_logger.info("Rule " + (created?" ":" not ") + " created");
test.stop();
+
}
@Override
@@ -1119,16 +1053,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
return execute((GetStorageStatsCommand) cmd);
} else if (cmd instanceof ManageSnapshotCommand) {
return execute((ManageSnapshotCommand) cmd);
- } else if (cmd instanceof BackupSnapshotCommand) {
- return execute((BackupSnapshotCommand) cmd);
- } else if (cmd instanceof DeleteSnapshotBackupCommand) {
- return execute((DeleteSnapshotBackupCommand) cmd);
- } else if (cmd instanceof DeleteSnapshotsDirCommand) {
- return execute((DeleteSnapshotsDirCommand) cmd);
- } else if (cmd instanceof CreateVolumeFromSnapshotCommand) {
- return execute((CreateVolumeFromSnapshotCommand) cmd);
- } else if (cmd instanceof CreatePrivateTemplateFromSnapshotCommand) {
- return execute((CreatePrivateTemplateFromSnapshotCommand) cmd);
} else if (cmd instanceof ModifyStoragePoolCommand) {
return execute((ModifyStoragePoolCommand) cmd);
} else if (cmd instanceof NetworkIngressRulesCmd) {
@@ -1222,127 +1146,10 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
}
}
protected ManageSnapshotAnswer execute(final ManageSnapshotCommand cmd) {
- String snapshotName = cmd.getSnapshotName();
- String VolPath = cmd.getVolumePath();
- try {
- StorageVol vol = getVolume(VolPath);
- if (vol == null) {
- return new ManageSnapshotAnswer(cmd, false, null);
- }
- Domain vm = getDomain(cmd.getVmName());
- String vmUuid = vm.getUUIDString();
- Object[] args = new Object[] {snapshotName, vmUuid};
- String snapshot = SnapshotXML.format(args);
- s_logger.debug(snapshot);
- if (cmd.getCommandSwitch().equalsIgnoreCase(ManageSnapshotCommand.CREATE_SNAPSHOT)) {
- vm.snapshotCreateXML(snapshot);
- } else {
- DomainSnapshot snap = vm.snapshotLookupByName(snapshotName);
- snap.delete(0);
- }
- } catch (LibvirtException e) {
- s_logger.debug("Failed to manage snapshot: " + e.toString());
- return new ManageSnapshotAnswer(cmd, false, "Failed to manage snapshot: " + e.toString());
- }
+ /*TODO: no snapshot support for KVM right now, but create_private_template needs us to return true here*/
return new ManageSnapshotAnswer(cmd, cmd.getSnapshotId(), cmd.getVolumePath(), true, null);
}
- protected BackupSnapshotAnswer execute(final BackupSnapshotCommand cmd) {
- Long dcId = cmd.getDataCenterId();
- Long accountId = cmd.getAccountId();
- Long volumeId = cmd.getVolumeId();
- String secondaryStoragePoolURL = cmd.getSecondaryStoragePoolURL();
- String snapshotName = cmd.getSnapshotName();
- String snapshotPath = cmd.getSnapshotUuid();
- String snapshotDestPath = null;
-
- try {
- StoragePool secondaryStoragePool = getNfsSPbyURI(_conn, new URI(secondaryStoragePoolURL));
- String ssPmountPath = _mountPoint + File.separator + secondaryStoragePool.getUUIDString();
- snapshotDestPath = ssPmountPath + File.separator + dcId + File.separator + "snapshots" + File.separator + accountId + File.separator + volumeId;
- final Script command = new Script(_manageSnapshotPath, _timeout, s_logger);
- command.add("-b", snapshotPath);
- command.add("-n", snapshotName);
- command.add("-p", snapshotDestPath);
- String result = command.execute();
- if (result != null) {
- s_logger.debug("Failed to backup snaptshot: " + result);
- return new BackupSnapshotAnswer(cmd, false, result, null);
- }
- } catch (LibvirtException e) {
- return new BackupSnapshotAnswer(cmd, false, e.toString(), null);
- } catch (URISyntaxException e) {
- return new BackupSnapshotAnswer(cmd, false, e.toString(), null);
- }
- return new BackupSnapshotAnswer(cmd, true, null, snapshotDestPath + File.separator + snapshotName);
- }
-
- protected DeleteSnapshotBackupAnswer execute(final DeleteSnapshotBackupCommand cmd) {
- return new DeleteSnapshotBackupAnswer(cmd, true, null);
- }
-
- protected Answer execute(DeleteSnapshotsDirCommand cmd) {
- return new Answer(cmd, true, null);
- }
-
- protected CreateVolumeFromSnapshotAnswer execute(final CreateVolumeFromSnapshotCommand cmd) {
- String snapshotPath = cmd.getSnapshotUuid();
- String primaryUuid = cmd.getPrimaryStoragePoolNameLabel();
- String primaryPath = _mountPoint + File.separator + primaryUuid;
- String volUuid = UUID.randomUUID().toString();
- String volPath = primaryPath + File.separator + volUuid;
- String result = Script.runSimpleBashScript("cp " + snapshotPath + " " + volPath);
- if (result != null) {
- return new CreateVolumeFromSnapshotAnswer(cmd, false, result, null);
- }
- return new CreateVolumeFromSnapshotAnswer(cmd, true, "", volPath);
- }
-
- protected CreatePrivateTemplateAnswer execute(final CreatePrivateTemplateFromSnapshotCommand cmd) {
- String orignalTmplPath = cmd.getOrigTemplateInstallPath();
- String templateFolder = cmd.getAccountId() + File.separator + cmd.getNewTemplateId();
- String templateInstallFolder = "template/tmpl/" + templateFolder;
- String snapshotPath = cmd.getSnapshotUuid();
- String tmplName = UUID.randomUUID().toString();
- String tmplFileName = tmplName + ".qcow2";
- StoragePool secondaryPool;
- try {
- secondaryPool = getNfsSPbyURI(_conn, new URI(cmd.getSecondaryStoragePoolURL()));
- /*TODO: assuming all the storage pools mounted under _mountPoint, the mount point should be got from pool.dumpxml*/
- String templatePath = _mountPoint + File.separator + secondaryPool.getUUIDString() + File.separator + templateInstallFolder;
- String tmplPath = templateInstallFolder + File.separator + tmplFileName;
- Script command = new Script(_createTmplPath, _timeout, s_logger);
- command.add("-t", templatePath);
- command.add("-n", tmplFileName);
- command.add("-f", snapshotPath);
- String result = command.execute();
-
- Map params = new HashMap();
- params.put(StorageLayer.InstanceConfigKey, _storage);
- Processor qcow2Processor = new QCOW2Processor();
- qcow2Processor.configure("QCOW2 Processor", params);
- FormatInfo info = qcow2Processor.process(templatePath, null, tmplName);
-
- TemplateLocation loc = new TemplateLocation(_storage, templatePath);
- loc.create(1, true, tmplName);
- loc.addFormat(info);
- loc.save();
-
- return new CreatePrivateTemplateAnswer(cmd, true, "", tmplPath, info.virtualSize, tmplName, info.format);
- } catch (LibvirtException e) {
- return new CreatePrivateTemplateAnswer(cmd, false, e.getMessage(), null, 0, null, null);
- } catch (URISyntaxException e) {
- return new CreatePrivateTemplateAnswer(cmd, false, e.getMessage(), null, 0, null, null);
- } catch (ConfigurationException e) {
- return new CreatePrivateTemplateAnswer(cmd, false, e.getMessage(), null, 0, null, null);
- } catch (InternalErrorException e) {
- return new CreatePrivateTemplateAnswer(cmd, false, e.getMessage(), null, 0, null, null);
- } catch (IOException e) {
- return new CreatePrivateTemplateAnswer(cmd, false, e.getMessage(), null, 0, null, null);
- }
- }
-
-
protected GetStorageStatsAnswer execute(final GetStorageStatsCommand cmd) {
StoragePool sp = null;
StoragePoolInfo spi = null;
@@ -1483,6 +1290,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
if (primaryPool == null) {
return new Answer(cmd, false, " Can't find primary storage pool");
}
+
LibvirtStorageVolumeDef vol = new LibvirtStorageVolumeDef(UUID.randomUUID().toString(), tmplVol.getInfo().capacity, volFormat.QCOW2, null, null);
s_logger.debug(vol.toString());
primaryVol = copyVolume(primaryPool, vol, tmplVol);
@@ -1908,7 +1716,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
final String vnet = getVnetId(cmd.getVnet());
if (vnet != null) {
try {
- createVnet(vnet, _pifs.first()); /*TODO: Need to add public network for domR*/
+ createVnet(vnet);
} catch (InternalErrorException e) {
return new PrepareForMigrationAnswer(cmd, false, result);
}
@@ -1922,11 +1730,9 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
return new PrepareForMigrationAnswer(cmd, result == null, result);
}
- public void createVnet(String vnetId, String pif) throws InternalErrorException {
- final Script command = new Script(_modifyVlanPath, _timeout, s_logger);
+ public void createVnet(String vnetId) throws InternalErrorException {
+ final Script command = new Script(_createvnetPath, _timeout, s_logger);
command.add("-v", vnetId);
- command.add("-p", pif);
- command.add("-o", "add");
final String result = command.execute();
if (result != null) {
@@ -2263,12 +2069,12 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
isoPath = isoVol.getPath();
diskDef iso = new diskDef();
- iso.defFileBasedDisk(isoPath, "hdc", diskDef.diskBus.IDE, diskDef.diskFmtType.RAW);
+ iso.defFileBasedDisk(isoPath, "hdc", diskDef.diskBus.IDE);
iso.setDeviceType(diskDef.deviceType.CDROM);
isoXml = iso.toString();
} else {
diskDef iso = new diskDef();
- iso.defFileBasedDisk(null, "hdc", diskDef.diskBus.IDE, diskDef.diskFmtType.RAW);
+ iso.defFileBasedDisk(null, "hdc", diskDef.diskBus.IDE);
iso.setDeviceType(diskDef.deviceType.CDROM);
isoXml = iso.toString();
}
@@ -2320,9 +2126,9 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
diskDef disk = new diskDef();
String guestOSType = getGuestType(vmName);
if (isGuestPVEnabled(guestOSType)) {
- disk.defFileBasedDisk(sourceFile, diskDev, diskDef.diskBus.VIRTIO, diskDef.diskFmtType.QCOW2);
+ disk.defFileBasedDisk(sourceFile, diskDev, diskDef.diskBus.VIRTIO);
} else {
- disk.defFileBasedDisk(sourceFile, diskDev, diskDef.diskBus.SCSI, diskDef.diskFmtType.QCOW2);
+ disk.defFileBasedDisk(sourceFile, diskDev, diskDef.diskBus.SCSI);
}
String xml = disk.toString();
return attachOrDetachDevice(attach, vmName, xml);
@@ -2822,8 +2628,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
}
}
- final Script command = new Script(_modifyVlanPath, _timeout, s_logger);
- command.add("-o", "delete");
+ final Script command = new Script(_vnetcleanupPath, _timeout, s_logger);
command.add("-v", vnetId);
return command.execute();
}
@@ -2887,21 +2692,16 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
}
private String getHypervisorPath() {
- File f =new File("/usr/bin/cloud-qemu-kvm");
- if (f.exists()) {
- return "/usr/bin/cloud-qemu-kvm";
- } else {
- if (_conn == null)
- return null;
+ if (_conn == null)
+ return null;
+
+ LibvirtCapXMLParser parser = new LibvirtCapXMLParser();
+ try {
+ parser.parseCapabilitiesXML(_conn.getCapabilities());
+ } catch (LibvirtException e) {
- LibvirtCapXMLParser parser = new LibvirtCapXMLParser();
- try {
- parser.parseCapabilitiesXML(_conn.getCapabilities());
- } catch (LibvirtException e) {
-
- }
- return parser.getEmulator();
}
+ return parser.getEmulator();
}
private String getGuestType(String vmName) {
@@ -2992,10 +2792,10 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
}
private String setVnetBrName(String vnetId) {
- return "cloudVirBr" + vnetId;
+ return "vnbr" + vnetId;
}
private String getVnetIdFromBrName(String vnetBrName) {
- return vnetBrName.replaceAll("cloudVirBr", "");
+ return vnetBrName.replaceAll("vnbr", "");
}
private List createUserVMNetworks(StartCommand cmd) throws InternalErrorException {
List nics = new ArrayList();
@@ -3015,8 +2815,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
/*guest network is vnet*/
String vnetId = getVnetId(cmd.getGuestNetworkId());
brName = setVnetBrName(vnetId);
- createVnet(vnetId, _pifs.first());
- pubNic.setHostNetType(hostNicType.VLAN);
+ createVnet(vnetId);
+ pubNic.setHostNetType(hostNicType.VNET);
}
pubNic.defBridgeNet(brName, null, guestMac, nicModel);
nics.add(pubNic);
@@ -3033,35 +2833,33 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
interfaceDef pubNic = new interfaceDef();
interfaceDef privNic = new interfaceDef();
interfaceDef vnetNic = new interfaceDef();
-
- /*nic 0, guest network*/
if ("untagged".equalsIgnoreCase(router.getVnet())){
+ /*guest network is direct attached with domr DHCP server*/
+ /*0 is on private nic, 1 is link local*/
vnetNic.defBridgeNet(_privBridgeName, null, guestMac, interfaceDef.nicModel.VIRTIO);
-
+ vnetNic.setHostNetType(hostNicType.DIRECT_ATTACHED_WITH_DHCP);
+ nics.add(vnetNic);
+
+ privNic.defPrivateNet(_privNwName, null, privateMac, interfaceDef.nicModel.VIRTIO);
+ privNic.setHostNetType(hostNicType.DIRECT_ATTACHED_WITH_DHCP);
+ nics.add(privNic);
} else {
+ /*guest network is vnet: 0 is vnet, 1 is link local, 2 is pub nic*/
String vnetId = getVnetId(router.getVnet());
brName = setVnetBrName(vnetId);
String vnetDev = "vtap" + vnetId;
- createVnet(vnetId, _pifs.first());
+ createVnet(vnetId);
vnetNic.defBridgeNet(brName, vnetDev, guestMac, interfaceDef.nicModel.VIRTIO);
+ vnetNic.setHostNetType(hostNicType.VNET);
+ nics.add(vnetNic);
+
+ privNic.defPrivateNet(_privNwName, null, privateMac, interfaceDef.nicModel.VIRTIO);
+ nics.add(privNic);
+
+ String pubDev = "tap" + vnetId;
+ pubNic.defBridgeNet(_publicBridgeName, pubDev, pubMac, interfaceDef.nicModel.VIRTIO);
+ nics.add(pubNic);
}
- nics.add(vnetNic);
-
- /*nic 1: link local*/
- privNic.defPrivateNet(_privNwName, null, privateMac, interfaceDef.nicModel.VIRTIO);
- nics.add(privNic);
-
- /*nic 2: public */
- if ("untagged".equalsIgnoreCase(router.getVlanId())) {
- pubNic.defBridgeNet(_publicBridgeName, null, pubMac, interfaceDef.nicModel.VIRTIO);
- } else {
- String vnetId = getVnetId(router.getVlanId());
- brName = setVnetBrName(vnetId);
- String vnetDev = "vtap" + vnetId;
- createVnet(vnetId, _pifs.second());
- pubNic.defBridgeNet(brName, vnetDev, pubMac, interfaceDef.nicModel.VIRTIO);
- }
- nics.add(pubNic);
return nics;
}
@@ -3078,7 +2876,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
vnetNic.defPrivateNet("default", null, null, interfaceDef.nicModel.VIRTIO);
nics.add(vnetNic);
- privNic.defPrivateNet(_privNwName, null, privateMac, interfaceDef.nicModel.VIRTIO);
+ privNic.defPrivateNet(_linkLocalBridgeName, null, privateMac, interfaceDef.nicModel.VIRTIO);
nics.add(privNic);
pubNic.defBridgeNet(_publicBridgeName, null, pubMac, interfaceDef.nicModel.VIRTIO);
@@ -3111,11 +2909,11 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
String datadiskPath = tmplVol.getKey();
diskDef hda = new diskDef();
- hda.defFileBasedDisk(rootkPath, "vda", diskDef.diskBus.IDE, diskDef.diskFmtType.QCOW2);
+ hda.defFileBasedDisk(rootkPath, "hda", diskDef.diskBus.IDE);
disks.add(hda);
diskDef hdb = new diskDef();
- hdb.defFileBasedDisk(datadiskPath, "vdb", diskDef.diskBus.IDE, diskDef.diskFmtType.QCOW2);
+ hdb.defFileBasedDisk(datadiskPath, "hdb", diskDef.diskBus.IDE);
disks.add(hdb);
return disks;
@@ -3150,13 +2948,13 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
diskDef hda = new diskDef();
- hda.defFileBasedDisk(rootVolume.getPath(), "vda", diskBusType, diskDef.diskFmtType.QCOW2);
+ hda.defFileBasedDisk(rootVolume.getPath(), "hda", diskBusType);
disks.add(hda);
/*Centos doesn't support scsi hotplug. For other host OSes, we attach the disk after the vm is running, so that we can hotplug it.*/
if (dataVolume != null) {
diskDef hdb = new diskDef();
- hdb.defFileBasedDisk(dataVolume.getPath(), "vdb", diskBusType, diskDef.diskFmtType.QCOW2);
+ hdb.defFileBasedDisk(dataVolume.getPath(), "hdb", diskBusType);
if (!isCentosHost()) {
hdb.setAttachDeferred(true);
}
@@ -3165,7 +2963,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
if (isoPath != null) {
diskDef hdc = new diskDef();
- hdc.defFileBasedDisk(isoPath, "hdc", diskDef.diskBus.IDE, diskDef.diskFmtType.RAW);
+ hdc.defFileBasedDisk(isoPath, "hdc", diskDef.diskBus.IDE);
hdc.setDeviceType(diskDef.deviceType.CDROM);
disks.add(hdc);
}
@@ -3469,9 +3267,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
return vol;
}
- private StorageVol getVolume(String volKey) throws LibvirtException{
+ private StorageVol getVolume(String volKey) {
StorageVol vol = null;
-
try {
vol = _conn.storageVolLookupByKey(volKey);
} catch (LibvirtException e) {
@@ -3479,16 +3276,31 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
}
if (vol == null) {
StoragePool pool = null;
- String token[] = volKey.split("/");
- if (token.length <= 2) {
- s_logger.debug("what the heck of volkey: " + volKey);
+ try {
+ String token[] = volKey.split("/");
+ if (token.length <= 2) {
+ s_logger.debug("what the heck of volkey: " + volKey);
+ return null;
+ }
+ String poolUUID = token[token.length - 2];
+ pool = _conn.storagePoolLookupByUUIDString(poolUUID);
+
+ } catch (LibvirtException e) {
+ s_logger.debug("Failed to get pool, with volKey: " + volKey + "due to" + e.toString());
return null;
}
- String poolUUID = token[token.length - 2];
- pool = _conn.storagePoolLookupByUUIDString(poolUUID);
- pool.refresh(0);
- vol = _conn.storageVolLookupByKey(volKey);
-
+
+ try {
+ pool.refresh(0);
+ } catch (LibvirtException e) {
+
+ }
+
+ try {
+ vol = _conn.storageVolLookupByKey(volKey);
+ } catch (LibvirtException e) {
+
+ }
}
return vol;
}
diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtVMDef.java b/agent/src/com/cloud/agent/resource/computing/LibvirtVMDef.java
index 4d0ab0ccbcc..369b3d10ced 100644
--- a/agent/src/com/cloud/agent/resource/computing/LibvirtVMDef.java
+++ b/agent/src/com/cloud/agent/resource/computing/LibvirtVMDef.java
@@ -248,37 +248,23 @@ public class LibvirtVMDef {
return _bus;
}
}
- enum diskFmtType {
- RAW("raw"),
- QCOW2("qcow2");
- String _fmtType;
- diskFmtType(String fmt) {
- _fmtType = fmt;
- }
- @Override
- public String toString() {
- return _fmtType;
- }
- }
private deviceType _deviceType; /*floppy, disk, cdrom*/
private diskType _diskType;
private String _sourcePath;
private String _diskLabel;
private diskBus _bus;
- private diskFmtType _diskFmtType; /*qcow2, raw etc.*/
private boolean _readonly = false;
private boolean _shareable = false;
private boolean _deferAttach = false;
public void setDeviceType(deviceType deviceType) {
_deviceType = deviceType;
}
- public void defFileBasedDisk(String filePath, String diskLabel, diskBus bus, diskFmtType diskFmtType) {
+ public void defFileBasedDisk(String filePath, String diskLabel, diskBus bus) {
_diskType = diskType.FILE;
_deviceType = deviceType.DISK;
_sourcePath = filePath;
_diskLabel = diskLabel;
- _diskFmtType = diskFmtType;
_bus = bus;
}
@@ -316,7 +302,6 @@ public class LibvirtVMDef {
}
diskBuilder.append(" type='" + _diskType + "'");
diskBuilder.append(">\n");
- diskBuilder.append("\n");
if (_diskType == diskType.FILE) {
diskBuilder.append("
-
-
-
-
-
-
-
-
-
+
@@ -29,57 +21,57 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/build/build-cloud.xml b/build/build-cloud.xml
index 416ab36ee1b..221e23d19ea 100755
--- a/build/build-cloud.xml
+++ b/build/build-cloud.xml
@@ -60,9 +60,7 @@
-
-
-
+
@@ -119,7 +117,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/build/deploy/production/consoleproxy/conf/consoleproxy.properties b/build/deploy/production/consoleproxy/conf/consoleproxy.properties
deleted file mode 100644
index 743db37ce54..00000000000
--- a/build/deploy/production/consoleproxy/conf/consoleproxy.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-consoleproxy.tcpListenPort=0
-consoleproxy.httpListenPort=80
-consoleproxy.httpCmdListenPort=8001
-consoleproxy.jarDir=./applet/
-consoleproxy.viewerLinger=180
-consoleproxy.reconnectMaxRetry=5
diff --git a/build/deploy/production/db/server-setup-dev.xml b/build/deploy/production/db/server-setup-dev.xml
deleted file mode 100644
index 429764a6e3e..00000000000
--- a/build/deploy/production/db/server-setup-dev.xml
+++ /dev/null
@@ -1,532 +0,0 @@
-
-
- 2.0
-
-
- 1
- AH
- 72.52.126.11
- 72.52.126.12
- 192.168.10.253
- 192.168.10.254
- 100-199
- 10.1.1.0/24
-
-
- 2
- KM
- 72.52.126.11
- 72.52.126.12
- 192.168.10.253
- 192.168.10.254
- 200-299
- 10.1.1.0/24
-
-
- 3
- KY
- 72.52.126.11
- 72.52.126.12
- 192.168.10.253
- 192.168.10.254
- 300-399
- 10.1.1.0/24
-
-
- 4
- WC
- 72.52.126.11
- 72.52.126.12
- 192.168.10.253
- 192.168.10.254
- 400-499
- 10.1.1.0/24
-
-
- 5
- CV
- 72.52.126.11
- 72.52.126.12
- 192.168.10.253
- 192.168.10.254
- 500-599
- 10.1.1.0/24
-
-
- 6
- KS
- 72.52.126.11
- 72.52.126.12
- 192.168.10.253
- 192.168.10.254
- 600-699
- 10.1.1.0/24
-
-
- 7
- ES
- 72.52.126.11
- 72.52.126.12
- 192.168.10.253
- 192.168.10.254
- 700-799
- 10.1.1.0/24
-
-
- 8
- RC
- 72.52.126.11
- 72.52.126.12
- 192.168.10.253
- 192.168.10.254
- 800-899
- 10.1.1.0/24
-
-
- 9
- AX
- 72.52.126.11
- 72.52.126.12
- 192.168.10.253
- 192.168.10.254
- 900-999
- 10.1.1.0/24
-
-
- 10
- JW
- 72.52.126.11
- 72.52.126.12
- 192.168.10.253
- 192.168.10.254
- 900-999
- 10.1.1.0/24
-
-
- 11
- AJ
- 72.52.126.11
- 72.52.126.12
- 192.168.10.253
- 192.168.10.254
- 1000-1099
- 10.1.1.0/24
-
-
-
-
-
-
- 1
- 31
- VirtualNetwork
- 192.168.31.1
- 255.255.255.0
- 192.168.31.150-192.168.31.159
-
-
- 2
- 32
- VirtualNetwork
- 192.168.32.1
- 255.255.255.0
- 192.168.32.150-192.168.32.159
-
-
- 3
- 33
- VirtualNetwork
- 192.168.33.1
- 255.255.255.0
- 192.168.33.150-192.168.33.159
-
-
- 4
- 34
- VirtualNetwork
- 192.168.34.1
- 255.255.255.0
- 192.168.34.150-192.168.34.159
-
-
- 5
- 35
- VirtualNetwork
- 192.168.35.1
- 255.255.255.0
- 192.168.35.150-192.168.35.159
-
-
- 6
- 36
- VirtualNetwork
- 192.168.36.1
- 255.255.255.0
- 192.168.36.150-192.168.36.159
-
-
- 7
- 37
- VirtualNetwork
- 192.168.37.1
- 255.255.255.0
- 192.168.37.150-192.168.37.159
-
-
- 8
- 38
- VirtualNetwork
- 192.168.38.1
- 255.255.255.0
- 192.168.38.150-192.168.38.159
-
-
- 9
- 39
- VirtualNetwork
- 192.168.39.1
- 255.255.255.0
- 192.168.39.150-192.168.39.159
-
-
- 10
- 40
- VirtualNetwork
- 192.168.40.1
- 255.255.255.0
- 192.168.40.150-192.168.40.159
-
-
- 11
- 41
- VirtualNetwork
- 192.168.41.1
- 255.255.255.0
- 192.168.41.150-192.168.41.159
-
-
-
-
-
- 1
- AH
- 1
- 192.168.10.20-192.168.10.24
- 192.168.10.0/24
-
-
- 2
- KM
- 2
- 192.168.10.25-192.168.10.29
- 192.168.10.0/24
-
-
- 3
- KY
- 3
- 192.168.10.30-192.168.10.34
- 192.168.10.0/24
-
-
- 4
- WC
- 4
- 192.168.10.35-192.168.10.39
- 192.168.10.0/24
-
-
- 5
- CV
- 5
- 192.168.10.40-192.168.10.44
- 192.168.10.0/24
-
-
- 6
- KS
- 6
- 192.168.10.45-192.168.10.49
- 192.168.10.0/24
-
-
- 7
- ES
- 7
- 192.168.10.50-192.168.10.54
- 192.168.10.0/24
-
-
- 8
- RC
- 8
- 192.168.10.55-192.168.10.59
- 192.168.10.0/24
-
-
- 9
- AX
- 9
- 192.168.10.62-192.168.10.64
- 192.168.10.0/24
-
-
- 10
- JW
- 10
- 192.168.10.65-192.168.10.69
- 192.168.10.0/24
-
-
- 11
- AJ
- 11
- 192.168.10.70-192.168.10.74
- 192.168.10.0/24
-
-
-
-
-
-
- 1
- Small Instance
- Small Instance [500MHZ CPU, 512MB MEM, 16GB Disk] - $0.10 per hour
- 1
- 512
- 500
- false
-
-
- 2
- Medium Instance
- Medium Instance [500MHZ CPU, 1GB MEM, 32GB Disk] - $0.20 per hour
- 1
- 1024
- 512
-
-
- 3
- Large Instance
- Large Instance [2GHZ CPU, 4GB MEM, 64GB Disk] - $0.30 per hour
- 2
- 4096
- 2000
-
-
-
-
-
- 1
- 1
- Small Disk
- Small Disk [16GB Disk]
- 16000
-
-
- 2
- 1
- Medium Disk
- Medium Disk [32GB Disk]
- 32000
-
-
- 3
- 1
- Large Disk
- Large Disk [64GB Disk]
- 64000
-
-
-
-
-
-
- 2
- admin
- password
- Admin
- User
- admin@mailprovider.com
-
-
-
-
-
- default.zone
- AH
-
-
- domain.suffix
- cloud-test.cloud.com
-
-
- instance.name
- AH
-
-
- consoleproxy.ram.size
- 256
-
-
- host.stats.interval
- 3600000
-
-
- storage.stats.interval
- 120000
-
-
- volume.stats.interval
- -1
-
-
- ping.interval
- 60
-
-
- alert.wait
- 1800
-
-
- expunge.interval
- 86400
-
-
- usage.aggregation.timezone
- GMT
-
-
-
- ssh.privatekey
- -----BEGIN RSA PRIVATE KEY-----\nMIIEoQIBAAKCAQEAnNUMVgQS87EzAQN9ufGgH3T1kOpqcvTmUrp8RVZyeA5qwptS\nrZxONRbhLK709pZFBJLmeFqiqciWoA/srVIFk+rPmBlVsMw8BK53hTGoax7iSe8s\nLFCAATm6vp0HnZzYqNfrzR2by36ET5aQD/VAyA55u+uUgAlxQuhKff2xjyahEHs+\nUiRlReiAgItygm9g3co3+8fJDOuRse+s0TOip1D0jPdo2AJFscyxrG9hWqQH86R/\nZlLJ7DqsiaAcUmn52u6Nsmd3BkRmGVx/D35Mq6upJqrk/QDfug9LF66yiIP/BEIn\n08N/wQ6m/O37WUtqqyl3rRKqs5TJ9ZnhsqeO9QIBIwKCAQA6QIDsv69EkkYk8qsK\njPJU06uq2rnS7T+bEhDmjdK+4MiRbOQx2vh6HnDktgM3BJ1K13oss/NGYHJ190lH\nsMA+QUXKx5TbRItSMixkrAta/Ne1D7FSScklBtBVbYZ8XtQhdMVML5GjWuCv2NZs\nU8eaw4xNHPyklcr7mBurI7b6p13VK5BNUWR/VNuigT4U89YzRcoEZ/sTlR+4ACYr\nxbUJJGBA03+NhdSAe2vodlMh5lGflD0JmHMFqqg9BcAtVb73JsOsxFQArbXwRd/q\nNckdoAvgJfhTOvXF5GMPLI0lGb6skJkS229F4GaBB2Iz4A9O0aHZob8I8zsWUbiu\npvBrAoGBAMjUDfF2x13NjH1cFHietO5O1oM0nZaAxKodxoAUvHVMUd5DIY50tqYw\n7ecKi2Cw43ONpdj0nP9Nc2NV3NDRqLopwkKUsTtq9AKQ2cIuw3+uS5vm0VZBzmTP\nuF04Qo4bXh/jFRA62u9bXsmIFtaehKxE1Gp6zi393GcbWP4HX/3dAoGBAMfq0KD3\ngeU1PHi9uI3Ss89nXzJsiGcwC5Iunu1aTzJCYhMlJkfmRcXYMAqSfg0nGWnfvlDh\nuOO26CHKjG182mTwYXdgQzIPpBc8suvgUWDBTrIzJI+zuyBLtPbd9DJEVrZkRVQX\nXrOV3Y5oOWsba4F+b20jaaHFAiY7s6OtrX/5AoGBAMMXI3zZyPwJgSlSIoPNX03m\nL3gke9QID4CvNduB26UlkVuRq5GzNRZ4rJdMEl3tqcC1fImdKswfWiX7o06ChqY3\nMb0FePfkPX7V2tnkSOJuzRsavLoxTCdqsxi6T0g318c0XZq81K4A/P5Jr8ksRl40\nPA+qfyVdAf3Cy3ptkHLzAoGASkFGLSi7N+CSzcLPhSJgCzUGGgsOF7LCeB/x4yGL\nIUvbSPCKj7vuB6gR2AqGlyvHnFprQpz7h8eYDI0PlmGS8kqn2+HtEpgYYGcAoMEI\nSIJQbhL+84vmaxTOL87IanEnhZL1LdzLZ0ZK+mE55fQ936P9gE77WVfNmSweJtob\n3xMCgYAl0aLeGf4oUZbI56eEaCbu8U7dEe6MF54VbozyiXqbp455QnUpuBrRn5uf\nc079dNcqTNDuk1+hYX9qNn1aXsvWeuofBXqWoFXu/c4yoWxJAPhEVhzZ9xrXI76I\nBKiPCyKrOa7bSLvs6SQPpuf5AQ8+NJrOxkEB9hbMuaAr2N5rCw==\n-----END RSA PRIVATE KEY-----
-
- Hidden
-
-
- ssh.publickey
-
- ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAnNUMVgQS87EzAQN9ufGgH3T1kOpqcvTmUrp8RVZyeA5qwptSrZxONRbhLK709pZFBJLmeFqiqciWoA/srVIFk+rPmBlVsMw8BK53hTGoax7iSe8sLFCAATm6vp0HnZzYqNfrzR2by36ET5aQD/VAyA55u+uUgAlxQuhKff2xjyahEHs+UiRlReiAgItygm9g3co3+8fJDOuRse+s0TOip1D0jPdo2AJFscyxrG9hWqQH86R/ZlLJ7DqsiaAcUmn52u6Nsmd3BkRmGVx/D35Mq6upJqrk/QDfug9LF66yiIP/BEIn08N/wQ6m/O37WUtqqyl3rRKqs5TJ9ZnhsqeO9Q== root@test2.lab.vmops.com
-
- Hidden
-
-
-
-
- memory.capacity.threshold
- 0.85
-
-
- cpu.capacity.threshold
- 0.85
-
-
- storage.capacity.threshold
- 0.85
-
-
- storage.allocated.capacity.threshold
- 0.85
-
-
- capacity.check.period
- 3600000
-
-
- wait
- 240
-
-
- network.throttling.rate
- 200
-
-
- multicast.throttling.rate
- 10
-
-
-
-
-
-
-
diff --git a/build/deploy/production/db/templates-dev.sql b/build/deploy/production/db/templates-dev.sql
deleted file mode 100644
index a12d5e14bbe..00000000000
--- a/build/deploy/production/db/templates-dev.sql
+++ /dev/null
@@ -1,14 +0,0 @@
-INSERT INTO `vmops`.`vm_template` (id, unique_name, name, public, path, created, type, hvm, bits, created_by, url, checksum, ready, display_text, enable_password)
- VALUES (1, 'routing', 'DomR Template', 0, 'tank/volumes/demo/template/private/u000000/os/routing', now(), 'ext3', 0, 64, 1, 'http://vmopsserver.lab.vmops.com/images/routing/vmi-root-fc8-x86_64-domR.img.bz2', 'd00927f863a23b98cc6df6e377c9d0c6', 0, 'DomR Template', 0);
-INSERT INTO `vmops`.`vm_template` (id, unique_name, name, public, path, created, type, hvm, bits, created_by, url, checksum, ready, display_text, enable_password)
- VALUES (3, 'centos53-x86_64', 'Centos 5.3(x86_64) no GUI', 1, 'tank/volumes/demo/template/public/os/centos53-x86_64', now(), 'ext3', 0, 64, 1, 'http://vmopsserver.lab.vmops.com/images/centos52-x86_64/vmi-root-centos.5-2.64.pv.img.gz', 'd4ca80825d936db00eedf26620f13d69', 0, 'Centos 5.3(x86_64) no GUI', 0);
-#INSERT INTO `vmops`.`vm_template` (id, unique_name, name, public, path, created, type, hvm, bits, created_by, url, checksum, ready, display_text, enable_password)
-# VALUES (4, 'centos52-x86_64-gui', 'Centos 5.2(x86_64) GUI', 1, 'tank/volumes/demo/template/public/os/centos52-x86_64-gui', now(), 'ext3', 0, 64, 1, 'http://vmopsserver.lab.vmops.com/images/centos52-x86_64/vmi-root-centos.5-2.64.pv.img.gz', 'd4ca80825d936db00eedf26620f13d69', 0, 'Centos 5.2(x86_64) GUI', 0);
-INSERT INTO `vmops`.`vm_template` (id, unique_name, name, public, path, created, type, hvm, bits, created_by, url, checksum, ready, display_text, enable_password)
- VALUES (5, 'winxpsp3', 'Windows XP SP3 (32-bit)', 1, 'tank/volumes/demo/template/public/os/winxpsp3', now(), 'ntfs', 1, 32, 1, 'http://vmopsserver.lab.vmops.com/images/fedora10-x86_64/vmi-root-fedora10.64.img.gz', 'c76d42703f14108b15acc9983307c759', 0, 'Windows XP SP3 (32-bit)', 0);
-INSERT INTO `vmops`.`vm_template` (id, unique_name, name, public, path, created, type, hvm, bits, created_by, url, checksum, ready, display_text, enable_password)
- VALUES (7, 'win2003sp2', 'Windows 2003 SP2 (32-bit)', 1, 'tank/volumes/demo/template/public/os/win2003sp2', now(), 'ntfs', 1, 32, 1, 'http://vmopsserver.lab.vmops.com/images/win2003sp2/vmi-root-win2003sp2.img.gz', '4d2cc51898d05c0f7a2852c15bcdc77b', 0, 'Windows 2003 SP2 (32-bit)', 0);
-INSERT INTO `vmops`.`vm_template` (id, unique_name, name, public, path, created, type, hvm, bits, created_by, url, checksum, ready, display_text, enable_password)
- VALUES (8, 'win2003sp2-x64', 'Windows 2003 SP2 (64-bit)', 1, 'tank/volumes/demo/template/public/os/win2003sp2-x64', now(), 'ntfs', 1, 64, 1, 'http://vmopsserver.lab.vmops.com/images/win2003sp2-x86_64/vmi-root-win2003sp2-x64.img.gz', '35d4de1c38eb4fb9d81a31c1d989c482', 0, 'Windows 2003 SP2 (64-bit)', 0);
-INSERT INTO `vmops`.`vm_template` (id, unique_name, name, public, path, created, type, hvm, bits, created_by, url, checksum, ready, display_text, enable_password)
- VALUES (9, 'fedora12-GUI-x86_64', 'Fedora 12 Desktop(64-bit)', 1, 'tank/volumes/demo/template/public/os/fedora12-GUI-x86_64', now(), 'ext3', 1, 64, 1, 'http://vmopsserver.lab.vmops.com/images/fedora12-GUI-x86_64/vmi-root-fedora12-GUI-x86_64.qcow2.gz', '', 0, 'Fedora 12 Desktop (with httpd,java and mysql)', 0);
diff --git a/build/deploy/production/premium/conf/log4j-cloud_usage.xml b/build/deploy/production/premium/conf/log4j-cloud_usage.xml
deleted file mode 100644
index 46500faad81..00000000000
--- a/build/deploy/production/premium/conf/log4j-cloud_usage.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/build/deploy/production/premium/conf/log4j-cloud_usage.xml.template b/build/deploy/production/premium/conf/log4j-cloud_usage.xml.template
deleted file mode 100644
index 7c94e594c93..00000000000
--- a/build/deploy/production/premium/conf/log4j-cloud_usage.xml.template
+++ /dev/null
@@ -1,68 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/build/deploy/production/premium/conf/usage-components.xml b/build/deploy/production/premium/conf/usage-components.xml
deleted file mode 100644
index 5e178302819..00000000000
--- a/build/deploy/production/premium/conf/usage-components.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
-
-
-
- 50
- -1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- DAILY
-
-
-
diff --git a/build/deploy/production/server/conf/agent-update.properties b/build/deploy/production/server/conf/agent-update.properties
deleted file mode 100644
index 6b42aa8b6f5..00000000000
--- a/build/deploy/production/server/conf/agent-update.properties
+++ /dev/null
@@ -1 +0,0 @@
-agent.minimal.version=@agent.min.version@
diff --git a/build/deploy/production/server/conf/cloud-localhost.pk12 b/build/deploy/production/server/conf/cloud-localhost.pk12
deleted file mode 100644
index 79dfc4d7aa6..00000000000
Binary files a/build/deploy/production/server/conf/cloud-localhost.pk12 and /dev/null differ
diff --git a/build/deploy/production/server/conf/ehcache.xml b/build/deploy/production/server/conf/ehcache.xml
deleted file mode 100755
index c65deeacdb9..00000000000
--- a/build/deploy/production/server/conf/ehcache.xml
+++ /dev/null
@@ -1,527 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/build/deploy/production/server/conf/log4j-cloud.xml b/build/deploy/production/server/conf/log4j-cloud.xml
deleted file mode 100755
index 2142d81eaaa..00000000000
--- a/build/deploy/production/server/conf/log4j-cloud.xml
+++ /dev/null
@@ -1,90 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/build/deploy/production/server/conf/log4j-cloud.xml.template b/build/deploy/production/server/conf/log4j-cloud.xml.template
deleted file mode 100644
index 5e1e6598884..00000000000
--- a/build/deploy/production/server/conf/log4j-cloud.xml.template
+++ /dev/null
@@ -1,90 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/build/deploy/production/server/conf/server.xml b/build/deploy/production/server/conf/server.xml
deleted file mode 100755
index 99ea003791c..00000000000
--- a/build/deploy/production/server/conf/server.xml
+++ /dev/null
@@ -1,147 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/build/package.xml b/build/package.xml
index 4d15dd2021a..354b5ebee07 100755
--- a/build/package.xml
+++ b/build/package.xml
@@ -72,7 +72,6 @@
-
@@ -134,7 +133,9 @@
-
+
+
+
@@ -164,7 +165,6 @@
-
@@ -232,8 +232,7 @@
-
-
+
diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in
index fb62d18615e..d5ace796fe4 100644
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -70,8 +70,6 @@ registerIso=com.cloud.api.commands.RegisterIsoCmd;15
updateIso=com.cloud.api.commands.UpdateIsoCmd;15
deleteIso=com.cloud.api.commands.DeleteIsoCmd;15
copyIso=com.cloud.api.commands.CopyIsoCmd;15
-updateIsoPermissions=com.cloud.api.commands.UpdateIsoPermissionsCmd;15
-listIsoPermissions=com.cloud.api.commands.ListIsoPermissionsCmd;15
#### guest OS commands
listOsTypes=com.cloud.api.commands.ListGuestOsCmd;15
@@ -138,7 +136,6 @@ listSystemVms=com.cloud.api.commands.ListSystemVMsCmd;1
#### configuration commands
updateConfiguration=com.cloud.api.commands.UpdateCfgCmd;1
listConfigurations=com.cloud.api.commands.ListCfgsByCmd;1
-addConfig=com.cloud.api.commands.AddConfigCmd;15
#### pod commands
createPod=com.cloud.api.commands.CreatePodCmd;1
@@ -195,8 +192,6 @@ createStoragePool=com.cloud.api.commands.CreateStoragePoolCmd;1
updateStoragePool=com.cloud.api.commands.UpdateStoragePoolCmd;1
deleteStoragePool=com.cloud.api.commands.DeletePoolCmd;1
listClusters=com.cloud.api.commands.ListClustersCmd;1
-enableStorageMaintenance=com.cloud.api.commands.PreparePrimaryStorageForMaintenanceCmd;1
-cancelStorageMaintenance=com.cloud.api.commands.CancelPrimaryStorageMaintenanceCmd;1
#### network group commands
createNetworkGroup=com.cloud.api.commands.CreateNetworkGroupCmd;11
diff --git a/client/tomcatconf/components.xml.in b/client/tomcatconf/components.xml.in
index 293f580c184..ecac928d1bc 100755
--- a/client/tomcatconf/components.xml.in
+++ b/client/tomcatconf/components.xml.in
@@ -34,10 +34,7 @@
50
-1
-
- 50
- -1
-
+
50
-1
@@ -80,6 +77,7 @@
+
@@ -146,7 +144,6 @@
-
@@ -224,7 +221,6 @@
-1
-
diff --git a/cloud.spec b/cloud.spec
index 1e010c9c814..8bb8752b8b8 100644
--- a/cloud.spec
+++ b/cloud.spec
@@ -4,7 +4,7 @@
# DISABLE the post-percentinstall java repacking and line number stripping
# we need to find a way to just disable the java repacking and line number stripping, but not the autodeps
-%define _ver 2.1.98
+%define _ver 2.1.2.1
%define _rel 1
Name: cloud
@@ -35,7 +35,7 @@ BuildRequires: jpackage-utils
BuildRequires: gcc
BuildRequires: glibc-devel
-%global _premium %(tar jtvmf %{SOURCE0} '*/cloudstack-proprietary/' --occurrence=1 2>/dev/null | wc -l)
+%global _premium %(tar jtvmf %{SOURCE0} '*/premium/' --occurrence=1 2>/dev/null | wc -l)
%description
This is the Cloud.com Stack, a highly-scalable elastic, open source,
@@ -190,22 +190,6 @@ Group: System Environment/Libraries
%description setup
The Cloud.com setup tools let you set up your Management Server and Usage Server.
-%package agent-libs
-Summary: Cloud.com agent libraries
-Requires: java >= 1.6.0
-Requires: %{name}-utils = %{version}-%{release}, %{name}-core = %{version}-%{release}, %{name}-deps = %{version}-%{release}
-Requires: commons-httpclient
-#Requires: commons-codec
-Requires: commons-collections
-Requires: commons-pool
-Requires: commons-dbcp
-Requires: jakarta-commons-logging
-Requires: jpackage-utils
-Group: System Environment/Libraries
-%description agent-libs
-The Cloud.com agent libraries are used by the Cloud Agent and the Cloud
-Console Proxy.
-
%package agent
Summary: Cloud.com agent
Obsoletes: vmops-agent < %{version}-%{release}
@@ -213,10 +197,8 @@ Obsoletes: vmops-console < %{version}-%{release}
Obsoletes: cloud-console < %{version}-%{release}
Requires: java >= 1.6.0
Requires: %{name}-utils = %{version}-%{release}, %{name}-core = %{version}-%{release}, %{name}-deps = %{version}-%{release}
-Requires: %{name}-agent-libs = %{version}-%{release}
Requires: %{name}-agent-scripts = %{version}-%{release}
Requires: %{name}-vnet = %{version}-%{release}
-Requires: python
Requires: %{name}-python = %{version}-%{release}
Requires: commons-httpclient
#Requires: commons-codec
@@ -235,8 +217,6 @@ Requires: libcgroup
Requires: /usr/bin/uuidgen
Requires: augeas >= 0.7.1
Requires: rsync
-Requires: /bin/egrep
-Requires: /sbin/ip
Group: System Environment/Libraries
%description agent
The Cloud.com agent is in charge of managing shared computing resources in
@@ -246,9 +226,7 @@ will participate in your cloud.
%package console-proxy
Summary: Cloud.com console proxy
Requires: java >= 1.6.0
-Requires: %{name}-utils = %{version}-%{release}, %{name}-core = %{version}-%{release}, %{name}-deps = %{version}-%{release}, %{name}-agent-libs = %{version}-%{release}
-Requires: python
-Requires: %{name}-python = %{version}-%{release}
+Requires: %{name}-utils = %{version}-%{release}, %{name}-core = %{version}-%{release}, %{name}-deps = %{version}-%{release}, %{name}-agent = %{version}-%{release}
Requires: commons-httpclient
#Requires: commons-codec
Requires: commons-collections
@@ -261,8 +239,6 @@ Requires: /sbin/service
Requires: /sbin/chkconfig
Requires: /usr/bin/uuidgen
Requires: augeas >= 0.7.1
-Requires: /bin/egrep
-Requires: /sbin/ip
Group: System Environment/Libraries
%description console-proxy
The Cloud.com console proxy is the service in charge of granting console
@@ -445,9 +421,7 @@ fi
%files utils
%defattr(0644,root,root,0755)
%{_javadir}/%{name}-utils.jar
-%{_javadir}/%{name}-api.jar
%doc %{_docdir}/%{name}-%{version}/sccs-info
-%doc %{_docdir}/%{name}-%{version}/version-info
%doc %{_docdir}/%{name}-%{version}/configure-info
%doc README
%doc HACKING
@@ -485,17 +459,19 @@ fi
%{_libdir}/%{name}/agent/scripts/installer/*
%{_libdir}/%{name}/agent/scripts/network/domr/*.sh
%{_libdir}/%{name}/agent/scripts/storage/*.sh
+%{_libdir}/%{name}/agent/scripts/storage/zfs/*
%{_libdir}/%{name}/agent/scripts/storage/qcow2/*
%{_libdir}/%{name}/agent/scripts/storage/secondary/*
%{_libdir}/%{name}/agent/scripts/util/*
%{_libdir}/%{name}/agent/scripts/vm/*.sh
%{_libdir}/%{name}/agent/scripts/vm/storage/nfs/*
+%{_libdir}/%{name}/agent/scripts/vm/storage/iscsi/*
%{_libdir}/%{name}/agent/scripts/vm/network/*
%{_libdir}/%{name}/agent/scripts/vm/hypervisor/*.sh
%{_libdir}/%{name}/agent/scripts/vm/hypervisor/kvm/*
+%{_libdir}/%{name}/agent/scripts/vm/hypervisor/xen/*
%{_libdir}/%{name}/agent/vms/systemvm.zip
%{_libdir}/%{name}/agent/scripts/vm/hypervisor/xenserver/*
-%{_libdir}/%{name}/agent/vms/systemvm-premium.zip
%doc README
%doc HACKING
%doc debian/copyright
@@ -617,15 +593,9 @@ fi
%doc HACKING
%doc debian/copyright
-%files agent-libs
-%defattr(0644,root,root,0755)
-%{_javadir}/%{name}-agent.jar
-%doc README
-%doc HACKING
-%doc debian/copyright
-
%files agent
%defattr(0644,root,root,0755)
+%{_javadir}/%{name}-agent.jar
%config(noreplace) %{_sysconfdir}/%{name}/agent/agent.properties
%config %{_sysconfdir}/%{name}/agent/developer.properties.template
%config %{_sysconfdir}/%{name}/agent/environment.properties
diff --git a/console-proxy/bindir/cloud-setup-console-proxy.in b/console-proxy/bindir/cloud-setup-console-proxy.in
index 9079c229ebb..6ce89909cc4 100755
--- a/console-proxy/bindir/cloud-setup-console-proxy.in
+++ b/console-proxy/bindir/cloud-setup-console-proxy.in
@@ -2,19 +2,6 @@
import sys, os, subprocess, errno, re
-# ---- This snippet of code adds the sources path and the waf configured PYTHONDIR to the Python path ----
-# ---- We do this so cloud_utils can be looked up in the following order:
-# ---- 1) Sources directory
-# ---- 2) waf configured PYTHONDIR
-# ---- 3) System Python path
-for pythonpath in (
- "@PYTHONDIR@",
- os.path.join(os.path.dirname(__file__),os.path.pardir,os.path.pardir,"python","lib"),
- ):
- if os.path.isdir(pythonpath): sys.path.insert(0,pythonpath)
-# ---- End snippet of code ----
-import cloud_utils
-
E_GENERIC= 1
E_NOKVM = 2
E_NODEFROUTE = 3
@@ -131,57 +118,98 @@ CentOS = os.path.exists("/etc/centos-release") or ( os.path.exists("/etc/redhat-
#--------------- procedure starts here ------------
-def main():
-
- servicename = "@PACKAGE@-console-proxy"
-
- stderr("Welcome to the Cloud Console Proxy setup")
- stderr("")
+stderr("Welcome to the Cloud Console Proxy setup")
+stderr("")
- try:
- check_hostname()
- stderr("The hostname of this machine is properly set up")
- except CalledProcessError,e:
- bail(E_NOFQDN,"This machine does not have an FQDN (fully-qualified domain name) for a hostname")
+try:
+ check_hostname()
+ stderr("The hostname of this machine is properly set up")
+except CalledProcessError,e:
+ bail(E_NOFQDN,"This machine does not have an FQDN (fully-qualified domain name) for a hostname")
+try:
+ service("@PACKAGE@-console-proxy","status")
+except CalledProcessError,e:
stderr("Stopping the Cloud Console Proxy")
- cloud_utils.stop_service(servicename)
+ m = service("@PACKAGE@-console-proxy","stop")
+ print m.stdout + m.stderr
stderr("Cloud Console Proxy stopped")
- ports = "8002".split()
- if Fedora or CentOS:
- try:
- o = chkconfig("--list","iptables")
- if ":on" in o.stdout and os.path.exists("/etc/sysconfig/iptables"):
- stderr("Setting up firewall rules to permit traffic to Cloud services")
- service.iptables.start() ; print o.stdout + o.stderr
- for p in ports: iptables("-I","INPUT","1","-p","tcp","--dport",p,'-j','ACCEPT')
- o = service.iptables.save() ; print o.stdout + o.stderr
- except CalledProcessError,e:
- print e.stdout+e.stderr
- bail(E_FWRECONFIGFAILED,"Firewall rules could not be set")
- else:
- stderr("Setting up firewall rules to permit traffic to Cloud services")
- try:
- for p in ports: ufw.allow(p)
- stderr("Rules set")
- except CalledProcessError,e:
- print e.stdout+e.stderr
- bail(E_FWRECONFIGFAILED,"Firewall rules could not be set")
+stderr("Determining default route")
+routes = ip.route().stdout.splitlines()
+defaultroute = [ x for x in routes if x.startswith("default") ]
+if not defaultroute: bail(E_NODEFROUTE,"Your network configuration does not have a default route")
+dev = defaultroute[0].split()[4]
+stderr("Default route assigned to device %s"%dev)
+
+ports = "8002".split()
+if Fedora or CentOS:
+ try:
+ o = chkconfig("--list","iptables")
+ if ":on" in o.stdout and os.path.exists("/etc/sysconfig/iptables"):
+ stderr("Setting up firewall rules to permit traffic to Cloud services")
+ service.iptables.start() ; print o.stdout + o.stderr
+ for p in ports: iptables("-I","INPUT","1","-p","tcp","--dport",p,'-j','ACCEPT')
+ o = service.iptables.save() ; print o.stdout + o.stderr
+ except CalledProcessError,e:
+ print e.stdout+e.stderr
+ bail(E_FWRECONFIGFAILED,"Firewall rules could not be set")
+else:
+ stderr("Setting up firewall rules to permit traffic to Cloud services")
+ try:
+ for p in ports: ufw.allow(p)
+ stderr("Rules set")
+ except CalledProcessError,e:
+ print e.stdout+e.stderr
+ bail(E_FWRECONFIGFAILED,"Firewall rules could not be set")
- stderr("We are going to enable ufw now. This may disrupt network connectivity and service availability. See the ufw documentation for information on how to manage ufw firewall policies.")
- try:
- o = ufw.enable < "y\n" ; print o.stdout + o.stderr
- except CalledProcessError,e:
- print e.stdout+e.stderr
- bail(E_FWRECONFIGFAILED,"Firewall could not be enabled")
+ stderr("We are going to enable ufw now. This may disrupt network connectivity and service availability. See the ufw documentation for information on how to manage ufw firewall policies.")
+ try:
+ o = ufw.enable < "y\n" ; print o.stdout + o.stderr
+ except CalledProcessError,e:
+ print e.stdout+e.stderr
+ bail(E_FWRECONFIGFAILED,"Firewall could not be enabled")
- cloud_utils.setup_consoleproxy_config("@CPSYSCONFDIR@/agent.properties")
- stderr("Enabling and starting the Cloud Console Proxy")
- cloud_utils.enable_service(servicename)
- stderr("Cloud Console Proxy restarted")
+stderr("Examining console-proxy configuration")
+fn = "@CPSYSCONFDIR@/agent.properties"
+text = file(fn).read(-1)
+lines = [ s.strip() for s in text.splitlines() ]
+confopts = dict([ m.split("=",1) for m in lines if "=" in m and not m.startswith("#") ])
+confposes = dict([ (m.split("=",1)[0],n) for n,m in enumerate(lines) if "=" in m and not m.startswith("#") ])
+
+if not "guid" in confopts:
+ stderr("Generating GUID for this console-proxy")
+ confopts['guid'] = uuidgen().stdout.strip()
+
+try: host = confopts["host"]
+except KeyError: host = "localhost"
+stderr("Please enter the host name of the management server that this console-proxy will connect to: (just hit ENTER to go with %s)",host)
+newhost = raw_input().strip()
+if newhost: host = newhost
+confopts["host"] = host
+
+confopts["private.network.device"] = dev
+confopts["public.network.device"] = dev
+
+for opt,val in confopts.items():
+ line = "=".join([opt,val])
+ if opt not in confposes: lines.append(line)
+ else: lines[confposes[opt]] = line
+
+text = "\n".join(lines)
+try: file(fn,"w").write(text)
+except Exception: bail(E_CPRECONFIGFAILED,"Console Proxy configuration failed")
+
+stderr("")
+stderr("Cloud Console Proxy setup completed successfully")
+
+stderr("Starting the Cloud Console Proxy")
+try:
+ m = service("@PACKAGE@-console-proxy","start")
+ print m.stdout + m.stderr
+except CalledProcessError,e:
+ print e.stdout + e.stderr
+ bail(E_CPFAILEDTOSTART,"@PACKAGE@-console-proxy failed to start")
-if __name__ == "__main__":
- main()
# FIXMES: 1) nullify networkmanager on ubuntu (asking the user first) and enable the networking service permanently
diff --git a/console-proxy/conf.dom0/agent.properties.in b/console-proxy/conf.dom0/agent.properties.in
index 100f6532af8..9124d6c4de6 100644
--- a/console-proxy/conf.dom0/agent.properties.in
+++ b/console-proxy/conf.dom0/agent.properties.in
@@ -19,11 +19,9 @@ pod=default
zone=default
#private.network.device= the private nic device
-# if this is commented, it is autodetected on service startup
-# private.network.device=cloudbr0
+private.network.device=cloudbr0
#public.network.device= the public nic device
-# if this is commented, it is autodetected on service startup
-# public.network.device=cloudbr0
+public.network.device=cloudbr0
#guid= a GUID to identify the agent
diff --git a/console-proxy/libexec/console-proxy-runner.in b/console-proxy/libexec/console-proxy-runner.in
index 8ff9987b795..a95b7200bd7 100755
--- a/console-proxy/libexec/console-proxy-runner.in
+++ b/console-proxy/libexec/console-proxy-runner.in
@@ -21,21 +21,7 @@ export CLASSPATH
set -e
cd "@CPLIBDIR@"
echo Current directory is "$PWD"
-echo CLASSPATH to run the console proxy: "$CLASSPATH"
-
-export PATH=/sbin:/usr/sbin:"$PATH"
-SERVICEARGS=
-for x in private public ; do
- configuration=`grep -q "^$x.network.device" "@CPSYSCONFDIR@"/agent.properties || true`
- if [ -n "$CONFIGURATION" ] ; then
- echo "Using manually-configured network device $CONFIGURATION"
- else
- defaultroute=`ip route | grep ^default | cut -d ' ' -f 5`
- test -n "$defaultroute"
- echo "Using auto-discovered network device $defaultroute which is the default route"
- SERVICEARGS="$SERVICEARGS -D$x.network.device="$defaultroute
- fi
-done
+echo CLASSPATH to run the agent: "$CLASSPATH"
function termagent() {
if [ "$agentpid" != "" ] ; then
@@ -52,7 +38,7 @@ function termagent() {
trap termagent TERM
while true ; do
- java -Xms128M -Xmx384M -cp "$CLASSPATH" $SERVICEARGS "$@" com.cloud.agent.AgentShell &
+ java -Xms128M -Xmx384M -cp "$CLASSPATH" "$@" com.cloud.agent.AgentShell &
agentpid=$!
echo "Console Proxy started. PID: $!" >&2
wait $agentpid
diff --git a/console-proxy/src/com/cloud/consoleproxy/ConsoleProxyViewer.java b/console-proxy/src/com/cloud/consoleproxy/ConsoleProxyViewer.java
index 754d8f6727e..7966f22f953 100644
--- a/console-proxy/src/com/cloud/consoleproxy/ConsoleProxyViewer.java
+++ b/console-proxy/src/com/cloud/consoleproxy/ConsoleProxyViewer.java
@@ -145,8 +145,7 @@ public class ConsoleProxyViewer implements java.lang.Runnable, RfbViewer, RfbPro
if(rfbThread.isAlive()) {
dropMe = true;
viewerInReuse = true;
- if(rfb != null)
- rfb.close();
+ rfb.close();
try {
rfbThread.join();
@@ -159,7 +158,8 @@ public class ConsoleProxyViewer implements java.lang.Runnable, RfbViewer, RfbPro
dropMe = false;
rfbThread = new Thread(this);
- rfbThread.setName("RFB Thread " + rfbThread.getId() + " >" + host + ":" + port);
+ rfbThread.setName("RFB Thread " + rfbThread.getId() + " >" + host + ":"
+ + port);
rfbThread.start();
tileDirtyEvent = new Object();
diff --git a/core/.classpath b/core/.classpath
index d6c04820681..11f8e9d85ff 100644
--- a/core/.classpath
+++ b/core/.classpath
@@ -17,6 +17,5 @@
-
diff --git a/core/src/com/cloud/agent/AgentManager.java b/core/src/com/cloud/agent/AgentManager.java
index 08e9a30a4ee..c87c193b2df 100755
--- a/core/src/com/cloud/agent/AgentManager.java
+++ b/core/src/com/cloud/agent/AgentManager.java
@@ -35,14 +35,14 @@ import com.cloud.host.HostStats;
import com.cloud.host.HostVO;
import com.cloud.host.Status;
import com.cloud.host.Status.Event;
-import com.cloud.offering.ServiceOffering;
+import com.cloud.service.ServiceOffering;
import com.cloud.service.ServiceOfferingVO;
import com.cloud.storage.StoragePoolVO;
import com.cloud.storage.VMTemplateVO;
import com.cloud.storage.VirtualMachineTemplate;
-import com.cloud.uservm.UserVm;
import com.cloud.utils.Pair;
import com.cloud.utils.component.Manager;
+import com.cloud.vm.UserVm;
import com.cloud.vm.VMInstanceVO;
/**
diff --git a/core/src/com/cloud/agent/api/BackupSnapshotCommand.java b/core/src/com/cloud/agent/api/BackupSnapshotCommand.java
index edf68518eb2..72c24317395 100644
--- a/core/src/com/cloud/agent/api/BackupSnapshotCommand.java
+++ b/core/src/com/cloud/agent/api/BackupSnapshotCommand.java
@@ -51,14 +51,13 @@ public class BackupSnapshotCommand extends SnapshotCommand {
Long accountId,
Long volumeId,
String snapshotUuid,
- String snapshotName,
String prevSnapshotUuid,
String prevBackupUuid,
String firstBackupUuid,
boolean isFirstSnapshotOfRootVolume,
boolean isVolumeInactive)
{
- super(primaryStoragePoolNameLabel, secondaryStoragePoolURL, snapshotUuid, snapshotName, dcId, accountId, volumeId);
+ super(primaryStoragePoolNameLabel, secondaryStoragePoolURL, snapshotUuid, dcId, accountId, volumeId);
this.prevSnapshotUuid = prevSnapshotUuid;
this.prevBackupUuid = prevBackupUuid;
this.firstBackupUuid = firstBackupUuid;
diff --git a/core/src/com/cloud/agent/api/CreatePrivateTemplateFromSnapshotCommand.java b/core/src/com/cloud/agent/api/CreatePrivateTemplateFromSnapshotCommand.java
index 13581099af9..d7454fa258a 100644
--- a/core/src/com/cloud/agent/api/CreatePrivateTemplateFromSnapshotCommand.java
+++ b/core/src/com/cloud/agent/api/CreatePrivateTemplateFromSnapshotCommand.java
@@ -49,12 +49,11 @@ public class CreatePrivateTemplateFromSnapshotCommand extends SnapshotCommand {
Long accountId,
Long volumeId,
String backedUpSnapshotUuid,
- String backedUpSnapshotName,
String origTemplateInstallPath,
Long newTemplateId,
String templateName)
{
- super(primaryStoragePoolNameLabel, secondaryStoragePoolURL, backedUpSnapshotUuid, backedUpSnapshotName, dcId, accountId, volumeId);
+ super(primaryStoragePoolNameLabel, secondaryStoragePoolURL, backedUpSnapshotUuid, dcId, accountId, volumeId);
this.origTemplateInstallPath = origTemplateInstallPath;
this.newTemplateId = newTemplateId;
this.templateName = templateName;
diff --git a/core/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java b/core/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java
index 2894c76d2c9..e2874916b6d 100644
--- a/core/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java
+++ b/core/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java
@@ -51,10 +51,9 @@ public class CreateVolumeFromSnapshotCommand extends SnapshotCommand {
Long accountId,
Long volumeId,
String backedUpSnapshotUuid,
- String backedUpSnapshotName,
String templatePath)
{
- super(primaryStoragePoolNameLabel, secondaryStoragePoolURL, backedUpSnapshotUuid, backedUpSnapshotName, dcId, accountId, volumeId);
+ super(primaryStoragePoolNameLabel, secondaryStoragePoolURL, backedUpSnapshotUuid, dcId, accountId, volumeId);
this.templatePath = templatePath;
}
diff --git a/core/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java b/core/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java
index 600477bd7ec..1f6cd9624f8 100644
--- a/core/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java
+++ b/core/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java
@@ -59,10 +59,9 @@ public class DeleteSnapshotBackupCommand extends SnapshotCommand {
Long accountId,
Long volumeId,
String backupUUID,
- String backupName,
String childUUID)
{
- super(primaryStoragePoolNameLabel, secondaryStoragePoolURL, backupUUID, backupName, dcId, accountId, volumeId);
+ super(primaryStoragePoolNameLabel, secondaryStoragePoolURL, backupUUID, dcId, accountId, volumeId);
this.childUUID = childUUID;
}
diff --git a/core/src/com/cloud/agent/api/DeleteSnapshotsDirCommand.java b/core/src/com/cloud/agent/api/DeleteSnapshotsDirCommand.java
index 2073019e61e..6544d6f1a23 100644
--- a/core/src/com/cloud/agent/api/DeleteSnapshotsDirCommand.java
+++ b/core/src/com/cloud/agent/api/DeleteSnapshotsDirCommand.java
@@ -57,10 +57,9 @@ public class DeleteSnapshotsDirCommand extends SnapshotCommand {
Long dcId,
Long accountId,
Long volumeId,
- String snapshotUUID,
- String snapshotName)
+ String snapshotUUID)
{
- super(primaryStoragePoolNameLabel, secondaryStoragePoolURL, snapshotUUID, snapshotName, dcId, accountId, volumeId);
+ super(primaryStoragePoolNameLabel, secondaryStoragePoolURL, snapshotUUID, dcId, accountId, volumeId);
}
}
\ No newline at end of file
diff --git a/core/src/com/cloud/agent/api/ManageSnapshotCommand.java b/core/src/com/cloud/agent/api/ManageSnapshotCommand.java
index 57497bc478b..d3509c0cabc 100644
--- a/core/src/com/cloud/agent/api/ManageSnapshotCommand.java
+++ b/core/src/com/cloud/agent/api/ManageSnapshotCommand.java
@@ -33,12 +33,11 @@ public class ManageSnapshotCommand extends Command {
// Information about the snapshot
private String _snapshotPath = null;
private String _snapshotName = null;
- private long _snapshotId;
- private String _vmName = null;
+ private long _snapshotId;
public ManageSnapshotCommand() {}
- public ManageSnapshotCommand(String commandSwitch, long snapshotId, String path, String snapshotName, String vmName) {
+ public ManageSnapshotCommand(String commandSwitch, long snapshotId, String path, String snapshotName) {
_commandSwitch = commandSwitch;
if (commandSwitch.equals(ManageSnapshotCommand.CREATE_SNAPSHOT)) {
_volumePath = path;
@@ -47,8 +46,7 @@ public class ManageSnapshotCommand extends Command {
_snapshotPath = path;
}
_snapshotName = snapshotName;
- _snapshotId = snapshotId;
- _vmName = vmName;
+ _snapshotId = snapshotId;
}
@Override
@@ -74,10 +72,6 @@ public class ManageSnapshotCommand extends Command {
public long getSnapshotId() {
return _snapshotId;
- }
-
- public String getVmName() {
- return _vmName;
}
}
\ No newline at end of file
diff --git a/core/src/com/cloud/agent/api/SnapshotCommand.java b/core/src/com/cloud/agent/api/SnapshotCommand.java
index 72722b06778..e967d0b8eb6 100644
--- a/core/src/com/cloud/agent/api/SnapshotCommand.java
+++ b/core/src/com/cloud/agent/api/SnapshotCommand.java
@@ -27,7 +27,6 @@ package com.cloud.agent.api;
public class SnapshotCommand extends Command {
private String primaryStoragePoolNameLabel;
private String snapshotUuid;
- private String snapshotName;
private String secondaryStoragePoolURL;
private Long dcId;
private Long accountId;
@@ -47,7 +46,6 @@ public class SnapshotCommand extends Command {
public SnapshotCommand(String primaryStoragePoolNameLabel,
String secondaryStoragePoolURL,
String snapshotUuid,
- String snapshotName,
Long dcId,
Long accountId,
Long volumeId)
@@ -58,7 +56,6 @@ public class SnapshotCommand extends Command {
this.dcId = dcId;
this.accountId = accountId;
this.volumeId = volumeId;
- this.snapshotName = snapshotName;
}
/**
@@ -75,10 +72,6 @@ public class SnapshotCommand extends Command {
return snapshotUuid;
}
- public String getSnapshotName() {
- return snapshotName;
- }
-
/**
* @return the secondaryStoragePoolURL
*/
diff --git a/core/src/com/cloud/agent/api/StartCommand.java b/core/src/com/cloud/agent/api/StartCommand.java
index 56747c8f6e6..966cc33e537 100755
--- a/core/src/com/cloud/agent/api/StartCommand.java
+++ b/core/src/com/cloud/agent/api/StartCommand.java
@@ -20,10 +20,10 @@ package com.cloud.agent.api;
import java.util.List;
import java.util.Map;
-import com.cloud.offering.ServiceOffering;
+import com.cloud.service.ServiceOffering;
import com.cloud.storage.VolumeVO;
-import com.cloud.uservm.UserVm;
import com.cloud.vm.DomainRouter;
+import com.cloud.vm.UserVm;
import com.cloud.vm.UserVmVO;
public class StartCommand extends AbstractStartCommand {
diff --git a/core/src/com/cloud/agent/api/StopCommand.java b/core/src/com/cloud/agent/api/StopCommand.java
index f4e3d24d092..4d8274f778a 100755
--- a/core/src/com/cloud/agent/api/StopCommand.java
+++ b/core/src/com/cloud/agent/api/StopCommand.java
@@ -17,6 +17,7 @@
*/
package com.cloud.agent.api;
+import com.cloud.vm.ConsoleProxyVO;
import com.cloud.vm.VirtualMachine;
public class StopCommand extends RebootCommand {
@@ -26,7 +27,6 @@ public class StopCommand extends RebootCommand {
private String vncPort=null;
private String urlPort=null;
private String publicConsoleProxyIpAddress=null;
- private String privateRouterIpAddress=null;
protected StopCommand() {
}
@@ -42,17 +42,15 @@ public class StopCommand extends RebootCommand {
public StopCommand(VirtualMachine vm, String vnet) {
super(vm);
this.vnet = vnet;
+ this.mirroredVolumes = vm.isMirroredVols();
}
public StopCommand(VirtualMachine vm, String vmName, String vnet) {
super(vmName);
this.vnet = vnet;
- }
-
- public StopCommand(VirtualMachine vm, String vmName, String vnet, String privateRouterIpAddress) {
- super(vmName);
- this.vnet = vnet;
- this.privateRouterIpAddress = privateRouterIpAddress;
+ if (vm != null) {
+ this.mirroredVolumes = vm.isMirroredVols();
+ }
}
public String getVnet() {
@@ -87,9 +85,5 @@ public class StopCommand extends RebootCommand {
public String getPublicConsoleProxyIpAddress() {
return this.publicConsoleProxyIpAddress;
}
-
- public String getPrivateRouterIpAddress() {
- return privateRouterIpAddress;
- }
}
diff --git a/core/src/com/cloud/agent/api/WatchNetworkAnswer.java b/core/src/com/cloud/agent/api/WatchNetworkAnswer.java
new file mode 100755
index 00000000000..5a6a4d32497
--- /dev/null
+++ b/core/src/com/cloud/agent/api/WatchNetworkAnswer.java
@@ -0,0 +1,52 @@
+/**
+ * Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
+ *
+ * This software is licensed under the GNU General Public License v3 or later.
+ *
+ * It is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+package com.cloud.agent.api;
+
+import java.util.Collection;
+import java.util.HashMap;
+
+public class WatchNetworkAnswer extends Answer {
+ HashMap transmitted;
+ HashMap received;
+
+ protected WatchNetworkAnswer() {
+ }
+
+ public WatchNetworkAnswer(WatchNetworkCommand cmd) {
+ super(cmd);
+ transmitted = new HashMap();
+ received = new HashMap();
+ }
+
+ public void addStats(String vmName, long txn, long rcvd) {
+ transmitted.put(vmName, txn);
+ received.put(vmName, rcvd);
+ }
+
+ public long[] getStats(String vmName) {
+ long[] stats = new long[2];
+ stats[0] = transmitted.get(vmName);
+ stats[1] = received.get(vmName);
+ return stats;
+ }
+
+ public Collection getAllVms() {
+ return transmitted.keySet();
+ }
+
+}
diff --git a/core/src/com/cloud/agent/api/NetworkUsageCommand.java b/core/src/com/cloud/agent/api/WatchNetworkCommand.java
old mode 100644
new mode 100755
similarity index 74%
rename from core/src/com/cloud/agent/api/NetworkUsageCommand.java
rename to core/src/com/cloud/agent/api/WatchNetworkCommand.java
index c9c88279f6d..20cca08eb79
--- a/core/src/com/cloud/agent/api/NetworkUsageCommand.java
+++ b/core/src/com/cloud/agent/api/WatchNetworkCommand.java
@@ -17,29 +17,22 @@
*/
package com.cloud.agent.api;
-
-public class NetworkUsageCommand extends Command {
- private String privateIP;
+public class WatchNetworkCommand extends Command implements CronCommand {
+ int interval;
- protected NetworkUsageCommand() {
-
+ protected WatchNetworkCommand() {
}
- public NetworkUsageCommand(String privateIP)
- {
- this.privateIP = privateIP;
- }
-
- public String getPrivateIP() {
- return privateIP;
+ public WatchNetworkCommand(int interval) {
+ this.interval = interval;
+ }
+
+ public int getInterval() {
+ return interval;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean executeInSequence() {
return false;
}
-
-}
\ No newline at end of file
+}
diff --git a/core/src/com/cloud/alert/dao/AlertDaoImpl.java b/core/src/com/cloud/alert/dao/AlertDaoImpl.java
index c79c6c48b9c..631abda39aa 100644
--- a/core/src/com/cloud/alert/dao/AlertDaoImpl.java
+++ b/core/src/com/cloud/alert/dao/AlertDaoImpl.java
@@ -18,10 +18,10 @@
package com.cloud.alert.dao;
-import java.util.List;
-
-import javax.ejb.Local;
-
+import java.util.List;
+
+import javax.ejb.Local;
+
import com.cloud.alert.AlertVO;
import com.cloud.utils.db.Filter;
import com.cloud.utils.db.GenericDaoBase;
@@ -32,7 +32,7 @@ public class AlertDaoImpl extends GenericDaoBase implements Alert
@Override
public AlertVO getLastAlert(short type, long dataCenterId, Long podId) {
Filter searchFilter = new Filter(AlertVO.class, "createdDate", Boolean.FALSE, Long.valueOf(1), Long.valueOf(1));
- SearchCriteria sc = createSearchCriteria();
+ SearchCriteria sc = createSearchCriteria();
sc.addAnd("type", SearchCriteria.Op.EQ, Short.valueOf(type));
sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, Long.valueOf(dataCenterId));
diff --git a/core/src/com/cloud/async/dao/AsyncJobDaoImpl.java b/core/src/com/cloud/async/dao/AsyncJobDaoImpl.java
index 24cacaa8cc3..9534484d271 100644
--- a/core/src/com/cloud/async/dao/AsyncJobDaoImpl.java
+++ b/core/src/com/cloud/async/dao/AsyncJobDaoImpl.java
@@ -19,12 +19,12 @@
package com.cloud.async.dao;
import java.util.Date;
-import java.util.List;
-
-import javax.ejb.Local;
-
-import org.apache.log4j.Logger;
-
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJobResult;
import com.cloud.async.AsyncJobVO;
import com.cloud.utils.db.Filter;
@@ -56,7 +56,7 @@ public class AsyncJobDaoImpl extends GenericDaoBase implements
}
public AsyncJobVO findInstancePendingAsyncJob(String instanceType, long instanceId) {
- SearchCriteria sc = pendingAsyncJobSearch.create();
+ SearchCriteria sc = pendingAsyncJobSearch.create();
sc.setParameters("instanceType", instanceType);
sc.setParameters("instanceId", instanceId);
sc.setParameters("status", AsyncJobResult.STATUS_IN_PROGRESS);
@@ -73,7 +73,7 @@ public class AsyncJobDaoImpl extends GenericDaoBase implements
}
public List getExpiredJobs(Date cutTime, int limit) {
- SearchCriteria sc = expiringAsyncJobSearch.create();
+ SearchCriteria sc = expiringAsyncJobSearch.create();
sc.setParameters("created", cutTime);
Filter filter = new Filter(AsyncJobVO.class, "created", true, 0L, (long)limit);
return listBy(sc, filter);
diff --git a/core/src/com/cloud/async/dao/SyncQueueDaoImpl.java b/core/src/com/cloud/async/dao/SyncQueueDaoImpl.java
index d009866e9e0..760fa384483 100644
--- a/core/src/com/cloud/async/dao/SyncQueueDaoImpl.java
+++ b/core/src/com/cloud/async/dao/SyncQueueDaoImpl.java
@@ -18,15 +18,15 @@
package com.cloud.async.dao;
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import java.util.Date;
-import java.util.TimeZone;
-
-import javax.ejb.Local;
-
-import org.apache.log4j.Logger;
-
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.Date;
+import java.util.TimeZone;
+
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+
import com.cloud.async.SyncQueueVO;
import com.cloud.utils.DateUtil;
import com.cloud.utils.db.GenericDaoBase;
@@ -36,9 +36,7 @@ import com.cloud.utils.db.Transaction;
@Local(value = { SyncQueueDao.class })
public class SyncQueueDaoImpl extends GenericDaoBase implements SyncQueueDao {
- private static final Logger s_logger = Logger.getLogger(SyncQueueDaoImpl.class.getName());
-
- SearchBuilder TypeIdSearch = createSearchBuilder();
+ private static final Logger s_logger = Logger.getLogger(SyncQueueDaoImpl.class.getName());
@Override
public void ensureQueue(String syncObjType, long syncObjId) {
@@ -63,17 +61,15 @@ public class SyncQueueDaoImpl extends GenericDaoBase implemen
@Override
public SyncQueueVO find(String syncObjType, long syncObjId) {
- SearchCriteria sc = TypeIdSearch.create();
+
+ SearchBuilder sb = createSearchBuilder();
+ sb.and("syncObjType", sb.entity().getSyncObjType(), SearchCriteria.Op.EQ);
+ sb.and("syncObjId", sb.entity().getSyncObjId(), SearchCriteria.Op.EQ);
+ sb.done();
+
+ SearchCriteria sc = sb.create();
sc.setParameters("syncObjType", syncObjType);
sc.setParameters("syncObjId", syncObjId);
return findOneActiveBy(sc);
- }
-
- protected SyncQueueDaoImpl() {
- super();
- TypeIdSearch = createSearchBuilder();
- TypeIdSearch.and("syncObjType", TypeIdSearch.entity().getSyncObjType(), SearchCriteria.Op.EQ);
- TypeIdSearch.and("syncObjId", TypeIdSearch.entity().getSyncObjId(), SearchCriteria.Op.EQ);
- TypeIdSearch.done();
}
}
diff --git a/core/src/com/cloud/async/dao/SyncQueueItemDaoImpl.java b/core/src/com/cloud/async/dao/SyncQueueItemDaoImpl.java
index a0b4df70074..752b4e5b1f6 100644
--- a/core/src/com/cloud/async/dao/SyncQueueItemDaoImpl.java
+++ b/core/src/com/cloud/async/dao/SyncQueueItemDaoImpl.java
@@ -46,10 +46,11 @@ public class SyncQueueItemDaoImpl extends GenericDaoBase
SearchBuilder sb = createSearchBuilder();
sb.and("queueId", sb.entity().getQueueId(), SearchCriteria.Op.EQ);
- sb.and("lastProcessNumber", sb.entity().getLastProcessNumber(), SearchCriteria.Op.NULL);
+ sb.and("lastProcessNumber", sb.entity().getLastProcessNumber(),
+ SearchCriteria.Op.NULL);
sb.done();
- SearchCriteria sc = sb.create();
+ SearchCriteria sc = sb.create();
sc.setParameters("queueId", queueId);
Filter filter = new Filter(SyncQueueItemVO.class, "created", true, 0L, 1L);
@@ -101,7 +102,7 @@ public class SyncQueueItemDaoImpl extends GenericDaoBase
SearchCriteria.Op.EQ);
sb.done();
- SearchCriteria sc = sb.create();
+ SearchCriteria sc = sb.create();
sc.setParameters("lastProcessMsid", msid);
Filter filter = new Filter(SyncQueueItemVO.class, "created", true, 0L, 1L);
diff --git a/core/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java b/core/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java
index 8fb19e21942..cdbf6f3714b 100644
--- a/core/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java
+++ b/core/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java
@@ -18,15 +18,15 @@
package com.cloud.cluster.dao;
-import java.sql.PreparedStatement;
-import java.util.Date;
-import java.util.List;
-import java.util.TimeZone;
-
-import javax.ejb.Local;
-
-import org.apache.log4j.Logger;
-
+import java.sql.PreparedStatement;
+import java.util.Date;
+import java.util.List;
+import java.util.TimeZone;
+
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+
import com.cloud.cluster.ManagementServerHostVO;
import com.cloud.utils.DateUtil;
import com.cloud.utils.db.GenericDaoBase;
@@ -41,7 +41,7 @@ public class ManagementServerHostDaoImpl extends GenericDaoBase MsIdSearch;
public ManagementServerHostVO findByMsid(long msid) {
- SearchCriteria sc = MsIdSearch.create();
+ SearchCriteria sc = MsIdSearch.create();
sc.setParameters("msid", msid);
List l = listBy(sc);
@@ -98,7 +98,7 @@ public class ManagementServerHostDaoImpl extends GenericDaoBase sc = activeSearch.create();
+ SearchCriteria sc = activeSearch.create();
sc.setParameters("lastUpdateTime", cutTime);
return listBy(sc);
diff --git a/core/src/com/cloud/configuration/ResourceCount.java b/core/src/com/cloud/configuration/ResourceCount.java
index b9efaf45859..59cd7de5e46 100644
--- a/core/src/com/cloud/configuration/ResourceCount.java
+++ b/core/src/com/cloud/configuration/ResourceCount.java
@@ -36,13 +36,9 @@ public interface ResourceCount {
public void setType(ResourceType type);
- public Long getAccountId();
+ public long getAccountId();
- public void setAccountId(Long accountId);
-
- public Long getDomainId();
-
- public void setDomainId(Long domainId);
+ public void setAccountId(long accountId);
public long getCount();
diff --git a/core/src/com/cloud/configuration/ResourceCountVO.java b/core/src/com/cloud/configuration/ResourceCountVO.java
index 99cc29ac8a3..d5612156601 100644
--- a/core/src/com/cloud/configuration/ResourceCountVO.java
+++ b/core/src/com/cloud/configuration/ResourceCountVO.java
@@ -27,6 +27,8 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
+import com.cloud.configuration.ResourceCount.ResourceType;
+
@Entity
@Table(name="resource_count")
public class ResourceCountVO implements ResourceCount {
@@ -41,19 +43,15 @@ public class ResourceCountVO implements ResourceCount {
private ResourceCount.ResourceType type;
@Column(name="account_id")
- private Long accountId;
-
- @Column(name="domain_id")
- private Long domainId;
+ private long accountId;
@Column(name="count")
private long count;
public ResourceCountVO() {}
- public ResourceCountVO(Long accountId, Long domainId, ResourceCount.ResourceType type, long count) {
+ public ResourceCountVO(long accountId, ResourceCount.ResourceType type, long count) {
this.accountId = accountId;
- this.domainId = domainId;
this.type = type;
this.count = count;
}
@@ -74,22 +72,14 @@ public class ResourceCountVO implements ResourceCount {
this.type = type;
}
- public Long getAccountId() {
+ public long getAccountId() {
return accountId;
}
- public void setAccountId(Long accountId) {
+ public void setAccountId(long accountId) {
this.accountId = accountId;
}
-
- public Long getDomainId() {
- return domainId;
- }
-
- public void setDomainId(Long domainId) {
- this.domainId = domainId;
- }
-
+
public long getCount() {
return count;
}
@@ -97,4 +87,5 @@ public class ResourceCountVO implements ResourceCount {
public void setCount(long count) {
this.count = count;
}
+
}
diff --git a/core/src/com/cloud/configuration/dao/ConfigurationDaoImpl.java b/core/src/com/cloud/configuration/dao/ConfigurationDaoImpl.java
index 54930bcb1dc..83c751a47f0 100644
--- a/core/src/com/cloud/configuration/dao/ConfigurationDaoImpl.java
+++ b/core/src/com/cloud/configuration/dao/ConfigurationDaoImpl.java
@@ -58,7 +58,7 @@ public class ConfigurationDaoImpl extends GenericDaoBase();
- SearchCriteria sc = InstanceSearch.create();
+ SearchCriteria sc = InstanceSearch.create();
sc.setParameters("instance", "DEFAULT");
List configurations = listBy(sc);
@@ -124,7 +124,7 @@ public class ConfigurationDaoImpl extends GenericDaoBase sc = NameSearch.create();
+ SearchCriteria sc = NameSearch.create();
sc.setParameters("name", name);
List configurations = listBy(sc);
diff --git a/core/src/com/cloud/configuration/dao/ResourceCountDao.java b/core/src/com/cloud/configuration/dao/ResourceCountDao.java
index 6925f5c08b2..99f85d62ba3 100644
--- a/core/src/com/cloud/configuration/dao/ResourceCountDao.java
+++ b/core/src/com/cloud/configuration/dao/ResourceCountDao.java
@@ -24,37 +24,6 @@ import com.cloud.utils.db.GenericDao;
public interface ResourceCountDao extends GenericDao {
- /**
- * Get the count of in use resources for an account by type
- * @param accountId the id of the account to get the resource count
- * @param type the type of resource (e.g. user_vm, public_ip, volume)
- * @return the count of resources in use for the given type and account
- */
- public long getAccountCount(long accountId, ResourceType type);
-
- /**
- * Get the count of in use resources for a domain by type
- * @param domainId the id of the domain to get the resource count
- * @param type the type of resource (e.g. user_vm, public_ip, volume)
- * @return the count of resources in use for the given type and domain
- */
- public long getDomainCount(long domainId, ResourceType type);
-
- /**
- * Update the count of resources in use for the given account and given resource type
- * @param accountId the id of the account to update resource count
- * @param type the type of resource (e.g. user_vm, public_ip, volume)
- * @param increment whether the change is adding or subtracting from the current count
- * @param delta the number of resources being added/released
- */
- public void updateAccountCount(long accountId, ResourceType type, boolean increment, long delta);
-
- /**
- * Update the count of resources in use for the given domain and given resource type
- * @param domainId the id of the domain to update resource count
- * @param type the type of resource (e.g. user_vm, public_ip, volume)
- * @param increment whether the change is adding or subtracting from the current count
- * @param delta the number of resources being added/released
- */
- public void updateDomainCount(long domainId, ResourceType type, boolean increment, long delta);
+ public long getCount(long accountId, ResourceType type);
+ public void updateCount(long accountId, ResourceType type, boolean increment, long delta);
}
diff --git a/core/src/com/cloud/configuration/dao/ResourceCountDaoImpl.java b/core/src/com/cloud/configuration/dao/ResourceCountDaoImpl.java
index e7921449ff2..d20aadbe753 100644
--- a/core/src/com/cloud/configuration/dao/ResourceCountDaoImpl.java
+++ b/core/src/com/cloud/configuration/dao/ResourceCountDaoImpl.java
@@ -20,88 +20,48 @@ package com.cloud.configuration.dao;
import javax.ejb.Local;
-import com.cloud.configuration.ResourceCount.ResourceType;
import com.cloud.configuration.ResourceCountVO;
+import com.cloud.configuration.ResourceLimitVO;
+import com.cloud.configuration.ResourceCount.ResourceType;
import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
@Local(value={ResourceCountDao.class})
public class ResourceCountDaoImpl extends GenericDaoBase implements ResourceCountDao {
- private SearchBuilder IdTypeSearch;
- private SearchBuilder DomainIdTypeSearch;
+ SearchBuilder IdTypeSearch;
+
public ResourceCountDaoImpl() {
IdTypeSearch = createSearchBuilder();
IdTypeSearch.and("type", IdTypeSearch.entity().getType(), SearchCriteria.Op.EQ);
IdTypeSearch.and("accountId", IdTypeSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
IdTypeSearch.done();
-
- DomainIdTypeSearch = createSearchBuilder();
- DomainIdTypeSearch.and("type", DomainIdTypeSearch.entity().getType(), SearchCriteria.Op.EQ);
- DomainIdTypeSearch.and("domainId", DomainIdTypeSearch.entity().getDomainId(), SearchCriteria.Op.EQ);
- DomainIdTypeSearch.done();
}
-
+
private ResourceCountVO findByAccountIdAndType(long accountId, ResourceType type) {
if (type == null) {
return null;
}
-
- SearchCriteria sc = IdTypeSearch.create();
+
+ SearchCriteria sc = IdTypeSearch.create();
sc.setParameters("accountId", accountId);
sc.setParameters("type", type);
-
+
return findOneBy(sc);
}
-
- private ResourceCountVO findByDomainIdAndType(long domainId, ResourceType type) {
- if (type == null) {
- return null;
- }
-
- SearchCriteria sc = DomainIdTypeSearch.create();
- sc.setParameters("domainId", domainId);
- sc.setParameters("type", type);
-
- return findOneBy(sc);
- }
-
- @Override
- public long getAccountCount(long accountId, ResourceType type) {
+
+ public long getCount(long accountId, ResourceType type) {
ResourceCountVO resourceCountVO = findByAccountIdAndType(accountId, type);
return (resourceCountVO != null) ? resourceCountVO.getCount() : 0;
}
-
- @Override
- public long getDomainCount(long domainId, ResourceType type) {
- ResourceCountVO resourceCountVO = findByDomainIdAndType(domainId, type);
- return (resourceCountVO != null) ? resourceCountVO.getCount() : 0;
- }
-
- @Override
- public void updateAccountCount(long accountId, ResourceType type, boolean increment, long delta) {
- delta = increment ? delta : delta * -1;
-
- ResourceCountVO resourceCountVO = findByAccountIdAndType(accountId, type);
-
- if (resourceCountVO == null) {
- resourceCountVO = new ResourceCountVO(accountId, null, type, 0);
- resourceCountVO.setCount(resourceCountVO.getCount() + delta);
- persist(resourceCountVO);
- } else {
- resourceCountVO.setCount(resourceCountVO.getCount() + delta);
- update(resourceCountVO.getId(), resourceCountVO);
- }
- }
-
- @Override
- public void updateDomainCount(long domainId, ResourceType type, boolean increment, long delta) {
+
+ public void updateCount(long accountId, ResourceType type, boolean increment, long delta) {
+ ResourceCountVO resourceCountVO = findByAccountIdAndType(accountId, type);
delta = increment ? delta : delta * -1;
-
- ResourceCountVO resourceCountVO = findByDomainIdAndType(domainId, type);
+
if (resourceCountVO == null) {
- resourceCountVO = new ResourceCountVO(null, domainId, type, 0);
+ resourceCountVO = new ResourceCountVO(accountId, type, 0);
resourceCountVO.setCount(resourceCountVO.getCount() + delta);
persist(resourceCountVO);
} else {
@@ -109,4 +69,5 @@ public class ResourceCountDaoImpl extends GenericDaoBase
update(resourceCountVO.getId(), resourceCountVO);
}
}
+
}
\ No newline at end of file
diff --git a/core/src/com/cloud/configuration/dao/ResourceLimitDao.java b/core/src/com/cloud/configuration/dao/ResourceLimitDao.java
index 6f48d331c65..811c1b26cdd 100644
--- a/core/src/com/cloud/configuration/dao/ResourceLimitDao.java
+++ b/core/src/com/cloud/configuration/dao/ResourceLimitDao.java
@@ -22,6 +22,7 @@ import java.util.List;
import com.cloud.configuration.ResourceCount;
import com.cloud.configuration.ResourceLimitVO;
+import com.cloud.configuration.ResourceCount.ResourceType;
import com.cloud.utils.db.GenericDao;
public interface ResourceLimitDao extends GenericDao {
@@ -32,4 +33,5 @@ public interface ResourceLimitDao extends GenericDao {
public List listByDomainId(Long domainId);
public boolean update(Long id, Long max);
public ResourceCount.ResourceType getLimitType(String type);
+
}
diff --git a/core/src/com/cloud/configuration/dao/ResourceLimitDaoImpl.java b/core/src/com/cloud/configuration/dao/ResourceLimitDaoImpl.java
index d6b4a002f22..c745c4e058c 100644
--- a/core/src/com/cloud/configuration/dao/ResourceLimitDaoImpl.java
+++ b/core/src/com/cloud/configuration/dao/ResourceLimitDaoImpl.java
@@ -30,8 +30,9 @@ import com.cloud.utils.db.SearchCriteria;
@Local(value={ResourceLimitDao.class})
public class ResourceLimitDaoImpl extends GenericDaoBase implements ResourceLimitDao {
- private SearchBuilder IdTypeSearch;
+ SearchBuilder IdTypeSearch;
+
public ResourceLimitDaoImpl () {
IdTypeSearch = createSearchBuilder();
IdTypeSearch.and("type", IdTypeSearch.entity().getType(), SearchCriteria.Op.EQ);
@@ -39,12 +40,12 @@ public class ResourceLimitDaoImpl extends GenericDaoBase
IdTypeSearch.and("accountId", IdTypeSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
IdTypeSearch.done();
}
-
+
public ResourceLimitVO findByDomainIdAndType(Long domainId, ResourceCount.ResourceType type) {
if (domainId == null || type == null)
return null;
- SearchCriteria sc = IdTypeSearch.create();
+ SearchCriteria sc = IdTypeSearch.create();
sc.setParameters("domainId", domainId);
sc.setParameters("type", type);
@@ -55,7 +56,7 @@ public class ResourceLimitDaoImpl extends GenericDaoBase
if (domainId == null)
return null;
- SearchCriteria sc = IdTypeSearch.create();
+ SearchCriteria sc = IdTypeSearch.create();
sc.setParameters("domainId", domainId);
return listBy(sc);
@@ -65,7 +66,7 @@ public class ResourceLimitDaoImpl extends GenericDaoBase
if (accountId == null || type == null)
return null;
- SearchCriteria sc = IdTypeSearch.create();
+ SearchCriteria sc = IdTypeSearch.create();
sc.setParameters("accountId", accountId);
sc.setParameters("type", type);
@@ -76,7 +77,7 @@ public class ResourceLimitDaoImpl extends GenericDaoBase
if (accountId == null)
return null;
- SearchCriteria sc = IdTypeSearch.create();
+ SearchCriteria sc = IdTypeSearch.create();
sc.setParameters("accountId", accountId);
return listBy(sc);
diff --git a/core/src/com/cloud/dc/dao/AccountVlanMapDaoImpl.java b/core/src/com/cloud/dc/dao/AccountVlanMapDaoImpl.java
index a59d622090e..ccbc195f77b 100644
--- a/core/src/com/cloud/dc/dao/AccountVlanMapDaoImpl.java
+++ b/core/src/com/cloud/dc/dao/AccountVlanMapDaoImpl.java
@@ -36,21 +36,21 @@ public class AccountVlanMapDaoImpl extends GenericDaoBase listAccountVlanMapsByAccount(long accountId) {
- SearchCriteria sc = AccountSearch.create();
+ SearchCriteria sc = AccountSearch.create();
sc.setParameters("accountId", accountId);
return listBy(sc);
}
@Override
public List listAccountVlanMapsByVlan(long vlanDbId) {
- SearchCriteria sc = VlanSearch.create();
+ SearchCriteria sc = VlanSearch.create();
sc.setParameters("vlanDbId", vlanDbId);
return listBy(sc);
}
@Override
public AccountVlanMapVO findAccountVlanMap(long accountId, long vlanDbId) {
- SearchCriteria sc = AccountVlanSearch.create();
+ SearchCriteria sc = AccountVlanSearch.create();
sc.setParameters("accountId", accountId);
sc.setParameters("vlanDbId", vlanDbId);
return findOneBy(sc);
diff --git a/core/src/com/cloud/dc/dao/ClusterDaoImpl.java b/core/src/com/cloud/dc/dao/ClusterDaoImpl.java
index e1d8ffe4b05..aebd29cf3a2 100644
--- a/core/src/com/cloud/dc/dao/ClusterDaoImpl.java
+++ b/core/src/com/cloud/dc/dao/ClusterDaoImpl.java
@@ -42,7 +42,7 @@ public class ClusterDaoImpl extends GenericDaoBase implements C
@Override
public List listByPodId(long podId) {
- SearchCriteria sc = PodSearch.create();
+ SearchCriteria sc = PodSearch.create();
sc.setParameters("pod", podId);
return listActiveBy(sc);
@@ -50,7 +50,7 @@ public class ClusterDaoImpl extends GenericDaoBase implements C
@Override
public ClusterVO findBy(String name, long podId) {
- SearchCriteria sc = PodSearch.create();
+ SearchCriteria sc = PodSearch.create();
sc.setParameters("pod", podId);
sc.setParameters("name", name);
diff --git a/core/src/com/cloud/dc/dao/DataCenterDaoImpl.java b/core/src/com/cloud/dc/dao/DataCenterDaoImpl.java
index a7d4b088ce8..faa9abb161e 100644
--- a/core/src/com/cloud/dc/dao/DataCenterDaoImpl.java
+++ b/core/src/com/cloud/dc/dao/DataCenterDaoImpl.java
@@ -64,7 +64,7 @@ public class DataCenterDaoImpl extends GenericDaoBase implem
@Override
public DataCenterVO findByName(String name) {
- SearchCriteria sc = NameSearch.create();
+ SearchCriteria sc = NameSearch.create();
sc.setParameters("name", name);
return findOneActiveBy(sc);
}
diff --git a/core/src/com/cloud/dc/dao/DataCenterIpAddressDaoImpl.java b/core/src/com/cloud/dc/dao/DataCenterIpAddressDaoImpl.java
index 06cb6726af8..4978f2a128f 100755
--- a/core/src/com/cloud/dc/dao/DataCenterIpAddressDaoImpl.java
+++ b/core/src/com/cloud/dc/dao/DataCenterIpAddressDaoImpl.java
@@ -49,7 +49,7 @@ public class DataCenterIpAddressDaoImpl extends GenericDaoBase FreePodDcIpSearch;
public DataCenterIpAddressVO takeIpAddress(long dcId, long podId, long instanceId) {
- SearchCriteria sc = FreeIpSearch.create();
+ SearchCriteria sc = FreeIpSearch.create();
sc.setParameters("dc", dcId);
sc.setParameters("pod", podId);
@@ -86,7 +86,7 @@ public class DataCenterIpAddressDaoImpl extends GenericDaoBase sc = FreePodDcIpSearch.create();
+ SearchCriteria sc = FreePodDcIpSearch.create();
sc.setParameters("podId", podId);
sc.setParameters("dcId", dcId);
sc.setParameters("ipAddress", ip);
@@ -124,7 +124,7 @@ public class DataCenterIpAddressDaoImpl extends GenericDaoBase sc = IpDcSearch.create();
+ SearchCriteria sc = IpDcSearch.create();
sc.setParameters("ip", ipAddress);
sc.setParameters("dc", dcId);
sc.setParameters("instance", instanceId);
@@ -170,14 +170,14 @@ public class DataCenterIpAddressDaoImpl extends GenericDaoBase listByPodIdDcId(long podId, long dcId) {
- SearchCriteria sc = PodDcSearch.create();
+ SearchCriteria sc = PodDcSearch.create();
sc.setParameters("podId", podId);
sc.setParameters("dataCenterId", dcId);
return listBy(sc);
}
public List listByPodIdDcIdIpAddress(long podId, long dcId, String ipAddress) {
- SearchCriteria sc = PodDcIpSearch.create();
+ SearchCriteria sc = PodDcIpSearch.create();
sc.setParameters("dcId", dcId);
sc.setParameters("podId", podId);
sc.setParameters("ipAddress", ipAddress);
diff --git a/core/src/com/cloud/dc/dao/DataCenterLinkLocalIpAddressDaoImpl.java b/core/src/com/cloud/dc/dao/DataCenterLinkLocalIpAddressDaoImpl.java
index 359cd6d0958..17414e28d58 100644
--- a/core/src/com/cloud/dc/dao/DataCenterLinkLocalIpAddressDaoImpl.java
+++ b/core/src/com/cloud/dc/dao/DataCenterLinkLocalIpAddressDaoImpl.java
@@ -49,7 +49,7 @@ public class DataCenterLinkLocalIpAddressDaoImpl extends GenericDaoBase FreePodDcIpSearch;
public DataCenterLinkLocalIpAddressVO takeIpAddress(long dcId, long podId, long instanceId) {
- SearchCriteria sc = FreeIpSearch.create();
+ SearchCriteria sc = FreeIpSearch.create();
sc.setParameters("dc", dcId);
sc.setParameters("pod", podId);
@@ -86,7 +86,7 @@ public class DataCenterLinkLocalIpAddressDaoImpl extends GenericDaoBase sc = FreePodDcIpSearch.create();
+ SearchCriteria sc = FreePodDcIpSearch.create();
sc.setParameters("podId", podId);
sc.setParameters("dcId", dcId);
sc.setParameters("ipAddress", ip);
@@ -124,7 +124,7 @@ public class DataCenterLinkLocalIpAddressDaoImpl extends GenericDaoBase sc = IpDcSearch.create();
+ SearchCriteria sc = IpDcSearch.create();
sc.setParameters("ip", ipAddress);
sc.setParameters("dc", dcId);
sc.setParameters("instance", instanceId);
@@ -170,14 +170,14 @@ public class DataCenterLinkLocalIpAddressDaoImpl extends GenericDaoBase listByPodIdDcId(long podId, long dcId) {
- SearchCriteria sc = PodDcSearch.create();
+ SearchCriteria sc = PodDcSearch.create();
sc.setParameters("podId", podId);
sc.setParameters("dataCenterId", dcId);
return listBy(sc);
}
public List listByPodIdDcIdIpAddress(long podId, long dcId, String ipAddress) {
- SearchCriteria sc = PodDcIpSearch.create();
+ SearchCriteria sc = PodDcIpSearch.create();
sc.setParameters("dcId", dcId);
sc.setParameters("podId", podId);
sc.setParameters("ipAddress", ipAddress);
diff --git a/core/src/com/cloud/dc/dao/DataCenterVnetDaoImpl.java b/core/src/com/cloud/dc/dao/DataCenterVnetDaoImpl.java
index e641c6c62a2..abe940f090a 100755
--- a/core/src/com/cloud/dc/dao/DataCenterVnetDaoImpl.java
+++ b/core/src/com/cloud/dc/dao/DataCenterVnetDaoImpl.java
@@ -20,9 +20,11 @@ package com.cloud.dc.dao;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Date;
+import java.util.Formatter;
import java.util.List;
import com.cloud.dc.DataCenterVnetVO;
+import com.cloud.exception.InternalErrorException;
import com.cloud.utils.db.GenericDao;
import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.SearchBuilder;
@@ -41,13 +43,13 @@ public class DataCenterVnetDaoImpl extends GenericDaoBase DcSearchAllocated;
public List listAllocatedVnets(long dcId) {
- SearchCriteria sc = DcSearchAllocated.create();
+ SearchCriteria sc = DcSearchAllocated.create();
sc.setParameters("dc", dcId);
return listActiveBy(sc);
}
public List findVnet(long dcId, String vnet) {
- SearchCriteria sc = VnetDcSearch.create();;
+ SearchCriteria sc = VnetDcSearch.create();;
sc.setParameters("dc", dcId);
sc.setParameters("vnet", vnet);
return listActiveBy(sc);
@@ -86,7 +88,7 @@ public class DataCenterVnetDaoImpl extends GenericDaoBase sc = FreeVnetSearch.create();
+ SearchCriteria sc = FreeVnetSearch.create();
sc.setParameters("dc", dcId);
Date now = new Date();
Transaction txn = Transaction.currentTxn();
@@ -109,7 +111,7 @@ public class DataCenterVnetDaoImpl extends GenericDaoBase sc = VnetDcSearchAllocated.create();
+ SearchCriteria sc = VnetDcSearchAllocated.create();
sc.setParameters("vnet", vnet);
sc.setParameters("dc", dcId);
sc.setParameters("account", accountId);
diff --git a/core/src/com/cloud/dc/dao/HostPodDaoImpl.java b/core/src/com/cloud/dc/dao/HostPodDaoImpl.java
index 03bd0d1e1a9..b12b5a997de 100644
--- a/core/src/com/cloud/dc/dao/HostPodDaoImpl.java
+++ b/core/src/com/cloud/dc/dao/HostPodDaoImpl.java
@@ -57,14 +57,14 @@ public class HostPodDaoImpl extends GenericDaoBase implements H
}
public List listByDataCenterId(long id) {
- SearchCriteria sc = DataCenterIdSearch.create();
+ SearchCriteria sc = DataCenterIdSearch.create();
sc.setParameters("dcId", id);
return listActiveBy(sc);
}
public HostPodVO findByName(String name, long dcId) {
- SearchCriteria sc = DataCenterAndNameSearch.create();
+ SearchCriteria sc = DataCenterAndNameSearch.create();
sc.setParameters("dc", dcId);
sc.setParameters("name", name);
diff --git a/core/src/com/cloud/dc/dao/PodVlanDaoImpl.java b/core/src/com/cloud/dc/dao/PodVlanDaoImpl.java
index f29e7bd7070..95f1ac84452 100755
--- a/core/src/com/cloud/dc/dao/PodVlanDaoImpl.java
+++ b/core/src/com/cloud/dc/dao/PodVlanDaoImpl.java
@@ -40,7 +40,7 @@ public class PodVlanDaoImpl extends GenericDaoBase implements G
private final SearchBuilder PodSearchAllocated;
public List listAllocatedVnets(long podId) {
- SearchCriteria sc = PodSearchAllocated.create();
+ SearchCriteria sc = PodSearchAllocated.create();
sc.setParameters("podId", podId);
return listActiveBy(sc);
}
@@ -78,7 +78,7 @@ public class PodVlanDaoImpl extends GenericDaoBase implements G
}
public PodVlanVO take(long podId, long accountId) {
- SearchCriteria sc = FreeVlanSearch.create();
+ SearchCriteria sc = FreeVlanSearch.create();
sc.setParameters("podId", podId);
Date now = new Date();
Transaction txn = Transaction.currentTxn();
@@ -101,7 +101,7 @@ public class PodVlanDaoImpl extends GenericDaoBase implements G
}
public void release(String vlan, long podId, long accountId) {
- SearchCriteria sc = VlanPodSearch.create();
+ SearchCriteria sc = VlanPodSearch.create();
sc.setParameters("vlan", vlan);
sc.setParameters("podId", podId);
sc.setParameters("account", accountId);
diff --git a/core/src/com/cloud/dc/dao/PodVlanMapDaoImpl.java b/core/src/com/cloud/dc/dao/PodVlanMapDaoImpl.java
index 617a084a64b..4720b599570 100644
--- a/core/src/com/cloud/dc/dao/PodVlanMapDaoImpl.java
+++ b/core/src/com/cloud/dc/dao/PodVlanMapDaoImpl.java
@@ -36,21 +36,21 @@ public class PodVlanMapDaoImpl extends GenericDaoBase implem
@Override
public List listPodVlanMapsByPod(long podId) {
- SearchCriteria sc = PodSearch.create();
+ SearchCriteria sc = PodSearch.create();
sc.setParameters("podId", podId);
return listBy(sc);
}
@Override
public List listPodVlanMapsByVlan(long vlanDbId) {
- SearchCriteria sc = VlanSearch.create();
+ SearchCriteria sc = VlanSearch.create();
sc.setParameters("vlanDbId", vlanDbId);
return listBy(sc);
}
@Override
public PodVlanMapVO findPodVlanMap(long podId, long vlanDbId) {
- SearchCriteria sc = PodVlanSearch.create();
+ SearchCriteria sc = PodVlanSearch.create();
sc.setParameters("podId", podId);
sc.setParameters("vlanDbId", vlanDbId);
return findOneBy(sc);
diff --git a/core/src/com/cloud/dc/dao/VlanDaoImpl.java b/core/src/com/cloud/dc/dao/VlanDaoImpl.java
index 76e78b7b6f7..05ce742f826 100644
--- a/core/src/com/cloud/dc/dao/VlanDaoImpl.java
+++ b/core/src/com/cloud/dc/dao/VlanDaoImpl.java
@@ -25,6 +25,8 @@ import java.util.Map;
import javax.ejb.Local;
import javax.naming.ConfigurationException;
+import org.apache.log4j.Logger;
+
import com.cloud.dc.AccountVlanMapVO;
import com.cloud.dc.PodVlanMapVO;
import com.cloud.dc.Vlan;
@@ -53,7 +55,7 @@ public class VlanDaoImpl extends GenericDaoBase implements VlanDao
@Override
public VlanVO findByZoneAndVlanId(long zoneId, String vlanId) {
- SearchCriteria sc = ZoneVlanIdSearch.create();
+ SearchCriteria sc = ZoneVlanIdSearch.create();
sc.setParameters("zoneId", zoneId);
sc.setParameters("vlanId", vlanId);
return findOneActiveBy(sc);
@@ -61,7 +63,7 @@ public class VlanDaoImpl extends GenericDaoBase implements VlanDao
@Override
public List findByZone(long zoneId) {
- SearchCriteria sc = ZoneSearch.create();
+ SearchCriteria sc = ZoneSearch.create();
sc.setParameters("zoneId", zoneId);
return listBy(sc);
}
@@ -84,7 +86,7 @@ public class VlanDaoImpl extends GenericDaoBase implements VlanDao
@Override
public List listByZoneAndType(long zoneId, VlanType vlanType) {
- SearchCriteria sc = ZoneTypeSearch.create();
+ SearchCriteria sc = ZoneTypeSearch.create();
sc.setParameters("zoneId", zoneId);
sc.setParameters("vlanType", vlanType);
return listBy(sc);
@@ -226,7 +228,7 @@ public class VlanDaoImpl extends GenericDaoBase implements VlanDao
@Override
public boolean zoneHasDirectAttachUntaggedVlans(long zoneId) {
- SearchCriteria sc = ZoneTypeAllPodsSearch.create();
+ SearchCriteria sc = ZoneTypeAllPodsSearch.create();
sc.setParameters("zoneId", zoneId);
sc.setParameters("vlanType", VlanType.DirectAttached);
@@ -237,7 +239,7 @@ public class VlanDaoImpl extends GenericDaoBase implements VlanDao
@Override
public Pair assignPodDirectAttachIpAddress(long zoneId,
long podId, long accountId, long domainId) {
- SearchCriteria sc = ZoneTypePodSearch.create();
+ SearchCriteria sc = ZoneTypePodSearch.create();
sc.setParameters("zoneId", zoneId);
sc.setParameters("vlanType", VlanType.DirectAttached);
sc.setJoinParameters("vlan", "podId", podId);
diff --git a/core/src/com/cloud/domain/dao/DomainDaoImpl.java b/core/src/com/cloud/domain/dao/DomainDaoImpl.java
index dc2633cdd6f..b56eb9cb7f6 100644
--- a/core/src/com/cloud/domain/dao/DomainDaoImpl.java
+++ b/core/src/com/cloud/domain/dao/DomainDaoImpl.java
@@ -186,7 +186,7 @@ public class DomainDaoImpl extends GenericDaoBase implements Dom
@Override
public DomainVO findDomainByPath(String domainPath) {
- SearchCriteria sc = createSearchCriteria();
+ SearchCriteria sc = createSearchCriteria();
sc.addAnd("path", SearchCriteria.Op.EQ, domainPath);
return findOneActiveBy(sc);
}
@@ -202,7 +202,7 @@ public class DomainDaoImpl extends GenericDaoBase implements Dom
}
boolean result = false;
- SearchCriteria sc = DomainPairSearch.create();
+ SearchCriteria sc = DomainPairSearch.create();
sc.setParameters("id", parentId, childId);
List domainPair = listActiveBy(sc);
diff --git a/core/src/com/cloud/event/dao/EventDao.java b/core/src/com/cloud/event/dao/EventDao.java
index 58390bb58ff..1491aae0658 100644
--- a/core/src/com/cloud/event/dao/EventDao.java
+++ b/core/src/com/cloud/event/dao/EventDao.java
@@ -19,15 +19,15 @@
package com.cloud.event.dao;
import java.util.Date;
-import java.util.List;
-
+import java.util.List;
+
import com.cloud.event.EventVO;
import com.cloud.utils.db.Filter;
import com.cloud.utils.db.GenericDao;
import com.cloud.utils.db.SearchCriteria;
public interface EventDao extends GenericDao {
- public List searchAllEvents(SearchCriteria sc, Filter filter);
+ public List searchAllEvents(SearchCriteria sc, Filter filter);
public List listOlderEvents(Date oldTime);
diff --git a/core/src/com/cloud/event/dao/EventDaoImpl.java b/core/src/com/cloud/event/dao/EventDaoImpl.java
index 45b34d5c3e1..c1d9be149e5 100644
--- a/core/src/com/cloud/event/dao/EventDaoImpl.java
+++ b/core/src/com/cloud/event/dao/EventDaoImpl.java
@@ -19,14 +19,15 @@
package com.cloud.event.dao;
import java.util.Date;
-import java.util.List;
-
-import javax.ejb.Local;
-
-import org.apache.log4j.Logger;
-
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+
import com.cloud.event.EventState;
import com.cloud.event.EventVO;
+import com.cloud.utils.db.DB;
import com.cloud.utils.db.Filter;
import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.SearchBuilder;
@@ -52,14 +53,20 @@ public class EventDaoImpl extends GenericDaoBase implements Event
}
@Override
- public List searchAllEvents(SearchCriteria sc, Filter filter) {
+ @DB
+ public List searchAllEvents(SearchCriteria sc, Filter filter) {
return listBy(sc, filter);
}
+ @Override
+ public List search(final SearchCriteria sc, final Filter filter) {
+ return super.search(sc, filter);
+ }
+
@Override
public List listOlderEvents(Date oldTime) {
if (oldTime == null) return null;
- SearchCriteria sc = createSearchCriteria();
+ SearchCriteria sc = createSearchCriteria();
sc.addAnd("createDate", SearchCriteria.Op.LT, oldTime);
return listBy(sc, null);
@@ -68,7 +75,7 @@ public class EventDaoImpl extends GenericDaoBase implements Event
@Override
public List listStartedEvents(Date minTime, Date maxTime) {
if (minTime == null || maxTime == null) return null;
- SearchCriteria sc = StartedEventsSearch.create();
+ SearchCriteria sc = StartedEventsSearch.create();
sc.setParameters("state", EventState.Completed);
sc.setParameters("startId", 0);
sc.setParameters("createDate", minTime, maxTime);
@@ -77,7 +84,7 @@ public class EventDaoImpl extends GenericDaoBase implements Event
@Override
public EventVO findCompletedEvent(long startId) {
- SearchCriteria sc = CompletedEventSearch.create();
+ SearchCriteria sc = CompletedEventSearch.create();
sc.setParameters("state", EventState.Completed);
sc.setParameters("startId", startId);
return findOneBy(sc);
diff --git a/core/src/com/cloud/agent/api/NetworkUsageAnswer.java b/core/src/com/cloud/exception/AgentUnavailableException.java
similarity index 53%
rename from core/src/com/cloud/agent/api/NetworkUsageAnswer.java
rename to core/src/com/cloud/exception/AgentUnavailableException.java
index bf4a4d5a7a9..2e6632c58a3 100644
--- a/core/src/com/cloud/agent/api/NetworkUsageAnswer.java
+++ b/core/src/com/cloud/exception/AgentUnavailableException.java
@@ -15,35 +15,31 @@
* along with this program. If not, see .
*
*/
-package com.cloud.agent.api;
+package com.cloud.exception;
-public class NetworkUsageAnswer extends Answer {
- Long bytesSent;
- Long bytesReceived;
+import com.cloud.utils.SerialVersionUID;
+
+/**
+ * This exception is thrown when the agent is unavailable to accept an
+ * command.
+ *
+ */
+public class AgentUnavailableException extends Exception {
- protected NetworkUsageAnswer() {
+ private static final long serialVersionUID = SerialVersionUID.AgentUnavailableException;
+
+ long _agentId;
+
+ public AgentUnavailableException(String msg, long agentId) {
+ super("Host " + agentId + ": " + msg);
+ _agentId = agentId;
}
- public NetworkUsageAnswer(NetworkUsageCommand cmd, String details, Long bytesSent, Long bytesReceived) {
- super(cmd, true, details);
- this.bytesReceived = bytesReceived;
- this.bytesSent = bytesSent;
+ public AgentUnavailableException(long agentId) {
+ this("Unable to reach host.", agentId);
}
-
- public void setBytesReceived(Long bytesReceived) {
- this.bytesReceived = bytesReceived;
- }
-
- public Long getBytesReceived() {
- return bytesReceived;
- }
-
- public void setBytesSent(Long bytesSent) {
- this.bytesSent = bytesSent;
- }
-
- public Long getBytesSent() {
- return bytesSent;
+ public long getAgentId() {
+ return _agentId;
}
}
diff --git a/core/src/com/cloud/exception/ConcurrentOperationException.java b/core/src/com/cloud/exception/ConcurrentOperationException.java
new file mode 100644
index 00000000000..43b85014443
--- /dev/null
+++ b/core/src/com/cloud/exception/ConcurrentOperationException.java
@@ -0,0 +1,29 @@
+/**
+ * Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
+ *
+ * This software is licensed under the GNU General Public License v3 or later.
+ *
+ * It is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+package com.cloud.exception;
+
+import com.cloud.utils.SerialVersionUID;
+
+public class ConcurrentOperationException extends Exception {
+
+ private static final long serialVersionUID = SerialVersionUID.ConcurrentOperationException;
+
+ public ConcurrentOperationException(String msg) {
+ super(msg);
+ }
+}
diff --git a/core/src/com/cloud/exception/DiscoveryException.java b/core/src/com/cloud/exception/DiscoveryException.java
new file mode 100644
index 00000000000..c6481d828e4
--- /dev/null
+++ b/core/src/com/cloud/exception/DiscoveryException.java
@@ -0,0 +1,33 @@
+/**
+ * Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
+ *
+ * This software is licensed under the GNU General Public License v3 or later.
+ *
+ * It is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+package com.cloud.exception;
+
+import com.cloud.utils.SerialVersionUID;
+
+public class DiscoveryException extends Exception {
+
+ private static final long serialVersionUID = SerialVersionUID.DiscoveryException;
+
+ public DiscoveryException(String msg) {
+ this(msg, null);
+ }
+
+ public DiscoveryException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+}
diff --git a/core/src/com/cloud/exception/HAStateException.java b/core/src/com/cloud/exception/HAStateException.java
new file mode 100644
index 00000000000..3b1bf24ec99
--- /dev/null
+++ b/core/src/com/cloud/exception/HAStateException.java
@@ -0,0 +1,35 @@
+/**
+ * Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
+ *
+ * This software is licensed under the GNU General Public License v3 or later.
+ *
+ * It is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+package com.cloud.exception;
+
+import com.cloud.utils.SerialVersionUID;
+
+/**
+ * This exception is thrown when a machine is in HA State and a operation,
+ * such as start or stop, is attempted on it. Machines that are in HA
+ * states need to be properly cleaned up before anything special can be
+ * done with it. Hence this special state.
+ */
+public class HAStateException extends ManagementServerException {
+
+ private static final long serialVersionUID = SerialVersionUID.HAStateException;
+
+ public HAStateException(String msg) {
+ super(msg);
+ }
+}
diff --git a/server/src/com/cloud/api/Parameter.java b/core/src/com/cloud/exception/InsufficientAddressCapacityException.java
similarity index 63%
rename from server/src/com/cloud/api/Parameter.java
rename to core/src/com/cloud/exception/InsufficientAddressCapacityException.java
index a1fe480f641..1cca265f1ec 100644
--- a/server/src/com/cloud/api/Parameter.java
+++ b/core/src/com/cloud/exception/InsufficientAddressCapacityException.java
@@ -16,22 +16,23 @@
*
*/
-package com.cloud.api;
+package com.cloud.exception;
-import static java.lang.annotation.ElementType.FIELD;
+import com.cloud.utils.SerialVersionUID;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+/**
+ * Exception thrown when the end there's not enough ip addresses in the system.
+ */
+public class InsufficientAddressCapacityException extends InsufficientCapacityException {
-import com.cloud.api.BaseCmd.CommandType;
+ private static final long serialVersionUID = SerialVersionUID.InsufficientAddressCapacityException;
+
+ public InsufficientAddressCapacityException(String msg) {
+ super(msg);
+ }
+
+ protected InsufficientAddressCapacityException() {
+ super();
+ }
-@Retention(RetentionPolicy.RUNTIME)
-@Target({FIELD})
-public @interface Parameter {
- String name() default "";
- boolean required() default false;
- CommandType type() default CommandType.OBJECT;
- CommandType collectionType() default CommandType.OBJECT;
}
-
diff --git a/core/src/com/cloud/exception/InsufficientCapacityException.java b/core/src/com/cloud/exception/InsufficientCapacityException.java
new file mode 100755
index 00000000000..233306b6000
--- /dev/null
+++ b/core/src/com/cloud/exception/InsufficientCapacityException.java
@@ -0,0 +1,35 @@
+/**
+ * Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
+ *
+ * This software is licensed under the GNU General Public License v3 or later.
+ *
+ * It is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+package com.cloud.exception;
+
+import com.cloud.utils.SerialVersionUID;
+
+/**
+ * Generic parent exception class for capacity being reached.
+ *
+ */
+public abstract class InsufficientCapacityException extends Exception {
+ private static final long serialVersionUID = SerialVersionUID.InsufficientCapacityException;
+
+ protected InsufficientCapacityException() {
+ }
+
+ public InsufficientCapacityException(String msg) {
+ super(msg);
+ }
+}
diff --git a/core/src/com/cloud/exception/InsufficientVirtualNetworkCapcityException.java b/core/src/com/cloud/exception/InsufficientVirtualNetworkCapcityException.java
new file mode 100644
index 00000000000..ded4f9fd966
--- /dev/null
+++ b/core/src/com/cloud/exception/InsufficientVirtualNetworkCapcityException.java
@@ -0,0 +1,28 @@
+/**
+ * Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
+ *
+ * This software is licensed under the GNU General Public License v3 or later.
+ *
+ * It is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+package com.cloud.exception;
+
+import com.cloud.utils.SerialVersionUID;
+
+public class InsufficientVirtualNetworkCapcityException extends InsufficientCapacityException {
+ private static final long serialVersionUID = SerialVersionUID.InsufficientCapacityException;
+
+ public InsufficientVirtualNetworkCapcityException(String msg) {
+ super(msg);
+ }
+}
diff --git a/utils/src/com/cloud/utils/db/DataStore.java b/core/src/com/cloud/exception/InternalErrorException.java
similarity index 74%
rename from utils/src/com/cloud/utils/db/DataStore.java
rename to core/src/com/cloud/exception/InternalErrorException.java
index 071322f35fd..9acc31ded00 100644
--- a/utils/src/com/cloud/utils/db/DataStore.java
+++ b/core/src/com/cloud/exception/InternalErrorException.java
@@ -1,7 +1,7 @@
/**
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
*
- * This software is licensed under the GNU General Public License v3 or later.
+ * This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -15,13 +15,18 @@
* along with this program. If not, see .
*
*/
-package com.cloud.utils.db;
-import java.util.HashMap;
-import java.util.Map;
+package com.cloud.exception;
+
+public class InternalErrorException extends ManagementServerException {
+
+
+ private static final long serialVersionUID = -3070582946175427902L;
+
+ public InternalErrorException(String message) {
+ super(message);
+ }
+
+
-public class DataStore {
-
- private final static Map, GenericDao, ?>> s_daos = new HashMap, GenericDao, ?>>(101);
-
}
diff --git a/core/src/com/cloud/exception/InvalidParameterValueException.java b/core/src/com/cloud/exception/InvalidParameterValueException.java
new file mode 100644
index 00000000000..e6b2dcd2a4a
--- /dev/null
+++ b/core/src/com/cloud/exception/InvalidParameterValueException.java
@@ -0,0 +1,34 @@
+/**
+ * Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
+ *
+ * This software is licensed under the GNU General Public License v3 or later.
+ *
+ * It is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+package com.cloud.exception;
+
+/**
+ * @author chiradeep
+ *
+ */
+public class InvalidParameterValueException extends ManagementServerException {
+
+ private static final long serialVersionUID = -2232066904895010203L;
+
+ public InvalidParameterValueException(String message) {
+ super(message);
+
+ }
+
+}
diff --git a/core/src/com/cloud/exception/ManagementServerException.java b/core/src/com/cloud/exception/ManagementServerException.java
new file mode 100644
index 00000000000..41ba73d138a
--- /dev/null
+++ b/core/src/com/cloud/exception/ManagementServerException.java
@@ -0,0 +1,44 @@
+/**
+ * Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
+ *
+ * This software is licensed under the GNU General Public License v3 or later.
+ *
+ * It is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+package com.cloud.exception;
+
+import com.cloud.utils.SerialVersionUID;
+
+/**
+ * @author chiradeep
+ *
+ */
+public class ManagementServerException extends Exception {
+
+
+ private static final long serialVersionUID = SerialVersionUID.ManagementServerException;
+
+
+ public ManagementServerException() {
+
+ }
+
+
+ public ManagementServerException(String message) {
+ super(message);
+ }
+
+
+
+
+}
diff --git a/utils/src/com/cloud/utils/db/DaoSearch.java b/core/src/com/cloud/exception/NetworkRuleConflictException.java
similarity index 73%
rename from utils/src/com/cloud/utils/db/DaoSearch.java
rename to core/src/com/cloud/exception/NetworkRuleConflictException.java
index bfe1536cdf3..fe8781b4487 100644
--- a/utils/src/com/cloud/utils/db/DaoSearch.java
+++ b/core/src/com/cloud/exception/NetworkRuleConflictException.java
@@ -1,7 +1,7 @@
/**
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
*
- * This software is licensed under the GNU General Public License v3 or later.
+ * This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -15,7 +15,16 @@
* along with this program. If not, see .
*
*/
-package com.cloud.utils.db;
-public interface DaoSearch {
+package com.cloud.exception;
+
+public class NetworkRuleConflictException extends
+ ManagementServerException {
+
+ private static final long serialVersionUID = -294905017911859479L;
+
+ public NetworkRuleConflictException(String message) {
+ super(message);
+ }
+
}
diff --git a/core/src/com/cloud/exception/PermissionDeniedException.java b/core/src/com/cloud/exception/PermissionDeniedException.java
new file mode 100644
index 00000000000..25f02f57fc0
--- /dev/null
+++ b/core/src/com/cloud/exception/PermissionDeniedException.java
@@ -0,0 +1,33 @@
+/**
+ * Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
+ *
+ * This software is licensed under the GNU General Public License v3 or later.
+ *
+ * It is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+package com.cloud.exception;
+
+/**
+ * @author chiradeep
+ *
+ */
+public class PermissionDeniedException extends ManagementServerException {
+
+ private static final long serialVersionUID = -4631412831814398074L;
+
+ public PermissionDeniedException(String message) {
+ super(message);
+ // TODO Auto-generated constructor stub
+ }
+
+}
diff --git a/core/src/com/cloud/exception/ResourceAllocationException.java b/core/src/com/cloud/exception/ResourceAllocationException.java
new file mode 100644
index 00000000000..be0c2bb7c72
--- /dev/null
+++ b/core/src/com/cloud/exception/ResourceAllocationException.java
@@ -0,0 +1,38 @@
+/**
+ * Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
+ *
+ * This software is licensed under the GNU General Public License v3 or later.
+ *
+ * It is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+package com.cloud.exception;
+
+public class ResourceAllocationException extends ManagementServerException {
+
+ private static final long serialVersionUID = -2232066904895010203L;
+ private String resourceType;
+
+ public ResourceAllocationException(String message) {
+ super(message);
+ }
+
+ public void setResourceType(String resourceType) {
+ this.resourceType = resourceType;
+ }
+
+ public String getResourceType() {
+ return this.resourceType;
+ }
+
+}
diff --git a/core/src/com/cloud/exception/ResourceInUseException.java b/core/src/com/cloud/exception/ResourceInUseException.java
new file mode 100644
index 00000000000..d622b4cc924
--- /dev/null
+++ b/core/src/com/cloud/exception/ResourceInUseException.java
@@ -0,0 +1,56 @@
+/**
+ * Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
+ *
+ * This software is licensed under the GNU General Public License v3 or later.
+ *
+ * It is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+package com.cloud.exception;
+
+/**
+ * @author chiradeep
+ *
+ */
+public class ResourceInUseException extends ManagementServerException {
+
+ private static final long serialVersionUID = 1383416910411639324L;
+ private String resourceType;
+ private String resourceName;
+
+ public ResourceInUseException(String message) {
+ super(message);
+ }
+
+ public ResourceInUseException(String message, String resourceType,
+ String resourceName) {
+ super(message);
+ this.resourceType = resourceType;
+ this.resourceName = resourceName;
+ }
+
+ public void setResourceType(String resourceType) {
+ this.resourceType = resourceType;
+ }
+
+ public String getResourceType() {
+ return this.resourceType;
+ }
+
+ public void setResourceName(String resourceName) {
+ this.resourceName = resourceName;
+ }
+
+ public String getResourceName() {
+ return resourceName;
+ }
+}
diff --git a/core/src/com/cloud/exception/StorageUnavailableException.java b/core/src/com/cloud/exception/StorageUnavailableException.java
new file mode 100644
index 00000000000..d6ed0265d88
--- /dev/null
+++ b/core/src/com/cloud/exception/StorageUnavailableException.java
@@ -0,0 +1,37 @@
+/**
+ * Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
+ *
+ * This software is licensed under the GNU General Public License v3 or later.
+ *
+ * It is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+package com.cloud.exception;
+
+import com.cloud.utils.SerialVersionUID;
+
+/**
+ * This exception is thrown when the storage device can not be reached.
+ *
+ */
+public class StorageUnavailableException extends AgentUnavailableException {
+
+ private static final long serialVersionUID = SerialVersionUID.StorageUnavailableException;
+
+ public StorageUnavailableException(long hostId) {
+ super(hostId);
+ }
+
+ public StorageUnavailableException(String msg) {
+ super(msg, -1);
+ }
+}
diff --git a/core/src/com/cloud/exception/UnableToExecuteException.java b/core/src/com/cloud/exception/UnableToExecuteException.java
new file mode 100755
index 00000000000..0bba6b0dd5e
--- /dev/null
+++ b/core/src/com/cloud/exception/UnableToExecuteException.java
@@ -0,0 +1,55 @@
+/**
+ * Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
+ *
+ * This software is licensed under the GNU General Public License v3 or later.
+ *
+ * It is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+package com.cloud.exception;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+import com.cloud.utils.SerialVersionUID;
+
+public class UnableToExecuteException extends Exception {
+ private static final long serialVersionUID = SerialVersionUID.UnableToExecuteException;
+
+ Command _cmd;
+ Answer _answer;
+
+ public UnableToExecuteException(Command cmd, String msg) {
+ this(cmd, msg, null);
+ }
+
+ public UnableToExecuteException(Command cmd, String msg, Throwable cause) {
+ this(cmd, null, msg, cause);
+ }
+
+ public UnableToExecuteException(Command cmd, Answer answer, String msg, Throwable cause) {
+ super(msg, cause);
+ _cmd = cmd;
+ _answer = answer;
+ }
+
+ public Command getCommand() {
+ return _cmd;
+ }
+
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("Msg: ").append(getMessage()).append("; ");
+ builder.append("Cmd: ").append(_cmd.toString()).append("; ");
+ builder.append("Ans: ").append(_answer != null ? _answer.toString() : "").append("; ");
+ return builder.toString();
+ }
+}
diff --git a/core/src/com/cloud/ha/dao/HighAvailabilityDaoImpl.java b/core/src/com/cloud/ha/dao/HighAvailabilityDaoImpl.java
index 9d5e5c85773..ec4492aeb2a 100644
--- a/core/src/com/cloud/ha/dao/HighAvailabilityDaoImpl.java
+++ b/core/src/com/cloud/ha/dao/HighAvailabilityDaoImpl.java
@@ -89,7 +89,7 @@ public class HighAvailabilityDaoImpl extends GenericDaoBase implem
public WorkVO take(final long serverId) {
final Transaction txn = Transaction.currentTxn();
try {
- final SearchCriteria sc = TBASearch.create();
+ final SearchCriteria sc = TBASearch.create();
sc.setParameters("time", System.currentTimeMillis() >> 10);
final Filter filter = new Filter(WorkVO.class, null, true, 0l, 1l);
@@ -118,14 +118,14 @@ public class HighAvailabilityDaoImpl extends GenericDaoBase implem
@Override
public List findPreviousHA(final long instanceId) {
- final SearchCriteria sc = PreviousInstanceSearch.create();
+ final SearchCriteria sc = PreviousInstanceSearch.create();
sc.setParameters("instance", instanceId);
return listBy(sc);
}
@Override
public void cleanup(final long time) {
- final SearchCriteria sc = CleanupSearch.create();
+ final SearchCriteria sc = CleanupSearch.create();
sc.setParameters("time", time);
sc.setParameters("step", HighAvailabilityManager.Step.Done, HighAvailabilityManager.Step.Cancelled);
delete(sc);
@@ -133,7 +133,7 @@ public class HighAvailabilityDaoImpl extends GenericDaoBase implem
@Override
public void deleteMigrationWorkItems(final long hostId, final WorkType type, final long serverId) {
- final SearchCriteria sc = UntakenMigrationSearch.create();
+ final SearchCriteria sc = UntakenMigrationSearch.create();
sc.setParameters("host", hostId);
sc.setParameters("type", type.toString());
@@ -148,7 +148,7 @@ public class HighAvailabilityDaoImpl extends GenericDaoBase implem
@Override
public List findTakenWorkItems(WorkType type) {
- SearchCriteria sc = TakenWorkSearch.create();
+ SearchCriteria sc = TakenWorkSearch.create();
sc.setParameters("type", type);
sc.setParameters("step", Step.Done, Step.Cancelled, Step.Error);
@@ -158,7 +158,7 @@ public class HighAvailabilityDaoImpl extends GenericDaoBase implem
@Override
public boolean delete(long instanceId, WorkType type) {
- SearchCriteria sc = PreviousWorkSearch.create();
+ SearchCriteria sc = PreviousWorkSearch.create();
sc.setParameters("instance", instanceId);
sc.setParameters("type", type);
return delete(sc) > 0;
@@ -166,7 +166,7 @@ public class HighAvailabilityDaoImpl extends GenericDaoBase implem
@Override
public boolean hasBeenScheduled(long instanceId, WorkType type) {
- SearchCriteria sc = PreviousWorkSearch.create();
+ SearchCriteria sc = PreviousWorkSearch.create();
sc.setParameters("instance", instanceId);
sc.setParameters("type", type);
return listActiveBy(sc, null).size() > 0;
diff --git a/core/src/com/cloud/host/HostVO.java b/core/src/com/cloud/host/HostVO.java
index c6c05672bac..c26f998e0fe 100644
--- a/core/src/com/cloud/host/HostVO.java
+++ b/core/src/com/cloud/host/HostVO.java
@@ -315,6 +315,9 @@ public class HostVO implements Host {
@Column(name="version")
private String version;
+ @Column(name="sequence")
+ private long sequence;
+
@Column(name=GenericDao.CREATED_COLUMN)
private Date created;
@@ -326,6 +329,7 @@ public class HostVO implements Host {
this.status = Status.Up;
this.totalMemory = 0;
this.dom0MinMemory = 0;
+ this.sequence = 1;
}
protected HostVO() {
@@ -421,6 +425,10 @@ public class HostVO implements Host {
this.storageUrl = url;
}
+ public long getSequence() {
+ return sequence;
+ }
+
public void setPodId(Long podId) {
this.podId = podId;
diff --git a/core/src/com/cloud/host/Status.java b/core/src/com/cloud/host/Status.java
index 5adf487445e..30274622d27 100644
--- a/core/src/com/cloud/host/Status.java
+++ b/core/src/com/cloud/host/Status.java
@@ -167,7 +167,6 @@ public enum Status {
s_fsm.addTransition(Status.Disconnected, Event.Ping, Status.Up);
s_fsm.addTransition(Status.Disconnected, Event.ManagementServerDown, Status.Disconnected);
s_fsm.addTransition(Status.Disconnected, Event.WaitedTooLong, Status.Alert);
- s_fsm.addTransition(Status.Disconnected, Event.Remove, Status.Removed);
s_fsm.addTransition(Status.Down, Event.MaintenanceRequested, Status.PrepareForMaintenance);
s_fsm.addTransition(Status.Down, Event.AgentConnected, Status.Connecting);
s_fsm.addTransition(Status.Down, Event.Remove, Status.Removed);
diff --git a/core/src/com/cloud/host/VmHostVO.java b/core/src/com/cloud/host/VmHostVO.java
new file mode 100755
index 00000000000..c70562fae7b
--- /dev/null
+++ b/core/src/com/cloud/host/VmHostVO.java
@@ -0,0 +1,85 @@
+/**
+ * Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
+ *
+ * This software is licensed under the GNU General Public License v3 or later.
+ *
+ * It is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+package com.cloud.host;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "op_vm_host")
+public class VmHostVO {
+ @Id
+ @Column(name = "id", updatable = false, nullable = false)
+ long id;
+
+ @Column(name = "vnc_ports", nullable = false)
+ long vncPorts;
+
+ @Column(name = "start_at", nullable = false)
+ int startAt;
+
+ public VmHostVO(long id, long vncPorts, int startAt) {
+ super();
+ this.id = id;
+ this.vncPorts = vncPorts;
+ this.startAt = startAt;
+ }
+
+ protected VmHostVO() {
+ }
+
+ public VmHostVO(long id, int[] vncPorts) {
+ this.id = id;
+
+ for (int port : vncPorts) {
+ this.vncPorts = markPortUsed(this.vncPorts, port);
+ }
+ }
+
+ public long getVncPorts() {
+ return vncPorts;
+ }
+
+ public void setVncPorts(long vncPorts) {
+ this.vncPorts = vncPorts;
+ }
+
+ public int getStartAt() {
+ return startAt;
+ }
+
+ public void setStartAt(int startAt) {
+ this.startAt = startAt;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public static long markPortAvailable(long ports, int port) {
+ assert (port < 63) : "Only supports 63 ports";
+ return ports & ~(1l << port);
+ }
+
+ public static long markPortUsed(long ports, int port) {
+ assert (port < 63) : "Only supports 63 ports";
+ return ports | (1l << port);
+ }
+}
diff --git a/core/src/com/cloud/host/dao/DetailsDaoImpl.java b/core/src/com/cloud/host/dao/DetailsDaoImpl.java
index 6bd554b683d..d624d1d9d3d 100644
--- a/core/src/com/cloud/host/dao/DetailsDaoImpl.java
+++ b/core/src/com/cloud/host/dao/DetailsDaoImpl.java
@@ -47,7 +47,7 @@ public class DetailsDaoImpl extends GenericDaoBase implements De
@Override
public DetailVO findDetail(long hostId, String name) {
- SearchCriteria sc = DetailSearch.create();
+ SearchCriteria sc = DetailSearch.create();
sc.setParameters("hostId", hostId);
sc.setParameters("name", name);
@@ -56,7 +56,7 @@ public class DetailsDaoImpl extends GenericDaoBase implements De
@Override
public Map findDetails(long hostId) {
- SearchCriteria sc = HostSearch.create();
+ SearchCriteria sc = HostSearch.create();
sc.setParameters("hostId", hostId);
List results = search(sc, null);
@@ -71,7 +71,7 @@ public class DetailsDaoImpl extends GenericDaoBase implements De
public void persist(long hostId, Map details) {
Transaction txn = Transaction.currentTxn();
txn.start();
- SearchCriteria sc = HostSearch.create();
+ SearchCriteria sc = HostSearch.create();
sc.setParameters("hostId", hostId);
delete(sc);
diff --git a/core/src/com/cloud/host/dao/HostDaoImpl.java b/core/src/com/cloud/host/dao/HostDaoImpl.java
index a58178f9c36..9368812718f 100644
--- a/core/src/com/cloud/host/dao/HostDaoImpl.java
+++ b/core/src/com/cloud/host/dao/HostDaoImpl.java
@@ -14,14 +14,15 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
- */
-package com.cloud.host.dao;
-
+ */
+package com.cloud.host.dao;
+
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
@@ -44,144 +45,145 @@ import com.cloud.utils.db.Attribute;
import com.cloud.utils.db.DB;
import com.cloud.utils.db.Filter;
import com.cloud.utils.db.GenericDaoBase;
-import com.cloud.utils.db.GenericSearchBuilder;
import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
import com.cloud.utils.db.Transaction;
import com.cloud.utils.db.UpdateBuilder;
import com.cloud.utils.db.SearchCriteria.Func;
-import com.cloud.utils.exception.CloudRuntimeException;
-
+
@Local(value = { HostDao.class }) @DB(txn=false)
-@TableGenerator(name="host_req_sq", table="op_host", pkColumnName="id", valueColumnName="sequence", allocationSize=1)
-public class HostDaoImpl extends GenericDaoBase implements HostDao {
+@TableGenerator(name="host_req_sq", table="host", pkColumnName="id", valueColumnName="sequence", allocationSize=1)
+public class HostDaoImpl extends GenericDaoBase implements HostDao {
private static final Logger s_logger = Logger.getLogger(HostDaoImpl.class);
-
- protected final SearchBuilder TypePodDcStatusSearch;
-
- protected final SearchBuilder IdStatusSearch;
- protected final SearchBuilder TypeDcSearch;
- protected final SearchBuilder TypeDcStatusSearch;
- protected final SearchBuilder LastPingedSearch;
- protected final SearchBuilder LastPingedSearch2;
- protected final SearchBuilder MsStatusSearch;
- protected final SearchBuilder DcPrivateIpAddressSearch;
- protected final SearchBuilder DcStorageIpAddressSearch;
-
- protected final SearchBuilder GuidSearch;
- protected final SearchBuilder DcSearch;
- protected final SearchBuilder PodSearch;
- protected final SearchBuilder TypeSearch;
- protected final SearchBuilder StatusSearch;
- protected final SearchBuilder NameLikeSearch;
- protected final SearchBuilder SequenceSearch;
+ protected final VmHostDaoImpl _vmHostDao;
+
+ protected final SearchBuilder TypePodDcStatusSearch;
+
+ protected final SearchBuilder IdStatusSearch;
+ protected final SearchBuilder TypeDcSearch;
+ protected final SearchBuilder TypeDcStatusSearch;
+ protected final SearchBuilder LastPingedSearch;
+ protected final SearchBuilder LastPingedSearch2;
+ protected final SearchBuilder MsStatusSearch;
+ protected final SearchBuilder DcPrivateIpAddressSearch;
+ protected final SearchBuilder DcStorageIpAddressSearch;
+
+ protected final SearchBuilder GuidSearch;
+ protected final SearchBuilder DcSearch;
+ protected final SearchBuilder PodSearch;
+ protected final SearchBuilder TypeSearch;
+ protected final SearchBuilder StatusSearch;
+ protected final SearchBuilder NameLikeSearch;
+ protected final SearchBuilder SequenceSearch;
protected final SearchBuilder DirectlyConnectedSearch;
protected final SearchBuilder UnmanagedDirectConnectSearch;
- protected final GenericSearchBuilder MaintenanceCountSearch;
+ protected final SearchBuilder MaintenanceCountSearch;
protected final SearchBuilder ClusterSearch;
-
- protected final Attribute _statusAttr;
- protected final Attribute _msIdAttr;
- protected final Attribute _pingTimeAttr;
-
- protected final DetailsDaoImpl _detailsDao = ComponentLocator.inject(DetailsDaoImpl.class);
-
- public HostDaoImpl() {
- MaintenanceCountSearch = createSearchBuilder(Long.class);
+ protected final Attribute _statusAttr;
+ protected final Attribute _msIdAttr;
+ protected final Attribute _pingTimeAttr;
+ protected final Attribute _sequenceAttr;
+
+ protected final DetailsDaoImpl _detailsDao = ComponentLocator.inject(DetailsDaoImpl.class);
+
+ public HostDaoImpl() {
+ _vmHostDao = ComponentLocator.inject(VmHostDaoImpl.class);
+
+ MaintenanceCountSearch = createSearchBuilder();
MaintenanceCountSearch.and("pod", MaintenanceCountSearch.entity().getPodId(), SearchCriteria.Op.EQ);
- MaintenanceCountSearch.select(null, Func.COUNT, null);
+ MaintenanceCountSearch.select(Func.COUNT);
MaintenanceCountSearch.and("status", MaintenanceCountSearch.entity().getStatus(), SearchCriteria.Op.IN);
MaintenanceCountSearch.done();
-
- TypePodDcStatusSearch = createSearchBuilder();
- HostVO entity = TypePodDcStatusSearch.entity();
- TypePodDcStatusSearch.and("type", entity.getType(), SearchCriteria.Op.EQ);
- TypePodDcStatusSearch.and("pod", entity.getPodId(), SearchCriteria.Op.EQ);
+
+ TypePodDcStatusSearch = createSearchBuilder();
+ HostVO entity = TypePodDcStatusSearch.entity();
+ TypePodDcStatusSearch.and("type", entity.getType(), SearchCriteria.Op.EQ);
+ TypePodDcStatusSearch.and("pod", entity.getPodId(), SearchCriteria.Op.EQ);
TypePodDcStatusSearch.and("dc", entity.getDataCenterId(), SearchCriteria.Op.EQ);
- TypePodDcStatusSearch.and("cluster", entity.getClusterId(), SearchCriteria.Op.EQ);
- TypePodDcStatusSearch.and("status", entity.getStatus(), SearchCriteria.Op.EQ);
- TypePodDcStatusSearch.done();
-
- LastPingedSearch = createSearchBuilder();
- LastPingedSearch.and("ping", LastPingedSearch.entity().getLastPinged(), SearchCriteria.Op.LT);
- LastPingedSearch.and("state", LastPingedSearch.entity().getStatus(), SearchCriteria.Op.IN);
- LastPingedSearch.done();
-
- LastPingedSearch2 = createSearchBuilder();
- LastPingedSearch2.and("ping", LastPingedSearch2.entity().getLastPinged(), SearchCriteria.Op.LT);
- LastPingedSearch2.and("type", LastPingedSearch2.entity().getType(), SearchCriteria.Op.EQ);
- LastPingedSearch2.done();
-
- MsStatusSearch = createSearchBuilder();
- MsStatusSearch.and("ms", MsStatusSearch.entity().getManagementServerId(), SearchCriteria.Op.EQ);
- MsStatusSearch.and("statuses", MsStatusSearch.entity().getStatus(), SearchCriteria.Op.IN);
- MsStatusSearch.done();
-
- TypeDcSearch = createSearchBuilder();
- TypeDcSearch.and("type", TypeDcSearch.entity().getType(), SearchCriteria.Op.EQ);
- TypeDcSearch.and("dc", TypeDcSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
- TypeDcSearch.done();
-
- TypeDcStatusSearch = createSearchBuilder();
- TypeDcStatusSearch.and("type", TypeDcStatusSearch.entity().getType(), SearchCriteria.Op.EQ);
- TypeDcStatusSearch.and("dc", TypeDcStatusSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
- TypeDcStatusSearch.and("status", TypeDcStatusSearch.entity().getStatus(), SearchCriteria.Op.EQ);
- TypeDcStatusSearch.done();
-
- IdStatusSearch = createSearchBuilder();
- IdStatusSearch.and("id", IdStatusSearch.entity().getId(), SearchCriteria.Op.EQ);
- IdStatusSearch.and("states", IdStatusSearch.entity().getStatus(), SearchCriteria.Op.IN);
- IdStatusSearch.done();
-
- DcPrivateIpAddressSearch = createSearchBuilder();
- DcPrivateIpAddressSearch.and("privateIpAddress", DcPrivateIpAddressSearch.entity().getPrivateIpAddress(), SearchCriteria.Op.EQ);
- DcPrivateIpAddressSearch.and("dc", DcPrivateIpAddressSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
- DcPrivateIpAddressSearch.done();
-
- DcStorageIpAddressSearch = createSearchBuilder();
- DcStorageIpAddressSearch.and("storageIpAddress", DcStorageIpAddressSearch.entity().getStorageIpAddress(), SearchCriteria.Op.EQ);
- DcStorageIpAddressSearch.and("dc", DcStorageIpAddressSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
- DcStorageIpAddressSearch.done();
-
- GuidSearch = createSearchBuilder();
- GuidSearch.and("guid", GuidSearch.entity().getGuid(), SearchCriteria.Op.EQ);
- GuidSearch.done();
-
- DcSearch = createSearchBuilder();
- DcSearch.and("dc", DcSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+ TypePodDcStatusSearch.and("cluster", entity.getClusterId(), SearchCriteria.Op.EQ);
+ TypePodDcStatusSearch.and("status", entity.getStatus(), SearchCriteria.Op.EQ);
+ TypePodDcStatusSearch.done();
+
+ LastPingedSearch = createSearchBuilder();
+ LastPingedSearch.and("ping", LastPingedSearch.entity().getLastPinged(), SearchCriteria.Op.LT);
+ LastPingedSearch.and("state", LastPingedSearch.entity().getStatus(), SearchCriteria.Op.IN);
+ LastPingedSearch.done();
+
+ LastPingedSearch2 = createSearchBuilder();
+ LastPingedSearch2.and("ping", LastPingedSearch2.entity().getLastPinged(), SearchCriteria.Op.LT);
+ LastPingedSearch2.and("type", LastPingedSearch2.entity().getType(), SearchCriteria.Op.EQ);
+ LastPingedSearch2.done();
+
+ MsStatusSearch = createSearchBuilder();
+ MsStatusSearch.and("ms", MsStatusSearch.entity().getManagementServerId(), SearchCriteria.Op.EQ);
+ MsStatusSearch.and("statuses", MsStatusSearch.entity().getStatus(), SearchCriteria.Op.IN);
+ MsStatusSearch.done();
+
+ TypeDcSearch = createSearchBuilder();
+ TypeDcSearch.and("type", TypeDcSearch.entity().getType(), SearchCriteria.Op.EQ);
+ TypeDcSearch.and("dc", TypeDcSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+ TypeDcSearch.done();
+
+ TypeDcStatusSearch = createSearchBuilder();
+ TypeDcStatusSearch.and("type", TypeDcStatusSearch.entity().getType(), SearchCriteria.Op.EQ);
+ TypeDcStatusSearch.and("dc", TypeDcStatusSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+ TypeDcStatusSearch.and("status", TypeDcStatusSearch.entity().getStatus(), SearchCriteria.Op.EQ);
+ TypeDcStatusSearch.done();
+
+ IdStatusSearch = createSearchBuilder();
+ IdStatusSearch.and("id", IdStatusSearch.entity().getId(), SearchCriteria.Op.EQ);
+ IdStatusSearch.and("states", IdStatusSearch.entity().getStatus(), SearchCriteria.Op.IN);
+ IdStatusSearch.done();
+
+ DcPrivateIpAddressSearch = createSearchBuilder();
+ DcPrivateIpAddressSearch.and("privateIpAddress", DcPrivateIpAddressSearch.entity().getPrivateIpAddress(), SearchCriteria.Op.EQ);
+ DcPrivateIpAddressSearch.and("dc", DcPrivateIpAddressSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+ DcPrivateIpAddressSearch.done();
+
+ DcStorageIpAddressSearch = createSearchBuilder();
+ DcStorageIpAddressSearch.and("storageIpAddress", DcStorageIpAddressSearch.entity().getStorageIpAddress(), SearchCriteria.Op.EQ);
+ DcStorageIpAddressSearch.and("dc", DcStorageIpAddressSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+ DcStorageIpAddressSearch.done();
+
+ GuidSearch = createSearchBuilder();
+ GuidSearch.and("guid", GuidSearch.entity().getGuid(), SearchCriteria.Op.EQ);
+ GuidSearch.done();
+
+ DcSearch = createSearchBuilder();
+ DcSearch.and("dc", DcSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
DcSearch.done();
ClusterSearch = createSearchBuilder();
ClusterSearch.and("cluster", ClusterSearch.entity().getClusterId(), SearchCriteria.Op.EQ);
- ClusterSearch.done();
-
- PodSearch = createSearchBuilder();
- PodSearch.and("pod", PodSearch.entity().getPodId(), SearchCriteria.Op.EQ);
- PodSearch.done();
-
- TypeSearch = createSearchBuilder();
- TypeSearch.and("type", TypeSearch.entity().getType(), SearchCriteria.Op.EQ);
- TypeSearch.done();
-
- StatusSearch =createSearchBuilder();
- StatusSearch.and("status", StatusSearch.entity().getStatus(), SearchCriteria.Op.IN);
- StatusSearch.done();
-
- NameLikeSearch = createSearchBuilder();
- NameLikeSearch.and("name", NameLikeSearch.entity().getName(), SearchCriteria.Op.LIKE);
- NameLikeSearch.done();
-
- SequenceSearch = createSearchBuilder();
- SequenceSearch.and("id", SequenceSearch.entity().getId(), SearchCriteria.Op.EQ);
-// SequenceSearch.addRetrieve("sequence", SequenceSearch.entity().getSequence());
- SequenceSearch.done();
-
- DirectlyConnectedSearch = createSearchBuilder();
- DirectlyConnectedSearch.and("resource", DirectlyConnectedSearch.entity().getResource(), SearchCriteria.Op.NNULL);
+ ClusterSearch.done();
+
+ PodSearch = createSearchBuilder();
+ PodSearch.and("pod", PodSearch.entity().getPodId(), SearchCriteria.Op.EQ);
+ PodSearch.done();
+
+ TypeSearch = createSearchBuilder();
+ TypeSearch.and("type", TypeSearch.entity().getType(), SearchCriteria.Op.EQ);
+ TypeSearch.done();
+
+ StatusSearch =createSearchBuilder();
+ StatusSearch.and("status", StatusSearch.entity().getStatus(), SearchCriteria.Op.IN);
+ StatusSearch.done();
+
+ NameLikeSearch = createSearchBuilder();
+ NameLikeSearch.and("name", NameLikeSearch.entity().getName(), SearchCriteria.Op.LIKE);
+ NameLikeSearch.done();
+
+ SequenceSearch = createSearchBuilder();
+ SequenceSearch.and("id", SequenceSearch.entity().getId(), SearchCriteria.Op.EQ);
+// SequenceSearch.addRetrieve("sequence", SequenceSearch.entity().getSequence());
+ SequenceSearch.done();
+
+ DirectlyConnectedSearch = createSearchBuilder();
+ DirectlyConnectedSearch.and("resource", DirectlyConnectedSearch.entity().getResource(), SearchCriteria.Op.NNULL);
DirectlyConnectedSearch.done();
- UnmanagedDirectConnectSearch = createSearchBuilder();
+ UnmanagedDirectConnectSearch = createSearchBuilder();
UnmanagedDirectConnectSearch.and("resource", UnmanagedDirectConnectSearch.entity().getResource(), SearchCriteria.Op.NNULL);
UnmanagedDirectConnectSearch.and("server", UnmanagedDirectConnectSearch.entity().getManagementServerId(), SearchCriteria.Op.NULL);
/*
@@ -191,404 +193,402 @@ public class HostDaoImpl extends GenericDaoBase implements HostDao
UnmanagedDirectConnectSearch.cp();
*/
UnmanagedDirectConnectSearch.done();
-
- _statusAttr = _allAttributes.get("status");
- _msIdAttr = _allAttributes.get("managementServerId");
- _pingTimeAttr = _allAttributes.get("lastPinged");
-
- assert (_statusAttr != null && _msIdAttr != null && _pingTimeAttr != null) : "Couldn't find one of these attributes";
+
+ _statusAttr = _allAttributes.get("status");
+ _msIdAttr = _allAttributes.get("managementServerId");
+ _pingTimeAttr = _allAttributes.get("lastPinged");
+ _sequenceAttr = _allAttributes.get("sequence");
+
+ assert (_statusAttr != null && _msIdAttr != null && _pingTimeAttr != null && _sequenceAttr != null) : "Couldn't find one of these attributes";
}
@Override
public long countBy(long podId, Status... statuses) {
- SearchCriteria sc = MaintenanceCountSearch.create();
+ SearchCriteria sc = MaintenanceCountSearch.create();
sc.setParameters("status", (Object[])statuses);
sc.setParameters("pod", podId);
- List rs = searchAll(sc, null);
+ List