mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Branch 2.1.refactor committed
This commit is contained in:
parent
05c020e1f6
commit
ac730ec496
381
HACKING
381
HACKING
@ -165,14 +165,11 @@ independently from the install directory:
|
|||||||
from happening. Or resort to the override method discussed
|
from happening. Or resort to the override method discussed
|
||||||
above (search for "override" in this document).
|
above (search for "override" in this document).
|
||||||
|
|
||||||
2) If you haven't done so yet, set the Agent up:
|
2) If you haven't done so yet, set the Console Proxy up:
|
||||||
|
|
||||||
- run $BINDIR/cloud-setup-agent
|
- run $BINDIR/cloud-setup-agent
|
||||||
|
|
||||||
3) Execute ./waf run_agent as root
|
3) Execute $LIBEXECDIR/agent-runner as root
|
||||||
|
|
||||||
this will launch sudo and require your root password unless you have
|
|
||||||
set sudo up not to ask for it
|
|
||||||
|
|
||||||
|
|
||||||
- Console Proxy (Linux-only):
|
- Console Proxy (Linux-only):
|
||||||
@ -190,183 +187,7 @@ independently from the install directory:
|
|||||||
|
|
||||||
- run $BINDIR/cloud-setup-console-proxy
|
- run $BINDIR/cloud-setup-console-proxy
|
||||||
|
|
||||||
3) Execute ./waf run_console_proxy
|
3) Execute $LIBEXECDIR/console-proxy-runner as root
|
||||||
|
|
||||||
this will launch sudo and require your root password unless you have
|
|
||||||
set sudo up not to ask for it
|
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
BUILD SYSTEM TIPS
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
=== Integrating compilation and execution of each component into Eclipse ===
|
|
||||||
|
|
||||||
To run the Management Server from Eclipse, set up an External Tool of the
|
|
||||||
Program variety. Put the path to the waf binary in the Location of the
|
|
||||||
window, and the source directory as Working Directory. Then specify
|
|
||||||
"install --preserve-config run" as arguments (without the quotes). You can
|
|
||||||
now use the Run button in Eclipse to execute the Management Server directly
|
|
||||||
from Eclipse. You can replace run with debug if you want to run the
|
|
||||||
Management Server with the Debugging Proxy turned on.
|
|
||||||
|
|
||||||
To run the Agent or Console Proxy from Eclipse, set up an External Tool of
|
|
||||||
the Program variety just like in the Management Server case. In there,
|
|
||||||
however, specify "install --preserve-config run_agent" or
|
|
||||||
"install --preserve-config run_console_proxy" as arguments instead.
|
|
||||||
Remember that you need to set sudo up to not ask you for a password and not
|
|
||||||
require a TTY, otherwise sudo -- implicitly called by waf run_agent or
|
|
||||||
waf run_console_proxy -- will refuse to work.
|
|
||||||
|
|
||||||
|
|
||||||
=== Building targets selectively ===
|
|
||||||
|
|
||||||
You can find out the targets of the build system:
|
|
||||||
|
|
||||||
./waf list_targets
|
|
||||||
|
|
||||||
If you want to run a specific task generator,
|
|
||||||
|
|
||||||
./waf build --targets=patchsubst
|
|
||||||
|
|
||||||
should run just that one (and whatever targets are required to build that
|
|
||||||
one, of course).
|
|
||||||
|
|
||||||
|
|
||||||
=== Common targets ===
|
|
||||||
|
|
||||||
* ./waf configure: you must always run configure once, and provide it with
|
|
||||||
the target installation paths for when you run install later
|
|
||||||
o --help: will show you all the configure options
|
|
||||||
o --no-dep-check: will skip dependency checks for java packages
|
|
||||||
needed to compile (saves 20 seconds when redoing the configure)
|
|
||||||
o --with-db-user, --with-db-pw, --with-db-host: informs the build
|
|
||||||
system of the MySQL configuration needed to set up the management
|
|
||||||
server upon install, and to do deploydb
|
|
||||||
|
|
||||||
* ./waf build: will compile any source files (and, on some projects, will
|
|
||||||
also perform any variable substitutions on any .in files such as the
|
|
||||||
MANIFEST files). Build outputs will be in <projectdir>/artifacts/default.
|
|
||||||
|
|
||||||
* ./waf install: will compile if not compiled yet, then execute an install
|
|
||||||
of the built targets. I had to write a significantly large amount of code
|
|
||||||
(that is, couple tens of lines of code) to make install work.
|
|
||||||
|
|
||||||
* ./waf run: will run the management server in the foreground
|
|
||||||
|
|
||||||
* ./waf debug: will run the management server in the foreground, and open
|
|
||||||
port 8787 to connect with the debugger (see the Run / debug options of
|
|
||||||
waf --help to change that port)
|
|
||||||
|
|
||||||
* ./waf deploydb: deploys the database using the MySQL configuration supplied
|
|
||||||
with the configuration options when you did ./waf configure. RUN WAF BUILD
|
|
||||||
FIRST AT LEAST ONCE.
|
|
||||||
|
|
||||||
* ./waf dist: create a source tarball. These tarballs will be distributed
|
|
||||||
independently on our Web site, and will form the source release of the
|
|
||||||
Cloud Stack. It is a self-contained release that can be ./waf built and
|
|
||||||
./waf installed everywhere.
|
|
||||||
|
|
||||||
* ./waf clean: remove known build products
|
|
||||||
|
|
||||||
* ./waf distclean: remove the artifacts/ directory altogether
|
|
||||||
|
|
||||||
* ./waf uninstall: uninstall all installed files
|
|
||||||
|
|
||||||
* ./waf rpm: build RPM packages
|
|
||||||
o if the build fails because the system lacks dependencies from our
|
|
||||||
other modules, waf will attempt to install RPMs from the repos,
|
|
||||||
then try the build
|
|
||||||
o it will place the built packages in artifacts/rpmbuild/
|
|
||||||
|
|
||||||
* ./waf deb: build Debian packages
|
|
||||||
o if the build fails because the system lacks dependencies from our
|
|
||||||
other modules, waf will attempt to install DEBs from the repos,
|
|
||||||
then try the build
|
|
||||||
o it will place the built packages in artifacts/debbuild/
|
|
||||||
|
|
||||||
* ./waf uninstallrpms: removes all Cloud.com RPMs from a system (but not
|
|
||||||
logfiles or modified config files)
|
|
||||||
|
|
||||||
* ./waf viewrpmdeps: displays RPM dependencies declared in the RPM specfile
|
|
||||||
|
|
||||||
* ./waf installrpmdeps: runs Yum to install the packages required to build
|
|
||||||
the CloudStack
|
|
||||||
|
|
||||||
* ./waf uninstalldebs: removes all Cloud.com DEBs from a system (AND logfiles
|
|
||||||
AND modified config files)
|
|
||||||
* ./waf viewdebdeps: displays DEB dependencies declared in the project
|
|
||||||
debian/control file
|
|
||||||
|
|
||||||
* ./waf installdebdeps: runs aptitude to install the packages required to
|
|
||||||
build our software
|
|
||||||
|
|
||||||
|
|
||||||
=== Overriding certain source files ===
|
|
||||||
|
|
||||||
Earlier in this document we explored overriding configuration files.
|
|
||||||
Overrides are not limited to configuration files.
|
|
||||||
|
|
||||||
If you want to provide your own server-setup.xml or SQL files in client/setup:
|
|
||||||
|
|
||||||
* create a directory override inside the client/setup folder
|
|
||||||
* place your file that should override a file in client/setup there
|
|
||||||
|
|
||||||
There's also override support in client/tomcatconf and agent/conf.
|
|
||||||
|
|
||||||
|
|
||||||
=== Environment substitutions ===
|
|
||||||
|
|
||||||
Any file named "something.in" has its tokens (@SOMETOKEN@) automatically
|
|
||||||
substituted for the corresponding build environment variable. The build
|
|
||||||
environment variables are generally constructed at configure time and
|
|
||||||
controllable by the --command-line-parameters to waf configure, and should
|
|
||||||
be available as a list of variables inside the file
|
|
||||||
artifacts/c4che/build.default.py.
|
|
||||||
|
|
||||||
|
|
||||||
=== The prerelease mechanism ===
|
|
||||||
|
|
||||||
The prerelease mechanism (--prerelease=BRANCHNAME) allows developers and
|
|
||||||
builders to build packages with pre-release Release tags. The Release tags
|
|
||||||
are constructed in such a way that both the build number and the branch name
|
|
||||||
is included, so developers can push these packages to repositories and upgrade
|
|
||||||
them using yum or aptitude without having to delete packages manually and
|
|
||||||
install packages manually every time a new build is done. Any package built
|
|
||||||
with the prerelease mechanism gets a standard X.Y.Z version number -- and,
|
|
||||||
due to the way that the prerelease Release tags are concocted, always upgrades
|
|
||||||
any older prerelease package already present on any system. The prerelease
|
|
||||||
mechanism must never be used to create packages that are intended to be
|
|
||||||
released as stable software to the general public.
|
|
||||||
|
|
||||||
Relevant documentation:
|
|
||||||
|
|
||||||
http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version
|
|
||||||
http://fedoraproject.org/wiki/PackageNamingGuidelines#Pre-Release_packages
|
|
||||||
|
|
||||||
Everything comes together on the build server in the following way:
|
|
||||||
|
|
||||||
|
|
||||||
=== SCCS info ===
|
|
||||||
|
|
||||||
When building a source distribution (waf dist), or RPM/DEB distributions
|
|
||||||
(waf deb / waf rpm), waf will automatically detect the relevant source code
|
|
||||||
control information if the git command is present on the machine where waf
|
|
||||||
is run, and it will write the information to a file called sccs-info inside
|
|
||||||
the source tarball / install it into /usr/share/doc/cloud*/sccs-info when
|
|
||||||
installing the packages.
|
|
||||||
|
|
||||||
If this source code conrol information cannot be calculated, then the old
|
|
||||||
sccs-info file is preserved across dist runs if it exists, and if it did
|
|
||||||
not exist before, the fact that the source could not be properly tracked
|
|
||||||
down to a repository is noted in the file.
|
|
||||||
|
|
||||||
|
|
||||||
=== Debugging the build system ===
|
|
||||||
|
|
||||||
Almost all targets have names. waf build -vvvvv --zones=task will give you
|
|
||||||
the task names that you can use in --targets.
|
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
@ -374,22 +195,6 @@ UNDERSTANDING THE BUILD SYSTEM
|
|||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
=== Documentation for the build system ===
|
|
||||||
|
|
||||||
The first and foremost reference material:
|
|
||||||
|
|
||||||
- http://freehackers.org/~tnagy/wafbook/index.html
|
|
||||||
|
|
||||||
Examples
|
|
||||||
|
|
||||||
- http://code.google.com/p/waf/wiki/CodeSnippets
|
|
||||||
- http://code.google.com/p/waf/w/list
|
|
||||||
|
|
||||||
FAQ
|
|
||||||
|
|
||||||
- http://code.google.com/p/waf/wiki/FAQ
|
|
||||||
|
|
||||||
|
|
||||||
=== Why waf ===
|
=== Why waf ===
|
||||||
|
|
||||||
The CloudStack uses waf to build itself. waf is a relative newcomer
|
The CloudStack uses waf to build itself. waf is a relative newcomer
|
||||||
@ -470,183 +275,3 @@ compile-java macro, waf will automatically pick it up, along with its
|
|||||||
depends= and JAR name attributes. In general, all you need to do is
|
depends= and JAR name attributes. In general, all you need to do is
|
||||||
add the produced JAR name to the packaging manifests (cloud.spec and
|
add the produced JAR name to the packaging manifests (cloud.spec and
|
||||||
debian/{name-of-package}.install).
|
debian/{name-of-package}.install).
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
FOR ANT USERS
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
If you are using Ant directly instead of using waf, these instructions apply to you:
|
|
||||||
|
|
||||||
in this document, the example instructions are based on local source repository rooted at c:\root. You are free to locate it to anywhere you'd like to.
|
|
||||||
3.1 Setup developer build type
|
|
||||||
|
|
||||||
1) Go to c:\cloud\java\build directory
|
|
||||||
|
|
||||||
2) Copy file build-cloud.properties.template to file build-cloud.properties, then modify some of the parameters to match your local setup. The template properties file should have content as
|
|
||||||
|
|
||||||
debug=true
|
|
||||||
debuglevel=lines,vars,source
|
|
||||||
tomcat.home=$TOMCAT_HOME --> change to your local Tomcat root directory such as c:/apache-tomcat-6.0.18
|
|
||||||
debug.jvmarg=-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n
|
|
||||||
deprecation=off
|
|
||||||
build.type=developer
|
|
||||||
target.compat.version=1.5
|
|
||||||
source.compat.version=1.5
|
|
||||||
branding.name=default
|
|
||||||
|
|
||||||
3) Make sure the following Environment variables and Path are set:
|
|
||||||
|
|
||||||
set enviroment variables:
|
|
||||||
CATALINA_HOME:
|
|
||||||
JAVA_HOME:
|
|
||||||
CLOUD_HOME:
|
|
||||||
MYSQL_HOME:
|
|
||||||
|
|
||||||
update the path to include
|
|
||||||
|
|
||||||
MYSQL_HOME\bin
|
|
||||||
|
|
||||||
4) Clone a full directory tree of C:\cloud\java\build\deploy\production to C:\cloud\java\build\deploy\developer
|
|
||||||
|
|
||||||
You can use Windows Explorer to copy the directory tree over. Please note, during your daily development process, whenever you see updates in C:\cloud\java\build\deploy\production, be sure to sync it into C:\cloud\java\build\deploy\developer.
|
|
||||||
3.2 Common build instructions
|
|
||||||
|
|
||||||
After you have setup the build type, you are ready to perform build and run Management Server alone locally.
|
|
||||||
|
|
||||||
cd java
|
|
||||||
python waf configure build install
|
|
||||||
|
|
||||||
More at Build system.
|
|
||||||
|
|
||||||
Will install the management server and its requisites to the appropriate place (your Tomcat instance on Windows, /usr/local on Linux). It will also install the agent to /usr/local/cloud/agent (this will change in the future).
|
|
||||||
4. Database and Server deployment
|
|
||||||
|
|
||||||
After a successful management server build (database deployment scripts use some of the artifacts from build process), you can use database deployment script to deploy and initialize the database. You can find the deployment scripts in C:/cloud/java/build/deploy/db. deploy-db.sh is used to create, populate your DB instance. Please take a look at content of deploy-db.sh for more details
|
|
||||||
|
|
||||||
Before you run the scripts, you should edit C:/cloud/java/build/deploy/developer/db/server-setup-dev.xml to allocate Public and Private IP ranges for your development setup. Ensure that the ranges you pick are unallocated to others.
|
|
||||||
|
|
||||||
Customized VM templates to be populated are in C:/cloud/java/build/deploy/developer/db/templates-dev.sql Edit this file to customize the templates to your needs.
|
|
||||||
|
|
||||||
Deploy the DB by running
|
|
||||||
|
|
||||||
./deploy-db.sh ../developer/db/server-setup-dev.xml ../developer/db/templates-dev.xml
|
|
||||||
4.1. Management Server Deployment
|
|
||||||
|
|
||||||
ant build-server
|
|
||||||
|
|
||||||
Build Management Server
|
|
||||||
|
|
||||||
ant deploy-server
|
|
||||||
|
|
||||||
Deploy Management Server software to Tomcat environment
|
|
||||||
|
|
||||||
ant debug
|
|
||||||
|
|
||||||
Start Management Server in debug mode. The JVM debug options can be found in cloud-build.properties
|
|
||||||
|
|
||||||
ant run
|
|
||||||
|
|
||||||
Start Management Server in normal mode.
|
|
||||||
|
|
||||||
5. Agent deployment
|
|
||||||
|
|
||||||
After a successful build process, you should be able to find build artifacts at distribution directory, in this example case, for developer build type, the artifacts locate at c:\cloud\java\dist\developer, particularly, if you have run
|
|
||||||
|
|
||||||
ant package-agent build command, you should see the agent software be packaged in a single file named agent.zip under c:\cloud\java\dist\developer, together with the agent deployment script deploy-agent.sh.
|
|
||||||
5.1 Agent Type
|
|
||||||
|
|
||||||
Agent software can be deployed and configured to serve with different roles at run time. In current implementation, there are 3 types of agent configuration, respectively called as Computing Server, Routing Server and Storage Server.
|
|
||||||
|
|
||||||
* When agent software is configured to run as Computing server, it is responsible to host user VMs. Agent software should be running in Xen Dom0 system on computer server machine.
|
|
||||||
|
|
||||||
* When agent software is configured to run as Routing Server, it is responsible to host routing VMs for user virtual network and console proxy system VMs. Routing server serves as the bridge to outside network, the machine that agent software is running should have at least two network interfaces, one towards outside network, one participates the internal VMOps management network. Like computer server, agent software on routing server should also be running in Xen Dom0 system.
|
|
||||||
|
|
||||||
* When agent software is configured to run as Storage server, it is responsible to provide storage service for all VMs. The storage service is based on ZFS running on a Solaris system, agent software on storage server is therefore running under Solaris (actually a Solaris VM), Dom0 systems on computing server and routing server can access the storage service through iScsi initiator. The storage volume will be eventually mounted on Dom0 system and make available to DomU VMs through our agent software.
|
|
||||||
|
|
||||||
5.2 Resource sharing
|
|
||||||
|
|
||||||
All developers can share the same set of agent server machines for development, to make this possible, the concept of instance appears in various places
|
|
||||||
|
|
||||||
* VM names. VM names are structual names, it contains a instance section that can identify VMs from different VMOps cloud instances. VMOps cloud instance name is configured in server configuration parameter AgentManager/instance.name
|
|
||||||
* iScsi initiator mount point. For Computing servers and Routing servers, the mount point can distinguish the mounted DomU VM images from different agent deployments. The mount location can be specified in agent.properties file with a name-value pair named mount.parent
|
|
||||||
* iScsi target allocation point. For storage servers, this allocation point can distinguish the storage allocation from different storage agent deployments. The allocation point can be specified in agent.properties file with a name-value pair named parent
|
|
||||||
|
|
||||||
5.4 Deploy agent software
|
|
||||||
|
|
||||||
Before running the deployment scripts, first copy the build artifacts agent.zip and deploy-agent.sh to your personal development directory on agent server machines. By our current convention, you can create your personal development directory that usually locates at /root/your name. In following example, the agent package and deployment scripts are copied to test0.lab.vmops.com and the deployment script file has been marked as executible.
|
|
||||||
|
|
||||||
On build machine,
|
|
||||||
|
|
||||||
scp agent.zip root@test0:/root/your name
|
|
||||||
|
|
||||||
scp deploy-agent.sh root@test0:/root/your name
|
|
||||||
|
|
||||||
On agent server machine
|
|
||||||
|
|
||||||
chmod +x deploy-agent.sh
|
|
||||||
5.4.1 Deploy agent on computing server
|
|
||||||
|
|
||||||
deploy-agent.sh -d /root/<your name>/agent -h <management server IP> -t computing -m expert
|
|
||||||
5.4.2 Deploy agent on routing server
|
|
||||||
|
|
||||||
deploy-agent.sh -d /root/<your name>/agent -h <management server IP> -t routing -m expert
|
|
||||||
5.4.3 Deploy agent on storage server
|
|
||||||
|
|
||||||
deploy-agent.sh -d /root/<your name>/agent -h <management server IP> -t storage -m expert
|
|
||||||
5.5 Configure agent
|
|
||||||
|
|
||||||
After you have deployed the agent software, you should configure the agent by editing the agent.properties file under /root/<your name>/agent/conf directory on each of the Routing, Computing and Storage servers. Add/Edit following properties. The rest are defaults that get populated by the agent at runtime.
|
|
||||||
workers=3
|
|
||||||
host=<replace with your management server IP>
|
|
||||||
port=8250
|
|
||||||
pod=<replace with your pod id>
|
|
||||||
zone=<replace with your zone id>
|
|
||||||
instance=<your unique instance name>
|
|
||||||
developer=true
|
|
||||||
|
|
||||||
Following is a sample agent.properties file for Routing server
|
|
||||||
|
|
||||||
workers=3
|
|
||||||
id=1
|
|
||||||
port=8250
|
|
||||||
pod=RC
|
|
||||||
storage=comstar
|
|
||||||
zone=RC
|
|
||||||
type=routing
|
|
||||||
private.network.nic=xenbr0
|
|
||||||
instance=RC
|
|
||||||
public.network.nic=xenbr1
|
|
||||||
developer=true
|
|
||||||
host=192.168.1.138
|
|
||||||
5.5 Running agent
|
|
||||||
|
|
||||||
Edit /root/<ryour name>/agent/conf/log4j-cloud.xml to update the location of logs to somewhere under /root/<your name>
|
|
||||||
|
|
||||||
Once you have deployed and configured the agent software, you are ready to launch it. Under the agent root directory (in our example, /root/<your name>/agent. there is a scrip file named run.sh, you can use it to launch the agent.
|
|
||||||
|
|
||||||
Launch agent in detached background process
|
|
||||||
|
|
||||||
nohup ./run.sh &
|
|
||||||
|
|
||||||
Launch agent in interactive mode
|
|
||||||
|
|
||||||
./run.sh
|
|
||||||
|
|
||||||
Launch agent in debug mode, for example, following command makes JVM listen at TCP port 8787
|
|
||||||
|
|
||||||
./run.sh -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n
|
|
||||||
|
|
||||||
If agent is launched in debug mode, you may use Eclipse IDE to remotely debug it, please note, when you are sharing agent server machine with others, choose a TCP port that is not in use by someone else.
|
|
||||||
|
|
||||||
Please also note that, run.sh also searches for /etc/cloud directory for agent.properties, make sure it uses the correct agent.properties file!
|
|
||||||
5.5. Stopping the Agents
|
|
||||||
|
|
||||||
the pid of the agent process is in /var/run/agent.<Instance>.pid
|
|
||||||
|
|
||||||
To Stop the agent:
|
|
||||||
|
|
||||||
kill <pid of agent>
|
|
||||||
|
|
||||||
|
|
||||||
155
INSTALL
155
INSTALL
@ -1,155 +0,0 @@
|
|||||||
---------------------------------------------------------------------
|
|
||||||
TABLE OF CONTENTS
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
1. Really quick start: building and installing a production stack
|
|
||||||
2. Post-install: setting the CloudStack components up
|
|
||||||
3. Installation paths: where the stack is installed on your system
|
|
||||||
4. Uninstalling the CloudStack from your system
|
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
REALLY QUICK START: BUILDING AND INSTALLING A PRODUCTION STACK
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
You have two options. Choose one:
|
|
||||||
|
|
||||||
a) Building distribution packages from the source and installing them
|
|
||||||
b) Building from the source and installing directly from there
|
|
||||||
|
|
||||||
|
|
||||||
=== I want to build and install distribution packages ===
|
|
||||||
|
|
||||||
This is the recommended way to run your CloudStack cloud. The
|
|
||||||
advantages are that dependencies are taken care of automatically
|
|
||||||
for you, and you can verify the integrity of the installed files
|
|
||||||
using your system's package manager.
|
|
||||||
|
|
||||||
1. As root, install the build dependencies.
|
|
||||||
|
|
||||||
a) Fedora / CentOS: ./waf installrpmdeps
|
|
||||||
|
|
||||||
b) Ubuntu: ./waf installdebdeps
|
|
||||||
|
|
||||||
2. As a non-root user, build the CloudStack packages.
|
|
||||||
|
|
||||||
a) Fedora / CentOS: ./waf rpm
|
|
||||||
|
|
||||||
b) Ubuntu: ./waf deb
|
|
||||||
|
|
||||||
3. As root, install the CloudStack packages.
|
|
||||||
You can choose which components to install on your system.
|
|
||||||
|
|
||||||
a) Fedora / CentOS: the installable RPMs are in artifacts/rpmbuild
|
|
||||||
install as root: rpm -ivh artifacts/rpmbuild/RPMS/{x86_64,noarch,i386}/*.rpm
|
|
||||||
|
|
||||||
b) Ubuntu: the installable DEBs are in artifacts/debbuild
|
|
||||||
install as root: dpkg -i artifacts/debbuild/*.deb
|
|
||||||
|
|
||||||
4. Configure and start the components you intend to run.
|
|
||||||
Consult the Installation Guide to find out how to
|
|
||||||
configure each component, and "Installation paths" for information
|
|
||||||
on where programs, initscripts and config files are installed.
|
|
||||||
|
|
||||||
|
|
||||||
=== I want to build and install directly from the source ===
|
|
||||||
|
|
||||||
This is the recommended way to run your CloudStack cloud if you
|
|
||||||
intend to modify the source, if you intend to port the CloudStack to
|
|
||||||
another distribution, or if you intend to run the CloudStack on a
|
|
||||||
distribution for which packages are not built.
|
|
||||||
|
|
||||||
1. As root, install the build dependencies.
|
|
||||||
See below for a list.
|
|
||||||
|
|
||||||
2. As non-root, configure the build.
|
|
||||||
See below to discover configuration options.
|
|
||||||
|
|
||||||
./waf configure
|
|
||||||
|
|
||||||
3. As non-root, build the CloudStack.
|
|
||||||
To learn more, see "Quick guide to developing, building and
|
|
||||||
installing from source" below.
|
|
||||||
|
|
||||||
./waf build
|
|
||||||
|
|
||||||
4. As root, install the runtime dependencies.
|
|
||||||
See below for a list.
|
|
||||||
|
|
||||||
5. As root, Install the CloudStack
|
|
||||||
|
|
||||||
./waf install
|
|
||||||
|
|
||||||
6. Configure and start the components you intend to run.
|
|
||||||
Consult the Installation Guide to find out how to
|
|
||||||
configure each component, and "Installation paths" for information
|
|
||||||
on where to find programs, initscripts and config files mentioned
|
|
||||||
in the Installation Guide (paths may vary).
|
|
||||||
|
|
||||||
|
|
||||||
=== Dependencies of the CloudStack ===
|
|
||||||
|
|
||||||
- Build dependencies:
|
|
||||||
|
|
||||||
1. FIXME DEPENDENCIES LIST THEM HERE
|
|
||||||
|
|
||||||
- Runtime dependencies:
|
|
||||||
|
|
||||||
2. FIXME DEPENDENCIES LIST THEM HERE
|
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
INSTALLATION PATHS: WHERE THE STACK IS INSTALLED ON YOUR SYSTEM
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
The CloudStack build system installs files on a variety of paths, each
|
|
||||||
one of which is selectable when building from source.
|
|
||||||
|
|
||||||
- $PREFIX:
|
|
||||||
the default prefix where the entire stack is installed
|
|
||||||
defaults to /usr/local on source builds
|
|
||||||
defaults to /usr on package builds
|
|
||||||
|
|
||||||
- $SYSCONFDIR/cloud:
|
|
||||||
|
|
||||||
the prefix for CloudStack configuration files
|
|
||||||
defaults to $PREFIX/etc/cloud on source builds
|
|
||||||
defaults to /etc/cloud on package builds
|
|
||||||
|
|
||||||
- $SYSCONFDIR/init.d:
|
|
||||||
the prefix for CloudStack initscripts
|
|
||||||
defaults to $PREFIX/etc/init.d on source builds
|
|
||||||
defaults to /etc/init.d on package builds
|
|
||||||
|
|
||||||
- $BINDIR:
|
|
||||||
the CloudStack installs programs there
|
|
||||||
defaults to $PREFIX/bin on source builds
|
|
||||||
defaults to /usr/bin on package builds
|
|
||||||
|
|
||||||
- $LIBEXECDIR:
|
|
||||||
the CloudStack installs service runners there
|
|
||||||
defaults to $PREFIX/libexec on source builds
|
|
||||||
defaults to /usr/libexec on package builds (/usr/bin on Ubuntu)
|
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
UNINSTALLING THE CLOUDSTACK FROM YOUR SYSTEM
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
- If you installed the CloudStack using packages, use your operating
|
|
||||||
system package manager to remove the CloudStack packages.
|
|
||||||
|
|
||||||
a) Fedora / CentOS: the installable RPMs are in artifacts/rpmbuild
|
|
||||||
as root: rpm -qa | grep ^cloud- | xargs rpm -e
|
|
||||||
|
|
||||||
b) Ubuntu: the installable DEBs are in artifacts/debbuild
|
|
||||||
aptitude purge '~ncloud'
|
|
||||||
|
|
||||||
- If you installed from a source tree:
|
|
||||||
|
|
||||||
./waf uninstall
|
|
||||||
|
|
||||||
191
README
191
README
@ -8,19 +8,202 @@ cloud.
|
|||||||
|
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
HOW TO INSTALL THE CLOUDSTACK
|
TABLE OF CONTENTS
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
Please refer to the document INSTALL distributed with the source.
|
1. Really quick start: building and installing a production stack
|
||||||
|
2. Post-install: setting the CloudStack components up
|
||||||
|
3. Installation paths: where the stack is installed on your system
|
||||||
|
4. Uninstalling the CloudStack from your system
|
||||||
|
5. Be part of the Cloud.com community!
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
HOW TO HACK ON THE CLOUDSTACK
|
REALLY QUICK START: BUILDING AND INSTALLING A PRODUCTION STACK
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
Please refer to the document HACKING distributed with the source.
|
You have two options. Choose one:
|
||||||
|
|
||||||
|
a) Building distribution packages from the source and installing them
|
||||||
|
b) Building from the source and installing directly from there
|
||||||
|
|
||||||
|
|
||||||
|
=== I want to build and install distribution packages ===
|
||||||
|
|
||||||
|
This is the recommended way to run your CloudStack cloud. The
|
||||||
|
advantages are that dependencies are taken care of automatically
|
||||||
|
for you, and you can verify the integrity of the installed files
|
||||||
|
using your system's package manager.
|
||||||
|
|
||||||
|
1. As root, install the build dependencies.
|
||||||
|
|
||||||
|
a) Fedora / CentOS: ./waf installrpmdeps
|
||||||
|
|
||||||
|
b) Ubuntu: ./waf installdebdeps
|
||||||
|
|
||||||
|
2. As a non-root user, build the CloudStack packages.
|
||||||
|
|
||||||
|
a) Fedora / CentOS: ./waf rpm
|
||||||
|
|
||||||
|
b) Ubuntu: ./waf deb
|
||||||
|
|
||||||
|
3. As root, install the CloudStack packages.
|
||||||
|
You can choose which components to install on your system.
|
||||||
|
|
||||||
|
a) Fedora / CentOS: the installable RPMs are in artifacts/rpmbuild
|
||||||
|
|
||||||
|
b) Ubuntu: the installable DEBs are in artifacts/debbuild
|
||||||
|
|
||||||
|
4. Configure and start the components you intend to run.
|
||||||
|
See "Setting the CloudStack components up" to find out how to
|
||||||
|
configure each component, and "Installation paths" for information
|
||||||
|
on where programs, initscripts and config files are installed.
|
||||||
|
|
||||||
|
|
||||||
|
=== I want to build and install directly from the source ===
|
||||||
|
|
||||||
|
This is the recommended way to run your CloudStack cloud if you
|
||||||
|
intend to modify the source, if you intend to port the CloudStack to
|
||||||
|
another distribution, or if you intend to run the CloudStack on a
|
||||||
|
distribution for which packages are not built.
|
||||||
|
|
||||||
|
1. As root, install the build dependencies.
|
||||||
|
See below for a list.
|
||||||
|
|
||||||
|
2. As non-root, configure the build.
|
||||||
|
See below to discover configuration options.
|
||||||
|
|
||||||
|
./waf configure
|
||||||
|
|
||||||
|
3. As non-root, build the CloudStack.
|
||||||
|
To learn more, see "Quick guide to developing, building and
|
||||||
|
installing from source" below.
|
||||||
|
|
||||||
|
./waf build
|
||||||
|
|
||||||
|
4. As root, install the runtime dependencies.
|
||||||
|
See below for a list.
|
||||||
|
|
||||||
|
5. As root, Install the CloudStack
|
||||||
|
|
||||||
|
./waf install
|
||||||
|
|
||||||
|
6. Configure and start the components you intend to run.
|
||||||
|
See "Setting the CloudStack components up" to find out how to
|
||||||
|
configure each component, and "Installation paths" for information
|
||||||
|
on where programs, initscripts and config files are installed.
|
||||||
|
|
||||||
|
|
||||||
|
=== Dependencies of the CloudStack ===
|
||||||
|
|
||||||
|
- Build dependencies:
|
||||||
|
|
||||||
|
1. FIXME DEPENDENCIES LIST THEM HERE
|
||||||
|
|
||||||
|
- Runtime dependencies:
|
||||||
|
|
||||||
|
2. FIXME DEPENDENCIES LIST THEM HERE
|
||||||
|
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
POST-INSTALL: SETTING THE CLOUDSTACK COMPONENTS UP
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
The CloudStack installs several components on your system.
|
||||||
|
|
||||||
|
Each component usually installs an initscript on your system, along
|
||||||
|
with one configuration command that will set your system up to run
|
||||||
|
said component properly. You must set each component up before
|
||||||
|
you can run it. The Installation Manual will guide you through the
|
||||||
|
process of setting each component up, and the section "Installation
|
||||||
|
paths" will explain where to find the installed files and what each
|
||||||
|
$VARIABLE means.
|
||||||
|
|
||||||
|
|
||||||
|
=== cloud-management: the Management Server ===
|
||||||
|
|
||||||
|
This Tomcat-based service runs your cloud and lets you manage it.
|
||||||
|
Its initscript is called cloud-management, and its setup command is
|
||||||
|
called cloud-setup-databases.
|
||||||
|
|
||||||
|
|
||||||
|
=== cloud-usage: the Usage Monitor ===
|
||||||
|
|
||||||
|
This Java-based service accounts usage metrics for your cloud.
|
||||||
|
Its initscript is called cloud-usage, and it takes its configuration
|
||||||
|
from the Management Server, so to set the Usage Monitor up, set the
|
||||||
|
management server up.
|
||||||
|
|
||||||
|
|
||||||
|
=== cloud-agent: the Cloud Agent ===
|
||||||
|
|
||||||
|
This Java-based service runs virtual machines based on orders from
|
||||||
|
the Management Service, connecting to it at startup. Its initscript
|
||||||
|
is called cloud-agent, and its setup command is called cloud-setup-agent.
|
||||||
|
|
||||||
|
|
||||||
|
=== cloud-console-proxy: the Cloud Console Proxy ===
|
||||||
|
|
||||||
|
This Java-based service provides access to virtual machine consoles
|
||||||
|
based on orders from the Management Service, connecting to it at
|
||||||
|
startup. Its initscript is called cloud-console-proxy, and its setup
|
||||||
|
command is called cloud-setup-console-proxy.
|
||||||
|
|
||||||
|
|
||||||
|
=== cloud-vnet: the Cloud Virtual Networking Arbiter ===
|
||||||
|
|
||||||
|
This C-based service provides network virtualization and isolation for
|
||||||
|
virtual machines based on security settings established by the cloud
|
||||||
|
operator. Its initscript is called cloud-vnet; it requires no setup.
|
||||||
|
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
INSTALLATION PATHS: WHERE THE STACK IS INSTALLED ON YOUR SYSTEM
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
The CloudStack build system installs files on a variety of paths, each
|
||||||
|
one of which is selectable when building from source.
|
||||||
|
|
||||||
|
- $PREFIX:
|
||||||
|
the default prefix where the entire stack is installed
|
||||||
|
defaults to /usr/local on source builds
|
||||||
|
defaults to /usr on package builds
|
||||||
|
|
||||||
|
- $SYSCONFDIR/cloud:
|
||||||
|
|
||||||
|
the prefix for CloudStack configuration files
|
||||||
|
defaults to $PREFIX/etc/cloud on source builds
|
||||||
|
defaults to /etc/cloud on package builds
|
||||||
|
|
||||||
|
- $SYSCONFDIR/init.d:
|
||||||
|
the prefix for CloudStack initscripts
|
||||||
|
defaults to $PREFIX/etc/init.d on source builds
|
||||||
|
defaults to /etc/init.d on package builds
|
||||||
|
|
||||||
|
- $BINDIR:
|
||||||
|
the CloudStack installs programs there
|
||||||
|
defaults to $PREFIX/bin on source builds
|
||||||
|
defaults to /usr/bin on package builds
|
||||||
|
|
||||||
|
- $LIBEXECDIR:
|
||||||
|
the CloudStack installs service runners there
|
||||||
|
defaults to $PREFIX/libexec on source builds
|
||||||
|
defaults to /usr/libexec on package builds (/usr/bin on Ubuntu)
|
||||||
|
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
UNINSTALLING THE CLOUDSTACK FROM YOUR SYSTEM
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
If you installed the CloudStack using packages, use your operating
|
||||||
|
system package manager to remove the CloudStack packages.
|
||||||
|
|
||||||
|
If you installed from the source: ./waf uninstall
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|||||||
10555
README.html
10555
README.html
File diff suppressed because it is too large
Load Diff
@ -33,7 +33,7 @@ for x in private public ; do
|
|||||||
defaultroute=`ip route | grep ^default | cut -d ' ' -f 5`
|
defaultroute=`ip route | grep ^default | cut -d ' ' -f 5`
|
||||||
test -n "$defaultroute"
|
test -n "$defaultroute"
|
||||||
echo "Using auto-discovered network device $defaultroute which is the default route"
|
echo "Using auto-discovered network device $defaultroute which is the default route"
|
||||||
SERVICEARGS="$SERVICEARGS $x.network.device="$defaultroute
|
SERVICEARGS="$SERVICEARGS -D$x.network.device="$defaultroute
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ function termagent() {
|
|||||||
|
|
||||||
trap termagent TERM
|
trap termagent TERM
|
||||||
while true ; do
|
while true ; do
|
||||||
java -Xms128M -Xmx384M -cp "$CLASSPATH" "$@" com.cloud.agent.AgentShell $SERVICEARGS &
|
java -Xms128M -Xmx384M -cp "$CLASSPATH" $SERVICEARGS "$@" com.cloud.agent.AgentShell &
|
||||||
agentpid=$!
|
agentpid=$!
|
||||||
echo "Agent started. PID: $!" >&2
|
echo "Agent started. PID: $!" >&2
|
||||||
wait $agentpid
|
wait $agentpid
|
||||||
|
|||||||
@ -114,7 +114,6 @@ import com.cloud.agent.api.ReadyAnswer;
|
|||||||
import com.cloud.agent.api.ReadyCommand;
|
import com.cloud.agent.api.ReadyCommand;
|
||||||
import com.cloud.agent.api.RebootAnswer;
|
import com.cloud.agent.api.RebootAnswer;
|
||||||
import com.cloud.agent.api.RebootCommand;
|
import com.cloud.agent.api.RebootCommand;
|
||||||
import com.cloud.agent.api.RebootRouterCommand;
|
|
||||||
import com.cloud.agent.api.StartAnswer;
|
import com.cloud.agent.api.StartAnswer;
|
||||||
import com.cloud.agent.api.StartCommand;
|
import com.cloud.agent.api.StartCommand;
|
||||||
import com.cloud.agent.api.StartConsoleProxyAnswer;
|
import com.cloud.agent.api.StartConsoleProxyAnswer;
|
||||||
@ -853,8 +852,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (isDirectAttachedNetwork(router.getVlanId()))
|
if (isDirectAttachedNetwork(router.getVlanId()))
|
||||||
default_network_rules_for_systemvm(vmName);*/
|
default_network_rules_for_systemvm(vmName);
|
||||||
} catch (LibvirtException e) {
|
} catch (LibvirtException e) {
|
||||||
if (nics != null) {
|
if (nics != null) {
|
||||||
cleanupVMNetworks(nics);
|
cleanupVMNetworks(nics);
|
||||||
@ -1070,8 +1069,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
return execute((StopCommand)cmd);
|
return execute((StopCommand)cmd);
|
||||||
} else if (cmd instanceof GetVmStatsCommand) {
|
} else if (cmd instanceof GetVmStatsCommand) {
|
||||||
return execute((GetVmStatsCommand)cmd);
|
return execute((GetVmStatsCommand)cmd);
|
||||||
} else if (cmd instanceof RebootRouterCommand) {
|
|
||||||
return execute((RebootRouterCommand)cmd);
|
|
||||||
} else if (cmd instanceof RebootCommand) {
|
} else if (cmd instanceof RebootCommand) {
|
||||||
return execute((RebootCommand)cmd);
|
return execute((RebootCommand)cmd);
|
||||||
} else if (cmd instanceof GetHostStatsCommand) {
|
} else if (cmd instanceof GetHostStatsCommand) {
|
||||||
@ -1177,7 +1174,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
if (primaryPool == null) {
|
if (primaryPool == null) {
|
||||||
String result = "Failed to get primary pool";
|
String result = "Failed to get primary pool";
|
||||||
s_logger.debug(result);
|
s_logger.debug(result);
|
||||||
return new CreateAnswer(cmd, result);
|
new CreateAnswer(cmd, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd.getTemplateUrl() != null) {
|
if (cmd.getTemplateUrl() != null) {
|
||||||
@ -1185,7 +1182,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
if (tmplVol == null) {
|
if (tmplVol == null) {
|
||||||
String result = "Failed to get tmpl vol";
|
String result = "Failed to get tmpl vol";
|
||||||
s_logger.debug(result);
|
s_logger.debug(result);
|
||||||
return new CreateAnswer(cmd, result);
|
new CreateAnswer(cmd, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
LibvirtStorageVolumeDef volDef = new LibvirtStorageVolumeDef(UUID.randomUUID().toString(), tmplVol.getInfo().capacity, volFormat.QCOW2, tmplVol.getPath(), volFormat.QCOW2);
|
LibvirtStorageVolumeDef volDef = new LibvirtStorageVolumeDef(UUID.randomUUID().toString(), tmplVol.getInfo().capacity, volFormat.QCOW2, tmplVol.getPath(), volFormat.QCOW2);
|
||||||
@ -1272,14 +1269,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
s_logger.debug("Failed to backup snaptshot: " + result);
|
s_logger.debug("Failed to backup snaptshot: " + result);
|
||||||
return new BackupSnapshotAnswer(cmd, false, result, null);
|
return new BackupSnapshotAnswer(cmd, false, result, null);
|
||||||
}
|
}
|
||||||
/*Delete the snapshot on primary*/
|
|
||||||
Domain vm = getDomain(cmd.getVmName());
|
|
||||||
String vmUuid = vm.getUUIDString();
|
|
||||||
Object[] args = new Object[] {snapshotName, vmUuid};
|
|
||||||
String snapshot = SnapshotXML.format(args);
|
|
||||||
s_logger.debug(snapshot);
|
|
||||||
DomainSnapshot snap = vm.snapshotLookupByName(snapshotName);
|
|
||||||
snap.delete(0);
|
|
||||||
} catch (LibvirtException e) {
|
} catch (LibvirtException e) {
|
||||||
return new BackupSnapshotAnswer(cmd, false, e.toString(), null);
|
return new BackupSnapshotAnswer(cmd, false, e.toString(), null);
|
||||||
} catch (URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
@ -1289,45 +1278,10 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected DeleteSnapshotBackupAnswer execute(final DeleteSnapshotBackupCommand cmd) {
|
protected DeleteSnapshotBackupAnswer execute(final DeleteSnapshotBackupCommand cmd) {
|
||||||
Long dcId = cmd.getDataCenterId();
|
|
||||||
Long accountId = cmd.getAccountId();
|
|
||||||
Long volumeId = cmd.getVolumeId();
|
|
||||||
try {
|
|
||||||
StoragePool secondaryStoragePool = getNfsSPbyURI(_conn, new URI(cmd.getSecondaryStoragePoolURL()));
|
|
||||||
String ssPmountPath = _mountPoint + File.separator + secondaryStoragePool.getUUIDString();
|
|
||||||
String 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("-d", snapshotDestPath);
|
|
||||||
command.add("-n", cmd.getSnapshotName());
|
|
||||||
|
|
||||||
command.execute();
|
|
||||||
} catch (LibvirtException e) {
|
|
||||||
return new DeleteSnapshotBackupAnswer(cmd, false, e.toString());
|
|
||||||
} catch (URISyntaxException e) {
|
|
||||||
return new DeleteSnapshotBackupAnswer(cmd, false, e.toString());
|
|
||||||
}
|
|
||||||
return new DeleteSnapshotBackupAnswer(cmd, true, null);
|
return new DeleteSnapshotBackupAnswer(cmd, true, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Answer execute(DeleteSnapshotsDirCommand cmd) {
|
protected Answer execute(DeleteSnapshotsDirCommand cmd) {
|
||||||
Long dcId = cmd.getDataCenterId();
|
|
||||||
Long accountId = cmd.getAccountId();
|
|
||||||
Long volumeId = cmd.getVolumeId();
|
|
||||||
try {
|
|
||||||
StoragePool secondaryStoragePool = getNfsSPbyURI(_conn, new URI(cmd.getSecondaryStoragePoolURL()));
|
|
||||||
String ssPmountPath = _mountPoint + File.separator + secondaryStoragePool.getUUIDString();
|
|
||||||
String 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("-d", snapshotDestPath);
|
|
||||||
command.add("-n", cmd.getSnapshotName());
|
|
||||||
command.execute();
|
|
||||||
} catch (LibvirtException e) {
|
|
||||||
return new Answer(cmd, false, e.toString());
|
|
||||||
} catch (URISyntaxException e) {
|
|
||||||
return new Answer(cmd, false, e.toString());
|
|
||||||
}
|
|
||||||
return new Answer(cmd, true, null);
|
return new Answer(cmd, true, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1521,7 +1475,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
if (secondaryPool == null) {
|
if (secondaryPool == null) {
|
||||||
return new Answer(cmd, false, " Failed to create storage pool");
|
return new Answer(cmd, false, " Failed to create storage pool");
|
||||||
}
|
}
|
||||||
tmplVol = getVolume(secondaryPool, getPathOfStoragePool(secondaryPool) + tmpltname);
|
tmplVol = secondaryPool.storageVolLookupByName(tmpltname);
|
||||||
if (tmplVol == null) {
|
if (tmplVol == null) {
|
||||||
return new Answer(cmd, false, " Can't find volume");
|
return new Answer(cmd, false, " Can't find volume");
|
||||||
}
|
}
|
||||||
@ -1535,7 +1489,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
if (primaryVol == null) {
|
if (primaryVol == null) {
|
||||||
return new Answer(cmd, false, " Can't create storage volume on storage pool");
|
return new Answer(cmd, false, " Can't create storage volume on storage pool");
|
||||||
}
|
}
|
||||||
|
|
||||||
StorageVolInfo priVolInfo = primaryVol.getInfo();
|
StorageVolInfo priVolInfo = primaryVol.getInfo();
|
||||||
DownloadAnswer answer = new DownloadAnswer(null,
|
DownloadAnswer answer = new DownloadAnswer(null,
|
||||||
100,
|
100,
|
||||||
@ -1567,8 +1520,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (secondaryPool != null) {
|
if (secondaryPool != null) {
|
||||||
secondaryPool.destroy();
|
|
||||||
secondaryPool.undefine();
|
|
||||||
secondaryPool.free();
|
secondaryPool.free();
|
||||||
}
|
}
|
||||||
} catch (LibvirtException l) {
|
} catch (LibvirtException l) {
|
||||||
@ -1857,6 +1808,12 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Answer execute(CheckVirtualMachineCommand cmd) {
|
private Answer execute(CheckVirtualMachineCommand cmd) {
|
||||||
|
if (VirtualMachineName.isValidRouterName(cmd.getVmName()) || VirtualMachineName.isValidConsoleProxyName(cmd.getVmName()) ) {
|
||||||
|
/*For domr, the trick is that the actual vmname is vmName-domrId.
|
||||||
|
*Here, we need to build the relationship between vmName and its actual name at first*/
|
||||||
|
getAllVms();
|
||||||
|
}
|
||||||
|
|
||||||
final State state = getVmState(cmd.getVmName());
|
final State state = getVmState(cmd.getVmName());
|
||||||
Integer vncPort = null;
|
Integer vncPort = null;
|
||||||
if (state == State.Running) {
|
if (state == State.Running) {
|
||||||
@ -2068,16 +2025,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Answer execute(RebootRouterCommand cmd) {
|
|
||||||
RebootAnswer answer = (RebootAnswer) execute((RebootCommand) cmd);
|
|
||||||
String result = _virtRouterResource.connect(cmd.getPrivateIpAddress());
|
|
||||||
if (result == null) {
|
|
||||||
return answer;
|
|
||||||
} else {
|
|
||||||
return new Answer(cmd, false, result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected GetVmStatsAnswer execute(GetVmStatsCommand cmd) {
|
protected GetVmStatsAnswer execute(GetVmStatsCommand cmd) {
|
||||||
List<String> vmNames = cmd.getVmNames();
|
List<String> vmNames = cmd.getVmNames();
|
||||||
try {
|
try {
|
||||||
@ -2112,8 +2059,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
_vms.put(vmName, State.Stopping);
|
_vms.put(vmName, State.Stopping);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
/*if (isDirectAttachedNetwork(cmd.getVnet()))
|
if (isDirectAttachedNetwork(cmd.getVnet()))
|
||||||
destroy_network_rules_for_vm(vmName);*/
|
destroy_network_rules_for_vm(vmName);
|
||||||
String result = stopVM(vmName, defineOps.UNDEFINE_VM);
|
String result = stopVM(vmName, defineOps.UNDEFINE_VM);
|
||||||
|
|
||||||
answer = new StopAnswer(cmd, null, port, bytesSent, bytesReceived);
|
answer = new StopAnswer(cmd, null, port, bytesSent, bytesReceived);
|
||||||
@ -2286,8 +2233,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (isDirectAttachedNetwork(cmd.getGuestNetworkId()))
|
if (isDirectAttachedNetwork(cmd.getGuestNetworkId()))
|
||||||
default_network_rules(cmd.getVmName(), cmd.getGuestIpAddress());*/
|
default_network_rules(cmd.getVmName(), cmd.getGuestIpAddress());
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
} catch(LibvirtException e) {
|
} catch(LibvirtException e) {
|
||||||
@ -3168,7 +3115,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
disks.add(hda);
|
disks.add(hda);
|
||||||
|
|
||||||
diskDef hdb = new diskDef();
|
diskDef hdb = new diskDef();
|
||||||
hdb.defFileBasedDisk(datadiskPath, "hdb", diskDef.diskBus.IDE, diskDef.diskFmtType.RAW);
|
hdb.defFileBasedDisk(datadiskPath, "vdb", diskDef.diskBus.IDE, diskDef.diskFmtType.QCOW2);
|
||||||
disks.add(hdb);
|
disks.add(hdb);
|
||||||
|
|
||||||
return disks;
|
return disks;
|
||||||
@ -3216,12 +3163,12 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
disks.add(hdb);
|
disks.add(hdb);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Add a placeholder for iso, even if there is no iso attached*/
|
if (isoPath != null) {
|
||||||
diskDef hdc = new diskDef();
|
diskDef hdc = new diskDef();
|
||||||
hdc.defFileBasedDisk(isoPath, "hdc", diskDef.diskBus.IDE, diskDef.diskFmtType.RAW);
|
hdc.defFileBasedDisk(isoPath, "hdc", diskDef.diskBus.IDE, diskDef.diskFmtType.RAW);
|
||||||
hdc.setDeviceType(diskDef.deviceType.CDROM);
|
hdc.setDeviceType(diskDef.deviceType.CDROM);
|
||||||
disks.add(hdc);
|
disks.add(hdc);
|
||||||
|
}
|
||||||
return disks;
|
return disks;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3545,7 +3492,4 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
}
|
}
|
||||||
return vol;
|
return vol;
|
||||||
}
|
}
|
||||||
private String getPathOfStoragePool(StoragePool pool) throws LibvirtException {
|
|
||||||
return _mountPoint + File.separator + pool.getUUIDString() + File.separator;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -199,7 +199,8 @@
|
|||||||
<copy todir="${scripts.target.dir}">
|
<copy todir="${scripts.target.dir}">
|
||||||
<fileset dir="${scripts.dir}">
|
<fileset dir="${scripts.dir}">
|
||||||
<include name="**/*"/>
|
<include name="**/*"/>
|
||||||
<exclude name="**/.*" />
|
<exclude name="**/.classpath" />
|
||||||
|
<exclude name="**/.project" />
|
||||||
<exclude name="**/network/domr/mth/" />
|
<exclude name="**/network/domr/mth/" />
|
||||||
<exclude name="**/network/domr/kvm/" />
|
<exclude name="**/network/domr/kvm/" />
|
||||||
<exclude name="**/network/domr/xenserver/" />
|
<exclude name="**/network/domr/xenserver/" />
|
||||||
@ -220,7 +221,6 @@
|
|||||||
<include name="**/*.html" />
|
<include name="**/*.html" />
|
||||||
<include name="**/*.js"/>
|
<include name="**/*.js"/>
|
||||||
<include name="**/*.jsp"/>
|
<include name="**/*.jsp"/>
|
||||||
<include name="**/*.properties"/>
|
|
||||||
<exclude name="**/.classpath" />
|
<exclude name="**/.classpath" />
|
||||||
<exclude name="**/.project" />
|
<exclude name="**/.project" />
|
||||||
</fileset>
|
</fileset>
|
||||||
@ -234,7 +234,6 @@
|
|||||||
<exclude name="**/*.html" />
|
<exclude name="**/*.html" />
|
||||||
<exclude name="**/*.js"/>
|
<exclude name="**/*.js"/>
|
||||||
<exclude name="**/*.jsp"/>
|
<exclude name="**/*.jsp"/>
|
||||||
<exclude name="**/*.properties"/>
|
|
||||||
<exclude name="**/.classpath" />
|
<exclude name="**/.classpath" />
|
||||||
<exclude name="**/.project" />
|
<exclude name="**/.project" />
|
||||||
</fileset>
|
</fileset>
|
||||||
|
|||||||
@ -132,11 +132,7 @@
|
|||||||
<war destfile="${client.dist.dir}/client.war" webxml="${client.dir}/WEB-INF/web.xml">
|
<war destfile="${client.dist.dir}/client.war" webxml="${client.dir}/WEB-INF/web.xml">
|
||||||
<fileset dir="${client.target.dir}">
|
<fileset dir="${client.target.dir}">
|
||||||
<include name="**/*" />
|
<include name="**/*" />
|
||||||
<exclude name="**/*.properties" />
|
|
||||||
</fileset>
|
</fileset>
|
||||||
<classes dir="${client.target.dir}">
|
|
||||||
<include name="**/resources/*.properties" />
|
|
||||||
</classes>
|
|
||||||
<lib dir="${jar.dir}">
|
<lib dir="${jar.dir}">
|
||||||
<include name="cloud-*.jar" />
|
<include name="cloud-*.jar" />
|
||||||
</lib>
|
</lib>
|
||||||
|
|||||||
@ -129,9 +129,6 @@
|
|||||||
<adapter name="Balance" class="com.cloud.consoleproxy.ConsoleProxyBalanceAllocator"/>
|
<adapter name="Balance" class="com.cloud.consoleproxy.ConsoleProxyBalanceAllocator"/>
|
||||||
</adapters>
|
</adapters>
|
||||||
|
|
||||||
<adapters key="com.cloud.storage.secondary.SecondaryStorageVmAllocator">
|
|
||||||
<adapter name="Balance" class="com.cloud.storage.secondary.SecondaryStorageVmDefaultAllocator"/>
|
|
||||||
</adapters>
|
|
||||||
<adapters key="com.cloud.server.auth.UserAuthenticator">
|
<adapters key="com.cloud.server.auth.UserAuthenticator">
|
||||||
<adapter name="MD5" class="com.cloud.server.auth.MD5UserAuthenticator"/>
|
<adapter name="MD5" class="com.cloud.server.auth.MD5UserAuthenticator"/>
|
||||||
</adapters>
|
</adapters>
|
||||||
@ -171,8 +168,6 @@
|
|||||||
</manager>
|
</manager>
|
||||||
<manager name="console proxy manager" class="com.cloud.consoleproxy.AgentBasedStandaloneConsoleProxyManager">
|
<manager name="console proxy manager" class="com.cloud.consoleproxy.AgentBasedStandaloneConsoleProxyManager">
|
||||||
</manager>
|
</manager>
|
||||||
<manager name="secondary storage vm manager" class="com.cloud.storage.secondary.SecondaryStorageManagerImpl">
|
|
||||||
</manager>
|
|
||||||
<manager name="vm manager" class="com.cloud.vm.UserVmManagerImpl"/>
|
<manager name="vm manager" class="com.cloud.vm.UserVmManagerImpl"/>
|
||||||
<manager name="upgrade manager" class="com.cloud.maint.UpgradeManagerImpl">
|
<manager name="upgrade manager" class="com.cloud.maint.UpgradeManagerImpl">
|
||||||
</manager>
|
</manager>
|
||||||
|
|||||||
41
cloud.spec
41
cloud.spec
@ -237,7 +237,6 @@ Requires: augeas >= 0.7.1
|
|||||||
Requires: rsync
|
Requires: rsync
|
||||||
Requires: /bin/egrep
|
Requires: /bin/egrep
|
||||||
Requires: /sbin/ip
|
Requires: /sbin/ip
|
||||||
Requires: vconfig
|
|
||||||
Group: System Environment/Libraries
|
Group: System Environment/Libraries
|
||||||
%description agent
|
%description agent
|
||||||
The Cloud.com agent is in charge of managing shared computing resources in
|
The Cloud.com agent is in charge of managing shared computing resources in
|
||||||
@ -451,18 +450,14 @@ fi
|
|||||||
%doc %{_docdir}/%{name}-%{version}/version-info
|
%doc %{_docdir}/%{name}-%{version}/version-info
|
||||||
%doc %{_docdir}/%{name}-%{version}/configure-info
|
%doc %{_docdir}/%{name}-%{version}/configure-info
|
||||||
%doc README
|
%doc README
|
||||||
%doc INSTALL
|
|
||||||
%doc HACKING
|
%doc HACKING
|
||||||
%doc README.html
|
|
||||||
%doc debian/copyright
|
%doc debian/copyright
|
||||||
|
|
||||||
%files client-ui
|
%files client-ui
|
||||||
%defattr(0644,root,root,0755)
|
%defattr(0644,root,root,0755)
|
||||||
%{_datadir}/%{name}/management/webapps/client/*
|
%{_datadir}/%{name}/management/webapps/client/*
|
||||||
%doc README
|
%doc README
|
||||||
%doc INSTALL
|
|
||||||
%doc HACKING
|
%doc HACKING
|
||||||
%doc README.html
|
|
||||||
%doc debian/copyright
|
%doc debian/copyright
|
||||||
|
|
||||||
%files server
|
%files server
|
||||||
@ -470,9 +465,7 @@ fi
|
|||||||
%{_javadir}/%{name}-server.jar
|
%{_javadir}/%{name}-server.jar
|
||||||
%{_sysconfdir}/%{name}/server/*
|
%{_sysconfdir}/%{name}/server/*
|
||||||
%doc README
|
%doc README
|
||||||
%doc INSTALL
|
|
||||||
%doc HACKING
|
%doc HACKING
|
||||||
%doc README.html
|
|
||||||
%doc debian/copyright
|
%doc debian/copyright
|
||||||
|
|
||||||
%if %{_premium}
|
%if %{_premium}
|
||||||
@ -482,9 +475,7 @@ fi
|
|||||||
%{_libdir}/%{name}/agent/scripts/*
|
%{_libdir}/%{name}/agent/scripts/*
|
||||||
%{_libdir}/%{name}/agent/vms/systemvm.zip
|
%{_libdir}/%{name}/agent/vms/systemvm.zip
|
||||||
%doc README
|
%doc README
|
||||||
%doc INSTALL
|
|
||||||
%doc HACKING
|
%doc HACKING
|
||||||
%doc README.html
|
|
||||||
%doc debian/copyright
|
%doc debian/copyright
|
||||||
|
|
||||||
%else
|
%else
|
||||||
@ -494,23 +485,19 @@ fi
|
|||||||
%{_libdir}/%{name}/agent/scripts/installer/*
|
%{_libdir}/%{name}/agent/scripts/installer/*
|
||||||
%{_libdir}/%{name}/agent/scripts/network/domr/*.sh
|
%{_libdir}/%{name}/agent/scripts/network/domr/*.sh
|
||||||
%{_libdir}/%{name}/agent/scripts/storage/*.sh
|
%{_libdir}/%{name}/agent/scripts/storage/*.sh
|
||||||
%{_libdir}/%{name}/agent/scripts/storage/zfs/*
|
|
||||||
%{_libdir}/%{name}/agent/scripts/storage/qcow2/*
|
%{_libdir}/%{name}/agent/scripts/storage/qcow2/*
|
||||||
%{_libdir}/%{name}/agent/scripts/storage/secondary/*
|
%{_libdir}/%{name}/agent/scripts/storage/secondary/*
|
||||||
%{_libdir}/%{name}/agent/scripts/util/*
|
%{_libdir}/%{name}/agent/scripts/util/*
|
||||||
%{_libdir}/%{name}/agent/scripts/vm/*.sh
|
%{_libdir}/%{name}/agent/scripts/vm/*.sh
|
||||||
%{_libdir}/%{name}/agent/scripts/vm/storage/nfs/*
|
%{_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/network/*
|
||||||
%{_libdir}/%{name}/agent/scripts/vm/hypervisor/*.sh
|
%{_libdir}/%{name}/agent/scripts/vm/hypervisor/*.sh
|
||||||
%{_libdir}/%{name}/agent/scripts/vm/hypervisor/kvm/*
|
%{_libdir}/%{name}/agent/scripts/vm/hypervisor/kvm/*
|
||||||
%{_libdir}/%{name}/agent/scripts/vm/hypervisor/xen/*
|
|
||||||
%{_libdir}/%{name}/agent/vms/systemvm.zip
|
%{_libdir}/%{name}/agent/vms/systemvm.zip
|
||||||
%{_libdir}/%{name}/agent/scripts/vm/hypervisor/xenserver/*
|
%{_libdir}/%{name}/agent/scripts/vm/hypervisor/xenserver/*
|
||||||
|
%{_libdir}/%{name}/agent/vms/systemvm-premium.zip
|
||||||
%doc README
|
%doc README
|
||||||
%doc INSTALL
|
|
||||||
%doc HACKING
|
%doc HACKING
|
||||||
%doc README.html
|
|
||||||
%doc debian/copyright
|
%doc debian/copyright
|
||||||
|
|
||||||
%endif
|
%endif
|
||||||
@ -519,9 +506,7 @@ fi
|
|||||||
%defattr(-,root,root,-)
|
%defattr(-,root,root,-)
|
||||||
%attr(755,root,root) %{_bindir}/%{name}-daemonize
|
%attr(755,root,root) %{_bindir}/%{name}-daemonize
|
||||||
%doc README
|
%doc README
|
||||||
%doc INSTALL
|
|
||||||
%doc HACKING
|
%doc HACKING
|
||||||
%doc README.html
|
|
||||||
%doc debian/copyright
|
%doc debian/copyright
|
||||||
|
|
||||||
%files deps
|
%files deps
|
||||||
@ -544,16 +529,13 @@ fi
|
|||||||
%{_javadir}/%{name}-xmlrpc-common-3.*.jar
|
%{_javadir}/%{name}-xmlrpc-common-3.*.jar
|
||||||
%{_javadir}/%{name}-xmlrpc-client-3.*.jar
|
%{_javadir}/%{name}-xmlrpc-client-3.*.jar
|
||||||
%doc README
|
%doc README
|
||||||
%doc INSTALL
|
|
||||||
%doc HACKING
|
%doc HACKING
|
||||||
%doc README.html
|
|
||||||
%doc debian/copyright
|
%doc debian/copyright
|
||||||
|
|
||||||
%files core
|
%files core
|
||||||
%defattr(0644,root,root,0755)
|
%defattr(0644,root,root,0755)
|
||||||
%{_javadir}/%{name}-core.jar
|
%{_javadir}/%{name}-core.jar
|
||||||
%doc README
|
%doc README
|
||||||
%doc INSTALL
|
|
||||||
%doc HACKING
|
%doc HACKING
|
||||||
%doc debian/copyright
|
%doc debian/copyright
|
||||||
|
|
||||||
@ -563,18 +545,14 @@ fi
|
|||||||
%attr(0755,root,root) %{_sbindir}/%{name}-vn
|
%attr(0755,root,root) %{_sbindir}/%{name}-vn
|
||||||
%attr(0755,root,root) %{_initrddir}/%{name}-vnetd
|
%attr(0755,root,root) %{_initrddir}/%{name}-vnetd
|
||||||
%doc README
|
%doc README
|
||||||
%doc INSTALL
|
|
||||||
%doc HACKING
|
%doc HACKING
|
||||||
%doc README.html
|
|
||||||
%doc debian/copyright
|
%doc debian/copyright
|
||||||
|
|
||||||
%files python
|
%files python
|
||||||
%defattr(0644,root,root,0755)
|
%defattr(0644,root,root,0755)
|
||||||
%{_prefix}/lib*/python*/site-packages/%{name}*
|
%{_prefix}/lib*/python*/site-packages/%{name}*
|
||||||
%doc README
|
%doc README
|
||||||
%doc INSTALL
|
|
||||||
%doc HACKING
|
%doc HACKING
|
||||||
%doc README.html
|
|
||||||
%doc debian/copyright
|
%doc debian/copyright
|
||||||
|
|
||||||
%files setup
|
%files setup
|
||||||
@ -594,9 +572,7 @@ fi
|
|||||||
%{_datadir}/%{name}/setup/postprocess-20to21.sql
|
%{_datadir}/%{name}/setup/postprocess-20to21.sql
|
||||||
%{_datadir}/%{name}/setup/schema-20to21.sql
|
%{_datadir}/%{name}/setup/schema-20to21.sql
|
||||||
%doc README
|
%doc README
|
||||||
%doc INSTALL
|
|
||||||
%doc HACKING
|
%doc HACKING
|
||||||
%doc README.html
|
|
||||||
%doc debian/copyright
|
%doc debian/copyright
|
||||||
|
|
||||||
%files client
|
%files client
|
||||||
@ -638,16 +614,13 @@ fi
|
|||||||
%dir %attr(770,root,%{name}) %{_localstatedir}/log/%{name}/management
|
%dir %attr(770,root,%{name}) %{_localstatedir}/log/%{name}/management
|
||||||
%dir %attr(770,root,%{name}) %{_localstatedir}/log/%{name}/agent
|
%dir %attr(770,root,%{name}) %{_localstatedir}/log/%{name}/agent
|
||||||
%doc README
|
%doc README
|
||||||
%doc INSTALL
|
|
||||||
%doc HACKING
|
%doc HACKING
|
||||||
%doc README.html
|
|
||||||
%doc debian/copyright
|
%doc debian/copyright
|
||||||
|
|
||||||
%files agent-libs
|
%files agent-libs
|
||||||
%defattr(0644,root,root,0755)
|
%defattr(0644,root,root,0755)
|
||||||
%{_javadir}/%{name}-agent.jar
|
%{_javadir}/%{name}-agent.jar
|
||||||
%doc README
|
%doc README
|
||||||
%doc INSTALL
|
|
||||||
%doc HACKING
|
%doc HACKING
|
||||||
%doc debian/copyright
|
%doc debian/copyright
|
||||||
|
|
||||||
@ -666,9 +639,7 @@ fi
|
|||||||
%attr(0755,root,root) %{_bindir}/%{name}-setup-agent
|
%attr(0755,root,root) %{_bindir}/%{name}-setup-agent
|
||||||
%dir %attr(770,root,root) %{_localstatedir}/log/%{name}/agent
|
%dir %attr(770,root,root) %{_localstatedir}/log/%{name}/agent
|
||||||
%doc README
|
%doc README
|
||||||
%doc INSTALL
|
|
||||||
%doc HACKING
|
%doc HACKING
|
||||||
%doc README.html
|
|
||||||
%doc debian/copyright
|
%doc debian/copyright
|
||||||
|
|
||||||
%files console-proxy
|
%files console-proxy
|
||||||
@ -683,9 +654,7 @@ fi
|
|||||||
%attr(0755,root,root) %{_bindir}/%{name}-setup-console-proxy
|
%attr(0755,root,root) %{_bindir}/%{name}-setup-console-proxy
|
||||||
%dir %attr(770,root,root) %{_localstatedir}/log/%{name}/console-proxy
|
%dir %attr(770,root,root) %{_localstatedir}/log/%{name}/console-proxy
|
||||||
%doc README
|
%doc README
|
||||||
%doc INSTALL
|
|
||||||
%doc HACKING
|
%doc HACKING
|
||||||
%doc README.html
|
|
||||||
%doc debian/copyright
|
%doc debian/copyright
|
||||||
|
|
||||||
%if %{_premium}
|
%if %{_premium}
|
||||||
@ -698,18 +667,14 @@ fi
|
|||||||
%{_libdir}/%{name}/test/*
|
%{_libdir}/%{name}/test/*
|
||||||
%{_sysconfdir}/%{name}/test/*
|
%{_sysconfdir}/%{name}/test/*
|
||||||
%doc README
|
%doc README
|
||||||
%doc INSTALL
|
|
||||||
%doc HACKING
|
%doc HACKING
|
||||||
%doc README.html
|
|
||||||
%doc debian/copyright
|
%doc debian/copyright
|
||||||
|
|
||||||
%files premium-deps
|
%files premium-deps
|
||||||
%defattr(0644,root,root,0755)
|
%defattr(0644,root,root,0755)
|
||||||
%{_javadir}/%{name}-premium/*.jar
|
%{_javadir}/%{name}-premium/*.jar
|
||||||
%doc README
|
%doc README
|
||||||
%doc INSTALL
|
|
||||||
%doc HACKING
|
%doc HACKING
|
||||||
%doc README.html
|
|
||||||
%doc debian/copyright
|
%doc debian/copyright
|
||||||
|
|
||||||
%files premium
|
%files premium
|
||||||
@ -723,9 +688,7 @@ fi
|
|||||||
%{_datadir}/%{name}/setup/create-database-premium.sql
|
%{_datadir}/%{name}/setup/create-database-premium.sql
|
||||||
%{_datadir}/%{name}/setup/create-schema-premium.sql
|
%{_datadir}/%{name}/setup/create-schema-premium.sql
|
||||||
%doc README
|
%doc README
|
||||||
%doc INSTALL
|
|
||||||
%doc HACKING
|
%doc HACKING
|
||||||
%doc README.html
|
|
||||||
%doc debian/copyright
|
%doc debian/copyright
|
||||||
|
|
||||||
%files usage
|
%files usage
|
||||||
@ -738,9 +701,7 @@ fi
|
|||||||
%config(noreplace) %{_sysconfdir}/%{name}/usage/log4j-%{name}_usage.xml
|
%config(noreplace) %{_sysconfdir}/%{name}/usage/log4j-%{name}_usage.xml
|
||||||
%config(noreplace) %attr(640,root,%{name}) %{_sysconfdir}/%{name}/usage/db.properties
|
%config(noreplace) %attr(640,root,%{name}) %{_sysconfdir}/%{name}/usage/db.properties
|
||||||
%doc README
|
%doc README
|
||||||
%doc INSTALL
|
|
||||||
%doc HACKING
|
%doc HACKING
|
||||||
%doc README.html
|
|
||||||
%doc debian/copyright
|
%doc debian/copyright
|
||||||
|
|
||||||
%endif
|
%endif
|
||||||
|
|||||||
@ -33,7 +33,7 @@ for x in private public ; do
|
|||||||
defaultroute=`ip route | grep ^default | cut -d ' ' -f 5`
|
defaultroute=`ip route | grep ^default | cut -d ' ' -f 5`
|
||||||
test -n "$defaultroute"
|
test -n "$defaultroute"
|
||||||
echo "Using auto-discovered network device $defaultroute which is the default route"
|
echo "Using auto-discovered network device $defaultroute which is the default route"
|
||||||
SERVICEARGS="$SERVICEARGS $x.network.device="$defaultroute
|
SERVICEARGS="$SERVICEARGS -D$x.network.device="$defaultroute
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ function termagent() {
|
|||||||
|
|
||||||
trap termagent TERM
|
trap termagent TERM
|
||||||
while true ; do
|
while true ; do
|
||||||
java -Xms128M -Xmx384M -cp "$CLASSPATH" "$@" com.cloud.agent.AgentShell $SERVICEARGS &
|
java -Xms128M -Xmx384M -cp "$CLASSPATH" $SERVICEARGS "$@" com.cloud.agent.AgentShell &
|
||||||
agentpid=$!
|
agentpid=$!
|
||||||
echo "Console Proxy started. PID: $!" >&2
|
echo "Console Proxy started. PID: $!" >&2
|
||||||
wait $agentpid
|
wait $agentpid
|
||||||
|
|||||||
@ -18,26 +18,5 @@
|
|||||||
<classpathentry kind="lib" path="/thirdparty/commons-httpclient-3.1.jar"/>
|
<classpathentry kind="lib" path="/thirdparty/commons-httpclient-3.1.jar"/>
|
||||||
<classpathentry kind="lib" path="/thirdparty/commons-codec-1.4.jar"/>
|
<classpathentry kind="lib" path="/thirdparty/commons-codec-1.4.jar"/>
|
||||||
<classpathentry combineaccessrules="false" kind="src" path="/api"/>
|
<classpathentry combineaccessrules="false" kind="src" path="/api"/>
|
||||||
<classpathentry kind="lib" path="/thirdparty/vmware/apputils.jar"/>
|
|
||||||
<classpathentry kind="lib" path="/thirdparty/vmware/vim.jar"/>
|
|
||||||
<classpathentry kind="lib" path="/thirdparty/vmware/vim25.jar"/>
|
|
||||||
<classpathentry kind="lib" path="/thirdparty/vmware/lib/activation.jar"/>
|
|
||||||
<classpathentry kind="lib" path="/thirdparty/vmware/lib/axis.jar"/>
|
|
||||||
<classpathentry kind="lib" path="/thirdparty/vmware/lib/jaxen-core.jar"/>
|
|
||||||
<classpathentry kind="lib" path="/thirdparty/vmware/lib/jaxen-jdom.jar"/>
|
|
||||||
<classpathentry kind="lib" path="/thirdparty/vmware/lib/jaxen.license"/>
|
|
||||||
<classpathentry kind="lib" path="/thirdparty/vmware/lib/jaxen.readme"/>
|
|
||||||
<classpathentry kind="lib" path="/thirdparty/vmware/lib/jaxrpc.jar"/>
|
|
||||||
<classpathentry kind="lib" path="/thirdparty/vmware/lib/jdom.jar"/>
|
|
||||||
<classpathentry kind="lib" path="/thirdparty/vmware/lib/mailapi.jar"/>
|
|
||||||
<classpathentry kind="lib" path="/thirdparty/vmware/lib/saxpath.jar"/>
|
|
||||||
<classpathentry kind="lib" path="/thirdparty/vmware/lib/smtp.jar"/>
|
|
||||||
<classpathentry kind="lib" path="/thirdparty/vmware/lib/wbem.jar"/>
|
|
||||||
<classpathentry kind="lib" path="/thirdparty/vmware/lib/xalan.jar"/>
|
|
||||||
<classpathentry kind="lib" path="/thirdparty/vmware/lib/xalan.license"/>
|
|
||||||
<classpathentry kind="lib" path="/thirdparty/vmware/lib/xalan.readme"/>
|
|
||||||
<classpathentry kind="lib" path="/thirdparty/vmware/lib/xerces.jar"/>
|
|
||||||
<classpathentry kind="lib" path="/thirdparty/vmware/lib/xerces.readme"/>
|
|
||||||
<classpathentry kind="lib" path="/thirdparty/vmware/lib/xml-apis.jar"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@ -30,7 +30,6 @@ public class BackupSnapshotCommand extends SnapshotCommand {
|
|||||||
private boolean isFirstSnapshotOfRootVolume;
|
private boolean isFirstSnapshotOfRootVolume;
|
||||||
private boolean isVolumeInactive;
|
private boolean isVolumeInactive;
|
||||||
private String firstBackupUuid;
|
private String firstBackupUuid;
|
||||||
private String vmName;
|
|
||||||
|
|
||||||
protected BackupSnapshotCommand() {
|
protected BackupSnapshotCommand() {
|
||||||
|
|
||||||
@ -57,8 +56,7 @@ public class BackupSnapshotCommand extends SnapshotCommand {
|
|||||||
String prevBackupUuid,
|
String prevBackupUuid,
|
||||||
String firstBackupUuid,
|
String firstBackupUuid,
|
||||||
boolean isFirstSnapshotOfRootVolume,
|
boolean isFirstSnapshotOfRootVolume,
|
||||||
boolean isVolumeInactive,
|
boolean isVolumeInactive)
|
||||||
String vmName)
|
|
||||||
{
|
{
|
||||||
super(primaryStoragePoolNameLabel, secondaryStoragePoolURL, snapshotUuid, snapshotName, dcId, accountId, volumeId);
|
super(primaryStoragePoolNameLabel, secondaryStoragePoolURL, snapshotUuid, snapshotName, dcId, accountId, volumeId);
|
||||||
this.prevSnapshotUuid = prevSnapshotUuid;
|
this.prevSnapshotUuid = prevSnapshotUuid;
|
||||||
@ -66,7 +64,6 @@ public class BackupSnapshotCommand extends SnapshotCommand {
|
|||||||
this.firstBackupUuid = firstBackupUuid;
|
this.firstBackupUuid = firstBackupUuid;
|
||||||
this.isFirstSnapshotOfRootVolume = isFirstSnapshotOfRootVolume;
|
this.isFirstSnapshotOfRootVolume = isFirstSnapshotOfRootVolume;
|
||||||
this.isVolumeInactive = isVolumeInactive;
|
this.isVolumeInactive = isVolumeInactive;
|
||||||
this.vmName = vmName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPrevSnapshotUuid() {
|
public String getPrevSnapshotUuid() {
|
||||||
@ -89,7 +86,4 @@ public class BackupSnapshotCommand extends SnapshotCommand {
|
|||||||
return isVolumeInactive;
|
return isVolumeInactive;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getVmName() {
|
|
||||||
return vmName;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -29,7 +29,6 @@ public class CreateCommand extends Command {
|
|||||||
private StoragePoolTO pool;
|
private StoragePoolTO pool;
|
||||||
private DiskCharacteristicsTO diskCharacteristics;
|
private DiskCharacteristicsTO diskCharacteristics;
|
||||||
private String templateUrl;
|
private String templateUrl;
|
||||||
private long size;
|
|
||||||
|
|
||||||
protected CreateCommand() {
|
protected CreateCommand() {
|
||||||
super();
|
super();
|
||||||
@ -45,7 +44,7 @@ public class CreateCommand extends Command {
|
|||||||
* @param pool
|
* @param pool
|
||||||
*/
|
*/
|
||||||
public CreateCommand(VolumeVO vol, VMInstanceVO vm, DiskCharacteristicsTO diskCharacteristics, String templateUrl, StoragePoolVO pool) {
|
public CreateCommand(VolumeVO vol, VMInstanceVO vm, DiskCharacteristicsTO diskCharacteristics, String templateUrl, StoragePoolVO pool) {
|
||||||
this(vol, vm, diskCharacteristics, pool, 0);
|
this(vol, vm, diskCharacteristics, pool);
|
||||||
this.templateUrl = templateUrl;
|
this.templateUrl = templateUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,12 +56,11 @@ public class CreateCommand extends Command {
|
|||||||
* @param diskCharacteristics
|
* @param diskCharacteristics
|
||||||
* @param pool
|
* @param pool
|
||||||
*/
|
*/
|
||||||
public CreateCommand(VolumeVO vol, VMInstanceVO vm, DiskCharacteristicsTO diskCharacteristics, StoragePoolVO pool, long size) {
|
public CreateCommand(VolumeVO vol, VMInstanceVO vm, DiskCharacteristicsTO diskCharacteristics, StoragePoolVO pool) {
|
||||||
this.volId = vol.getId();
|
this.volId = vol.getId();
|
||||||
this.diskCharacteristics = diskCharacteristics;
|
this.diskCharacteristics = diskCharacteristics;
|
||||||
this.pool = new StoragePoolTO(pool);
|
this.pool = new StoragePoolTO(pool);
|
||||||
this.templateUrl = null;
|
this.templateUrl = null;
|
||||||
this.size = size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -85,8 +83,4 @@ public class CreateCommand extends Command {
|
|||||||
public long getVolumeId() {
|
public long getVolumeId() {
|
||||||
return volId;
|
return volId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getSize(){
|
|
||||||
return this.size;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,122 +0,0 @@
|
|||||||
package com.cloud.hypervisor.vmware.resource;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.naming.ConfigurationException;
|
|
||||||
|
|
||||||
import com.cloud.agent.IAgentControl;
|
|
||||||
import com.cloud.agent.api.Answer;
|
|
||||||
import com.cloud.agent.api.Command;
|
|
||||||
import com.cloud.agent.api.PingCommand;
|
|
||||||
import com.cloud.agent.api.StartupCommand;
|
|
||||||
import com.cloud.agent.api.storage.CopyVolumeAnswer;
|
|
||||||
import com.cloud.agent.api.storage.CopyVolumeCommand;
|
|
||||||
import com.cloud.agent.api.storage.CreateAnswer;
|
|
||||||
import com.cloud.agent.api.storage.CreateCommand;
|
|
||||||
import com.cloud.agent.api.storage.DestroyCommand;
|
|
||||||
import com.cloud.agent.api.storage.DownloadAnswer;
|
|
||||||
import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
|
|
||||||
import com.cloud.agent.api.storage.ShareAnswer;
|
|
||||||
import com.cloud.agent.api.storage.ShareCommand;
|
|
||||||
import com.cloud.host.Host.Type;
|
|
||||||
import com.cloud.resource.ServerResource;
|
|
||||||
import com.cloud.storage.resource.StoragePoolResource;
|
|
||||||
|
|
||||||
public class VmwareResource implements StoragePoolResource, ServerResource {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DownloadAnswer execute(PrimaryStorageDownloadCommand cmd) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Answer execute(DestroyCommand cmd) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ShareAnswer execute(ShareCommand cmd) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CopyVolumeAnswer execute(CopyVolumeCommand cmd) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CreateAnswer execute(CreateCommand cmd) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void disconnected() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Answer executeRequest(Command cmd) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IAgentControl getAgentControl() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PingCommand getCurrentStatus(long id) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Type getType() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public StartupCommand[] initialize() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAgentControl(IAgentControl agentControl) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
|
|
||||||
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean start() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean stop() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -148,13 +148,13 @@ import com.cloud.exception.InternalErrorException;
|
|||||||
import com.cloud.host.Host.Type;
|
import com.cloud.host.Host.Type;
|
||||||
import com.cloud.hypervisor.Hypervisor;
|
import com.cloud.hypervisor.Hypervisor;
|
||||||
import com.cloud.resource.ServerResource;
|
import com.cloud.resource.ServerResource;
|
||||||
import com.cloud.storage.Storage.ImageFormat;
|
|
||||||
import com.cloud.storage.Storage.StoragePoolType;
|
|
||||||
import com.cloud.storage.StorageLayer;
|
import com.cloud.storage.StorageLayer;
|
||||||
import com.cloud.storage.StoragePoolVO;
|
import com.cloud.storage.StoragePoolVO;
|
||||||
|
import com.cloud.storage.VolumeVO;
|
||||||
|
import com.cloud.storage.Storage.ImageFormat;
|
||||||
|
import com.cloud.storage.Storage.StoragePoolType;
|
||||||
import com.cloud.storage.Volume.StorageResourceType;
|
import com.cloud.storage.Volume.StorageResourceType;
|
||||||
import com.cloud.storage.Volume.VolumeType;
|
import com.cloud.storage.Volume.VolumeType;
|
||||||
import com.cloud.storage.VolumeVO;
|
|
||||||
import com.cloud.storage.resource.StoragePoolResource;
|
import com.cloud.storage.resource.StoragePoolResource;
|
||||||
import com.cloud.storage.template.TemplateInfo;
|
import com.cloud.storage.template.TemplateInfo;
|
||||||
import com.cloud.utils.NumbersUtil;
|
import com.cloud.utils.NumbersUtil;
|
||||||
@ -171,7 +171,6 @@ import com.cloud.vm.State;
|
|||||||
import com.cloud.vm.VirtualMachineName;
|
import com.cloud.vm.VirtualMachineName;
|
||||||
import com.trilead.ssh2.SCPClient;
|
import com.trilead.ssh2.SCPClient;
|
||||||
import com.xensource.xenapi.APIVersion;
|
import com.xensource.xenapi.APIVersion;
|
||||||
import com.xensource.xenapi.Bond;
|
|
||||||
import com.xensource.xenapi.Connection;
|
import com.xensource.xenapi.Connection;
|
||||||
import com.xensource.xenapi.Console;
|
import com.xensource.xenapi.Console;
|
||||||
import com.xensource.xenapi.Host;
|
import com.xensource.xenapi.Host;
|
||||||
@ -184,10 +183,6 @@ import com.xensource.xenapi.Pool;
|
|||||||
import com.xensource.xenapi.SR;
|
import com.xensource.xenapi.SR;
|
||||||
import com.xensource.xenapi.Session;
|
import com.xensource.xenapi.Session;
|
||||||
import com.xensource.xenapi.Types;
|
import com.xensource.xenapi.Types;
|
||||||
import com.xensource.xenapi.Types.BadServerResponse;
|
|
||||||
import com.xensource.xenapi.Types.IpConfigurationMode;
|
|
||||||
import com.xensource.xenapi.Types.VmPowerState;
|
|
||||||
import com.xensource.xenapi.Types.XenAPIException;
|
|
||||||
import com.xensource.xenapi.VBD;
|
import com.xensource.xenapi.VBD;
|
||||||
import com.xensource.xenapi.VDI;
|
import com.xensource.xenapi.VDI;
|
||||||
import com.xensource.xenapi.VIF;
|
import com.xensource.xenapi.VIF;
|
||||||
@ -195,6 +190,9 @@ import com.xensource.xenapi.VLAN;
|
|||||||
import com.xensource.xenapi.VM;
|
import com.xensource.xenapi.VM;
|
||||||
import com.xensource.xenapi.VMGuestMetrics;
|
import com.xensource.xenapi.VMGuestMetrics;
|
||||||
import com.xensource.xenapi.XenAPIObject;
|
import com.xensource.xenapi.XenAPIObject;
|
||||||
|
import com.xensource.xenapi.Types.BadServerResponse;
|
||||||
|
import com.xensource.xenapi.Types.VmPowerState;
|
||||||
|
import com.xensource.xenapi.Types.XenAPIException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encapsulates the interface to the XenServer API.
|
* Encapsulates the interface to the XenServer API.
|
||||||
@ -2794,7 +2792,6 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||||||
protected String startSystemVM(String vmName, String vlanId, Network nw0, List<VolumeVO> vols, String bootArgs, String guestMacAddr, String privateIp, String privateMacAddr,
|
protected String startSystemVM(String vmName, String vlanId, Network nw0, List<VolumeVO> vols, String bootArgs, String guestMacAddr, String privateIp, String privateMacAddr,
|
||||||
String publicMacAddr, int cmdPort, long ramSize) {
|
String publicMacAddr, int cmdPort, long ramSize) {
|
||||||
|
|
||||||
setupLinkLocalNetwork();
|
|
||||||
VM vm = null;
|
VM vm = null;
|
||||||
List<Ternary<SR, VDI, VolumeVO>> mounts = null;
|
List<Ternary<SR, VDI, VolumeVO>> mounts = null;
|
||||||
Connection conn = getConnection();
|
Connection conn = getConnection();
|
||||||
@ -3166,29 +3163,6 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||||||
if (s_logger.isDebugEnabled()) {
|
if (s_logger.isDebugEnabled()) {
|
||||||
s_logger.debug("Found a network called " + name + " on host=" + _host.ip + "; Network=" + nr.uuid + "; pif=" + pr.uuid);
|
s_logger.debug("Found a network called " + name + " on host=" + _host.ip + "; Network=" + nr.uuid + "; pif=" + pr.uuid);
|
||||||
}
|
}
|
||||||
if (pr.bondMasterOf != null && pr.bondMasterOf.size() > 0) {
|
|
||||||
if (pr.bondMasterOf.size() > 1) {
|
|
||||||
String msg = new StringBuilder("Unsupported configuration. Network " + name + " has more than one bond. Network=").append(nr.uuid)
|
|
||||||
.append("; pif=").append(pr.uuid).toString();
|
|
||||||
s_logger.warn(msg);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
Bond bond = pr.bondMasterOf.iterator().next();
|
|
||||||
Set<PIF> slaves = bond.getSlaves(conn);
|
|
||||||
for (PIF slave : slaves) {
|
|
||||||
PIF.Record spr = slave.getRecord(conn);
|
|
||||||
if (spr.management) {
|
|
||||||
Host host = Host.getByUuid(conn, _host.uuid);
|
|
||||||
if (!transferManagementNetwork(conn, host, slave, spr, pif)) {
|
|
||||||
String msg = new StringBuilder("Unable to transfer management network. slave=" + spr.uuid + "; master=" + pr.uuid + "; host="
|
|
||||||
+ _host.uuid).toString();
|
|
||||||
s_logger.warn(msg);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Nic(network, nr, pif, pr);
|
return new Nic(network, nr, pif, pr);
|
||||||
}
|
}
|
||||||
@ -3546,6 +3520,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||||||
}
|
}
|
||||||
_host.privatePif = privateNic.pr.uuid;
|
_host.privatePif = privateNic.pr.uuid;
|
||||||
_host.privateNetwork = privateNic.nr.uuid;
|
_host.privateNetwork = privateNic.nr.uuid;
|
||||||
|
_privateNetworkName = privateNic.nr.nameLabel;
|
||||||
|
|
||||||
Nic guestNic = null;
|
Nic guestNic = null;
|
||||||
if (_guestNetworkName != null && !_guestNetworkName.equals(_privateNetworkName)) {
|
if (_guestNetworkName != null && !_guestNetworkName.equals(_privateNetworkName)) {
|
||||||
@ -3557,6 +3532,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||||||
} else {
|
} else {
|
||||||
guestNic = privateNic;
|
guestNic = privateNic;
|
||||||
}
|
}
|
||||||
|
_guestNetworkName = guestNic.nr.nameLabel;
|
||||||
_host.guestNetwork = guestNic.nr.uuid;
|
_host.guestNetwork = guestNic.nr.uuid;
|
||||||
_host.guestPif = guestNic.pr.uuid;
|
_host.guestPif = guestNic.pr.uuid;
|
||||||
|
|
||||||
@ -3572,6 +3548,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||||||
}
|
}
|
||||||
_host.publicPif = publicNic.pr.uuid;
|
_host.publicPif = publicNic.pr.uuid;
|
||||||
_host.publicNetwork = publicNic.nr.uuid;
|
_host.publicNetwork = publicNic.nr.uuid;
|
||||||
|
_publicNetworkName = publicNic.nr.nameLabel;
|
||||||
|
|
||||||
|
|
||||||
Nic storageNic1 = getLocalNetwork(conn, _storageNetworkName1);
|
Nic storageNic1 = getLocalNetwork(conn, _storageNetworkName1);
|
||||||
@ -3679,35 +3656,6 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean transferManagementNetwork(Connection conn, Host host, PIF src, PIF.Record spr, PIF dest) throws XmlRpcException, XenAPIException {
|
|
||||||
dest.reconfigureIp(conn, spr.ipConfigurationMode, spr.IP, spr.netmask, spr.gateway, spr.DNS);
|
|
||||||
Host.managementReconfigure(conn, dest);
|
|
||||||
String hostUuid = null;
|
|
||||||
int count = 0;
|
|
||||||
while (count < 10) {
|
|
||||||
try {
|
|
||||||
Thread.sleep(10000);
|
|
||||||
hostUuid = host.getUuid(conn);
|
|
||||||
if (hostUuid != null) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} catch (XmlRpcException e) {
|
|
||||||
s_logger.debug("Waiting for host to come back: " + e.getMessage());
|
|
||||||
} catch (XenAPIException e) {
|
|
||||||
s_logger.debug("Waiting for host to come back: " + e.getMessage());
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
s_logger.debug("Gotta run");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (hostUuid == null) {
|
|
||||||
s_logger.warn("Unable to transfer the management network from " + spr.uuid);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
src.reconfigureIp(conn, IpConfigurationMode.NONE, null, null, null, null);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StartupCommand[] initialize() throws IllegalArgumentException{
|
public StartupCommand[] initialize() throws IllegalArgumentException{
|
||||||
@ -3720,6 +3668,8 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setupLinkLocalNetwork();
|
||||||
|
|
||||||
destroyStoppedVm();
|
destroyStoppedVm();
|
||||||
StartupRoutingCommand cmd = new StartupRoutingCommand();
|
StartupRoutingCommand cmd = new StartupRoutingCommand();
|
||||||
fillHostInfo(cmd);
|
fillHostInfo(cmd);
|
||||||
@ -4066,15 +4016,9 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||||||
if (details == null) {
|
if (details == null) {
|
||||||
details = new HashMap<String, String>();
|
details = new HashMap<String, String>();
|
||||||
}
|
}
|
||||||
if (_privateNetworkName != null) {
|
|
||||||
details.put("private.network.device", _privateNetworkName);
|
details.put("private.network.device", _privateNetworkName);
|
||||||
}
|
|
||||||
if (_publicNetworkName != null) {
|
|
||||||
details.put("public.network.device", _publicNetworkName);
|
details.put("public.network.device", _publicNetworkName);
|
||||||
}
|
|
||||||
if (_guestNetworkName != null) {
|
|
||||||
details.put("guest.network.device", _guestNetworkName);
|
details.put("guest.network.device", _guestNetworkName);
|
||||||
}
|
|
||||||
details.put("can_bridge_firewall", Boolean.toString(_canBridgeFirewall));
|
details.put("can_bridge_firewall", Boolean.toString(_canBridgeFirewall));
|
||||||
cmd.setHostDetails(details);
|
cmd.setHostDetails(details);
|
||||||
cmd.setName(hr.nameLabel);
|
cmd.setName(hr.nameLabel);
|
||||||
@ -4281,11 +4225,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||||||
vdir.nameLabel = dskch.getName();
|
vdir.nameLabel = dskch.getName();
|
||||||
vdir.SR = poolSr;
|
vdir.SR = poolSr;
|
||||||
vdir.type = Types.VdiType.USER;
|
vdir.type = Types.VdiType.USER;
|
||||||
|
vdir.virtualSize = dskch.getSize();
|
||||||
if(cmd.getSize()!=0)
|
|
||||||
vdir.virtualSize = cmd.getSize();
|
|
||||||
else
|
|
||||||
vdir.virtualSize = dskch.getSize();
|
|
||||||
vdi = VDI.create(conn, vdir);
|
vdi = VDI.create(conn, vdir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -48,12 +48,12 @@ public class ExteralIpAddressAllocator implements IpAddrAllocator{
|
|||||||
@Inject IPAddressDao _ipAddressDao = null;
|
@Inject IPAddressDao _ipAddressDao = null;
|
||||||
@Inject VlanDao _vlanDao;
|
@Inject VlanDao _vlanDao;
|
||||||
private boolean _isExternalIpAllocatorEnabled = false;
|
private boolean _isExternalIpAllocatorEnabled = false;
|
||||||
private String _externalIpAllocatorUrl = null;
|
private String _externalIpAllocatorUrl;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IpAddr getPrivateIpAddress(String macAddr, long dcId, long podId) {
|
public IpAddr getPrivateIpAddress(String macAddr, long dcId, long podId) {
|
||||||
if (_externalIpAllocatorUrl == null || this._externalIpAllocatorUrl.equalsIgnoreCase("")) {
|
if (this._externalIpAllocatorUrl.equalsIgnoreCase("")) {
|
||||||
return new IpAddr();
|
return new IpAddr();
|
||||||
}
|
}
|
||||||
String urlString = this._externalIpAllocatorUrl + "?command=getIpAddr&mac=" + macAddr + "&dc=" + dcId + "&pod=" + podId;
|
String urlString = this._externalIpAllocatorUrl + "?command=getIpAddr&mac=" + macAddr + "&dc=" + dcId + "&pod=" + podId;
|
||||||
@ -102,12 +102,10 @@ public class ExteralIpAddressAllocator implements IpAddrAllocator{
|
|||||||
@Override
|
@Override
|
||||||
public boolean releasePrivateIpAddress(String ip, long dcId, long podId) {
|
public boolean releasePrivateIpAddress(String ip, long dcId, long podId) {
|
||||||
/*TODO: call API to release the ip address from external DHCP server*/
|
/*TODO: call API to release the ip address from external DHCP server*/
|
||||||
if (_externalIpAllocatorUrl == null || this._externalIpAllocatorUrl.equalsIgnoreCase("")) {
|
String urlString = this._externalIpAllocatorUrl + "?command=releaseIpAddr&ip=" + ip + "&dc=" + dcId + "&pod=" + podId;
|
||||||
|
if (this._externalIpAllocatorUrl.equalsIgnoreCase("")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
String urlString = this._externalIpAllocatorUrl + "?command=releaseIpAddr&ip=" + ip + "&dc=" + dcId + "&pod=" + podId;
|
|
||||||
|
|
||||||
s_logger.debug("releaseIP:" + urlString);
|
s_logger.debug("releaseIP:" + urlString);
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -481,11 +481,10 @@ public interface ManagementServer {
|
|||||||
* @param name - name for the volume
|
* @param name - name for the volume
|
||||||
* @param zoneId - id of the zone to create this volume on
|
* @param zoneId - id of the zone to create this volume on
|
||||||
* @param diskOfferingId - id of the disk offering to create this volume with
|
* @param diskOfferingId - id of the disk offering to create this volume with
|
||||||
* @param size - size of the volume
|
|
||||||
* @return true if success, false if not
|
* @return true if success, false if not
|
||||||
*/
|
*/
|
||||||
VolumeVO createVolume(long accountId, long userId, String name, long zoneId, long diskOfferingId, long startEventId, long size) throws InternalErrorException;
|
VolumeVO createVolume(long accountId, long userId, String name, long zoneId, long diskOfferingId, long startEventId) throws InternalErrorException;
|
||||||
long createVolumeAsync(long accountId, long userId, String name, long zoneId, long diskOfferingId, long size) throws InvalidParameterValueException, InternalErrorException, ResourceAllocationException;
|
long createVolumeAsync(long accountId, long userId, String name, long zoneId, long diskOfferingId) throws InvalidParameterValueException, InternalErrorException, ResourceAllocationException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds the root volume of the VM
|
* Finds the root volume of the VM
|
||||||
@ -644,15 +643,14 @@ public interface ManagementServer {
|
|||||||
* @param displayName user-supplied name to be shown in the UI or returned in the API
|
* @param displayName user-supplied name to be shown in the UI or returned in the API
|
||||||
* @param groupName user-supplied groupname to be shown in the UI or returned in the API
|
* @param groupName user-supplied groupname to be shown in the UI or returned in the API
|
||||||
* @param userData user-supplied base64-encoded data that can be retrieved by the instance from the virtual router
|
* @param userData user-supplied base64-encoded data that can be retrieved by the instance from the virtual router
|
||||||
* @param size -- size to be used for volume creation in case the disk offering is private (i.e. size=0)
|
|
||||||
* @return VirtualMachine if successfully deployed, null otherwise
|
* @return VirtualMachine if successfully deployed, null otherwise
|
||||||
* @throws InvalidParameterValueException if the parameter values are incorrect.
|
* @throws InvalidParameterValueException if the parameter values are incorrect.
|
||||||
* @throws ExecutionException
|
* @throws ExecutionException
|
||||||
* @throws StorageUnavailableException
|
* @throws StorageUnavailableException
|
||||||
* @throws ConcurrentOperationException
|
* @throws ConcurrentOperationException
|
||||||
*/
|
*/
|
||||||
UserVm deployVirtualMachine(long userId, long accountId, long dataCenterId, long serviceOfferingId, long templateId, Long diskOfferingId, String domain, String password, String displayName, String group, String userData, String [] groups, long startEventId, long size) throws ResourceAllocationException, InvalidParameterValueException, InternalErrorException, InsufficientStorageCapacityException, PermissionDeniedException, ExecutionException, StorageUnavailableException, ConcurrentOperationException;
|
UserVm deployVirtualMachine(long userId, long accountId, long dataCenterId, long serviceOfferingId, long templateId, Long diskOfferingId, String domain, String password, String displayName, String group, String userData, String [] groups, long startEventId) throws ResourceAllocationException, InvalidParameterValueException, InternalErrorException, InsufficientStorageCapacityException, PermissionDeniedException, ExecutionException, StorageUnavailableException, ConcurrentOperationException;
|
||||||
long deployVirtualMachineAsync(long userId, long accountId, long dataCenterId, long serviceOfferingId, long templateId, Long diskOfferingId, String domain, String password, String displayName, String group, String userData, String [] groups, long size) throws InvalidParameterValueException, PermissionDeniedException;
|
long deployVirtualMachineAsync(long userId, long accountId, long dataCenterId, long serviceOfferingId, long templateId, Long diskOfferingId, String domain, String password, String displayName, String group, String userData, String [] groups) throws InvalidParameterValueException, PermissionDeniedException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts a Virtual Machine
|
* Starts a Virtual Machine
|
||||||
@ -714,9 +712,8 @@ public interface ManagementServer {
|
|||||||
* Recovers a destroyed virtual machine.
|
* Recovers a destroyed virtual machine.
|
||||||
* @param vmId
|
* @param vmId
|
||||||
* @return true if recovered, false otherwise
|
* @return true if recovered, false otherwise
|
||||||
* @throws InternalErrorException
|
|
||||||
*/
|
*/
|
||||||
boolean recoverVirtualMachine(long vmId) throws ResourceAllocationException, InternalErrorException;
|
boolean recoverVirtualMachine(long vmId) throws ResourceAllocationException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Upgrade the virtual machine to a new service offering
|
* Upgrade the virtual machine to a new service offering
|
||||||
@ -1769,12 +1766,6 @@ public interface ManagementServer {
|
|||||||
*/
|
*/
|
||||||
DiskOfferingVO findDiskOfferingById(long diskOffering);
|
DiskOfferingVO findDiskOfferingById(long diskOffering);
|
||||||
|
|
||||||
/**
|
|
||||||
* Finds the obj associated with the private disk offering
|
|
||||||
* @return -- vo obj for private disk offering
|
|
||||||
*/
|
|
||||||
List<DiskOfferingVO> findPrivateDiskOffering();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the permissions on a template. A private template can be made public, or individual accounts can be granted permission to launch instances from the template.
|
* Update the permissions on a template. A private template can be made public, or individual accounts can be granted permission to launch instances from the template.
|
||||||
* @param templateId
|
* @param templateId
|
||||||
@ -1999,8 +1990,8 @@ public interface ManagementServer {
|
|||||||
*/
|
*/
|
||||||
long updateLoadBalancerRuleAsync(long userId, long accountId, long loadBalancerId, String name, String description, String privatePort, String algorithm);
|
long updateLoadBalancerRuleAsync(long userId, long accountId, long loadBalancerId, String name, String description, String privatePort, String algorithm);
|
||||||
|
|
||||||
void assignToLoadBalancer(long userId, long loadBalancerId, List<Long> instanceIds) throws NetworkRuleConflictException, InternalErrorException, PermissionDeniedException, InvalidParameterValueException;
|
// void assignToLoadBalancer(long userId, long loadBalancerId, List<Long> instanceIds) throws NetworkRuleConflictException, InternalErrorException, PermissionDeniedException, InvalidParameterValueException;
|
||||||
long assignToLoadBalancerAsync(long userId, long loadBalancerId, List<Long> instanceIds);
|
// long assignToLoadBalancerAsync(long userId, long loadBalancerId, List<Long> instanceIds, Map<String, String> params);
|
||||||
boolean removeFromLoadBalancer(long userId, long loadBalancerId, List<Long> instanceIds) throws InvalidParameterValueException;
|
boolean removeFromLoadBalancer(long userId, long loadBalancerId, List<Long> instanceIds) throws InvalidParameterValueException;
|
||||||
long removeFromLoadBalancerAsync(long userId, long loadBalancerId, List<Long> instanceIds);
|
long removeFromLoadBalancerAsync(long userId, long loadBalancerId, List<Long> instanceIds);
|
||||||
|
|
||||||
@ -2182,6 +2173,4 @@ public interface ManagementServer {
|
|||||||
boolean checkLocalStorageConfigVal();
|
boolean checkLocalStorageConfigVal();
|
||||||
|
|
||||||
boolean addConfig(String instance, String component, String category, String name, String value, String description);
|
boolean addConfig(String instance, String component, String category, String name, String value, String description);
|
||||||
|
|
||||||
boolean validateCustomVolumeSizeRange(long size) throws InvalidParameterValueException;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -156,10 +156,6 @@ public class DiskOfferingVO implements DiskOffering {
|
|||||||
this.displayText = displayText;
|
this.displayText = displayText;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getDiskSize(){
|
|
||||||
return diskSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getDiskSizeInBytes() {
|
public long getDiskSizeInBytes() {
|
||||||
return diskSize * 1024 * 1024;
|
return diskSize * 1024 * 1024;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,6 @@ import com.cloud.host.Host;
|
|||||||
import com.cloud.host.HostVO;
|
import com.cloud.host.HostVO;
|
||||||
import com.cloud.service.ServiceOfferingVO;
|
import com.cloud.service.ServiceOfferingVO;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
import com.cloud.uservm.UserVm;
|
|
||||||
import com.cloud.utils.Pair;
|
import com.cloud.utils.Pair;
|
||||||
import com.cloud.utils.component.Manager;
|
import com.cloud.utils.component.Manager;
|
||||||
import com.cloud.utils.exception.ExecutionException;
|
import com.cloud.utils.exception.ExecutionException;
|
||||||
@ -93,10 +92,9 @@ public interface StorageManager extends Manager {
|
|||||||
* @param offering service offering of the vm.
|
* @param offering service offering of the vm.
|
||||||
* @param diskOffering disk offering of the vm.
|
* @param diskOffering disk offering of the vm.
|
||||||
* @param avoids storage pools to avoid.
|
* @param avoids storage pools to avoid.
|
||||||
* @param size : size of the volume if defined
|
|
||||||
* @return List of VolumeVO
|
* @return List of VolumeVO
|
||||||
*/
|
*/
|
||||||
List<VolumeVO> create(Account account, VMInstanceVO vm, VMTemplateVO template, DataCenterVO dc, HostPodVO pod, ServiceOfferingVO offering, DiskOfferingVO diskOffering, long size) throws StorageUnavailableException, ExecutionException;
|
List<VolumeVO> create(Account account, VMInstanceVO vm, VMTemplateVO template, DataCenterVO dc, HostPodVO pod, ServiceOfferingVO offering, DiskOfferingVO diskOffering) throws StorageUnavailableException, ExecutionException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create StoragePool based on uri
|
* Create StoragePool based on uri
|
||||||
@ -158,7 +156,7 @@ public interface StorageManager extends Manager {
|
|||||||
public long createUserVM(Account account, VMInstanceVO vm,
|
public long createUserVM(Account account, VMInstanceVO vm,
|
||||||
VMTemplateVO template, DataCenterVO dc, HostPodVO pod,
|
VMTemplateVO template, DataCenterVO dc, HostPodVO pod,
|
||||||
ServiceOfferingVO offering, DiskOfferingVO diskOffering,
|
ServiceOfferingVO offering, DiskOfferingVO diskOffering,
|
||||||
List<StoragePoolVO> avoids, long size);
|
List<StoragePoolVO> avoids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method sends the given command on all the hosts in the primary storage pool given until is succeeds on any one.
|
* This method sends the given command on all the hosts in the primary storage pool given until is succeeds on any one.
|
||||||
@ -170,7 +168,7 @@ public interface StorageManager extends Manager {
|
|||||||
* @return The answer for that command, could be success or failure.
|
* @return The answer for that command, could be success or failure.
|
||||||
*/
|
*/
|
||||||
Answer sendToHostsOnStoragePool(Long poolId, Command cmd, String basicErrMsg);
|
Answer sendToHostsOnStoragePool(Long poolId, Command cmd, String basicErrMsg);
|
||||||
Answer sendToHostsOnStoragePool(Long poolId, Command cmd, String basicErrMsg, int retriesPerHost, int pauseBeforeRetry, boolean shouldBeSnapshotCapable, Long vmId );
|
Answer sendToHostsOnStoragePool(Long poolId, Command cmd, String basicErrMsg, int retriesPerHost, int pauseBeforeRetry, boolean shouldBeSnapshotCapable);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -197,10 +195,9 @@ public interface StorageManager extends Manager {
|
|||||||
* @param name
|
* @param name
|
||||||
* @param dc
|
* @param dc
|
||||||
* @param diskOffering
|
* @param diskOffering
|
||||||
* @param size
|
|
||||||
* @return VolumeVO
|
* @return VolumeVO
|
||||||
*/
|
*/
|
||||||
VolumeVO createVolume(long accountId, long userId, String name, DataCenterVO dc, DiskOfferingVO diskOffering, long startEventId, long size);
|
VolumeVO createVolume(long accountId, long userId, String name, DataCenterVO dc, DiskOfferingVO diskOffering, long startEventId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marks the specified volume as destroyed in the management server database. The expunge thread will delete the volume from its storage pool.
|
* Marks the specified volume as destroyed in the management server database. The expunge thread will delete the volume from its storage pool.
|
||||||
@ -233,8 +230,6 @@ public interface StorageManager extends Manager {
|
|||||||
*/
|
*/
|
||||||
boolean volumeInactive(VolumeVO volume);
|
boolean volumeInactive(VolumeVO volume);
|
||||||
|
|
||||||
String getVmNameOnVolume(VolumeVO volume);
|
|
||||||
|
|
||||||
List<Pair<VolumeVO, StoragePoolVO>> isStoredOn(VMInstanceVO vm);
|
List<Pair<VolumeVO, StoragePoolVO>> isStoredOn(VMInstanceVO vm);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -25,6 +25,4 @@ import com.cloud.utils.db.GenericDao;
|
|||||||
|
|
||||||
public interface DiskOfferingDao extends GenericDao<DiskOfferingVO, Long> {
|
public interface DiskOfferingDao extends GenericDao<DiskOfferingVO, Long> {
|
||||||
List<DiskOfferingVO> listByDomainId(long domainId);
|
List<DiskOfferingVO> listByDomainId(long domainId);
|
||||||
List<DiskOfferingVO> findPrivateDiskOffering();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,7 +38,6 @@ public class DiskOfferingDaoImpl extends GenericDaoBase<DiskOfferingVO, Long> im
|
|||||||
private static final Logger s_logger = Logger.getLogger(DiskOfferingDaoImpl.class);
|
private static final Logger s_logger = Logger.getLogger(DiskOfferingDaoImpl.class);
|
||||||
|
|
||||||
private final SearchBuilder<DiskOfferingVO> DomainIdSearch;
|
private final SearchBuilder<DiskOfferingVO> DomainIdSearch;
|
||||||
private final SearchBuilder<DiskOfferingVO> PrivateDiskOfferingSearch;
|
|
||||||
private final Attribute _typeAttr;
|
private final Attribute _typeAttr;
|
||||||
|
|
||||||
protected DiskOfferingDaoImpl() {
|
protected DiskOfferingDaoImpl() {
|
||||||
@ -46,10 +45,6 @@ public class DiskOfferingDaoImpl extends GenericDaoBase<DiskOfferingVO, Long> im
|
|||||||
DomainIdSearch.and("domainId", DomainIdSearch.entity().getDomainId(), SearchCriteria.Op.EQ);
|
DomainIdSearch.and("domainId", DomainIdSearch.entity().getDomainId(), SearchCriteria.Op.EQ);
|
||||||
DomainIdSearch.done();
|
DomainIdSearch.done();
|
||||||
|
|
||||||
PrivateDiskOfferingSearch = createSearchBuilder();
|
|
||||||
PrivateDiskOfferingSearch.and("diskSize", PrivateDiskOfferingSearch.entity().getDiskSize(), SearchCriteria.Op.EQ);
|
|
||||||
PrivateDiskOfferingSearch.done();
|
|
||||||
|
|
||||||
_typeAttr = _allAttributes.get("type");
|
_typeAttr = _allAttributes.get("type");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,13 +56,6 @@ public class DiskOfferingDaoImpl extends GenericDaoBase<DiskOfferingVO, Long> im
|
|||||||
return listActiveBy(sc);
|
return listActiveBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DiskOfferingVO> findPrivateDiskOffering() {
|
|
||||||
SearchCriteria<DiskOfferingVO> sc = PrivateDiskOfferingSearch.create();
|
|
||||||
sc.setParameters("diskSize", 0);
|
|
||||||
return listActiveBy(sc);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DiskOfferingVO> searchAll(SearchCriteria<DiskOfferingVO> sc, final Filter filter, final Boolean lock, final boolean cache) {
|
public List<DiskOfferingVO> searchAll(SearchCriteria<DiskOfferingVO> sc, final Filter filter, final Boolean lock, final boolean cache) {
|
||||||
sc.addAnd(_typeAttr, Op.EQ, Type.Disk);
|
sc.addAnd(_typeAttr, Op.EQ, Type.Disk);
|
||||||
|
|||||||
@ -130,6 +130,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
|||||||
public List<VMTemplateVO> listByAccountId(long accountId) {
|
public List<VMTemplateVO> listByAccountId(long accountId) {
|
||||||
SearchCriteria<VMTemplateVO> sc = AccountIdSearch.create();
|
SearchCriteria<VMTemplateVO> sc = AccountIdSearch.create();
|
||||||
sc.setParameters("accountId", accountId);
|
sc.setParameters("accountId", accountId);
|
||||||
|
sc.setParameters("publicTemplate", false);
|
||||||
return listActiveBy(sc);
|
return listActiveBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -28,8 +28,6 @@ public interface VMTemplateHostDao extends GenericDao<VMTemplateHostVO, Long> {
|
|||||||
|
|
||||||
List<VMTemplateHostVO> listByTemplateId(long templateId);
|
List<VMTemplateHostVO> listByTemplateId(long templateId);
|
||||||
|
|
||||||
List<VMTemplateHostVO> listByOnlyTemplateId(long templateId);
|
|
||||||
|
|
||||||
VMTemplateHostVO findByHostTemplate(long hostId, long templateId);
|
VMTemplateHostVO findByHostTemplate(long hostId, long templateId);
|
||||||
|
|
||||||
VMTemplateHostVO findByHostTemplate(long hostId, long templateId, boolean lock);
|
VMTemplateHostVO findByHostTemplate(long hostId, long templateId, boolean lock);
|
||||||
|
|||||||
@ -146,13 +146,6 @@ public class VMTemplateHostDaoImpl extends GenericDaoBase<VMTemplateHostVO, Long
|
|||||||
return listBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<VMTemplateHostVO> listByOnlyTemplateId(long templateId) {
|
|
||||||
SearchCriteria<VMTemplateHostVO> sc = TemplateSearch.create();
|
|
||||||
sc.setParameters("template_id", templateId);
|
|
||||||
return listBy(sc);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VMTemplateHostVO findByHostTemplate(long hostId, long templateId) {
|
public VMTemplateHostVO findByHostTemplate(long hostId, long templateId) {
|
||||||
SearchCriteria<VMTemplateHostVO> sc = HostTemplateSearch.create();
|
SearchCriteria<VMTemplateHostVO> sc = HostTemplateSearch.create();
|
||||||
|
|||||||
@ -22,94 +22,131 @@ import org.apache.log4j.Logger;
|
|||||||
|
|
||||||
import com.cloud.utils.ProcessUtil;
|
import com.cloud.utils.ProcessUtil;
|
||||||
|
|
||||||
|
|
||||||
public class UserContext {
|
public class UserContext {
|
||||||
private static final Logger s_logger = Logger.getLogger(UserContext.class);
|
private static final Logger s_logger = Logger.getLogger(UserContext.class);
|
||||||
|
|
||||||
private static ThreadLocal<UserContext> s_currentContext = new ThreadLocal<UserContext>();
|
private static ThreadLocal<UserContext> s_currentContext = new ThreadLocal<UserContext>();
|
||||||
|
|
||||||
private Long userId;
|
private Long userId;
|
||||||
private Long accountId;
|
private String accountName;
|
||||||
private String sessionId;
|
private Long accountId;
|
||||||
|
private Long domainId;
|
||||||
|
private String sessionId;
|
||||||
|
private Object accountObject;
|
||||||
|
|
||||||
private boolean apiServer;
|
private boolean apiServer;
|
||||||
|
|
||||||
private static UserContext s_nullContext = new UserContext();
|
private static UserContext s_nullContext = new UserContext();
|
||||||
|
|
||||||
public UserContext() {
|
public UserContext() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserContext(Long userId, Object accountObject, String accountName, Long accountId, Long domainId, String sessionId, boolean apiServer) {
|
||||||
|
this.userId = userId;
|
||||||
|
this.accountObject = accountObject;
|
||||||
|
this.accountId = accountId;
|
||||||
|
this.domainId = domainId;
|
||||||
|
this.sessionId = sessionId;
|
||||||
|
this.apiServer = apiServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getUserId() {
|
||||||
|
if (userId != null) {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!apiServer) {
|
||||||
|
s_logger.warn("Null user id in UserContext " + ProcessUtil.dumpStack());
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(Long userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccountName() {
|
||||||
|
return accountName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccountName(String accountName) {
|
||||||
|
this.accountName = accountName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getAccountId() {
|
||||||
|
if (accountId != null) {
|
||||||
|
return accountId;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!apiServer) {
|
||||||
|
s_logger.warn("Null account id in UserContext " + ProcessUtil.dumpStack());
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccountId(Long accountId) {
|
||||||
|
this.accountId = accountId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDomainId() {
|
||||||
|
return domainId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDomainId(Long domainId) {
|
||||||
|
this.domainId = domainId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSessionId() {
|
||||||
|
return sessionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getAccountObject() {
|
||||||
|
return accountObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccountObject(Object accountObject) {
|
||||||
|
this.accountObject = accountObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSessionKey(String sessionId) {
|
||||||
|
this.sessionId = sessionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isApiServer() {
|
||||||
|
return apiServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApiServer(boolean apiServer) {
|
||||||
|
this.apiServer = apiServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static UserContext current() {
|
||||||
|
UserContext context = s_currentContext.get();
|
||||||
|
if (context == null) {
|
||||||
|
return s_nullContext;
|
||||||
|
}
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void updateContext(Long userId, Object accountObject, String accountName, Long accountId, Long domainId, String sessionId) {
|
||||||
|
UserContext context = current();
|
||||||
|
assert(context != null) : "Context should be already setup before you can call this one";
|
||||||
|
|
||||||
|
context.setUserId(userId);
|
||||||
|
context.setAccountObject(accountObject);
|
||||||
|
context.setAccountName(accountName);
|
||||||
|
context.setAccountId(accountId);
|
||||||
|
context.setDomainId(domainId);
|
||||||
|
context.setSessionKey(sessionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserContext(Long userId, Long accountId, String sessionId, boolean apiServer) {
|
public static void registerContext(Long userId, Object accountObject, String accountName, Long accountId, Long domainId, String sessionId, boolean apiServer) {
|
||||||
this.userId = userId;
|
s_currentContext.set(new UserContext(userId, accountObject, accountName, accountId, domainId, sessionId, apiServer));
|
||||||
this.accountId = accountId;
|
|
||||||
this.sessionId = sessionId;
|
|
||||||
this.apiServer = apiServer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getUserId() {
|
|
||||||
if(userId != null)
|
|
||||||
return userId.longValue();
|
|
||||||
|
|
||||||
if(!apiServer)
|
|
||||||
s_logger.warn("Null user id in UserContext " + ProcessUtil.dumpStack());
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUserId(Long userId) {
|
|
||||||
this.userId = userId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getAccountId() {
|
|
||||||
if(accountId != null)
|
|
||||||
return accountId.longValue();
|
|
||||||
|
|
||||||
if(!apiServer)
|
|
||||||
s_logger.warn("Null account id in UserContext " + ProcessUtil.dumpStack());
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAccountId(Long accountId) {
|
|
||||||
this.accountId = accountId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSessionId() {
|
|
||||||
return sessionId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSessionKey(String sessionId) {
|
|
||||||
this.sessionId = sessionId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isApiServer() {
|
|
||||||
return apiServer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setApiServer(boolean apiServer) {
|
|
||||||
this.apiServer = apiServer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static UserContext current() {
|
|
||||||
UserContext context = s_currentContext.get();
|
|
||||||
if(context == null)
|
|
||||||
return s_nullContext;
|
|
||||||
return context;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void updateContext(Long userId, Long accountId, String sessionId) {
|
|
||||||
UserContext context = current();
|
|
||||||
assert(context != null) : "Context should be already setup before you can call this one";
|
|
||||||
|
|
||||||
context.setUserId(userId);
|
|
||||||
context.setAccountId(accountId);
|
|
||||||
context.setSessionKey(sessionId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void registerContext(Long userId, Long accountId, String sessionId, boolean apiServer) {
|
|
||||||
s_currentContext.set(new UserContext(userId, accountId, sessionId, apiServer));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void unregisterContext() {
|
public static void unregisterContext() {
|
||||||
s_currentContext.set(null);
|
s_currentContext.set(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -155,24 +155,6 @@ public class UserVmVO extends VMInstanceVO implements UserVm {
|
|||||||
this.group = group;
|
this.group = group;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserVmVO(long id,
|
|
||||||
String instanceName,
|
|
||||||
String displayName,
|
|
||||||
long templateId,
|
|
||||||
long guestOsId,
|
|
||||||
boolean haEnabled,
|
|
||||||
long domainId,
|
|
||||||
long accountId,
|
|
||||||
long serviceOfferingId,
|
|
||||||
String group,
|
|
||||||
String userData) {
|
|
||||||
super(id, displayName, instanceName, Type.User, templateId, guestOsId, haEnabled);
|
|
||||||
this.group = group;
|
|
||||||
this.userData = userData;
|
|
||||||
this.displayName = displayName;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public UserVmVO(long id,
|
public UserVmVO(long id,
|
||||||
String name,
|
String name,
|
||||||
long templateId,
|
long templateId,
|
||||||
|
|||||||
@ -122,25 +122,6 @@ public class VMInstanceVO implements VirtualMachine {
|
|||||||
@Temporal(value=TemporalType.TIMESTAMP)
|
@Temporal(value=TemporalType.TIMESTAMP)
|
||||||
Date updateTime;
|
Date updateTime;
|
||||||
|
|
||||||
public VMInstanceVO(long id,
|
|
||||||
String name,
|
|
||||||
String instanceName,
|
|
||||||
Type type,
|
|
||||||
Long vmTemplateId,
|
|
||||||
long guestOSId,
|
|
||||||
boolean haEnabled) {
|
|
||||||
this.id = id;
|
|
||||||
this.name = name;
|
|
||||||
if (vmTemplateId != null) {
|
|
||||||
this.templateId = vmTemplateId;
|
|
||||||
}
|
|
||||||
this.instanceName = instanceName;
|
|
||||||
this.type = type;
|
|
||||||
this.guestOSId = guestOSId;
|
|
||||||
this.haEnabled = haEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public VMInstanceVO(long id,
|
public VMInstanceVO(long id,
|
||||||
String name,
|
String name,
|
||||||
String instanceName,
|
String instanceName,
|
||||||
|
|||||||
@ -17,18 +17,15 @@
|
|||||||
*/
|
*/
|
||||||
package com.cloud.vm;
|
package com.cloud.vm;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.cloud.hypervisor.Hypervisor;
|
|
||||||
|
|
||||||
public class VmCharacteristics {
|
public class VmCharacteristics {
|
||||||
int core;
|
|
||||||
int speed; // in mhz
|
|
||||||
long ram; // in bytes
|
|
||||||
Hypervisor.Type hypervisorType;
|
|
||||||
VirtualMachine.Type type;
|
VirtualMachine.Type type;
|
||||||
|
int cpus; // -1 means, take everything.
|
||||||
|
int speed; // In megahertz
|
||||||
|
long ram; // in bytes
|
||||||
|
|
||||||
Map<String, String> params;
|
protected VmCharacteristics() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public VmCharacteristics(VirtualMachine.Type type) {
|
public VmCharacteristics(VirtualMachine.Type type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
@ -37,32 +34,4 @@ public class VmCharacteristics {
|
|||||||
public VirtualMachine.Type getType() {
|
public VirtualMachine.Type getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public VmCharacteristics() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCores() {
|
|
||||||
return core;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSpeed() {
|
|
||||||
return speed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getRam() {
|
|
||||||
return ram;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Hypervisor.Type getHypervisorType() {
|
|
||||||
return hypervisorType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public VmCharacteristics(int core, int speed, long ram, Hypervisor.Type type, Map<String, String> params) {
|
|
||||||
this.core = core;
|
|
||||||
this.speed = speed;
|
|
||||||
this.ram = ram;
|
|
||||||
this.hypervisorType = type;
|
|
||||||
this.params = params;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -1,651 +0,0 @@
|
|||||||
package com.cloud.vmware;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.rmi.RemoteException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.log4j.xml.DOMConfigurator;
|
|
||||||
|
|
||||||
import com.cloud.utils.PropertiesUtil;
|
|
||||||
import com.vmware.apputils.AppUtil;
|
|
||||||
import com.vmware.vim.ArrayOfManagedObjectReference;
|
|
||||||
import com.vmware.vim.DatastoreInfo;
|
|
||||||
import com.vmware.vim.DynamicProperty;
|
|
||||||
import com.vmware.vim.InvalidProperty;
|
|
||||||
import com.vmware.vim.ManagedObjectReference;
|
|
||||||
import com.vmware.vim.ObjectContent;
|
|
||||||
import com.vmware.vim.ObjectSpec;
|
|
||||||
import com.vmware.vim.PropertyFilterSpec;
|
|
||||||
import com.vmware.vim.PropertySpec;
|
|
||||||
import com.vmware.vim.RuntimeFault;
|
|
||||||
import com.vmware.vim.SelectionSpec;
|
|
||||||
import com.vmware.vim.TraversalSpec;
|
|
||||||
|
|
||||||
public class TestVMWare {
|
|
||||||
private static AppUtil cb;
|
|
||||||
|
|
||||||
private static void setupLog4j() {
|
|
||||||
File file = PropertiesUtil.findConfigFile("log4j-cloud.xml");
|
|
||||||
|
|
||||||
if(file != null) {
|
|
||||||
System.out.println("Log4j configuration from : " + file.getAbsolutePath());
|
|
||||||
DOMConfigurator.configureAndWatch(file.getAbsolutePath(), 10000);
|
|
||||||
} else {
|
|
||||||
System.out.println("Configure log4j with default properties");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void getAndPrintInventoryContents() throws Exception {
|
|
||||||
TraversalSpec resourcePoolTraversalSpec = new TraversalSpec();
|
|
||||||
resourcePoolTraversalSpec.setName("resourcePoolTraversalSpec");
|
|
||||||
resourcePoolTraversalSpec.setType("ResourcePool");
|
|
||||||
resourcePoolTraversalSpec.setPath("resourcePool");
|
|
||||||
resourcePoolTraversalSpec.setSkip(new Boolean(false));
|
|
||||||
resourcePoolTraversalSpec.setSelectSet(
|
|
||||||
new SelectionSpec [] { new SelectionSpec(null,null,"resourcePoolTraversalSpec") });
|
|
||||||
|
|
||||||
TraversalSpec computeResourceRpTraversalSpec = new TraversalSpec();
|
|
||||||
computeResourceRpTraversalSpec.setName("computeResourceRpTraversalSpec");
|
|
||||||
computeResourceRpTraversalSpec.setType("ComputeResource");
|
|
||||||
computeResourceRpTraversalSpec.setPath("resourcePool");
|
|
||||||
computeResourceRpTraversalSpec.setSkip(new Boolean(false));
|
|
||||||
computeResourceRpTraversalSpec.setSelectSet(
|
|
||||||
new SelectionSpec [] { new SelectionSpec(null,null,"resourcePoolTraversalSpec") });
|
|
||||||
|
|
||||||
TraversalSpec computeResourceHostTraversalSpec = new TraversalSpec();
|
|
||||||
computeResourceHostTraversalSpec.setName("computeResourceHostTraversalSpec");
|
|
||||||
computeResourceHostTraversalSpec.setType("ComputeResource");
|
|
||||||
computeResourceHostTraversalSpec.setPath("host");
|
|
||||||
computeResourceHostTraversalSpec.setSkip(new Boolean(false));
|
|
||||||
|
|
||||||
TraversalSpec datacenterHostTraversalSpec = new TraversalSpec();
|
|
||||||
datacenterHostTraversalSpec.setName("datacenterHostTraversalSpec");
|
|
||||||
datacenterHostTraversalSpec.setType("Datacenter");
|
|
||||||
datacenterHostTraversalSpec.setPath("hostFolder");
|
|
||||||
datacenterHostTraversalSpec.setSkip(new Boolean(false));
|
|
||||||
datacenterHostTraversalSpec.setSelectSet(
|
|
||||||
new SelectionSpec [] { new SelectionSpec(null,null,"folderTraversalSpec") });
|
|
||||||
|
|
||||||
TraversalSpec datacenterVmTraversalSpec = new TraversalSpec();
|
|
||||||
datacenterVmTraversalSpec.setName("datacenterVmTraversalSpec");
|
|
||||||
datacenterVmTraversalSpec.setType("Datacenter");
|
|
||||||
datacenterVmTraversalSpec.setPath("vmFolder");
|
|
||||||
datacenterVmTraversalSpec.setSkip(new Boolean(false));
|
|
||||||
datacenterVmTraversalSpec.setSelectSet(
|
|
||||||
new SelectionSpec [] { new SelectionSpec(null,null,"folderTraversalSpec") });
|
|
||||||
|
|
||||||
TraversalSpec folderTraversalSpec = new TraversalSpec();
|
|
||||||
folderTraversalSpec.setName("folderTraversalSpec");
|
|
||||||
folderTraversalSpec.setType("Folder");
|
|
||||||
folderTraversalSpec.setPath("childEntity");
|
|
||||||
folderTraversalSpec.setSkip(new Boolean(false));
|
|
||||||
folderTraversalSpec.setSelectSet(
|
|
||||||
new SelectionSpec [] { new SelectionSpec(null,null,"folderTraversalSpec"),
|
|
||||||
datacenterHostTraversalSpec,
|
|
||||||
datacenterVmTraversalSpec,
|
|
||||||
computeResourceRpTraversalSpec,
|
|
||||||
computeResourceHostTraversalSpec,
|
|
||||||
resourcePoolTraversalSpec });
|
|
||||||
|
|
||||||
PropertySpec[] propspecary = new PropertySpec[] { new PropertySpec() };
|
|
||||||
propspecary[0].setAll(new Boolean(false));
|
|
||||||
propspecary[0].setPathSet(new String[] { "name" });
|
|
||||||
propspecary[0].setType("ManagedEntity");
|
|
||||||
|
|
||||||
PropertyFilterSpec spec = new PropertyFilterSpec();
|
|
||||||
spec.setPropSet(propspecary);
|
|
||||||
spec.setObjectSet(new ObjectSpec[] { new ObjectSpec() });
|
|
||||||
spec.getObjectSet(0).setObj(cb.getConnection().getRootFolder());
|
|
||||||
spec.getObjectSet(0).setSkip(new Boolean(false));
|
|
||||||
spec.getObjectSet(0).setSelectSet(
|
|
||||||
new SelectionSpec[] { folderTraversalSpec });
|
|
||||||
|
|
||||||
// Recursively get all ManagedEntity ManagedObjectReferences
|
|
||||||
// and the "name" property for all ManagedEntities retrieved
|
|
||||||
ObjectContent[] ocary =
|
|
||||||
cb.getConnection().getService().retrieveProperties(
|
|
||||||
cb.getConnection().getServiceContent().getPropertyCollector(),
|
|
||||||
new PropertyFilterSpec[] { spec }
|
|
||||||
);
|
|
||||||
|
|
||||||
// If we get contents back. print them out.
|
|
||||||
if (ocary != null) {
|
|
||||||
ObjectContent oc = null;
|
|
||||||
ManagedObjectReference mor = null;
|
|
||||||
DynamicProperty[] pcary = null;
|
|
||||||
DynamicProperty pc = null;
|
|
||||||
for (int oci = 0; oci < ocary.length; oci++) {
|
|
||||||
oc = ocary[oci];
|
|
||||||
mor = oc.getObj();
|
|
||||||
pcary = oc.getPropSet();
|
|
||||||
|
|
||||||
System.out.println("Object Type : " + mor.getType());
|
|
||||||
System.out.println("Reference Value : " + mor.get_value());
|
|
||||||
|
|
||||||
if (pcary != null) {
|
|
||||||
for (int pci = 0; pci < pcary.length; pci++) {
|
|
||||||
pc = pcary[pci];
|
|
||||||
System.out.println(" Property Name : " + pc.getName());
|
|
||||||
if (pc != null) {
|
|
||||||
if (!pc.getVal().getClass().isArray()) {
|
|
||||||
System.out.println(" Property Value : " + pc.getVal());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Object[] ipcary = (Object[])pc.getVal();
|
|
||||||
System.out.println("Val : " + pc.getVal());
|
|
||||||
for (int ii = 0; ii < ipcary.length; ii++) {
|
|
||||||
Object oval = ipcary[ii];
|
|
||||||
if (oval.getClass().getName().indexOf("ManagedObjectReference") >= 0) {
|
|
||||||
ManagedObjectReference imor = (ManagedObjectReference)oval;
|
|
||||||
|
|
||||||
System.out.println("Inner Object Type : " + imor.getType());
|
|
||||||
System.out.println("Inner Reference Value : " + imor.get_value());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
System.out.println("Inner Property Value : " + oval);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
System.out.println("No Managed Entities retrieved!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void listDataCenters() {
|
|
||||||
try {
|
|
||||||
ManagedObjectReference[] morDatacenters = getDataCenterMors();
|
|
||||||
if(morDatacenters != null) {
|
|
||||||
for(ManagedObjectReference mor : morDatacenters) {
|
|
||||||
System.out.println("Datacenter : " + mor.get_value());
|
|
||||||
|
|
||||||
Map<String, Object> properites = new HashMap<String, Object>();
|
|
||||||
properites.put("name", null);
|
|
||||||
properites.put("vmFolder", null);
|
|
||||||
properites.put("hostFolder", null);
|
|
||||||
|
|
||||||
getProperites(mor, properites);
|
|
||||||
for(Map.Entry<String, Object> entry : properites.entrySet()) {
|
|
||||||
if(entry.getValue() instanceof ManagedObjectReference) {
|
|
||||||
ManagedObjectReference morProp = (ManagedObjectReference)entry.getValue();
|
|
||||||
System.out.println("\t" + entry.getKey() + ":(" + morProp.getType() + ", " + morProp.get_value() + ")");
|
|
||||||
} else {
|
|
||||||
System.out.println("\t" + entry.getKey() + ":" + entry.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println("Datacenter clusters");
|
|
||||||
ManagedObjectReference[] clusters = getDataCenterClusterMors(mor);
|
|
||||||
if(clusters != null) {
|
|
||||||
for(ManagedObjectReference morCluster : clusters) {
|
|
||||||
Object[] props = this.getProperties(morCluster, new String[] {"name"});
|
|
||||||
System.out.println("cluster : " + props[0]);
|
|
||||||
|
|
||||||
System.out.println("cluster hosts");
|
|
||||||
ManagedObjectReference[] hosts = getClusterHostMors(morCluster);
|
|
||||||
if(hosts != null) {
|
|
||||||
for(ManagedObjectReference morHost : hosts) {
|
|
||||||
Object[] props2 = this.getProperties(morHost, new String[] {"name"});
|
|
||||||
System.out.println("host : " + props2[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println("Datacenter standalone hosts");
|
|
||||||
ManagedObjectReference[] hosts = getDataCenterStandaloneHostMors(mor);
|
|
||||||
if(hosts != null) {
|
|
||||||
for(ManagedObjectReference morHost : hosts) {
|
|
||||||
Object[] props = this.getProperties(morHost, new String[] {"name"});
|
|
||||||
System.out.println("host : " + props[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println("Datacenter datastores");
|
|
||||||
ManagedObjectReference[] stores = getDataCenterDatastoreMors(mor);
|
|
||||||
if(stores != null) {
|
|
||||||
for(ManagedObjectReference morStore : stores) {
|
|
||||||
// data store name property does not work for some reason
|
|
||||||
Object[] props = getProperties(morStore, new String[] {"info" });
|
|
||||||
|
|
||||||
System.out.println(morStore.getType() + ": " + ((DatastoreInfo)props[0]).getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println("Datacenter VMs");
|
|
||||||
ManagedObjectReference[] vms = getDataCenterVMMors(mor);
|
|
||||||
if(stores != null) {
|
|
||||||
for(ManagedObjectReference morVm : vms) {
|
|
||||||
Object[] props = this.getProperties(morVm, new String[] {"name"});
|
|
||||||
System.out.println("VM name: " + props[0] + ", ref val: " + morVm.get_value());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch(RuntimeFault e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch(RemoteException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void listInventoryFolders() {
|
|
||||||
TraversalSpec folderTraversalSpec = new TraversalSpec();
|
|
||||||
folderTraversalSpec.setName("folderTraversalSpec");
|
|
||||||
folderTraversalSpec.setType("Folder");
|
|
||||||
folderTraversalSpec.setPath("childEntity");
|
|
||||||
folderTraversalSpec.setSkip(new Boolean(false));
|
|
||||||
folderTraversalSpec.setSelectSet(
|
|
||||||
new SelectionSpec [] { new SelectionSpec(null, null, "folderTraversalSpec")}
|
|
||||||
);
|
|
||||||
|
|
||||||
PropertySpec[] propSpecs = new PropertySpec[] { new PropertySpec() };
|
|
||||||
propSpecs[0].setAll(new Boolean(false));
|
|
||||||
propSpecs[0].setPathSet(new String[] { "name" });
|
|
||||||
propSpecs[0].setType("ManagedEntity");
|
|
||||||
|
|
||||||
PropertyFilterSpec filterSpec = new PropertyFilterSpec();
|
|
||||||
filterSpec.setPropSet(propSpecs);
|
|
||||||
filterSpec.setObjectSet(new ObjectSpec[] { new ObjectSpec() });
|
|
||||||
filterSpec.getObjectSet(0).setObj(cb.getConnection().getRootFolder());
|
|
||||||
filterSpec.getObjectSet(0).setSkip(new Boolean(false));
|
|
||||||
filterSpec.getObjectSet(0).setSelectSet(
|
|
||||||
new SelectionSpec[] { folderTraversalSpec }
|
|
||||||
);
|
|
||||||
|
|
||||||
try {
|
|
||||||
ObjectContent[] objContent = cb.getConnection().getService().retrieveProperties(
|
|
||||||
cb.getConnection().getServiceContent().getPropertyCollector(),
|
|
||||||
new PropertyFilterSpec[] { filterSpec }
|
|
||||||
);
|
|
||||||
printContent(objContent);
|
|
||||||
} catch (InvalidProperty e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (RuntimeFault e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private TraversalSpec getFolderRecursiveTraversalSpec() {
|
|
||||||
SelectionSpec recurseFolders = new SelectionSpec();
|
|
||||||
recurseFolders.setName("folder2childEntity");
|
|
||||||
|
|
||||||
TraversalSpec folder2childEntity = new TraversalSpec();
|
|
||||||
folder2childEntity.setType("Folder");
|
|
||||||
folder2childEntity.setPath("childEntity");
|
|
||||||
folder2childEntity.setName(recurseFolders.getName());
|
|
||||||
folder2childEntity.setSelectSet(new SelectionSpec[] { recurseFolders });
|
|
||||||
|
|
||||||
return folder2childEntity;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ManagedObjectReference[] getDataCenterMors() throws RuntimeFault, RemoteException {
|
|
||||||
PropertySpec pSpec = new PropertySpec();
|
|
||||||
pSpec.setType("Datacenter");
|
|
||||||
pSpec.setPathSet(new String[] { "name"} );
|
|
||||||
|
|
||||||
ObjectSpec oSpec = new ObjectSpec();
|
|
||||||
oSpec.setObj(cb.getConnection().getRootFolder());
|
|
||||||
oSpec.setSkip(Boolean.TRUE);
|
|
||||||
oSpec.setSelectSet(new SelectionSpec[] { getFolderRecursiveTraversalSpec() });
|
|
||||||
|
|
||||||
PropertyFilterSpec pfSpec = new PropertyFilterSpec();
|
|
||||||
pfSpec.setPropSet(new PropertySpec[] { pSpec });
|
|
||||||
pfSpec.setObjectSet(new ObjectSpec[] { oSpec });
|
|
||||||
|
|
||||||
ObjectContent[] ocs = cb.getConnection().getService().retrieveProperties(
|
|
||||||
cb.getConnection().getServiceContent().getPropertyCollector(),
|
|
||||||
new PropertyFilterSpec[] { pfSpec });
|
|
||||||
|
|
||||||
if(ocs != null) {
|
|
||||||
ManagedObjectReference[] morDatacenters = new ManagedObjectReference[ocs.length];
|
|
||||||
for(int i = 0; i < ocs.length; i++)
|
|
||||||
morDatacenters[i] = ocs[i].getObj();
|
|
||||||
|
|
||||||
return morDatacenters;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ManagedObjectReference[] getDataCenterVMMors(ManagedObjectReference morDatacenter) throws RuntimeFault, RemoteException {
|
|
||||||
PropertySpec pSpec = new PropertySpec();
|
|
||||||
pSpec.setType("VirtualMachine");
|
|
||||||
pSpec.setPathSet(new String[] { "name"} );
|
|
||||||
|
|
||||||
ObjectSpec oSpec = new ObjectSpec();
|
|
||||||
oSpec.setObj(morDatacenter);
|
|
||||||
oSpec.setSkip(Boolean.TRUE);
|
|
||||||
|
|
||||||
TraversalSpec tSpec = new TraversalSpec();
|
|
||||||
tSpec.setName("dc2VMFolder");
|
|
||||||
tSpec.setType("Datacenter");
|
|
||||||
tSpec.setPath("vmFolder");
|
|
||||||
tSpec.setSelectSet(new SelectionSpec[] { getFolderRecursiveTraversalSpec() } );
|
|
||||||
|
|
||||||
oSpec.setSelectSet(new SelectionSpec[] { tSpec });
|
|
||||||
|
|
||||||
PropertyFilterSpec pfSpec = new PropertyFilterSpec();
|
|
||||||
pfSpec.setPropSet(new PropertySpec[] { pSpec });
|
|
||||||
pfSpec.setObjectSet(new ObjectSpec[] { oSpec });
|
|
||||||
|
|
||||||
ObjectContent[] ocs = cb.getConnection().getService().retrieveProperties(
|
|
||||||
cb.getConnection().getServiceContent().getPropertyCollector(),
|
|
||||||
new PropertyFilterSpec[] { pfSpec });
|
|
||||||
|
|
||||||
if(ocs != null) {
|
|
||||||
ManagedObjectReference[] morVMs = new ManagedObjectReference[ocs.length];
|
|
||||||
for(int i = 0; i < ocs.length; i++)
|
|
||||||
morVMs[i] = ocs[i].getObj();
|
|
||||||
|
|
||||||
return morVMs;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ManagedObjectReference[] getDataCenterDatastoreMors(ManagedObjectReference morDatacenter) throws RuntimeFault, RemoteException {
|
|
||||||
Object[] stores = getProperties(morDatacenter, new String[] { "datastore" });
|
|
||||||
if(stores != null && stores.length == 1) {
|
|
||||||
return ((ArrayOfManagedObjectReference)stores[0]).getManagedObjectReference();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ManagedObjectReference[] getDataCenterClusterMors(ManagedObjectReference morDatacenter) throws RuntimeFault, RemoteException {
|
|
||||||
PropertySpec pSpec = new PropertySpec();
|
|
||||||
pSpec.setType("ClusterComputeResource");
|
|
||||||
pSpec.setPathSet(new String[] { "name"} );
|
|
||||||
|
|
||||||
ObjectSpec oSpec = new ObjectSpec();
|
|
||||||
oSpec.setObj(morDatacenter);
|
|
||||||
oSpec.setSkip(Boolean.TRUE);
|
|
||||||
|
|
||||||
TraversalSpec tSpec = new TraversalSpec();
|
|
||||||
tSpec.setName("traversalHostFolder");
|
|
||||||
tSpec.setType("Datacenter");
|
|
||||||
tSpec.setPath("hostFolder");
|
|
||||||
tSpec.setSkip(false);
|
|
||||||
tSpec.setSelectSet(new SelectionSpec[] { getFolderRecursiveTraversalSpec() });
|
|
||||||
|
|
||||||
oSpec.setSelectSet(new TraversalSpec[] { tSpec });
|
|
||||||
|
|
||||||
PropertyFilterSpec pfSpec = new PropertyFilterSpec();
|
|
||||||
pfSpec.setPropSet(new PropertySpec[] { pSpec });
|
|
||||||
pfSpec.setObjectSet(new ObjectSpec[] { oSpec });
|
|
||||||
|
|
||||||
ObjectContent[] ocs = cb.getConnection().getService().retrieveProperties(
|
|
||||||
cb.getConnection().getServiceContent().getPropertyCollector(),
|
|
||||||
new PropertyFilterSpec[] { pfSpec });
|
|
||||||
|
|
||||||
if(ocs != null) {
|
|
||||||
ManagedObjectReference[] morDatacenters = new ManagedObjectReference[ocs.length];
|
|
||||||
for(int i = 0; i < ocs.length; i++)
|
|
||||||
morDatacenters[i] = ocs[i].getObj();
|
|
||||||
|
|
||||||
return morDatacenters;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ManagedObjectReference[] getDataCenterStandaloneHostMors(ManagedObjectReference morDatacenter) throws RuntimeFault, RemoteException {
|
|
||||||
PropertySpec pSpec = new PropertySpec();
|
|
||||||
pSpec.setType("ComputeResource");
|
|
||||||
pSpec.setPathSet(new String[] { "name"} );
|
|
||||||
|
|
||||||
ObjectSpec oSpec = new ObjectSpec();
|
|
||||||
oSpec.setObj(morDatacenter);
|
|
||||||
oSpec.setSkip(Boolean.TRUE);
|
|
||||||
|
|
||||||
TraversalSpec tSpec = new TraversalSpec();
|
|
||||||
tSpec.setName("traversalHostFolder");
|
|
||||||
tSpec.setType("Datacenter");
|
|
||||||
tSpec.setPath("hostFolder");
|
|
||||||
tSpec.setSkip(false);
|
|
||||||
tSpec.setSelectSet(new SelectionSpec[] { getFolderRecursiveTraversalSpec() });
|
|
||||||
|
|
||||||
oSpec.setSelectSet(new TraversalSpec[] { tSpec });
|
|
||||||
|
|
||||||
PropertyFilterSpec pfSpec = new PropertyFilterSpec();
|
|
||||||
pfSpec.setPropSet(new PropertySpec[] { pSpec });
|
|
||||||
pfSpec.setObjectSet(new ObjectSpec[] { oSpec });
|
|
||||||
|
|
||||||
ObjectContent[] ocs = cb.getConnection().getService().retrieveProperties(
|
|
||||||
cb.getConnection().getServiceContent().getPropertyCollector(),
|
|
||||||
new PropertyFilterSpec[] { pfSpec });
|
|
||||||
|
|
||||||
if(ocs != null) {
|
|
||||||
List<ManagedObjectReference> listComputeResources = new ArrayList<ManagedObjectReference>();
|
|
||||||
for(ObjectContent oc : ocs) {
|
|
||||||
if(oc.getObj().getType().equalsIgnoreCase("ComputeResource"))
|
|
||||||
listComputeResources.add(oc.getObj());
|
|
||||||
}
|
|
||||||
|
|
||||||
List<ManagedObjectReference> listHosts = new ArrayList<ManagedObjectReference>();
|
|
||||||
for(ManagedObjectReference morComputeResource : listComputeResources) {
|
|
||||||
ManagedObjectReference[] hosts = getComputeResourceHostMors(morComputeResource);
|
|
||||||
if(hosts != null) {
|
|
||||||
for(ManagedObjectReference host: hosts)
|
|
||||||
listHosts.add(host);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return listHosts.toArray(new ManagedObjectReference[0]);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ManagedObjectReference[] getComputeResourceHostMors(ManagedObjectReference morCompute) throws RuntimeFault, RemoteException {
|
|
||||||
PropertySpec pSpec = new PropertySpec();
|
|
||||||
pSpec.setType("HostSystem");
|
|
||||||
pSpec.setPathSet(new String[] { "name"} );
|
|
||||||
|
|
||||||
ObjectSpec oSpec = new ObjectSpec();
|
|
||||||
oSpec.setObj(morCompute);
|
|
||||||
oSpec.setSkip(true);
|
|
||||||
|
|
||||||
TraversalSpec tSpec = new TraversalSpec();
|
|
||||||
tSpec.setName("computeResource2Host");
|
|
||||||
tSpec.setType("ComputeResource");
|
|
||||||
tSpec.setPath("host");
|
|
||||||
tSpec.setSkip(false);
|
|
||||||
oSpec.setSelectSet(new TraversalSpec[] { tSpec });
|
|
||||||
|
|
||||||
PropertyFilterSpec pfSpec = new PropertyFilterSpec();
|
|
||||||
pfSpec.setPropSet(new PropertySpec[] { pSpec });
|
|
||||||
pfSpec.setObjectSet(new ObjectSpec[] { oSpec });
|
|
||||||
|
|
||||||
ObjectContent[] ocs = cb.getConnection().getService().retrieveProperties(
|
|
||||||
cb.getConnection().getServiceContent().getPropertyCollector(),
|
|
||||||
new PropertyFilterSpec[] { pfSpec });
|
|
||||||
|
|
||||||
if(ocs != null) {
|
|
||||||
ManagedObjectReference[] morDatacenters = new ManagedObjectReference[ocs.length];
|
|
||||||
for(int i = 0; i < ocs.length; i++)
|
|
||||||
morDatacenters[i] = ocs[i].getObj();
|
|
||||||
|
|
||||||
return morDatacenters;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ManagedObjectReference[] getClusterHostMors(ManagedObjectReference morCluster) throws RuntimeFault, RemoteException {
|
|
||||||
// ClusterComputeResource inherits from ComputeResource
|
|
||||||
return getComputeResourceHostMors(morCluster);
|
|
||||||
}
|
|
||||||
|
|
||||||
private ObjectContent[] getDataCenterProperites(String[] properites) throws RuntimeFault, RemoteException {
|
|
||||||
PropertySpec pSpec = new PropertySpec();
|
|
||||||
pSpec.setType("Datacenter");
|
|
||||||
pSpec.setPathSet(properites );
|
|
||||||
|
|
||||||
SelectionSpec recurseFolders = new SelectionSpec();
|
|
||||||
recurseFolders.setName("folder2childEntity");
|
|
||||||
|
|
||||||
TraversalSpec folder2childEntity = new TraversalSpec();
|
|
||||||
folder2childEntity.setType("Folder");
|
|
||||||
folder2childEntity.setPath("childEntity");
|
|
||||||
folder2childEntity.setName(recurseFolders.getName());
|
|
||||||
folder2childEntity.setSelectSet(new SelectionSpec[] { recurseFolders });
|
|
||||||
|
|
||||||
ObjectSpec oSpec = new ObjectSpec();
|
|
||||||
oSpec.setObj(cb.getConnection().getRootFolder());
|
|
||||||
oSpec.setSkip(Boolean.TRUE);
|
|
||||||
oSpec.setSelectSet(new SelectionSpec[] { folder2childEntity });
|
|
||||||
|
|
||||||
PropertyFilterSpec pfSpec = new PropertyFilterSpec();
|
|
||||||
pfSpec.setPropSet(new PropertySpec[] { pSpec });
|
|
||||||
pfSpec.setObjectSet(new ObjectSpec[] { oSpec });
|
|
||||||
|
|
||||||
return cb.getConnection().getService().retrieveProperties(
|
|
||||||
cb.getConnection().getServiceContent().getPropertyCollector(),
|
|
||||||
new PropertyFilterSpec[] { pfSpec });
|
|
||||||
}
|
|
||||||
|
|
||||||
private void printContent(ObjectContent[] objContent) {
|
|
||||||
if(objContent != null) {
|
|
||||||
for(ObjectContent oc : objContent) {
|
|
||||||
ManagedObjectReference mor = oc.getObj();
|
|
||||||
DynamicProperty[] objProps = oc.getPropSet();
|
|
||||||
|
|
||||||
System.out.println("Object type: " + mor.getType());
|
|
||||||
if(objProps != null) {
|
|
||||||
for(DynamicProperty objProp : objProps) {
|
|
||||||
if(!objProp.getClass().isArray()) {
|
|
||||||
System.out.println("\t" + objProp.getName() + "=" + objProp.getVal());
|
|
||||||
} else {
|
|
||||||
Object[] ipcary = (Object[])objProp.getVal();
|
|
||||||
System.out.print("\t" + objProp.getName() + "=[");
|
|
||||||
int i = 0;
|
|
||||||
for(Object item : ipcary) {
|
|
||||||
if (item.getClass().getName().indexOf("ManagedObjectReference") >= 0) {
|
|
||||||
ManagedObjectReference imor = (ManagedObjectReference)item;
|
|
||||||
System.out.print("(" + imor.getType() + "," + imor.get_value() + ")");
|
|
||||||
} else {
|
|
||||||
System.out.print(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(i < ipcary.length - 1)
|
|
||||||
System.out.print(", ");
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println("]");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void getProperites(ManagedObjectReference mor, Map<String, Object> properties) throws RuntimeFault, RemoteException {
|
|
||||||
PropertySpec pSpec = new PropertySpec();
|
|
||||||
pSpec.setType(mor.getType());
|
|
||||||
pSpec.setPathSet(properties.keySet().toArray(new String[0]));
|
|
||||||
|
|
||||||
ObjectSpec oSpec = new ObjectSpec();
|
|
||||||
oSpec.setObj(mor);
|
|
||||||
|
|
||||||
PropertyFilterSpec pfSpec = new PropertyFilterSpec();
|
|
||||||
pfSpec.setPropSet(new PropertySpec[] {pSpec} );
|
|
||||||
pfSpec.setObjectSet(new ObjectSpec[] {oSpec} );
|
|
||||||
|
|
||||||
ObjectContent[] ocs = cb.getConnection().getService().retrieveProperties(
|
|
||||||
cb.getConnection().getServiceContent().getPropertyCollector(),
|
|
||||||
new PropertyFilterSpec[] {pfSpec} );
|
|
||||||
|
|
||||||
if(ocs != null) {
|
|
||||||
for(ObjectContent oc : ocs) {
|
|
||||||
DynamicProperty[] propSet = oc.getPropSet();
|
|
||||||
if(propSet != null) {
|
|
||||||
for(DynamicProperty prop : propSet) {
|
|
||||||
properties.put(prop.getName(), prop.getVal());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Object[] getProperties(ManagedObjectReference moRef, String[] properties) throws RuntimeFault, RemoteException {
|
|
||||||
PropertySpec pSpec = new PropertySpec();
|
|
||||||
pSpec.setType(moRef.getType());
|
|
||||||
pSpec.setPathSet(properties);
|
|
||||||
|
|
||||||
ObjectSpec oSpec = new ObjectSpec();
|
|
||||||
// Set the starting object
|
|
||||||
oSpec.setObj(moRef);
|
|
||||||
|
|
||||||
PropertyFilterSpec pfSpec = new PropertyFilterSpec();
|
|
||||||
pfSpec.setPropSet(new PropertySpec[] {pSpec} );
|
|
||||||
pfSpec.setObjectSet(new ObjectSpec[] {oSpec} );
|
|
||||||
ObjectContent[] ocs = cb.getConnection().getService().retrieveProperties(
|
|
||||||
cb.getConnection().getServiceContent().getPropertyCollector(),
|
|
||||||
new PropertyFilterSpec[] {pfSpec} );
|
|
||||||
|
|
||||||
Object[] ret = new Object[properties.length];
|
|
||||||
if(ocs != null) {
|
|
||||||
for(int i = 0; i< ocs.length; ++i) {
|
|
||||||
ObjectContent oc = ocs[i];
|
|
||||||
DynamicProperty[] dps = oc.getPropSet();
|
|
||||||
if(dps != null) {
|
|
||||||
for(int j = 0; j < dps.length; ++j) {
|
|
||||||
DynamicProperty dp = dps[j];
|
|
||||||
for(int p = 0; p < ret.length; ++p) {
|
|
||||||
if(properties[p].equals(dp.getName())) {
|
|
||||||
ret[p] = dp.getVal();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void powerOnVm() throws Exception {
|
|
||||||
ManagedObjectReference morVm = new ManagedObjectReference();
|
|
||||||
morVm.setType("VirtualMachine");
|
|
||||||
morVm.set_value("vm-66");
|
|
||||||
|
|
||||||
cb.getConnection().getService().powerOnVM_Task(morVm, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void powerOffVm() throws Exception {
|
|
||||||
ManagedObjectReference morVm = new ManagedObjectReference();
|
|
||||||
morVm.setType("VirtualMachine");
|
|
||||||
morVm.set_value("vm-66");
|
|
||||||
|
|
||||||
cb.getConnection().getService().powerOffVM_Task(morVm);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
|
||||||
setupLog4j();
|
|
||||||
TestVMWare client = new TestVMWare();
|
|
||||||
|
|
||||||
// skip certificate check
|
|
||||||
System.setProperty("axis.socketSecureFactory", "org.apache.axis.components.net.SunFakeTrustSocketFactory");
|
|
||||||
|
|
||||||
String serviceUrl = "https://vsphere-1.lab.vmops.com/sdk/vimService";
|
|
||||||
try {
|
|
||||||
String[] params = new String[] {"--url", serviceUrl, "--username", "Administrator", "--password", "Suite219" };
|
|
||||||
|
|
||||||
cb = AppUtil.initialize("Connect", params);
|
|
||||||
cb.connect();
|
|
||||||
System.out.println("Connection Succesful.");
|
|
||||||
|
|
||||||
// client.listInventoryFolders();
|
|
||||||
// client.listDataCenters();
|
|
||||||
client.powerOnVm();
|
|
||||||
|
|
||||||
cb.disConnect();
|
|
||||||
} catch (Exception e) {
|
|
||||||
System.out.println("Failed to connect to " + serviceUrl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
2
debian/rules
vendored
2
debian/rules
vendored
@ -91,7 +91,7 @@ binary-common:
|
|||||||
dh_testdir
|
dh_testdir
|
||||||
dh_testroot
|
dh_testroot
|
||||||
dh_installchangelogs
|
dh_installchangelogs
|
||||||
dh_installdocs -A README INSTALL HACKING README.html
|
dh_installdocs -A README HACKING
|
||||||
# dh_installexamples
|
# dh_installexamples
|
||||||
# dh_installmenu
|
# dh_installmenu
|
||||||
# dh_installdebconf
|
# dh_installdebconf
|
||||||
|
|||||||
@ -790,14 +790,13 @@ class SetupFirewall2(ConfigTask):
|
|||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
|
|
||||||
yield "Permitting traffic in the bridge interface, migration port and for VNC ports"
|
yield "Permitting traffic in the bridge interface and for VNC ports"
|
||||||
|
|
||||||
if distro in (Fedora , CentOS):
|
if distro in (Fedora , CentOS):
|
||||||
|
|
||||||
for rule in (
|
for rule in (
|
||||||
"-I FORWARD -i %s -o %s -j ACCEPT"%(self.brname,self.brname),
|
"-I FORWARD -i %s -o %s -j ACCEPT"%(self.brname,self.brname),
|
||||||
"-I INPUT 1 -p tcp --dport 5900:6100 -j ACCEPT",
|
"-I INPUT 1 -p tcp --dport 5900:6100 -j ACCEPT",
|
||||||
"-I INPUT 1 -p tcp --dport 49152:49216 -j ACCEPT",
|
|
||||||
):
|
):
|
||||||
args = rule.split()
|
args = rule.split()
|
||||||
o = iptables(*args)
|
o = iptables(*args)
|
||||||
@ -814,7 +813,6 @@ class SetupFirewall2(ConfigTask):
|
|||||||
newtext.append(line)
|
newtext.append(line)
|
||||||
file("/etc/ufw/before.rules","w").writelines(newtext)
|
file("/etc/ufw/before.rules","w").writelines(newtext)
|
||||||
ufw.allow.proto.tcp("from","any","to","any","port","5900:6100")
|
ufw.allow.proto.tcp("from","any","to","any","port","5900:6100")
|
||||||
ufw.allow.proto.tcp("from","any","to","any","port","49152:49216")
|
|
||||||
|
|
||||||
stop_service("ufw")
|
stop_service("ufw")
|
||||||
start_service("ufw")
|
start_service("ufw")
|
||||||
@ -926,7 +924,7 @@ def setup_agent_config(configfile):
|
|||||||
zoneandpod = prompt_for_hostpods(x)
|
zoneandpod = prompt_for_hostpods(x)
|
||||||
if zoneandpod:
|
if zoneandpod:
|
||||||
confopts["zone"],confopts["pod"] = zoneandpod
|
confopts["zone"],confopts["pod"] = zoneandpod
|
||||||
stderr("You selected zone %s pod %s",confopts["zone"],confopts["pod"])
|
stderr("You selected zone %s pod %s",e,confopts["zone"],confopts["pod"])
|
||||||
else:
|
else:
|
||||||
stderr("Skipped -- using the previous zone %s pod %s",confopts["zone"],confopts["pod"])
|
stderr("Skipped -- using the previous zone %s pod %s",confopts["zone"],confopts["pod"])
|
||||||
except (urllib2.URLError,urllib2.HTTPError),e:
|
except (urllib2.URLError,urllib2.HTTPError),e:
|
||||||
|
|||||||
@ -6,12 +6,12 @@
|
|||||||
</projects>
|
</projects>
|
||||||
<buildSpec>
|
<buildSpec>
|
||||||
<buildCommand>
|
<buildCommand>
|
||||||
<name>org.python.pydev.PyDevBuilder</name>
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
<arguments>
|
<arguments>
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
</buildSpec>
|
</buildSpec>
|
||||||
<natures>
|
<natures>
|
||||||
<nature>org.python.pydev.pythonNature</nature>
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
</natures>
|
</natures>
|
||||||
</projectDescription>
|
</projectDescription>
|
||||||
|
|||||||
@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<?eclipse-pydev version="1.0"?>
|
|
||||||
|
|
||||||
<pydev_project>
|
|
||||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
|
|
||||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.6</pydev_property>
|
|
||||||
</pydev_project>
|
|
||||||
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# $Id: createtmplt.sh 11542 2010-08-09 03:22:31Z edison $ $HeadURL: svn://svn.lab.vmops.com/repos/vmdev/java/scripts/storage/qcow2/createtmplt.sh $
|
# $Id: createtmplt.sh 11474 2010-08-06 05:53:02Z edison $ $HeadURL: svn://svn.lab.vmops.com/repos/vmdev/java/scripts/storage/qcow2/createtmplt.sh $
|
||||||
# createtmplt.sh -- install a template
|
# createtmplt.sh -- install a template
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
@ -142,11 +142,6 @@ then
|
|||||||
exit 3
|
exit 3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tmpltimg=$(uncompress $tmpltimg)
|
|
||||||
if [ $? -ne 0 ]
|
|
||||||
then
|
|
||||||
printf "failed to uncompress $tmpltimg\n"
|
|
||||||
fi
|
|
||||||
|
|
||||||
create_from_file $tmpltfs $tmpltimg $tmpltname
|
create_from_file $tmpltfs $tmpltimg $tmpltname
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# $Id: managesnapshot.sh 11542 2010-08-09 03:22:31Z edison $ $HeadURL: svn://svn.lab.vmops.com/repos/vmdev/java/scripts/storage/qcow2/managesnapshot.sh $
|
# $Id: managesnapshot.sh 11474 2010-08-06 05:53:02Z edison $ $HeadURL: svn://svn.lab.vmops.com/repos/vmdev/java/scripts/storage/qcow2/managesnapshot.sh $
|
||||||
# managesnapshot.sh -- manage snapshots for a single disk (create, destroy, rollback)
|
# managesnapshot.sh -- manage snapshots for a single disk (create, destroy, rollback)
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -34,19 +34,16 @@ create_snapshot() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
destroy_snapshot() {
|
destroy_snapshot() {
|
||||||
local backupSnapDir=$1
|
local disk=$1
|
||||||
local snapshotname=$2
|
local snapshotname=$2
|
||||||
local failed=0
|
local failed=0
|
||||||
|
|
||||||
if [ -f $backupSnapDir/$snapshotname ]
|
qemu-img snapshot -d $snapshotname $disk
|
||||||
then
|
|
||||||
rm -f $backupSnapDir/$snapshotname
|
|
||||||
|
|
||||||
if [ $? -gt 0 ]
|
if [ $? -gt 0 ]
|
||||||
then
|
then
|
||||||
printf "***Failed to delete snapshot $snapshotname for path $backupSnapDir\n" >&2
|
printf "***Failed to delete snapshot $snapshotname for path $disk\n" >&2
|
||||||
failed=1
|
failed=1
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return $failed
|
return $failed
|
||||||
|
|||||||
@ -26,5 +26,5 @@ for psid in `ps -ef | grep xenheartbeat | grep -v grep | awk '{print $2}'`; do
|
|||||||
kill $psid
|
kill $psid
|
||||||
done
|
done
|
||||||
|
|
||||||
nohup /opt/xensource/bin/xenheartbeat.sh $1 $2 >/var/log/heartbeat.log 2>&1 &
|
nohup /opt/xensource/bin/heartbeat.sh $1 $2 >/var/log/heartbeat.log 2>&1 &
|
||||||
echo "======> DONE <======"
|
echo "======> DONE <======"
|
||||||
|
|||||||
@ -23,10 +23,5 @@ iptables-save > /etc/sysconfig/iptables
|
|||||||
sed -i 's/127\.0\.0\.1/0\.0\.0\.0/' /opt/xensource/libexec/vncterm-wrapper 2>&1
|
sed -i 's/127\.0\.0\.1/0\.0\.0\.0/' /opt/xensource/libexec/vncterm-wrapper 2>&1
|
||||||
sed -i 's/127\.0\.0\.1/0\.0\.0\.0/' /opt/xensource/libexec/qemu-dm-wrapper 2>&1
|
sed -i 's/127\.0\.0\.1/0\.0\.0\.0/' /opt/xensource/libexec/qemu-dm-wrapper 2>&1
|
||||||
|
|
||||||
# disable the default link local on xenserver
|
|
||||||
sed -i /NOZEROCONF/d /etc/sysconfig/network
|
|
||||||
echo "NOZEROCONF=yes" >> /etc/sysconfig/network
|
|
||||||
|
|
||||||
|
|
||||||
echo "success"
|
echo "success"
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# $Id: modifyvlan.sh 11549 2010-08-09 20:55:51Z edison $ $HeadURL: svn://svn.lab.vmops.com/repos/vmdev/java/scripts/vm/network/vnet/modifyvlan.sh $
|
# $Id: modifyvlan.sh 11388 2010-08-02 17:04:13Z edison $ $HeadURL: svn://svn.lab.vmops.com/repos/vmdev/java/scripts/vm/network/vnet/modifyvlan.sh $
|
||||||
# modifyvlan.sh -- adds and deletes VLANs from a Routing Server
|
# modifyvlan.sh -- adds and deletes VLANs from a Routing Server
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
@ -128,13 +128,6 @@ then
|
|||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Vlan module is loaded?
|
|
||||||
lsmod|grep ^8021q >& /dev/null
|
|
||||||
if [ $? -gt 0 ]
|
|
||||||
then
|
|
||||||
modprobe 8021q >& /dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$op" == "add" ]
|
if [ "$op" == "add" ]
|
||||||
then
|
then
|
||||||
# Add the vlan
|
# Add the vlan
|
||||||
|
|||||||
5
server/src/com/cloud/api/ApiConstants.java
Normal file
5
server/src/com/cloud/api/ApiConstants.java
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package com.cloud.api;
|
||||||
|
|
||||||
|
public class ApiConstants {
|
||||||
|
public static final String ID = "id";
|
||||||
|
}
|
||||||
169
server/src/com/cloud/api/ApiDispatcher.java
Normal file
169
server/src/com/cloud/api/ApiDispatcher.java
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
package com.cloud.api;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import com.cloud.api.BaseCmd.CommandType;
|
||||||
|
import com.cloud.network.NetworkManager;
|
||||||
|
import com.cloud.server.ManagementServer;
|
||||||
|
import com.cloud.storage.StorageManager;
|
||||||
|
import com.cloud.utils.DateUtil;
|
||||||
|
import com.cloud.utils.component.ComponentLocator;
|
||||||
|
import com.cloud.utils.exception.CloudRuntimeException;
|
||||||
|
import com.cloud.vm.UserVmManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class that dispatches API commands to the appropriate manager for execution.
|
||||||
|
*/
|
||||||
|
public class ApiDispatcher {
|
||||||
|
private static final Logger s_logger = Logger.getLogger(ApiDispatcher.class.getName());
|
||||||
|
|
||||||
|
private ManagementServer _mgmtServer;
|
||||||
|
private NetworkManager _networkMgr;
|
||||||
|
private StorageManager _storageMgr;
|
||||||
|
private UserVmManager _userVmMgr;
|
||||||
|
|
||||||
|
public ApiDispatcher() {
|
||||||
|
ComponentLocator locator = ComponentLocator.getLocator(ManagementServer.Name);
|
||||||
|
_mgmtServer = (ManagementServer)ComponentLocator.getComponent(ManagementServer.Name);
|
||||||
|
_networkMgr = locator.getManager(NetworkManager.class);
|
||||||
|
_storageMgr = locator.getManager(StorageManager.class);
|
||||||
|
_userVmMgr = locator.getManager(UserVmManager.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dispatch(BaseCmd cmd, Map<String, String> params) {
|
||||||
|
Map<String, Object> unpackedParams = cmd.unpackParams(params);
|
||||||
|
Field[] fields = cmd.getClass().getDeclaredFields();
|
||||||
|
for (Field field : fields) {
|
||||||
|
Parameter parameterAnnotation = field.getAnnotation(Parameter.class);
|
||||||
|
if (parameterAnnotation == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Object paramObj = unpackedParams.get(parameterAnnotation.name());
|
||||||
|
if (paramObj == null) {
|
||||||
|
if (parameterAnnotation.required()) {
|
||||||
|
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Unable to execute API command " + cmd.getName() + " due to missing parameter " + parameterAnnotation.name());
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// marshall the parameter into the correct type and set the field value
|
||||||
|
try {
|
||||||
|
setFieldValue(field, cmd, paramObj, parameterAnnotation);
|
||||||
|
} catch (IllegalArgumentException argEx) {
|
||||||
|
if (s_logger.isDebugEnabled()) {
|
||||||
|
s_logger.debug("Unable to execute API command " + cmd.getName() + " due to invalid value " + paramObj + " for parameter " + parameterAnnotation.name());
|
||||||
|
}
|
||||||
|
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Unable to execute API command " + cmd.getName() + " due to invalid value " + paramObj + " for parameter " + parameterAnnotation.name());
|
||||||
|
} catch (ParseException parseEx) {
|
||||||
|
if (s_logger.isDebugEnabled()) {
|
||||||
|
s_logger.debug("Invalid date parameter " + paramObj + " passed to command " + cmd.getName());
|
||||||
|
}
|
||||||
|
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Unable to parse date " + paramObj + " for command " + cmd.getName() + ", please pass dates in the format yyyy-MM-dd");
|
||||||
|
} catch (CloudRuntimeException cloudEx) {
|
||||||
|
// FIXME: Better error message? This only happens if the API command is not executable, which typically means there was
|
||||||
|
// and IllegalAccessException setting one of the parameters.
|
||||||
|
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Internal error executing API command " + cmd.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Implementation impl = cmd.getClass().getAnnotation(Implementation.class);
|
||||||
|
String methodName = impl.method();
|
||||||
|
Object mgr = _mgmtServer;
|
||||||
|
switch (impl.manager()) {
|
||||||
|
case NetworkManager:
|
||||||
|
mgr = _networkMgr;
|
||||||
|
break;
|
||||||
|
case StorageManager:
|
||||||
|
mgr = _storageMgr;
|
||||||
|
break;
|
||||||
|
case UserVmManager:
|
||||||
|
mgr = _userVmMgr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Method method = mgr.getClass().getMethod(methodName, cmd.getClass());
|
||||||
|
method.invoke(mgr, cmd);
|
||||||
|
} catch (NoSuchMethodException nsme) {
|
||||||
|
s_logger.warn("Exception executing method " + methodName + " for command " + cmd.getClass().getSimpleName(), nsme);
|
||||||
|
throw new CloudRuntimeException("Unable to execute method " + methodName + " for command " + cmd.getClass().getSimpleName() + ", unable to find implementation.");
|
||||||
|
} catch (InvocationTargetException ite) {
|
||||||
|
s_logger.warn("Exception executing method " + methodName + " for command " + cmd.getClass().getSimpleName(), ite);
|
||||||
|
throw new CloudRuntimeException("Unable to execute method " + methodName + " for command " + cmd.getClass().getSimpleName() + ", internal error in the implementation.");
|
||||||
|
} catch (IllegalAccessException iae) {
|
||||||
|
s_logger.warn("Exception executing method " + methodName + " for command " + cmd.getClass().getSimpleName(), iae);
|
||||||
|
throw new CloudRuntimeException("Unable to execute method " + methodName + " for command " + cmd.getClass().getSimpleName() + ", internal error in the implementation.");
|
||||||
|
} catch (IllegalArgumentException iArgEx) {
|
||||||
|
s_logger.warn("Exception executing method " + methodName + " for command " + cmd.getClass().getSimpleName(), iArgEx);
|
||||||
|
throw new CloudRuntimeException("Unable to execute method " + methodName + " for command " + cmd.getClass().getSimpleName() + ", internal error in the implementation.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private void setFieldValue(Field field, BaseCmd cmdObj, Object paramObj, Parameter annotation) throws IllegalArgumentException, ParseException {
|
||||||
|
try {
|
||||||
|
field.setAccessible(true);
|
||||||
|
CommandType fieldType = annotation.type();
|
||||||
|
switch (fieldType) {
|
||||||
|
case BOOLEAN:
|
||||||
|
field.set(cmdObj, Boolean.valueOf(paramObj.toString()));
|
||||||
|
break;
|
||||||
|
case DATE:
|
||||||
|
DateFormat format = BaseCmd.INPUT_FORMAT;
|
||||||
|
synchronized (format) {
|
||||||
|
field.set(cmdObj, format.parse(paramObj.toString()));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case FLOAT:
|
||||||
|
field.set(cmdObj, Float.valueOf(paramObj.toString()));
|
||||||
|
break;
|
||||||
|
case INTEGER:
|
||||||
|
field.set(cmdObj, Integer.valueOf(paramObj.toString()));
|
||||||
|
break;
|
||||||
|
case LIST:
|
||||||
|
List listParam = new ArrayList();
|
||||||
|
StringTokenizer st = new StringTokenizer(paramObj.toString(), ",");
|
||||||
|
while (st.hasMoreTokens()) {
|
||||||
|
String token = st.nextToken();
|
||||||
|
CommandType listType = annotation.collectionType();
|
||||||
|
switch (listType) {
|
||||||
|
case INTEGER:
|
||||||
|
listParam.add(Integer.valueOf(token));
|
||||||
|
break;
|
||||||
|
case LONG:
|
||||||
|
listParam.add(Long.valueOf(token));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
field.set(cmdObj, listParam);
|
||||||
|
break;
|
||||||
|
case LONG:
|
||||||
|
field.set(cmdObj, Long.valueOf(paramObj.toString()));
|
||||||
|
break;
|
||||||
|
case STRING:
|
||||||
|
field.set(cmdObj, paramObj.toString());
|
||||||
|
break;
|
||||||
|
case TZDATE:
|
||||||
|
field.set(cmdObj, DateUtil.parseTZDateString(paramObj.toString()));
|
||||||
|
break;
|
||||||
|
case MAP:
|
||||||
|
default:
|
||||||
|
field.set(cmdObj, paramObj);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException ex) {
|
||||||
|
s_logger.error("Error initializing command " + cmdObj.getName() + ", field " + field.getName() + " is not accessible.");
|
||||||
|
throw new CloudRuntimeException("Internal error initializing parameters for command " + cmdObj.getName() + " [field " + field.getName() + " is not accessible]");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -25,11 +25,16 @@ import java.io.FileInputStream;
|
|||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InterruptedIOException;
|
import java.io.InterruptedIOException;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.ServerSocket;
|
import java.net.ServerSocket;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
|
import java.net.URLDecoder;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.ParseException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -38,6 +43,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.StringTokenizer;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
@ -74,15 +80,20 @@ import org.apache.http.protocol.ResponseDate;
|
|||||||
import org.apache.http.protocol.ResponseServer;
|
import org.apache.http.protocol.ResponseServer;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import com.cloud.api.BaseCmd.CommandType;
|
||||||
|
import com.cloud.async.AsyncJobManager;
|
||||||
|
import com.cloud.async.AsyncJobVO;
|
||||||
import com.cloud.configuration.ConfigurationVO;
|
import com.cloud.configuration.ConfigurationVO;
|
||||||
import com.cloud.configuration.dao.ConfigurationDao;
|
import com.cloud.configuration.dao.ConfigurationDao;
|
||||||
import com.cloud.domain.DomainVO;
|
import com.cloud.domain.DomainVO;
|
||||||
import com.cloud.maid.StackMaid;
|
import com.cloud.maid.StackMaid;
|
||||||
|
import com.cloud.serializer.GsonHelper;
|
||||||
import com.cloud.server.ManagementServer;
|
import com.cloud.server.ManagementServer;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
import com.cloud.user.User;
|
import com.cloud.user.User;
|
||||||
import com.cloud.user.UserAccount;
|
import com.cloud.user.UserAccount;
|
||||||
import com.cloud.user.UserContext;
|
import com.cloud.user.UserContext;
|
||||||
|
import com.cloud.utils.DateUtil;
|
||||||
import com.cloud.utils.Pair;
|
import com.cloud.utils.Pair;
|
||||||
import com.cloud.utils.PropertiesUtil;
|
import com.cloud.utils.PropertiesUtil;
|
||||||
import com.cloud.utils.component.ComponentLocator;
|
import com.cloud.utils.component.ComponentLocator;
|
||||||
@ -90,7 +101,8 @@ import com.cloud.utils.concurrency.NamedThreadFactory;
|
|||||||
import com.cloud.utils.db.SearchCriteria;
|
import com.cloud.utils.db.SearchCriteria;
|
||||||
import com.cloud.utils.db.Transaction;
|
import com.cloud.utils.db.Transaction;
|
||||||
import com.cloud.utils.encoding.Base64;
|
import com.cloud.utils.encoding.Base64;
|
||||||
|
import com.cloud.utils.exception.CloudRuntimeException;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
public class ApiServer implements HttpRequestHandler {
|
public class ApiServer implements HttpRequestHandler {
|
||||||
private static final Logger s_logger = Logger.getLogger(ApiServer.class.getName());
|
private static final Logger s_logger = Logger.getLogger(ApiServer.class.getName());
|
||||||
@ -101,7 +113,8 @@ public class ApiServer implements HttpRequestHandler {
|
|||||||
private static final short READ_ONLY_ADMIN_COMMAND = 4;
|
private static final short READ_ONLY_ADMIN_COMMAND = 4;
|
||||||
private static final short USER_COMMAND = 8;
|
private static final short USER_COMMAND = 8;
|
||||||
private Properties _apiCommands = null;
|
private Properties _apiCommands = null;
|
||||||
private ManagementServer _ms = null;
|
private AsyncJobManager _asyncMgr;
|
||||||
|
private ApiDispatcher _dispatcher;
|
||||||
|
|
||||||
private static int _workerCount = 0;
|
private static int _workerCount = 0;
|
||||||
|
|
||||||
@ -174,7 +187,9 @@ public class ApiServer implements HttpRequestHandler {
|
|||||||
s_logger.error("Exception loading properties file", ioex);
|
s_logger.error("Exception loading properties file", ioex);
|
||||||
}
|
}
|
||||||
|
|
||||||
_ms = (ManagementServer)ComponentLocator.getComponent(ManagementServer.Name);
|
ComponentLocator locator = ComponentLocator.getLocator(ManagementServer.Name);
|
||||||
|
_asyncMgr = locator.getManager(AsyncJobManager.class);
|
||||||
|
_dispatcher = new ApiDispatcher();
|
||||||
|
|
||||||
int apiPort = 8096; // default port
|
int apiPort = 8096; // default port
|
||||||
ConfigurationDao configDao = ComponentLocator.getLocator(ManagementServer.Name).getDao(ConfigurationDao.class);
|
ConfigurationDao configDao = ComponentLocator.getLocator(ManagementServer.Name).getDao(ConfigurationDao.class);
|
||||||
@ -233,7 +248,7 @@ public class ApiServer implements HttpRequestHandler {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// always trust commands from API port, user context will always be UID_SYSTEM/ACCOUNT_ID_SYSTEM
|
// always trust commands from API port, user context will always be UID_SYSTEM/ACCOUNT_ID_SYSTEM
|
||||||
UserContext.registerContext(User.UID_SYSTEM, Account.ACCOUNT_ID_SYSTEM, null, true);
|
UserContext.registerContext(User.UID_SYSTEM, null, null, Account.ACCOUNT_ID_SYSTEM, null, null, true);
|
||||||
|
|
||||||
String responseText = handleRequest(parameterMap, true, responseType);
|
String responseText = handleRequest(parameterMap, true, responseType);
|
||||||
sb.append(" 200 " + ((responseText == null) ? 0 : responseText.length()));
|
sb.append(" 200 " + ((responseText == null) ? 0 : responseText.length()));
|
||||||
@ -266,8 +281,9 @@ public class ApiServer implements HttpRequestHandler {
|
|||||||
|
|
||||||
public String handleRequest(Map params, boolean decode, String responseType) throws ServerApiException {
|
public String handleRequest(Map params, boolean decode, String responseType) throws ServerApiException {
|
||||||
String response = null;
|
String response = null;
|
||||||
|
String[] command = null;
|
||||||
try {
|
try {
|
||||||
String[] command = (String[])params.get("command");
|
command = (String[])params.get("command");
|
||||||
if (command == null) {
|
if (command == null) {
|
||||||
s_logger.error("invalid request, no command sent");
|
s_logger.error("invalid request, no command sent");
|
||||||
if (s_logger.isTraceEnabled()) {
|
if (s_logger.isTraceEnabled()) {
|
||||||
@ -280,7 +296,7 @@ public class ApiServer implements HttpRequestHandler {
|
|||||||
}
|
}
|
||||||
response = buildErrorResponse("invalid request, no command sent", responseType);
|
response = buildErrorResponse("invalid request, no command sent", responseType);
|
||||||
} else {
|
} else {
|
||||||
Map<String, Object> paramMap = new HashMap<String, Object>();
|
Map<String, String> paramMap = new HashMap<String, String>();
|
||||||
Set keys = params.keySet();
|
Set keys = params.keySet();
|
||||||
Iterator keysIter = keys.iterator();
|
Iterator keysIter = keys.iterator();
|
||||||
while (keysIter.hasNext()) {
|
while (keysIter.hasNext()) {
|
||||||
@ -288,18 +304,33 @@ public class ApiServer implements HttpRequestHandler {
|
|||||||
if ("command".equalsIgnoreCase(key)) {
|
if ("command".equalsIgnoreCase(key)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Object[] value = (Object[])params.get(key);
|
String[] value = (String[])params.get(key);
|
||||||
paramMap.put(key, value[0]);
|
|
||||||
|
String decodedValue = null;
|
||||||
|
if (decode) {
|
||||||
|
try {
|
||||||
|
decodedValue = URLDecoder.decode(value[0], "UTF-8");
|
||||||
|
} catch (UnsupportedEncodingException usex) {
|
||||||
|
s_logger.warn(key + " could not be decoded, value = " + value[0]);
|
||||||
|
throw new ServerApiException(BaseCmd.PARAM_ERROR, key + " could not be decoded, received value " + value[0]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
decodedValue = value[0];
|
||||||
|
}
|
||||||
|
paramMap.put(key, decodedValue);
|
||||||
}
|
}
|
||||||
String cmdClassName = _apiCommands.getProperty(command[0]);
|
String cmdClassName = _apiCommands.getProperty(command[0]);
|
||||||
if (cmdClassName != null) {
|
if (cmdClassName != null) {
|
||||||
Class<?> cmdClass = Class.forName(cmdClassName);
|
Class<?> cmdClass = Class.forName(cmdClassName);
|
||||||
BaseCmd cmdObj = (BaseCmd)cmdClass.newInstance();
|
BaseCmd cmdObj = (BaseCmd)cmdClass.newInstance();
|
||||||
cmdObj.setManagementServer(_ms);
|
|
||||||
Map<String, Object> validatedParams = cmdObj.validateParams(paramMap, decode);
|
|
||||||
|
|
||||||
List<Pair<String, Object>> resultValues = cmdObj.execute(validatedParams);
|
// This is where the command is either serialized, or directly dispatched
|
||||||
response = cmdObj.buildResponse(resultValues, responseType);
|
response = queueCommand(cmdObj, paramMap);
|
||||||
|
|
||||||
|
// Map<String, Object> validatedParams = cmdObj.validateParams(paramMap, decode);
|
||||||
|
|
||||||
|
// List<Pair<String, Object>> resultValues = cmdObj.execute(validatedParams);
|
||||||
|
// response = cmdObj.buildResponse(resultValues, responseType);
|
||||||
} else {
|
} else {
|
||||||
s_logger.warn("unknown API command: " + ((command == null) ? "null" : command[0]));
|
s_logger.warn("unknown API command: " + ((command == null) ? "null" : command[0]));
|
||||||
response = buildErrorResponse("unknown API command: " + ((command == null) ? "null" : command[0]), responseType);
|
response = buildErrorResponse("unknown API command: " + ((command == null) ? "null" : command[0]), responseType);
|
||||||
@ -309,13 +340,31 @@ public class ApiServer implements HttpRequestHandler {
|
|||||||
if (ex instanceof ServerApiException) {
|
if (ex instanceof ServerApiException) {
|
||||||
throw (ServerApiException)ex;
|
throw (ServerApiException)ex;
|
||||||
} else {
|
} else {
|
||||||
s_logger.error("error executing api command", ex);
|
s_logger.error("unhandled exception executing api command: " + ((command == null) ? "null" : command[0]), ex);
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Internal server error, unable to execute request.");
|
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Internal server error, unable to execute request.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String queueCommand(BaseCmd cmdObj, Map<String, String> params) {
|
||||||
|
if (cmdObj instanceof BaseAsyncCmd) {
|
||||||
|
BaseAsyncCmd asyncCmd = (BaseAsyncCmd)cmdObj;
|
||||||
|
|
||||||
|
Gson gson = GsonHelper.getBuilder().create();
|
||||||
|
|
||||||
|
AsyncJobVO job = new AsyncJobVO();
|
||||||
|
job.setUserId(UserContext.current().getUserId());
|
||||||
|
job.setCmd(cmdObj.getClass().getName());
|
||||||
|
job.setCmdInfo(gson.toJson(params));
|
||||||
|
long jobId = _asyncMgr.submitAsyncJob(job);
|
||||||
|
return asyncCmd.getResponse(jobId);
|
||||||
|
} else {
|
||||||
|
_dispatcher.dispatch(cmdObj, params);
|
||||||
|
return cmdObj.getResponse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean verifyRequest(Map<String, Object[]> requestParameters, String userId) {
|
public boolean verifyRequest(Map<String, Object[]> requestParameters, String userId) {
|
||||||
try {
|
try {
|
||||||
String apiKey = null;
|
String apiKey = null;
|
||||||
@ -400,13 +449,20 @@ public class ApiServer implements HttpRequestHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (account.getType() == Account.ACCOUNT_TYPE_NORMAL) {
|
if (account.getType() == Account.ACCOUNT_TYPE_NORMAL) {
|
||||||
|
UserContext.updateContext(user.getId(), account, account.getAccountName(), account.getId(), account.getDomainId(), null);
|
||||||
|
|
||||||
|
/*
|
||||||
requestParameters.put(BaseCmd.Properties.USER_ID.getName(), new String[] { user.getId().toString() });
|
requestParameters.put(BaseCmd.Properties.USER_ID.getName(), new String[] { user.getId().toString() });
|
||||||
requestParameters.put(BaseCmd.Properties.ACCOUNT.getName(), new String[] { account.getAccountName() });
|
requestParameters.put(BaseCmd.Properties.ACCOUNT.getName(), new String[] { account.getAccountName() });
|
||||||
requestParameters.put(BaseCmd.Properties.DOMAIN_ID.getName(), new String[] { account.getDomainId().toString() });
|
requestParameters.put(BaseCmd.Properties.DOMAIN_ID.getName(), new String[] { account.getDomainId().toString() });
|
||||||
requestParameters.put(BaseCmd.Properties.ACCOUNT_OBJ.getName(), new Object[] { account });
|
requestParameters.put(BaseCmd.Properties.ACCOUNT_OBJ.getName(), new Object[] { account });
|
||||||
|
*/
|
||||||
} else {
|
} else {
|
||||||
|
UserContext.updateContext(user.getId(), account, null, null, null, null);
|
||||||
|
/*
|
||||||
requestParameters.put(BaseCmd.Properties.USER_ID.getName(), new String[] { user.getId().toString() });
|
requestParameters.put(BaseCmd.Properties.USER_ID.getName(), new String[] { user.getId().toString() });
|
||||||
requestParameters.put(BaseCmd.Properties.ACCOUNT_OBJ.getName(), new Object[] { account });
|
requestParameters.put(BaseCmd.Properties.ACCOUNT_OBJ.getName(), new Object[] { account });
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isCommandAvailable(account.getType(), commandName)) {
|
if (!isCommandAvailable(account.getType(), commandName)) {
|
||||||
|
|||||||
@ -154,16 +154,17 @@ public class ApiServlet extends HttpServlet {
|
|||||||
|
|
||||||
boolean isNew = ((session == null) ? true : session.isNew());
|
boolean isNew = ((session == null) ? true : session.isNew());
|
||||||
|
|
||||||
Object accountObj = null;
|
// Initialize an empty context and we will update it after we have verified the request below,
|
||||||
|
// we no longer rely on web-session here, verifyRequest will populate user/account information
|
||||||
|
// if a API key exists
|
||||||
|
UserContext.registerContext(null, null, null, null, null, null, false);
|
||||||
String userId = null;
|
String userId = null;
|
||||||
String account = null;
|
|
||||||
String domainId = null;
|
|
||||||
|
|
||||||
if (!isNew) {
|
if (!isNew) {
|
||||||
userId = (String)session.getAttribute(BaseCmd.Properties.USER_ID.getName());
|
userId = (String)session.getAttribute(BaseCmd.Properties.USER_ID.getName());
|
||||||
account = (String)session.getAttribute(BaseCmd.Properties.ACCOUNT.getName());
|
String account = (String)session.getAttribute(BaseCmd.Properties.ACCOUNT.getName());
|
||||||
domainId = (String)session.getAttribute(BaseCmd.Properties.DOMAIN_ID.getName());
|
String domainId = (String)session.getAttribute(BaseCmd.Properties.DOMAIN_ID.getName());
|
||||||
accountObj = session.getAttribute(BaseCmd.Properties.ACCOUNT_OBJ.getName());
|
Object accountObj = session.getAttribute(BaseCmd.Properties.ACCOUNT_OBJ.getName());
|
||||||
String sessionKey = (String)session.getAttribute(BaseCmd.Properties.SESSION_KEY.getName());
|
String sessionKey = (String)session.getAttribute(BaseCmd.Properties.SESSION_KEY.getName());
|
||||||
String[] sessionKeyParam = (String[])params.get(BaseCmd.Properties.SESSION_KEY.getName());
|
String[] sessionKeyParam = (String[])params.get(BaseCmd.Properties.SESSION_KEY.getName());
|
||||||
if ((sessionKeyParam == null) || (sessionKey == null) || !sessionKey.equals(sessionKeyParam[0])) {
|
if ((sessionKeyParam == null) || (sessionKey == null) || !sessionKey.equals(sessionKeyParam[0])) {
|
||||||
@ -179,25 +180,18 @@ public class ApiServlet extends HttpServlet {
|
|||||||
resp.sendError(HttpServletResponse.SC_BAD_REQUEST, "no command specified");
|
resp.sendError(HttpServletResponse.SC_BAD_REQUEST, "no command specified");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
UserContext.updateContext(Long.valueOf(userId), accountObj, account, ((Account)accountObj).getId(), Long.valueOf(domainId), session.getId());
|
||||||
} else {
|
} else {
|
||||||
// Clear out the variables we retrieved from the session and invalidate the session. This ensures
|
// Invalidate the session to ensure we won't allow a request across management server restarts if the userId was serialized to the
|
||||||
// we won't allow a request across management server restarts if the userId was serialized to the
|
|
||||||
// stored session
|
// stored session
|
||||||
userId = null;
|
|
||||||
account = null;
|
|
||||||
accountObj = null;
|
|
||||||
session.invalidate();
|
session.invalidate();
|
||||||
resp.sendError(HttpServletResponse.SC_UNAUTHORIZED, "unable to verify user credentials");
|
resp.sendError(HttpServletResponse.SC_UNAUTHORIZED, "unable to verify user credentials");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize an empty context and we will update it after we have verified the request below,
|
|
||||||
// we no longer rely on web-session here, verifyRequest will populate user/account information
|
|
||||||
// if a API key exists
|
|
||||||
UserContext.registerContext(null, null, null, false);
|
|
||||||
|
|
||||||
if (_apiServer.verifyRequest(params, userId)) {
|
if (_apiServer.verifyRequest(params, userId)) {
|
||||||
|
/*
|
||||||
if (accountObj != null) {
|
if (accountObj != null) {
|
||||||
Account userAccount = (Account)accountObj;
|
Account userAccount = (Account)accountObj;
|
||||||
if (userAccount.getType() == Account.ACCOUNT_TYPE_NORMAL) {
|
if (userAccount.getType() == Account.ACCOUNT_TYPE_NORMAL) {
|
||||||
@ -214,6 +208,7 @@ public class ApiServlet extends HttpServlet {
|
|||||||
// update user context info here so that we can take information if the request is authenticated
|
// update user context info here so that we can take information if the request is authenticated
|
||||||
// via api key mechenism
|
// via api key mechenism
|
||||||
updateUserContext(params, session != null ? session.getId() : null);
|
updateUserContext(params, session != null ? session.getId() : null);
|
||||||
|
*/
|
||||||
try {
|
try {
|
||||||
String response = _apiServer.handleRequest(params, false, responseType);
|
String response = _apiServer.handleRequest(params, false, responseType);
|
||||||
writeResponse(resp, response != null ? response : "", false, responseType);
|
writeResponse(resp, response != null ? response : "", false, responseType);
|
||||||
@ -238,6 +233,7 @@ public class ApiServlet extends HttpServlet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
private void updateUserContext(Map<String, Object[]> requestParameters, String sessionId) {
|
private void updateUserContext(Map<String, Object[]> requestParameters, String sessionId) {
|
||||||
String userIdStr = (String)(requestParameters.get(BaseCmd.Properties.USER_ID.getName())[0]);
|
String userIdStr = (String)(requestParameters.get(BaseCmd.Properties.USER_ID.getName())[0]);
|
||||||
Account accountObj = (Account)(requestParameters.get(BaseCmd.Properties.ACCOUNT_OBJ.getName())[0]);
|
Account accountObj = (Account)(requestParameters.get(BaseCmd.Properties.ACCOUNT_OBJ.getName())[0]);
|
||||||
@ -252,6 +248,7 @@ public class ApiServlet extends HttpServlet {
|
|||||||
|
|
||||||
UserContext.updateContext(userId, accountId, sessionId);
|
UserContext.updateContext(userId, accountId, sessionId);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// FIXME: rather than isError, we might was to pass in the status code to give more flexibility
|
// FIXME: rather than isError, we might was to pass in the status code to give more flexibility
|
||||||
private void writeResponse(HttpServletResponse resp, String response, boolean isError, String responseType) {
|
private void writeResponse(HttpServletResponse resp, String response, boolean isError, String responseType) {
|
||||||
|
|||||||
19
server/src/com/cloud/api/BaseAsyncCmd.java
Normal file
19
server/src/com/cloud/api/BaseAsyncCmd.java
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package com.cloud.api;
|
||||||
|
|
||||||
|
import com.cloud.serializer.SerializerHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A base command for supporting asynchronous API calls. When an API command is received, the command will be
|
||||||
|
* serialized to the queue (currently the async_job table) and a response will be immediately returned with the
|
||||||
|
* id of the queue object. The id can be used to query the status/progress of the command using the
|
||||||
|
* queryAsyncJobResult API command.
|
||||||
|
*
|
||||||
|
* TODO: Create commands are often async and yet they need to return the id of object in question, e.g. deployVirtualMachine
|
||||||
|
* should return a virtual machine id, createPortForwardingServiceRule should return a rule id, and createVolume should return
|
||||||
|
* a volume id.
|
||||||
|
*/
|
||||||
|
public abstract class BaseAsyncCmd extends BaseCmd {
|
||||||
|
public String getResponse(long jobId) {
|
||||||
|
return SerializerHelper.toSerializedString(Long.valueOf(jobId));
|
||||||
|
}
|
||||||
|
}
|
||||||
15
server/src/com/cloud/api/BaseAsyncCreateCmd.java
Normal file
15
server/src/com/cloud/api/BaseAsyncCreateCmd.java
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package com.cloud.api;
|
||||||
|
|
||||||
|
public abstract class BaseAsyncCreateCmd extends BaseAsyncCmd {
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
public abstract Object createObject();
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -21,7 +21,6 @@ package com.cloud.api;
|
|||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.ParseException;
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -35,7 +34,6 @@ import com.cloud.async.AsyncJobVO;
|
|||||||
import com.cloud.serializer.SerializerHelper;
|
import com.cloud.serializer.SerializerHelper;
|
||||||
import com.cloud.server.ManagementServer;
|
import com.cloud.server.ManagementServer;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
import com.cloud.utils.DateUtil;
|
|
||||||
import com.cloud.utils.Pair;
|
import com.cloud.utils.Pair;
|
||||||
|
|
||||||
public abstract class BaseCmd {
|
public abstract class BaseCmd {
|
||||||
@ -45,19 +43,15 @@ public abstract class BaseCmd {
|
|||||||
public static final String RESPONSE_TYPE_XML = "xml";
|
public static final String RESPONSE_TYPE_XML = "xml";
|
||||||
public static final String RESPONSE_TYPE_JSON = "json";
|
public static final String RESPONSE_TYPE_JSON = "json";
|
||||||
|
|
||||||
private Map<String, String> _params;
|
public enum CommandType {
|
||||||
private ManagementServer _ms = null;
|
BOOLEAN, DATE, FLOAT, INTEGER, LIST, LONG, OBJECT, MAP, STRING, TZDATE
|
||||||
|
}
|
||||||
|
|
||||||
public static final short TYPE_STRING = 0;
|
public enum Manager {
|
||||||
public static final short TYPE_INT = 1;
|
ManagementServer, NetworkManager, StorageManager, UserVmManager
|
||||||
public static final short TYPE_LONG = 2;
|
}
|
||||||
public static final short TYPE_DATE = 3;
|
|
||||||
public static final short TYPE_FLOAT = 4;
|
|
||||||
public static final short TYPE_BOOLEAN = 5;
|
|
||||||
public static final short TYPE_OBJECT = 6;
|
|
||||||
public static final short TYPE_OBJECT_MAP = 7;
|
|
||||||
public static final short TYPE_TZDATE = 8;
|
|
||||||
|
|
||||||
|
// FIXME: Extract these out into a separate file
|
||||||
// Client error codes
|
// Client error codes
|
||||||
public static final int MALFORMED_PARAMETER_ERROR = 430;
|
public static final int MALFORMED_PARAMETER_ERROR = 430;
|
||||||
public static final int VM_INVALID_PARAM_ERROR = 431;
|
public static final int VM_INVALID_PARAM_ERROR = 431;
|
||||||
@ -100,329 +94,11 @@ public abstract class BaseCmd {
|
|||||||
public static final int STORAGE_RESOURCE_IN_USE = 580;
|
public static final int STORAGE_RESOURCE_IN_USE = 580;
|
||||||
|
|
||||||
|
|
||||||
private static final DateFormat _format = new SimpleDateFormat("yyyy-MM-dd");
|
public static final DateFormat INPUT_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
private static final DateFormat _outputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
|
private static final DateFormat _outputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
|
||||||
|
|
||||||
public enum Properties {
|
|
||||||
ACCOUNT("account", BaseCmd.TYPE_STRING, "account"),
|
|
||||||
ACCOUNT_ID("accountid", BaseCmd.TYPE_LONG, "accountId"),
|
|
||||||
ACCOUNT_NAMES("accounts", BaseCmd.TYPE_STRING, "accounts"),
|
|
||||||
ACCOUNT_TYPE("accounttype", BaseCmd.TYPE_LONG, "accounttype"),
|
|
||||||
ACCOUNT_OBJ("accountobj", BaseCmd.TYPE_OBJECT, "accountobj"),
|
|
||||||
ACTIVE_VIEWER_SESSIONS("activeviewersessions", BaseCmd.TYPE_INT, "activeviewersessions"),
|
|
||||||
ADD("add", BaseCmd.TYPE_BOOLEAN, "add"),
|
|
||||||
ALGORITHM("algorithm", BaseCmd.TYPE_STRING, "algorithm"),
|
|
||||||
ALLOCATED("allocated", BaseCmd.TYPE_DATE, "allocated"),
|
|
||||||
ALLOCATED_ONLY("allocatedonly", BaseCmd.TYPE_BOOLEAN, "allocatedOnly"),
|
|
||||||
API_KEY("apikey", BaseCmd.TYPE_STRING, "apiKey"),
|
|
||||||
APPLIED("applied", BaseCmd.TYPE_BOOLEAN, "applied"),
|
|
||||||
AVAILABLE("available", BaseCmd.TYPE_BOOLEAN, "available"),
|
|
||||||
AVERAGE_LOAD("averageload",BaseCmd.TYPE_LONG,"averageLoad"),
|
|
||||||
ASSIGN_DATE("assigneddate", BaseCmd.TYPE_DATE, "assigneddate"),
|
|
||||||
BITS("bits", BaseCmd.TYPE_INT, "bits"),
|
|
||||||
BOOTABLE("bootable", BaseCmd.TYPE_BOOLEAN, "bootable"),
|
|
||||||
BYTES_RECEIVED("receivedbytes", BaseCmd.TYPE_LONG, "receivedbytes"),
|
|
||||||
BYTES_SENT("sentbytes", BaseCmd.TYPE_LONG, "sentbytes"),
|
|
||||||
CAPABILITIES("capabilities", BaseCmd.TYPE_STRING, "capabilities"),
|
|
||||||
CAPACITY_TOTAL("capacitytotal", BaseCmd.TYPE_LONG, "capacitytotal"),
|
|
||||||
CAPACITY_USED("capacityused", BaseCmd.TYPE_LONG, "capacityused"),
|
|
||||||
CATEGORY("category", BaseCmd.TYPE_STRING, "category"),
|
|
||||||
CLEANUP("cleanup", BaseCmd.TYPE_BOOLEAN, "cleanup"),
|
|
||||||
CLOUD_IDENTIFIER("cloudidentifier", BaseCmd.TYPE_STRING, "cloudIdentifier"),
|
|
||||||
CLUSTER_ID("clusterid", BaseCmd.TYPE_LONG, "clusterid"),
|
|
||||||
CLUSTER_NAME("clustername", BaseCmd.TYPE_STRING, "clustername"),
|
|
||||||
CMD("cmd", BaseCmd.TYPE_STRING, "cmd"),
|
|
||||||
COMPONENT("component", BaseCmd.TYPE_STRING, "component"),
|
|
||||||
CONSOLE_HOST("consolehost", BaseCmd.TYPE_STRING, "consoleHost"),
|
|
||||||
CONSOLE_IMAGE_URL("consoleimageurl", BaseCmd.TYPE_STRING, "consoleImageUrl"),
|
|
||||||
CONSOLE_PASSWORD("consolepassword", BaseCmd.TYPE_STRING, "consolePassword"),
|
|
||||||
CONSOLE_PORT("consoleport", BaseCmd.TYPE_STRING, "consolePort"),
|
|
||||||
CONSOLE_PROXY_HOST("consoleproxyhost", BaseCmd.TYPE_STRING, "consoleProxyHost"),
|
|
||||||
CONSOLE_PROXY_PORT("consoleproxyport", BaseCmd.TYPE_STRING, "consoleProxyPort"),
|
|
||||||
CONSOLE_PROXY_SSLENABLED("consoleproxysslenabled", BaseCmd.TYPE_BOOLEAN, "consoleProxySslEnabled"),
|
|
||||||
CIDR("cidr", BaseCmd.TYPE_STRING, "cidr"),
|
|
||||||
CIDR_ADDRESS("cidraddress", BaseCmd.TYPE_STRING, "CidrAddress"),
|
|
||||||
CIDR_LIST("cidrlist", BaseCmd.TYPE_STRING, "cidrList"),
|
|
||||||
GUEST_IP_ADDRESS("guestipaddress", BaseCmd.TYPE_STRING, "guestIpAddress"),
|
|
||||||
GUEST_MAC_ADDRESS("guestmacaddress", BaseCmd.TYPE_STRING, "guestMacAddress"),
|
|
||||||
GUEST_NETMASK("guestnetmask", BaseCmd.TYPE_STRING, "guestNetmask"),
|
|
||||||
GUEST_CIDR_ADDRESS("guestcidraddress", BaseCmd.TYPE_STRING, "GuestCidrAddress"),
|
|
||||||
CIDR_SIZE("cidrsize", BaseCmd.TYPE_LONG, "CidrSize"),
|
|
||||||
CPU_NUMBER("cpunumber", BaseCmd.TYPE_LONG, "CpuNumber"),
|
|
||||||
CPU_SPEED("cpuspeed", BaseCmd.TYPE_LONG, "CpuSpeed"),
|
|
||||||
CPU_ALLOCATED("cpuallocated", BaseCmd.TYPE_LONG, "cpuallocated"),
|
|
||||||
CPU_USED("cpuused", BaseCmd.TYPE_LONG, "cpuused"),
|
|
||||||
CREATED("created", BaseCmd.TYPE_DATE, "created"),
|
|
||||||
CROSS_ZONES("crossZones", BaseCmd.TYPE_BOOLEAN, "crosszones"),
|
|
||||||
DAILY_MAX("dailymax", BaseCmd.TYPE_INT, "dailyMax"),
|
|
||||||
DATA_DISK_OFFERING_ID("datadiskofferingid", BaseCmd.TYPE_LONG, "dataDiskOfferingId"),
|
|
||||||
DATA_DISK_OFFERING_NAME("datadiskofferingname", BaseCmd.TYPE_LONG, "dataDiskOfferingName"),
|
|
||||||
DESCRIPTION("description", BaseCmd.TYPE_STRING, "description"),
|
|
||||||
DETAILS("details", BaseCmd.TYPE_OBJECT_MAP, "details"),
|
|
||||||
DEVICE_NAME("devicename", BaseCmd.TYPE_STRING, "deviceName"),
|
|
||||||
DIRECT_ATTACH_NETWORK_GROUPS_ENABLED("directattachnetworkgroupsenabled", BaseCmd.TYPE_BOOLEAN, "directAttachNetworkGroupsEnabled"),
|
|
||||||
DIRECT_ATTACHED_UNTAGGED_ENABLED("directattacheduntaggedenabled", BaseCmd.TYPE_BOOLEAN, "directAttachedUntaggedEnabled"),
|
|
||||||
SYSTEM_VM_USE_LOCAL_STORAGE("systemvmuselocalstorage", BaseCmd.TYPE_BOOLEAN, "systemVmUseLocalStorage"),
|
|
||||||
DISCONNECTED("disconnected", BaseCmd.TYPE_DATE, "disconnected"),
|
|
||||||
DISPLAY_TEXT("displaytext", BaseCmd.TYPE_STRING, "displayText"),
|
|
||||||
DISK_OFFERING_DISPLAY_TEXT("diskofferingdisplaytext", BaseCmd.TYPE_LONG, "diskOfferingDisplayText"),
|
|
||||||
DISK_OFFERING_ID("diskofferingid", BaseCmd.TYPE_LONG, "diskOfferingId"),
|
|
||||||
DISK_OFFERING_NAME("diskofferingname", BaseCmd.TYPE_LONG, "diskOfferingName"),
|
|
||||||
DISK_SIZE("disksize", BaseCmd.TYPE_LONG, "diskSize"),
|
|
||||||
DISK_SIZE_ALLOCATED("disksizeallocated", BaseCmd.TYPE_LONG, "disksizeallocated"),
|
|
||||||
DISK_SIZE_TOTAL("disksizetotal", BaseCmd.TYPE_LONG, "disksizetotal"),
|
|
||||||
DISPLAY_NAME("displayname", BaseCmd.TYPE_STRING, "displayname"),
|
|
||||||
DNS1("dns1", BaseCmd.TYPE_STRING, "dns1"),
|
|
||||||
DNS2("dns2", BaseCmd.TYPE_STRING, "dns2"),
|
|
||||||
DOMAIN("domain", BaseCmd.TYPE_STRING, "domain"),
|
|
||||||
DOMAIN_ID("domainid", BaseCmd.TYPE_LONG, "domainId"),
|
|
||||||
DOMAIN_LEVEL("level", BaseCmd.TYPE_INT, "level"),
|
|
||||||
DEST_ZONE_ID("destzoneid", BaseCmd.TYPE_LONG, "destZoneId"),
|
|
||||||
DURATION("duration", BaseCmd.TYPE_INT, "duration"),
|
|
||||||
EMAIL("email", BaseCmd.TYPE_STRING, "email"),
|
|
||||||
END_DATE("enddate", BaseCmd.TYPE_DATE, "endDate"),
|
|
||||||
END_IP("endip", BaseCmd.TYPE_STRING, "endIp"),
|
|
||||||
END_PORT("endport", BaseCmd.TYPE_INT, "endPort"),
|
|
||||||
END_VLAN("endvlan", BaseCmd.TYPE_LONG, "endvlan"),
|
|
||||||
ENTRY_TIME("entrytime", BaseCmd.TYPE_INT, "entryTime"),
|
|
||||||
EVENTS("events",BaseCmd.TYPE_STRING,"events"),
|
|
||||||
FIREWALL_ENABLE_PASSWORD("firewallenablepassword", BaseCmd.TYPE_STRING, "firewallEnablePassword"),
|
|
||||||
FIREWALL_IP("firewallip", BaseCmd.TYPE_STRING, "firewallIp"),
|
|
||||||
FIREWALL_PASSWORD("firewallpassword", BaseCmd.TYPE_STRING, "firewallPassword"),
|
|
||||||
FIREWALL_RULE_ID("firewallruleid", BaseCmd.TYPE_LONG, "firewallRuleId"),
|
|
||||||
FIREWALL_USER("firewalluser", BaseCmd.TYPE_STRING, "firewallUser"),
|
|
||||||
FIRSTNAME("firstname", BaseCmd.TYPE_STRING, "firstname"),
|
|
||||||
FOR_VIRTUAL_NETWORK("forvirtualnetwork", BaseCmd.TYPE_BOOLEAN, "forVirtualNetwork"),
|
|
||||||
FORMAT("format", BaseCmd.TYPE_STRING, "format"),
|
|
||||||
GATEWAY("gateway", BaseCmd.TYPE_STRING, "gateway"),
|
|
||||||
GROUP("group", BaseCmd.TYPE_STRING, "group"),
|
|
||||||
GROUP_ID("group", BaseCmd.TYPE_LONG, "groupId"),
|
|
||||||
GROUP_IDS("groupids", BaseCmd.TYPE_STRING, "groupIds"),
|
|
||||||
HA_ENABLE("haenable", BaseCmd.TYPE_BOOLEAN, "haEnable"),
|
|
||||||
HAS_CHILD("haschild", BaseCmd.TYPE_BOOLEAN, "haschild"),
|
|
||||||
HOST_ID("hostid", BaseCmd.TYPE_LONG, "hostId"),
|
|
||||||
HOST_IDS("hostids", BaseCmd.TYPE_STRING, "hostIds"),
|
|
||||||
HOST_NAME("hostname", BaseCmd.TYPE_STRING, "hostname"),
|
|
||||||
HOURLY_MAX("hourlymax", BaseCmd.TYPE_INT, "hourlyMax"),
|
|
||||||
HYPERVISOR("hypervisor", BaseCmd.TYPE_STRING, "hypervisor"),
|
|
||||||
HYPERVISOR_TYPE("hypervisortype", BaseCmd.TYPE_STRING, "hypervisorType"),
|
|
||||||
ICMP_TYPE("icmptype", BaseCmd.TYPE_INT, "icmpType"),
|
|
||||||
ICMP_CODE("icmpcode", BaseCmd.TYPE_INT, "icmpCode"),
|
|
||||||
ID("id", BaseCmd.TYPE_LONG, "id"),
|
|
||||||
DEVICE_ID("deviceid", BaseCmd.TYPE_LONG, "deviceid"),
|
|
||||||
IDS("ids", BaseCmd.TYPE_STRING, "Ids"),
|
|
||||||
INTERNAL_DNS1("internaldns1", BaseCmd.TYPE_STRING, "internaldns1"),
|
|
||||||
INTERNAL_DNS2("internaldns2", BaseCmd.TYPE_STRING, "internaldns2"),
|
|
||||||
INTERVAL("interval", BaseCmd.TYPE_INT, "interval"),
|
|
||||||
INTERVAL_TYPE("intervaltype", BaseCmd.TYPE_STRING, "intervalType"),
|
|
||||||
INSTANCE("instance", BaseCmd.TYPE_STRING, "instance"),
|
|
||||||
IP_ADDRESS("ipaddress", BaseCmd.TYPE_STRING, "ipAddress"),
|
|
||||||
IP_AVAIL("ipavailable", BaseCmd.TYPE_INT, "ipavailable"),
|
|
||||||
IP_LIMIT("iplimit", BaseCmd.TYPE_INT, "iplimit"),
|
|
||||||
IP_TOTAL("iptotal", BaseCmd.TYPE_INT, "iptotal"),
|
|
||||||
IS_RECURSIVE("isrecursive", BaseCmd.TYPE_BOOLEAN, "isrecursive"),
|
|
||||||
IS_FEATURED("isfeatured", BaseCmd.TYPE_BOOLEAN, "isfeatured"),
|
|
||||||
IS_MINE("ismine", BaseCmd.TYPE_BOOLEAN, "isMine"),
|
|
||||||
IS_PUBLIC("ispublic", BaseCmd.TYPE_BOOLEAN, "isPublic"),
|
|
||||||
IS_CLEANUP_REQUIRED("iscleanuprequired", BaseCmd.TYPE_BOOLEAN, "iscleanuprequired"),
|
|
||||||
IS_ENABLED("isenabled", BaseCmd.TYPE_BOOLEAN, "isEnabled"),
|
|
||||||
IS_MIRRORED("ismirrored", BaseCmd.TYPE_BOOLEAN, "isMirrored"),
|
|
||||||
IS_LOCAL_STORAGE_ACTIVE("islocalstorageactive", BaseCmd.TYPE_BOOLEAN, "isLocalStorageActive"),
|
|
||||||
ISO_FILTER("isofilter", BaseCmd.TYPE_STRING, "isoFilter"),
|
|
||||||
ISO_ID("isoid", BaseCmd.TYPE_LONG, "isoId"),
|
|
||||||
ISO_NAME("isoname", BaseCmd.TYPE_STRING, "isoName"),
|
|
||||||
ISO_PATH("isopath", BaseCmd.TYPE_STRING, "isoPath"),
|
|
||||||
ISO_STATUS("isostatus", BaseCmd.TYPE_STRING, "isoStatus"),
|
|
||||||
IS_READY("isready", BaseCmd.TYPE_BOOLEAN, "isReady"),
|
|
||||||
IS_SOURCE_NAT("issourcenat", BaseCmd.TYPE_BOOLEAN, "isSourceNat"),
|
|
||||||
JOB_CMD("jobcmd", BaseCmd.TYPE_LONG, "jobcmd"),
|
|
||||||
JOB_ID("jobid", BaseCmd.TYPE_LONG, "jobid"),
|
|
||||||
JOB_INSTANCE_ID("jobinstanceid", BaseCmd.TYPE_LONG, "jobinstanceid"),
|
|
||||||
JOB_INSTANCE_TYPE("jobinstancetype", BaseCmd.TYPE_STRING, "jobinstancetype"),
|
|
||||||
JOB_PROCESS_STATUS("jobprocstatus", BaseCmd.TYPE_INT, "jobprocstatus"),
|
|
||||||
JOB_RESULT("jobresult", BaseCmd.TYPE_STRING, "jobresult"),
|
|
||||||
JOB_RESULT_CODE("jobresultcode", BaseCmd.TYPE_INT, "jobresultcode"),
|
|
||||||
JOB_RESULT_TYPE("jobresulttype", BaseCmd.TYPE_STRING, "jobresulttype"),
|
|
||||||
JOB_STATUS("jobstatus", BaseCmd.TYPE_INT, "jobstatus"),
|
|
||||||
KEYWORD("keyword", BaseCmd.TYPE_STRING, "keyword"),
|
|
||||||
LASTNAME("lastname", BaseCmd.TYPE_STRING, "lastname"),
|
|
||||||
LASTPINGED("lastpinged", BaseCmd.TYPE_DATE, "lastpinged"),
|
|
||||||
LEVEL("level", BaseCmd.TYPE_STRING, "level"),
|
|
||||||
LUN("lun", BaseCmd.TYPE_INT, "lun"),
|
|
||||||
MAC_ADDRESS("macaddress", BaseCmd.TYPE_STRING, "macaddress"),
|
|
||||||
MAX("max", BaseCmd.TYPE_LONG, "max"),
|
|
||||||
MAX_SNAPS("maxsnaps", BaseCmd.TYPE_INT, "maxSnaps"),
|
|
||||||
M_SERVER_ID("managementserverid", BaseCmd.TYPE_LONG, "managementserverid"),
|
|
||||||
MEMORY("memory", BaseCmd.TYPE_LONG, "memory"),
|
|
||||||
MEMORY_TOTAL("memorytotal", BaseCmd.TYPE_LONG, "memorytotal"),
|
|
||||||
MEMORY_USED("memoryused", BaseCmd.TYPE_LONG, "memoryused"),
|
|
||||||
MEMORY_ALLOCATED("memoryallocated", BaseCmd.TYPE_LONG, "memoryallocated"),
|
|
||||||
MONTHLY_MAX("monthlymax", BaseCmd.TYPE_INT, "monthlyMax"),
|
|
||||||
MULTICAST_RATE("multicastrate", BaseCmd.TYPE_INT, "multicastrate"),
|
|
||||||
NAME("name", BaseCmd.TYPE_STRING, "name"),
|
|
||||||
NEW_NAME("newname", BaseCmd.TYPE_STRING, "newname"),
|
|
||||||
NETMASK("netmask", BaseCmd.TYPE_STRING, "netmask"),
|
|
||||||
NETWORK_DOMAIN("networkdomain", BaseCmd.TYPE_STRING, "networkdomain"),
|
|
||||||
NETWORK_GROUP_LIST("networkgrouplist", BaseCmd.TYPE_STRING, "networkGroupList"),
|
|
||||||
NETWORK_GROUP_NAME("networkgroupname", BaseCmd.TYPE_STRING, "networkGroupName"),
|
|
||||||
NETWORK_KB_READ("networkkbsread", BaseCmd.TYPE_LONG, "networkkbsread"),
|
|
||||||
NETWORK_KB_WRITE("networkkbswrite", BaseCmd.TYPE_LONG, "networkkbswrite"),
|
|
||||||
NETWORK_RATE("networkrate", BaseCmd.TYPE_INT, "networkrate"),
|
|
||||||
NETWORK_TYPE("networktype", BaseCmd.TYPE_STRING, "networkType"),
|
|
||||||
OFFERING_ID("offeringid", BaseCmd.TYPE_LONG, "offeringId"),
|
|
||||||
OFFER_HA("offerha", BaseCmd.TYPE_BOOLEAN, "offerHa"),
|
|
||||||
OLD_POD_NAME("oldpodname", BaseCmd.TYPE_STRING, "oldPodName"),
|
|
||||||
OLD_ZONE_NAME("oldzonename", BaseCmd.TYPE_STRING, "oldZoneName"),
|
|
||||||
OS_ARCHITECTURE("osarchitecture", BaseCmd.TYPE_INT, "osArchitecture"),
|
|
||||||
OS_CATEGORY_ID("oscategoryid", BaseCmd.TYPE_LONG, "osCategoryId"),
|
|
||||||
OS_CATEGORY_NAME("oscategoryname", BaseCmd.TYPE_STRING, "osCategoryName"),
|
|
||||||
OS_TYPE_ID("ostypeid", BaseCmd.TYPE_LONG, "osTypeId"),
|
|
||||||
OS_TYPE_NAME("ostypename", BaseCmd.TYPE_STRING, "osTypeName"),
|
|
||||||
OP("op", BaseCmd.TYPE_STRING, "op"),
|
|
||||||
PAGE("page", BaseCmd.TYPE_INT, "page"),
|
|
||||||
PAGESIZE("pagesize", BaseCmd.TYPE_INT, "pagesize"),
|
|
||||||
PARENT_ID("parentid", BaseCmd.TYPE_LONG, "parentId"),
|
|
||||||
PARENT_DOMAIN_ID("parentdomainid", BaseCmd.TYPE_LONG, "parentDomainId"),
|
|
||||||
PARENT_DOMAIN_NAME("parentdomainname", BaseCmd.TYPE_STRING, "parentDomainName"),
|
|
||||||
PASSWORD("password", BaseCmd.TYPE_STRING, "password"),
|
|
||||||
PASSWORD_ENABLED("passwordenabled", BaseCmd.TYPE_BOOLEAN, "passwordenabled"),
|
|
||||||
PATH("path", BaseCmd.TYPE_STRING, "path"),
|
|
||||||
PERCENT_USED("percentused", BaseCmd.TYPE_STRING, "percentused"),
|
|
||||||
POD_ID("podid", BaseCmd.TYPE_LONG, "podId"),
|
|
||||||
POD_NAME("podname", BaseCmd.TYPE_STRING, "podName"),
|
|
||||||
PORT_FORWARDING_SERVICE_ID("portforwardingserviceid", BaseCmd.TYPE_LONG, "portForwardingServiceId"),
|
|
||||||
PORTAL("portal", BaseCmd.TYPE_STRING, "portal"),
|
|
||||||
PRIVATE_IP("privateip", BaseCmd.TYPE_STRING, "privateIp"),
|
|
||||||
PRIVATE_MAC_ADDRESS("privatemacaddress", BaseCmd.TYPE_STRING, "privatemacaddress"),
|
|
||||||
PRIVATE_NETMASK("privatenetmask", BaseCmd.TYPE_STRING, "privatenetmask"),
|
|
||||||
PRIVATE_PORT("privateport", BaseCmd.TYPE_STRING, "privatePort"),
|
|
||||||
PROTOCOL("protocol", BaseCmd.TYPE_STRING, "protocol"),
|
|
||||||
PUBLIC_IP("publicip", BaseCmd.TYPE_STRING, "publicIp"),
|
|
||||||
PUBLIC_MAC_ADDRESS("publicmacaddress", BaseCmd.TYPE_STRING, "publicMacAddress"),
|
|
||||||
PUBLIC_NETMASK("publicnetmask", BaseCmd.TYPE_STRING, "publicNetmask"),
|
|
||||||
PUBLIC_PORT("publicport", BaseCmd.TYPE_STRING, "publicPort"),
|
|
||||||
RAW_USAGE("rawusage", BaseCmd.TYPE_FLOAT, "rawUsage"),
|
|
||||||
RELEASE_DATE("releaseddate", BaseCmd.TYPE_DATE, "releaseddate"),
|
|
||||||
REMOVED("removed", BaseCmd.TYPE_DATE, "removed"),
|
|
||||||
REQUIRES_HVM("requireshvm", BaseCmd.TYPE_BOOLEAN, "requireshvm"),
|
|
||||||
RESOURCE_TYPE("resourcetype", BaseCmd.TYPE_INT, "resourcetype"),
|
|
||||||
RESPONSE_TYPE("response",BaseCmd.TYPE_STRING,"response"),
|
|
||||||
ROOT_DISK_OFFERING_ID("rootdiskofferingid", BaseCmd.TYPE_LONG, "rootDiskOfferingId"),
|
|
||||||
RULE_ID("ruleid", BaseCmd.TYPE_LONG, "ruleId"),
|
|
||||||
RUNNING_VMS("runningvms", BaseCmd.TYPE_LONG, "runningvms"),
|
|
||||||
SCHEDULE("schedule", BaseCmd.TYPE_STRING, "schedule"),
|
|
||||||
SCHEDULED("scheduled", BaseCmd.TYPE_DATE, "scheduled"),
|
|
||||||
SCOPE("scope", BaseCmd.TYPE_STRING, "scope"),
|
|
||||||
SECRET_KEY("secretkey", BaseCmd.TYPE_STRING, "secretKey"),
|
|
||||||
SENT("sent", BaseCmd.TYPE_DATE, "sent"),
|
|
||||||
SERVICE_OFFERING_ID("serviceofferingid", BaseCmd.TYPE_LONG, "serviceOfferingId"),
|
|
||||||
SERVICE_OFFERING_NAME("serviceofferingname", BaseCmd.TYPE_STRING, "serviceOfferingName"),
|
|
||||||
SESSION_KEY("sessionkey", BaseCmd.TYPE_STRING, "sessionKey"),
|
|
||||||
SHOW_ALL("showall", BaseCmd.TYPE_BOOLEAN, "showall"),
|
|
||||||
SIGNATURE("signature",BaseCmd.TYPE_STRING,"signature"),
|
|
||||||
SIZE("size", BaseCmd.TYPE_LONG, "size"),
|
|
||||||
SNAPSHOT_AVAIL("snapshotavailable", BaseCmd.TYPE_INT, "snapshotavailable"),
|
|
||||||
SNAPSHOT_ID("snapshotid", BaseCmd.TYPE_LONG, "snapshotid"),
|
|
||||||
SNAPSHOT_LIMIT("snapshotlimit", BaseCmd.TYPE_INT, "snapshotlimit"),
|
|
||||||
SNAPSHOT_POLICY_ID("snapshotpolicyid", BaseCmd.TYPE_LONG, "snapshotPolicyId"),
|
|
||||||
SNAPSHOT_TOTAL("snapshottotal", BaseCmd.TYPE_INT, "snapshottotal"),
|
|
||||||
SNAPSHOT_TYPE("snapshottype", BaseCmd.TYPE_STRING, "snapshotType"),
|
|
||||||
SOURCE_ZONE_ID("sourcezoneid", BaseCmd.TYPE_LONG, "sourceZoneId"),
|
|
||||||
SSO_KEY("ssokey", BaseCmd.TYPE_STRING, "ssoKey"),
|
|
||||||
START_DATE("startdate", BaseCmd.TYPE_DATE, "startDate"),
|
|
||||||
START_IP("startip", BaseCmd.TYPE_STRING, "startIp"),
|
|
||||||
START_PORT("startport", BaseCmd.TYPE_INT, "startPort"),
|
|
||||||
START_TZDATE("startdate", BaseCmd.TYPE_TZDATE, "startDate"),
|
|
||||||
START_VLAN("startvlan", BaseCmd.TYPE_LONG, "startvlan"),
|
|
||||||
STATE("state", BaseCmd.TYPE_STRING, "state"),
|
|
||||||
STOPPED_VMS("stoppedvms", BaseCmd.TYPE_LONG, "stoppedvms"),
|
|
||||||
STORAGE("storage", BaseCmd.TYPE_LONG, "storage"),
|
|
||||||
STORAGE_TYPE("storagetype", BaseCmd.TYPE_STRING, "storageType"),
|
|
||||||
SUCCESS("success", BaseCmd.TYPE_BOOLEAN, "success"),
|
|
||||||
SUM_ACROSS_ZONE("sumacrosszone", BaseCmd.TYPE_BOOLEAN, "sumAcrossZone"),
|
|
||||||
SYSTEM_VM_TYPE("systemvmtype", BaseCmd.TYPE_STRING, "systemvmtype"),
|
|
||||||
TAGS("tags", BaseCmd.TYPE_STRING, "tags"),
|
|
||||||
TAKEN("taken", BaseCmd.TYPE_DATE, "taken"),
|
|
||||||
TARGET_IQN("targetiqn", BaseCmd.TYPE_STRING, "targetiqn"),
|
|
||||||
TEMPLATE_AVAIL("templateavailable", BaseCmd.TYPE_INT, "templateavailable"),
|
|
||||||
TEMPLATE_FILTER("templatefilter", BaseCmd.TYPE_STRING, "templateFilter"),
|
|
||||||
TEMPLATE_ID("templateid", BaseCmd.TYPE_LONG, "templateId"),
|
|
||||||
TEMPLATE_LIMIT("templatelimit", BaseCmd.TYPE_INT, "templatelimit"),
|
|
||||||
TEMPLATE_NAME("templatename", BaseCmd.TYPE_STRING, "templateName"),
|
|
||||||
TEMPLATE_DISPLAY_TEXT("templatedisplaytext", BaseCmd.TYPE_STRING, "templateDisplayText"),
|
|
||||||
TEMPLATE_STATUS("templatestatus", BaseCmd.TYPE_STRING, "templateStatus"),
|
|
||||||
TEMPLATE_TOTAL("templatetotal", BaseCmd.TYPE_INT, "templatetotal"),
|
|
||||||
TIMEZONE("timezone", BaseCmd.TYPE_STRING, "timezone"),
|
|
||||||
TIMEZONE_OFFSET("timezoneoffset", BaseCmd.TYPE_FLOAT, "timezoneOffset"),
|
|
||||||
TOTAL_MEMORY("totalmemory", BaseCmd.TYPE_LONG, "totalmemory"),
|
|
||||||
TOTAL_VMS("totalvms", BaseCmd.TYPE_LONG, "totalvms"),
|
|
||||||
TYPE("type", BaseCmd.TYPE_STRING, "type"),
|
|
||||||
URL("url", BaseCmd.TYPE_STRING, "url"),
|
|
||||||
USAGE("usage", BaseCmd.TYPE_STRING, "usage"),
|
|
||||||
USAGE_ID("usageid", BaseCmd.TYPE_LONG, "usageId"),
|
|
||||||
USER_ID("userid", BaseCmd.TYPE_LONG, "userId"),
|
|
||||||
USERNAME("username", BaseCmd.TYPE_STRING, "username"),
|
|
||||||
USER_DATA("userdata", BaseCmd.TYPE_STRING, "userData"),
|
|
||||||
USER_NETWORK_GROUP_LIST("usernetworkgrouplist", BaseCmd.TYPE_OBJECT_MAP, "userNetworkGroupList"),
|
|
||||||
USE_VIRTUAL_NETWORK("usevirtualnetwork", BaseCmd.TYPE_BOOLEAN, "useVirtualNetwork"),
|
|
||||||
VALUE("value", BaseCmd.TYPE_STRING, "value"),
|
|
||||||
VERSION("version", BaseCmd.TYPE_STRING, "version"),
|
|
||||||
VIRTUAL_MACHINE_DISPLAYNAME("vmdisplayname", BaseCmd.TYPE_STRING, "vmdisplayname"),
|
|
||||||
VIRTUAL_MACHINE_ID("virtualmachineid", BaseCmd.TYPE_LONG, "virtualMachineId"),
|
|
||||||
VIRTUAL_MACHINE_IDS("virtualmachineids", BaseCmd.TYPE_STRING, "virtualMachineIds"),
|
|
||||||
VIRTUAL_MACHINE_NAME("vmname", BaseCmd.TYPE_STRING, "vmname"),
|
|
||||||
//VIRTUAL_MACHINE_PASSWORD("virtualmachinepassword", BaseCmd.TYPE_STRING, "virtualMachinePassword"),
|
|
||||||
VIRTUAL_MACHINE_STATE("vmstate", BaseCmd.TYPE_STRING, "vmState"),
|
|
||||||
VLAN_ID("vlanname", BaseCmd.TYPE_STRING, "vlanName"),
|
|
||||||
VLAN_DB_ID("vlanid", BaseCmd.TYPE_LONG, "vlanId"),
|
|
||||||
VLAN("vlan", BaseCmd.TYPE_STRING, "vlan"),
|
|
||||||
VM_AVAIL("vmavailable", BaseCmd.TYPE_LONG, "vmavailable"),
|
|
||||||
VM_LIMIT("vmlimit", BaseCmd.TYPE_LONG, "vmlimit"),
|
|
||||||
VM_RUNNING("vmrunning", BaseCmd.TYPE_LONG, "vmrunning"),
|
|
||||||
VM_STOPPED("vmstopped", BaseCmd.TYPE_LONG, "vmstopped"),
|
|
||||||
VM_TOTAL("vmtotal", BaseCmd.TYPE_LONG, "vmtotal"),
|
|
||||||
VNET("vlan", BaseCmd.TYPE_STRING, "vlan"),
|
|
||||||
VOLUME_AVAIL("volumeavailable", BaseCmd.TYPE_INT, "volumeavailable"),
|
|
||||||
VOLUME_ID("volumeid", BaseCmd.TYPE_LONG, "volumeId"), // FIXME: this is an array of longs
|
|
||||||
VOLUME_LIMIT("volumelimit", BaseCmd.TYPE_INT, "volumelimit"),
|
|
||||||
VOLUME_NAME("volumename", BaseCmd.TYPE_STRING, "volumeName"),
|
|
||||||
VOLUME_TOTAL("volumetotal", BaseCmd.TYPE_INT, "volumetotal"),
|
|
||||||
VOLUME_TYPE("volumetype", BaseCmd.TYPE_STRING, "volumeType"),
|
|
||||||
WEEKLY_MAX("weeklymax", BaseCmd.TYPE_INT, "weeklyMax"),
|
|
||||||
ZONE_ID("zoneid", BaseCmd.TYPE_LONG, "zoneId"),
|
|
||||||
ZONE_NAME("zonename", BaseCmd.TYPE_STRING, "zoneName");
|
|
||||||
|
|
||||||
private final String _name;
|
|
||||||
private final short _dataType;
|
|
||||||
private final String _tagName;
|
|
||||||
|
|
||||||
Properties(String name, short dataType, String tagName) {
|
|
||||||
_name = name;
|
|
||||||
_dataType = dataType;
|
|
||||||
_tagName = tagName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public short getDataType() { return _dataType; }
|
|
||||||
public String getName() { return _name; }
|
|
||||||
public String getTagName() { return _tagName; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract List<Pair<String, Object>> execute(Map<String, Object> params);
|
|
||||||
public abstract String getName();
|
public abstract String getName();
|
||||||
public abstract List<Pair<Enum, Boolean>> getProperties();
|
public abstract String getResponse();
|
||||||
|
|
||||||
public Map<String, String> getParams() {
|
|
||||||
return _params;
|
|
||||||
}
|
|
||||||
public void setParams(Map<String, String> params) {
|
|
||||||
_params = params;
|
|
||||||
}
|
|
||||||
public ManagementServer getManagementServer() {
|
|
||||||
return _ms;
|
|
||||||
}
|
|
||||||
public void setManagementServer(ManagementServer ms) {
|
|
||||||
_ms = ms;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDateString(Date date) {
|
public String getDateString(Date date) {
|
||||||
if (date == null) {
|
if (date == null) {
|
||||||
@ -435,12 +111,14 @@ public abstract class BaseCmd {
|
|||||||
return formattedString;
|
return formattedString;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Object> validateParams(Map<String, Object> params, boolean decode) {
|
public Map<String, Object> validateParams(Map<String, String> params, boolean decode) {
|
||||||
List<Pair<Enum, Boolean>> properties = getProperties();
|
// List<Pair<Enum, Boolean>> properties = getProperties();
|
||||||
|
|
||||||
// step 1 - all parameter names passed in will be converted to lowercase
|
// step 1 - all parameter names passed in will be converted to lowercase
|
||||||
Map<String, Object> processedParams = lowercaseParams(params, decode);
|
Map<String, Object> processedParams = lowercaseParams(params, decode);
|
||||||
|
return processedParams;
|
||||||
|
|
||||||
|
/*
|
||||||
// step 2 - make sure all required params exist, and all existing params adhere to the appropriate data type
|
// step 2 - make sure all required params exist, and all existing params adhere to the appropriate data type
|
||||||
Map<String, Object> validatedParams = new HashMap<String, Object>();
|
Map<String, Object> validatedParams = new HashMap<String, Object>();
|
||||||
for (Pair<Enum, Boolean> propertyPair : properties) {
|
for (Pair<Enum, Boolean> propertyPair : properties) {
|
||||||
@ -524,91 +202,89 @@ public abstract class BaseCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return validatedParams;
|
return validatedParams;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
private Map<String, Object> lowercaseParams(Map<String, String> params, boolean decode) {
|
||||||
private Map<String, Object> lowercaseParams(Map<String, Object> params, boolean decode) {
|
|
||||||
Map<String, Object> lowercaseParams = new HashMap<String, Object>();
|
Map<String, Object> lowercaseParams = new HashMap<String, Object>();
|
||||||
for (String key : params.keySet()) {
|
for (String key : params.keySet()) {
|
||||||
int arrayStartIndex = key.indexOf('[');
|
lowercaseParams.put(key.toLowerCase(), params.get(key));
|
||||||
int arrayStartLastIndex = key.lastIndexOf('[');
|
}
|
||||||
if (arrayStartIndex != arrayStartLastIndex) {
|
return lowercaseParams;
|
||||||
throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (arrayStartIndex > 0) {
|
// FIXME: move this to a utils method so that maps can be unpacked and integer/long values can be appropriately cast
|
||||||
int arrayEndIndex = key.indexOf(']');
|
@SuppressWarnings("unchecked")
|
||||||
int arrayEndLastIndex = key.lastIndexOf(']');
|
public Map<String, Object> unpackParams(Map<String, String> params) {
|
||||||
if ((arrayEndIndex < arrayStartIndex) || (arrayEndIndex != arrayEndLastIndex)) {
|
Map<String, Object> lowercaseParams = new HashMap<String, Object>();
|
||||||
// malformed parameter
|
for (String key : params.keySet()) {
|
||||||
throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
int arrayStartIndex = key.indexOf('[');
|
||||||
}
|
int arrayStartLastIndex = key.lastIndexOf('[');
|
||||||
|
if (arrayStartIndex != arrayStartLastIndex) {
|
||||||
|
throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
||||||
|
}
|
||||||
|
|
||||||
// Now that we have an array object, check for a field name in the case of a complex object
|
if (arrayStartIndex > 0) {
|
||||||
int fieldIndex = key.indexOf('.');
|
int arrayEndIndex = key.indexOf(']');
|
||||||
String fieldName = null;
|
int arrayEndLastIndex = key.lastIndexOf(']');
|
||||||
if (fieldIndex < arrayEndIndex) {
|
if ((arrayEndIndex < arrayStartIndex) || (arrayEndIndex != arrayEndLastIndex)) {
|
||||||
throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
// malformed parameter
|
||||||
} else {
|
throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
||||||
fieldName = key.substring(fieldIndex + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// parse the parameter name as the text before the first '[' character
|
|
||||||
String paramName = key.substring(0, arrayStartIndex);
|
|
||||||
paramName = paramName.toLowerCase();
|
|
||||||
|
|
||||||
Map<Integer, Map> mapArray = null;
|
|
||||||
Map<String, Object> mapValue = null;
|
|
||||||
String indexStr = key.substring(arrayStartIndex+1, arrayEndIndex);
|
|
||||||
int index = 0;
|
|
||||||
boolean parsedIndex = false;
|
|
||||||
try {
|
|
||||||
if (indexStr != null) {
|
|
||||||
index = Integer.parseInt(indexStr);
|
|
||||||
parsedIndex = true;
|
|
||||||
}
|
|
||||||
} catch (NumberFormatException nfe) {
|
|
||||||
s_logger.warn("Invalid parameter " + key + " received, unable to parse object array, returning an error.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!parsedIndex) {
|
|
||||||
throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
|
||||||
}
|
|
||||||
|
|
||||||
Object value = lowercaseParams.get(paramName);
|
|
||||||
if (value == null) {
|
|
||||||
// for now, assume object array with sub fields
|
|
||||||
mapArray = new HashMap<Integer, Map>();
|
|
||||||
mapValue = new HashMap<String, Object>();
|
|
||||||
mapArray.put(Integer.valueOf(index), mapValue);
|
|
||||||
} else if (value instanceof Map) {
|
|
||||||
mapArray = (HashMap)value;
|
|
||||||
mapValue = mapArray.get(Integer.valueOf(index));
|
|
||||||
if (mapValue == null) {
|
|
||||||
mapValue = new HashMap<String, Object>();
|
|
||||||
mapArray.put(Integer.valueOf(index), mapValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// we are ready to store the value for a particular field into the map for this object, make sure the value is decoded if required
|
|
||||||
String valueStr = (String)params.get(key);
|
|
||||||
String decodedValue = null;
|
|
||||||
if (decode) {
|
|
||||||
try {
|
|
||||||
decodedValue = URLDecoder.decode(valueStr, "UTF-8");
|
|
||||||
} catch (UnsupportedEncodingException usex) {
|
|
||||||
s_logger.warn(key + " could not be decoded, value = " + valueStr);
|
|
||||||
throw new ServerApiException(PARAM_ERROR, key + " could not be decoded, received value " + valueStr);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
decodedValue = valueStr;
|
|
||||||
}
|
}
|
||||||
mapValue.put(fieldName, decodedValue);
|
|
||||||
|
|
||||||
lowercaseParams.put(paramName, mapArray);
|
// Now that we have an array object, check for a field name in the case of a complex object
|
||||||
} else {
|
int fieldIndex = key.indexOf('.');
|
||||||
|
String fieldName = null;
|
||||||
|
if (fieldIndex < arrayEndIndex) {
|
||||||
|
throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
||||||
|
} else {
|
||||||
|
fieldName = key.substring(fieldIndex + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// parse the parameter name as the text before the first '[' character
|
||||||
|
String paramName = key.substring(0, arrayStartIndex);
|
||||||
|
paramName = paramName.toLowerCase();
|
||||||
|
|
||||||
|
Map<Integer, Map> mapArray = null;
|
||||||
|
Map<String, Object> mapValue = null;
|
||||||
|
String indexStr = key.substring(arrayStartIndex+1, arrayEndIndex);
|
||||||
|
int index = 0;
|
||||||
|
boolean parsedIndex = false;
|
||||||
|
try {
|
||||||
|
if (indexStr != null) {
|
||||||
|
index = Integer.parseInt(indexStr);
|
||||||
|
parsedIndex = true;
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException nfe) {
|
||||||
|
s_logger.warn("Invalid parameter " + key + " received, unable to parse object array, returning an error.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!parsedIndex) {
|
||||||
|
throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
||||||
|
}
|
||||||
|
|
||||||
|
Object value = lowercaseParams.get(paramName);
|
||||||
|
if (value == null) {
|
||||||
|
// for now, assume object array with sub fields
|
||||||
|
mapArray = new HashMap<Integer, Map>();
|
||||||
|
mapValue = new HashMap<String, Object>();
|
||||||
|
mapArray.put(Integer.valueOf(index), mapValue);
|
||||||
|
} else if (value instanceof Map) {
|
||||||
|
mapArray = (HashMap)value;
|
||||||
|
mapValue = mapArray.get(Integer.valueOf(index));
|
||||||
|
if (mapValue == null) {
|
||||||
|
mapValue = new HashMap<String, Object>();
|
||||||
|
mapArray.put(Integer.valueOf(index), mapValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// we are ready to store the value for a particular field into the map for this object
|
||||||
|
mapValue.put(fieldName, (String)params.get(key));
|
||||||
|
|
||||||
|
lowercaseParams.put(paramName, mapArray);
|
||||||
|
} else {
|
||||||
lowercaseParams.put(key.toLowerCase(), params.get(key));
|
lowercaseParams.put(key.toLowerCase(), params.get(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return lowercaseParams;
|
return lowercaseParams;
|
||||||
}
|
}
|
||||||
@ -832,10 +508,11 @@ public abstract class BaseCmd {
|
|||||||
(accountType == Account.ACCOUNT_TYPE_READ_ONLY_ADMIN));
|
(accountType == Account.ACCOUNT_TYPE_READ_ONLY_ADMIN));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Account getAccount(Map<String, Object> params) throws ServerApiException {
|
private Account getAccount(Map<String, Object> params) throws ServerApiException {
|
||||||
Long domainId = (Long) params.get(Properties.DOMAIN_ID.getName());
|
// FIXME: This should go into the context!
|
||||||
Account account = (Account)params.get(Properties.ACCOUNT_OBJ.getName());
|
Long domainId = (Long) params.get("domainid");
|
||||||
String accountName = (String) params.get(Properties.ACCOUNT.getName());
|
Account account = (Account)params.get("accountobj");
|
||||||
|
String accountName = (String) params.get("account");
|
||||||
|
|
||||||
Long accountId = null;
|
Long accountId = null;
|
||||||
Account finalAccount = null;
|
Account finalAccount = null;
|
||||||
|
|||||||
34
server/src/com/cloud/api/BaseListCmd.java
Normal file
34
server/src/com/cloud/api/BaseListCmd.java
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package com.cloud.api;
|
||||||
|
|
||||||
|
|
||||||
|
public abstract class BaseListCmd extends BaseCmd {
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////// BaseList API parameters /////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="keyword", type=CommandType.STRING)
|
||||||
|
private String keyword;
|
||||||
|
|
||||||
|
// FIXME: Need to be able to specify next/prev/first/last, so Integer might not be right
|
||||||
|
@Parameter(name="page", type=CommandType.INTEGER)
|
||||||
|
private Integer page;
|
||||||
|
|
||||||
|
@Parameter(name="pagesize", type=CommandType.INTEGER)
|
||||||
|
private Integer pageSize;
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getKeyword() {
|
||||||
|
return keyword;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getPage() {
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getPageSize() {
|
||||||
|
return pageSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
16
server/src/com/cloud/api/Implementation.java
Normal file
16
server/src/com/cloud/api/Implementation.java
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package com.cloud.api;
|
||||||
|
|
||||||
|
import static java.lang.annotation.ElementType.TYPE;
|
||||||
|
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
import com.cloud.api.BaseCmd.Manager;
|
||||||
|
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target({TYPE})
|
||||||
|
public @interface Implementation {
|
||||||
|
String method() default "";
|
||||||
|
Manager manager() default Manager.ManagementServer;
|
||||||
|
}
|
||||||
37
server/src/com/cloud/api/Parameter.java
Normal file
37
server/src/com/cloud/api/Parameter.java
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.cloud.api;
|
||||||
|
|
||||||
|
import static java.lang.annotation.ElementType.FIELD;
|
||||||
|
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
import com.cloud.api.BaseCmd.CommandType;
|
||||||
|
|
||||||
|
@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;
|
||||||
|
}
|
||||||
|
|
||||||
@ -18,41 +18,81 @@
|
|||||||
|
|
||||||
package com.cloud.api.commands;
|
package com.cloud.api.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.Implementation;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.utils.Pair;
|
import com.cloud.api.BaseCmd.Manager;
|
||||||
|
|
||||||
|
@Implementation(method="addConfig", manager=Manager.ManagementServer)
|
||||||
public class AddConfigCmd extends BaseCmd {
|
public class AddConfigCmd extends BaseCmd {
|
||||||
public static final Logger s_logger = Logger.getLogger(AddConfigCmd.class.getName());
|
public static final Logger s_logger = Logger.getLogger(AddConfigCmd.class.getName());
|
||||||
|
|
||||||
private static final String s_name = "addconfigresponse";
|
private static final String s_name = "addconfigresponse";
|
||||||
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
|
||||||
|
|
||||||
static {
|
/////////////////////////////////////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.INSTANCE, Boolean.TRUE));
|
//////////////// API parameters /////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.COMPONENT, Boolean.TRUE));
|
/////////////////////////////////////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.CATEGORY, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NAME, Boolean.TRUE));
|
@Parameter(name="category", type=CommandType.STRING, required=true)
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.VALUE, Boolean.FALSE));
|
private String category;
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DESCRIPTION, Boolean.FALSE));
|
|
||||||
|
@Parameter(name="component", type=CommandType.STRING, required=true)
|
||||||
|
private String component;
|
||||||
|
|
||||||
|
@Parameter(name="description", type=CommandType.STRING)
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Parameter(name="instance", type=CommandType.STRING, required=true)
|
||||||
|
private String instance;
|
||||||
|
|
||||||
|
@Parameter(name="name", type=CommandType.STRING, required=true)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Parameter(name="value", type=CommandType.STRING)
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getCategory() {
|
||||||
|
return category;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getComponent() {
|
||||||
|
return component;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInstance() {
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getConfigPropName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/*
|
||||||
public List<Pair<Enum, Boolean>> getProperties() {
|
|
||||||
return s_properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
||||||
String instance = (String) params.get(BaseCmd.Properties.INSTANCE.getName());
|
String instance = (String) params.get(BaseCmd.Properties.INSTANCE.getName());
|
||||||
@ -81,4 +121,5 @@ public class AddConfigCmd extends BaseCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,48 +18,87 @@
|
|||||||
|
|
||||||
package com.cloud.api.commands;
|
package com.cloud.api.commands;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.BaseCmd.Manager;
|
||||||
import com.cloud.dc.ClusterVO;
|
import com.cloud.api.Implementation;
|
||||||
import com.cloud.dc.HostPodVO;
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.host.Host;
|
|
||||||
import com.cloud.host.HostStats;
|
|
||||||
import com.cloud.offering.ServiceOffering;
|
|
||||||
import com.cloud.storage.GuestOSCategoryVO;
|
|
||||||
import com.cloud.utils.Pair;
|
|
||||||
import com.cloud.vm.UserVmVO;
|
|
||||||
|
|
||||||
|
@Implementation(method="discoverHosts", manager=Manager.ManagementServer)
|
||||||
public class AddHostCmd extends BaseCmd {
|
public class AddHostCmd extends BaseCmd {
|
||||||
public static final Logger s_logger = Logger.getLogger(AddHostCmd.class.getName());
|
public static final Logger s_logger = Logger.getLogger(AddHostCmd.class.getName());
|
||||||
private static final String s_name = "addhostresponse";
|
private static final String s_name = "addhostresponse";
|
||||||
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
|
||||||
|
|
||||||
static {
|
/////////////////////////////////////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ZONE_ID, Boolean.TRUE));
|
//////////////// API parameters /////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.POD_ID, Boolean.FALSE));
|
/////////////////////////////////////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.CLUSTER_ID, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.CLUSTER_NAME, Boolean.FALSE));
|
@Parameter(name="clusterid", type=CommandType.LONG)
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.URL, Boolean.TRUE));
|
private Long clusterId;
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USERNAME, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PASSWORD, Boolean.TRUE));
|
@Parameter(name="clustername", type=CommandType.STRING)
|
||||||
|
private String clusterName;
|
||||||
|
|
||||||
|
@Parameter(name="password", type=CommandType.STRING, required=true)
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@Parameter(name="podid", type=CommandType.LONG)
|
||||||
|
private Long podId;
|
||||||
|
|
||||||
|
@Parameter(name="url", type=CommandType.STRING, required=true)
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
@Parameter(name="username", type=CommandType.STRING, required=true)
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
@Parameter(name="zoneid", type=CommandType.LONG, required=true)
|
||||||
|
private Long zoneId;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getClusterId() {
|
||||||
|
return clusterId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getClusterName() {
|
||||||
|
return clusterName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getPodId() {
|
||||||
|
return podId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getZoneId() {
|
||||||
|
return zoneId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public List<Pair<Enum, Boolean>> getProperties() {
|
|
||||||
return s_properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/*
|
||||||
@Override
|
@Override
|
||||||
public List<Pair<String, Object>> execute(Map<String, Object> params)
|
public List<Pair<String, Object>> execute(Map<String, Object> params)
|
||||||
{
|
{
|
||||||
@ -237,4 +276,5 @@ public class AddHostCmd extends BaseCmd {
|
|||||||
return serverTags;
|
return serverTags;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,44 +18,52 @@
|
|||||||
|
|
||||||
package com.cloud.api.commands;
|
package com.cloud.api.commands;
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
import java.net.URISyntaxException;
|
|
||||||
import java.text.DecimalFormat;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.BaseCmd.Manager;
|
||||||
import com.cloud.host.Host;
|
import com.cloud.api.Implementation;
|
||||||
import com.cloud.host.HostStats;
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.host.HostVO;
|
|
||||||
import com.cloud.offering.ServiceOffering;
|
|
||||||
import com.cloud.utils.NumbersUtil;
|
|
||||||
import com.cloud.utils.Pair;
|
|
||||||
import com.cloud.vm.UserVmVO;
|
|
||||||
|
|
||||||
|
@Implementation(method="discoverHosts", manager=Manager.ManagementServer)
|
||||||
public class AddSecondaryStorageCmd extends BaseCmd {
|
public class AddSecondaryStorageCmd extends BaseCmd {
|
||||||
public static final Logger s_logger = Logger.getLogger(AddSecondaryStorageCmd.class.getName());
|
public static final Logger s_logger = Logger.getLogger(AddSecondaryStorageCmd.class.getName());
|
||||||
private static final String s_name = "addsecondarystorageresponse";
|
private static final String s_name = "addsecondarystorageresponse";
|
||||||
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
|
||||||
|
|
||||||
static {
|
/////////////////////////////////////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ZONE_ID, Boolean.TRUE));
|
//////////////// API parameters /////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.URL, Boolean.TRUE));
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="url", type=CommandType.STRING, required=true)
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
@Parameter(name="zoneid", type=CommandType.LONG)
|
||||||
|
private Long zoneId;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getZoneId() {
|
||||||
|
return zoneId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public List<Pair<Enum, Boolean>> getProperties() {
|
|
||||||
return s_properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/*
|
||||||
@Override
|
@Override
|
||||||
public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
||||||
Long zoneId = (Long)params.get(BaseCmd.Properties.ZONE_ID.getName());
|
Long zoneId = (Long)params.get(BaseCmd.Properties.ZONE_ID.getName());
|
||||||
@ -172,4 +180,5 @@ public class AddSecondaryStorageCmd extends BaseCmd {
|
|||||||
return serverTags;
|
return serverTags;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,41 +18,68 @@
|
|||||||
|
|
||||||
package com.cloud.api.commands;
|
package com.cloud.api.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.StringTokenizer;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.BaseCmd.Manager;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.api.Implementation;
|
||||||
import com.cloud.utils.Pair;
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.utils.StringUtils;
|
|
||||||
|
|
||||||
|
@Implementation(method="assignSecurityGroup", manager=Manager.ManagementServer)
|
||||||
public class AssignPortForwardingServiceCmd extends BaseCmd {
|
public class AssignPortForwardingServiceCmd extends BaseCmd {
|
||||||
public static final Logger s_logger = Logger.getLogger(AssignPortForwardingServiceCmd.class.getName());
|
public static final Logger s_logger = Logger.getLogger(AssignPortForwardingServiceCmd.class.getName());
|
||||||
|
|
||||||
private static final String s_name = "assignportforwardingserviceresponse";
|
private static final String s_name = "assignportforwardingserviceresponse";
|
||||||
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
|
||||||
|
|
||||||
static {
|
/////////////////////////////////////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
//////////////// API parameters /////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
/////////////////////////////////////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.IDS, Boolean.FALSE));
|
@Parameter(name="id", type=CommandType.STRING)
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PUBLIC_IP, Boolean.TRUE));
|
private Long id;
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.VIRTUAL_MACHINE_ID, Boolean.TRUE));
|
|
||||||
|
@Parameter(name="ids", type=CommandType.LIST, collectionType=CommandType.LONG)
|
||||||
|
private List<Long> ids;
|
||||||
|
|
||||||
|
@Parameter(name="publicip", type=CommandType.STRING, required=true)
|
||||||
|
private String publicIp;
|
||||||
|
|
||||||
|
@Parameter(name="virtualmachineid", type=CommandType.LONG, required=true)
|
||||||
|
private Long virtualMachineId;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Long> getIds() {
|
||||||
|
return ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPublicIp() {
|
||||||
|
return publicIp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getVirtualMachineId() {
|
||||||
|
return virtualMachineId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Pair<Enum, Boolean>> getProperties() {
|
/*
|
||||||
return s_properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
||||||
@ -121,4 +148,5 @@ public class AssignPortForwardingServiceCmd extends BaseCmd {
|
|||||||
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.JOB_ID.getName(), Long.valueOf(jobId)));
|
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.JOB_ID.getName(), Long.valueOf(jobId)));
|
||||||
return returnValues;
|
return returnValues;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,43 +18,74 @@
|
|||||||
|
|
||||||
package com.cloud.api.commands;
|
package com.cloud.api.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.StringTokenizer;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.BaseCmd.Manager;
|
||||||
import com.cloud.network.LoadBalancerVO;
|
import com.cloud.api.Implementation;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.utils.Pair;
|
|
||||||
|
|
||||||
|
@Implementation(method="assignToLoadBalancer", manager=Manager.NetworkManager)
|
||||||
public class AssignToLoadBalancerRuleCmd extends BaseCmd {
|
public class AssignToLoadBalancerRuleCmd extends BaseCmd {
|
||||||
public static final Logger s_logger = Logger.getLogger(AssignToLoadBalancerRuleCmd.class.getName());
|
public static final Logger s_logger = Logger.getLogger(AssignToLoadBalancerRuleCmd.class.getName());
|
||||||
|
|
||||||
private static final String s_name = "assigntoloadbalancerruleresponse";
|
private static final String s_name = "assigntoloadbalancerruleresponse";
|
||||||
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
|
||||||
|
|
||||||
static {
|
/////////////////////////////////////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
//////////////// API parameters /////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
/////////////////////////////////////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE));
|
@Parameter(name="id", type=CommandType.LONG, required=true)
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.TRUE));
|
private Long id;
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.VIRTUAL_MACHINE_ID, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.VIRTUAL_MACHINE_IDS, Boolean.FALSE));
|
@Parameter(name="virtualmachineid", type=CommandType.LONG, required=false)
|
||||||
|
private Long virtualMachineId;
|
||||||
|
|
||||||
|
@Parameter(name="virtualmachineids", type=CommandType.LIST, collectionType=CommandType.LONG, required=false)
|
||||||
|
private List<Long> virtualMachineIds;
|
||||||
|
|
||||||
|
@Parameter(name="account", type=CommandType.STRING, required=false)
|
||||||
|
private String accountName;
|
||||||
|
|
||||||
|
@Parameter(name="domainid", type=CommandType.LONG, required=false)
|
||||||
|
private Long domainId;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getLoadBalancerId() {
|
||||||
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getVirtualMachineId() {
|
||||||
|
return virtualMachineId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Long> getVirtualMachineIds() {
|
||||||
|
return virtualMachineIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccountName() {
|
||||||
|
return accountName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDomainId() {
|
||||||
|
return domainId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Pair<Enum, Boolean>> getProperties() {
|
/*
|
||||||
return s_properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
||||||
Long userId = (Long)params.get(BaseCmd.Properties.USER_ID.getName());
|
Long userId = (Long)params.get(BaseCmd.Properties.USER_ID.getName());
|
||||||
@ -105,7 +136,11 @@ public class AssignToLoadBalancerRuleCmd extends BaseCmd {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long jobId = getManagementServer().assignToLoadBalancerAsync(userId.longValue(), loadBalancerId.longValue(), instanceIdList);
|
Map<String, String> paramMap = new HashMap<String, String>();
|
||||||
|
for (String key : params.keySet()) {
|
||||||
|
paramMap.put(key, (String)params.get(key));
|
||||||
|
}
|
||||||
|
long jobId = getManagementServer().assignToLoadBalancerAsync(paramMap);
|
||||||
|
|
||||||
if (jobId == 0) {
|
if (jobId == 0) {
|
||||||
s_logger.warn("Unable to schedule async-job for AssignToLoadBalancerRule comamnd");
|
s_logger.warn("Unable to schedule async-job for AssignToLoadBalancerRule comamnd");
|
||||||
@ -118,4 +153,11 @@ public class AssignToLoadBalancerRuleCmd extends BaseCmd {
|
|||||||
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.JOB_ID.getName(), Long.valueOf(jobId)));
|
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.JOB_ID.getName(), Long.valueOf(jobId)));
|
||||||
return returnValues;
|
return returnValues;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getResponse() {
|
||||||
|
// there's no specific response for this command
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,39 +18,54 @@
|
|||||||
|
|
||||||
package com.cloud.api.commands;
|
package com.cloud.api.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.BaseCmd.Manager;
|
||||||
import com.cloud.dc.VlanVO;
|
import com.cloud.api.Implementation;
|
||||||
import com.cloud.dc.Vlan.VlanType;
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
|
||||||
import com.cloud.exception.InternalErrorException;
|
|
||||||
import com.cloud.exception.InvalidParameterValueException;
|
|
||||||
import com.cloud.exception.ResourceAllocationException;
|
|
||||||
import com.cloud.network.IPAddressVO;
|
|
||||||
import com.cloud.user.Account;
|
|
||||||
import com.cloud.utils.Pair;
|
|
||||||
|
|
||||||
|
@Implementation(method="associateIpAddress", manager=Manager.ManagementServer)
|
||||||
public class AssociateIPAddrCmd extends BaseCmd {
|
public class AssociateIPAddrCmd extends BaseCmd {
|
||||||
public static final Logger s_logger = Logger.getLogger(AssociateIPAddrCmd.class.getName());
|
public static final Logger s_logger = Logger.getLogger(AssociateIPAddrCmd.class.getName());
|
||||||
|
|
||||||
private static final String s_name = "associateipaddressresponse";
|
private static final String s_name = "associateipaddressresponse";
|
||||||
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
|
||||||
|
|
||||||
static {
|
/////////////////////////////////////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT, Boolean.FALSE));
|
//////////////// API parameters /////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE));
|
/////////////////////////////////////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
@Parameter(name="account", type=CommandType.STRING)
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ZONE_ID, Boolean.TRUE));
|
private String accountName;
|
||||||
|
|
||||||
|
@Parameter(name="domainid", type=CommandType.LONG)
|
||||||
|
private Long domainId;
|
||||||
|
|
||||||
|
@Parameter(name="zoneid", type=CommandType.LONG, required=true)
|
||||||
|
private Long zoneId;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getAccountName() {
|
||||||
|
return accountName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getDomainId() {
|
||||||
|
return domainId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getZoneId() {
|
||||||
|
return zoneId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
@ -59,10 +74,7 @@ public class AssociateIPAddrCmd extends BaseCmd {
|
|||||||
return "addressinfo";
|
return "addressinfo";
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Pair<Enum, Boolean>> getProperties() {
|
/*
|
||||||
return s_properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
||||||
Long zoneId = (Long)params.get(BaseCmd.Properties.ZONE_ID.getName());
|
Long zoneId = (Long)params.get(BaseCmd.Properties.ZONE_ID.getName());
|
||||||
@ -168,4 +180,5 @@ public class AssociateIPAddrCmd extends BaseCmd {
|
|||||||
}
|
}
|
||||||
return embeddedObject;
|
return embeddedObject;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,42 +18,53 @@
|
|||||||
|
|
||||||
package com.cloud.api.commands;
|
package com.cloud.api.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.BaseCmd.Manager;
|
||||||
import com.cloud.storage.VMTemplateVO;
|
import com.cloud.api.Implementation;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.utils.Pair;
|
|
||||||
import com.cloud.vm.UserVmVO;
|
|
||||||
|
|
||||||
|
@Implementation(method="attachISOToVM", manager=Manager.ManagementServer)
|
||||||
public class AttachIsoCmd extends BaseCmd {
|
public class AttachIsoCmd extends BaseCmd {
|
||||||
public static final Logger s_logger = Logger.getLogger(AttachIsoCmd.class.getName());
|
public static final Logger s_logger = Logger.getLogger(AttachIsoCmd.class.getName());
|
||||||
|
|
||||||
private static final String s_name = "attachisoresponse";
|
private static final String s_name = "attachisoresponse";
|
||||||
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
|
||||||
|
|
||||||
static {
|
/////////////////////////////////////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.VIRTUAL_MACHINE_ID, Boolean.TRUE));
|
//////////////// API parameters /////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.TRUE));
|
/////////////////////////////////////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
@Parameter(name="id", type=CommandType.LONG, required=true)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Parameter(name="virtualmachineid", type=CommandType.LONG, required=true)
|
||||||
|
private Long virtualMachineId;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getVirtualMachineId() {
|
||||||
|
return virtualMachineId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/*
|
||||||
public List<Pair<Enum, Boolean>> getProperties() {
|
|
||||||
return s_properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
||||||
Account account = (Account) params.get(BaseCmd.Properties.ACCOUNT_OBJ.getName());
|
Account account = (Account) params.get(BaseCmd.Properties.ACCOUNT_OBJ.getName());
|
||||||
@ -118,4 +129,5 @@ public class AttachIsoCmd extends BaseCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,45 +18,62 @@
|
|||||||
|
|
||||||
package com.cloud.api.commands;
|
package com.cloud.api.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.BaseCmd.Manager;
|
||||||
import com.cloud.storage.VolumeVO;
|
import com.cloud.api.Implementation;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.utils.Pair;
|
|
||||||
import com.cloud.vm.UserVmVO;
|
|
||||||
|
|
||||||
|
@Implementation(method="attachVolumeToVM", manager=Manager.ManagementServer)
|
||||||
public class AttachVolumeCmd extends BaseCmd {
|
public class AttachVolumeCmd extends BaseCmd {
|
||||||
public static final Logger s_logger = Logger.getLogger(AttachVolumeCmd.class.getName());
|
public static final Logger s_logger = Logger.getLogger(AttachVolumeCmd.class.getName());
|
||||||
private static final String s_name = "attachvolumeresponse";
|
private static final String s_name = "attachvolumeresponse";
|
||||||
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
|
||||||
|
|
||||||
static {
|
/////////////////////////////////////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
//////////////// API parameters /////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
/////////////////////////////////////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.VIRTUAL_MACHINE_ID, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DEVICE_ID, Boolean.FALSE));
|
|
||||||
|
|
||||||
|
@Parameter(name="deviceid", type=CommandType.LONG)
|
||||||
|
private Long deviceId;
|
||||||
|
|
||||||
|
@Parameter(name="id", type=CommandType.LONG, required=true)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Parameter(name="virtualmachineid", type=CommandType.LONG, required=true)
|
||||||
|
private Long virtualMachineId;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getDeviceId() {
|
||||||
|
return deviceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getVirtualMachineId() {
|
||||||
|
return virtualMachineId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Pair<Enum, Boolean>> getProperties() {
|
|
||||||
return s_properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getResultObjectName() {
|
public static String getResultObjectName() {
|
||||||
return "volume";
|
return "volume";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
@Override
|
@Override
|
||||||
public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
||||||
Account account = (Account) params.get(BaseCmd.Properties.ACCOUNT_OBJ.getName());
|
Account account = (Account) params.get(BaseCmd.Properties.ACCOUNT_OBJ.getName());
|
||||||
@ -121,4 +138,5 @@ public class AttachVolumeCmd extends BaseCmd {
|
|||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to attach volume: " + ex.getMessage());
|
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to attach volume: " + ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,43 +18,108 @@
|
|||||||
|
|
||||||
package com.cloud.api.commands;
|
package com.cloud.api.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.BaseCmd.Manager;
|
||||||
import com.cloud.network.security.NetworkGroupVO;
|
import com.cloud.api.Implementation;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.utils.Pair;
|
|
||||||
import com.cloud.utils.net.NetUtils;
|
|
||||||
|
|
||||||
|
@Implementation(method="authorizeNetworkGroupIngress", manager=Manager.ManagementServer)
|
||||||
public class AuthorizeNetworkGroupIngressCmd extends BaseCmd {
|
public class AuthorizeNetworkGroupIngressCmd extends BaseCmd {
|
||||||
public static final Logger s_logger = Logger.getLogger(AuthorizeNetworkGroupIngressCmd.class.getName());
|
public static final Logger s_logger = Logger.getLogger(AuthorizeNetworkGroupIngressCmd.class.getName());
|
||||||
|
|
||||||
private static final String s_name = "authorizenetworkgroupingress";
|
private static final String s_name = "authorizenetworkgroupingress";
|
||||||
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
|
||||||
|
|
||||||
static {
|
/////////////////////////////////////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
//////////////// API parameters /////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT, Boolean.FALSE));
|
/////////////////////////////////////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
@Parameter(name="protocol", type=CommandType.STRING)
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PROTOCOL, Boolean.FALSE));
|
private String protocol;
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.START_PORT, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.END_PORT, Boolean.FALSE));
|
@Parameter(name="startport", type=CommandType.INTEGER)
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ICMP_TYPE, Boolean.FALSE));
|
private Integer startPort;
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ICMP_CODE, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NETWORK_GROUP_NAME, Boolean.TRUE));
|
@Parameter(name="endport", type=CommandType.INTEGER)
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.CIDR_LIST, Boolean.FALSE));
|
private Integer endPort;
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_NETWORK_GROUP_LIST, Boolean.FALSE));
|
|
||||||
|
@Parameter(name="icmptype", type=CommandType.INTEGER)
|
||||||
|
private Integer icmpType;
|
||||||
|
|
||||||
|
@Parameter(name="icmpcode", type=CommandType.INTEGER)
|
||||||
|
private Integer icmpCode;
|
||||||
|
|
||||||
|
@Parameter(name="networkgroupname", type=CommandType.STRING, required=true)
|
||||||
|
private String networkGroupName;
|
||||||
|
|
||||||
|
@Parameter(name="cidrlist", type=CommandType.STRING)
|
||||||
|
private String cidrList;
|
||||||
|
|
||||||
|
@Parameter(name="usernetworkgrouplist", type=CommandType.MAP)
|
||||||
|
private Map userNetworkGroupList;
|
||||||
|
|
||||||
|
@Parameter(name="account", type=CommandType.STRING)
|
||||||
|
private String accountName;
|
||||||
|
|
||||||
|
@Parameter(name="domainid", type=CommandType.LONG)
|
||||||
|
private Long domainId;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getAccountName() {
|
||||||
|
return accountName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCidrList() {
|
||||||
|
return cidrList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDomainId() {
|
||||||
|
return domainId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getEndPort() {
|
||||||
|
return endPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getIcmpCode() {
|
||||||
|
return icmpCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getIcmpType() {
|
||||||
|
return icmpType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNetworkGroupName() {
|
||||||
|
return networkGroupName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProtocol() {
|
||||||
|
if (protocol == null) {
|
||||||
|
return "all";
|
||||||
|
}
|
||||||
|
return protocol;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getStartPort() {
|
||||||
|
return startPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map getUserNetworkGroupList() {
|
||||||
|
return userNetworkGroupList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
@ -63,10 +128,7 @@ public class AuthorizeNetworkGroupIngressCmd extends BaseCmd {
|
|||||||
return "networkgroup";
|
return "networkgroup";
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Pair<Enum, Boolean>> getProperties() {
|
/*
|
||||||
return s_properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
||||||
Account account = (Account)params.get(BaseCmd.Properties.ACCOUNT_OBJ.getName());
|
Account account = (Account)params.get(BaseCmd.Properties.ACCOUNT_OBJ.getName());
|
||||||
@ -253,6 +315,7 @@ public class AuthorizeNetworkGroupIngressCmd extends BaseCmd {
|
|||||||
//returnValues.add(new Pair<String, Object>(BaseCmd.Properties.RULE_ID.getName(), Long.valueOf(ruleId)));
|
//returnValues.add(new Pair<String, Object>(BaseCmd.Properties.RULE_ID.getName(), Long.valueOf(ruleId)));
|
||||||
return returnValues;
|
return returnValues;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
protected long getInstanceIdFromJobSuccessResult(String result) {
|
protected long getInstanceIdFromJobSuccessResult(String result) {
|
||||||
|
|||||||
@ -18,39 +18,49 @@
|
|||||||
|
|
||||||
package com.cloud.api.commands;
|
package com.cloud.api.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.BaseCmd.Manager;
|
||||||
import com.cloud.host.HostVO;
|
import com.cloud.api.Implementation;
|
||||||
import com.cloud.utils.Pair;
|
import com.cloud.api.Parameter;
|
||||||
|
|
||||||
|
@Implementation(method="maintenanceCompleted", manager=Manager.ManagementServer)
|
||||||
public class CancelMaintenanceCmd extends BaseCmd {
|
public class CancelMaintenanceCmd extends BaseCmd {
|
||||||
public static final Logger s_logger = Logger.getLogger(CancelMaintenanceCmd.class.getName());
|
public static final Logger s_logger = Logger.getLogger(CancelMaintenanceCmd.class.getName());
|
||||||
|
|
||||||
private static final String s_name = "cancelhostmaintenanceresponse";
|
private static final String s_name = "cancelhostmaintenanceresponse";
|
||||||
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
|
||||||
|
|
||||||
static {
|
/////////////////////////////////////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.TRUE));
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="id", type=CommandType.LONG, required=true)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Pair<Enum, Boolean>> getProperties() {
|
|
||||||
return s_properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getResultObjectName() {
|
public static String getResultObjectName() {
|
||||||
return "host";
|
return "host";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
@Override
|
@Override
|
||||||
public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
||||||
Long hostId = (Long)params.get(BaseCmd.Properties.ID.getName());
|
Long hostId = (Long)params.get(BaseCmd.Properties.ID.getName());
|
||||||
@ -73,4 +83,5 @@ public class CancelMaintenanceCmd extends BaseCmd {
|
|||||||
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.JOB_ID.getName(), Long.valueOf(jobId)));
|
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.JOB_ID.getName(), Long.valueOf(jobId)));
|
||||||
return returnValues;
|
return returnValues;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,44 +18,49 @@
|
|||||||
|
|
||||||
package com.cloud.api.commands;
|
package com.cloud.api.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.BaseCmd.Manager;
|
||||||
import com.cloud.exception.InvalidParameterValueException;
|
import com.cloud.api.Implementation;
|
||||||
import com.cloud.host.Status;
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.storage.StoragePoolVO;
|
|
||||||
import com.cloud.user.Account;
|
|
||||||
import com.cloud.utils.Pair;
|
|
||||||
|
|
||||||
|
@Implementation(method="cancelPrimaryStorageMaintenance", manager=Manager.ManagementServer)
|
||||||
public class CancelPrimaryStorageMaintenanceCmd extends BaseCmd {
|
public class CancelPrimaryStorageMaintenanceCmd extends BaseCmd {
|
||||||
public static final Logger s_logger = Logger.getLogger(CancelPrimaryStorageMaintenanceCmd.class.getName());
|
public static final Logger s_logger = Logger.getLogger(CancelPrimaryStorageMaintenanceCmd.class.getName());
|
||||||
|
|
||||||
private static final String s_name = "cancelprimarystoragemaintenanceresponse";
|
private static final String s_name = "cancelprimarystoragemaintenanceresponse";
|
||||||
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
|
||||||
|
|
||||||
static {
|
/////////////////////////////////////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.TRUE));
|
//////////////// API parameters /////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
/////////////////////////////////////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
|
||||||
|
@Parameter(name="id", type=CommandType.LONG, required=true)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Pair<Enum, Boolean>> getProperties() {
|
|
||||||
return s_properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getResultObjectName() {
|
public static String getResultObjectName() {
|
||||||
return "primarystorage";
|
return "primarystorage";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
@Override
|
@Override
|
||||||
public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
||||||
Long storagePoolId = (Long)params.get(BaseCmd.Properties.ID.getName());
|
Long storagePoolId = (Long)params.get(BaseCmd.Properties.ID.getName());
|
||||||
@ -91,4 +96,5 @@ public class CancelPrimaryStorageMaintenanceCmd extends BaseCmd {
|
|||||||
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.STATE.getName(), Status.PrepareForMaintenance));
|
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.STATE.getName(), Status.PrepareForMaintenance));
|
||||||
return returnValues;
|
return returnValues;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,34 +18,54 @@
|
|||||||
|
|
||||||
package com.cloud.api.commands;
|
package com.cloud.api.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.BaseCmd.Manager;
|
||||||
|
import com.cloud.api.Implementation;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.async.executor.CopyTemplateResultObject;
|
import com.cloud.async.executor.CopyTemplateResultObject;
|
||||||
import com.cloud.serializer.SerializerHelper;
|
import com.cloud.serializer.SerializerHelper;
|
||||||
import com.cloud.storage.Storage;
|
|
||||||
import com.cloud.storage.VMTemplateVO;
|
|
||||||
import com.cloud.user.Account;
|
|
||||||
import com.cloud.utils.Pair;
|
|
||||||
|
|
||||||
|
@Implementation(method="copyTemplate", manager=Manager.ManagementServer)
|
||||||
public class CopyIsoCmd extends BaseCmd {
|
public class CopyIsoCmd extends BaseCmd {
|
||||||
public static final Logger s_logger = Logger.getLogger(CopyIsoCmd.class.getName());
|
public static final Logger s_logger = Logger.getLogger(CopyIsoCmd.class.getName());
|
||||||
private static final String s_name = "copyisoresponse";
|
private static final String s_name = "copyisoresponse";
|
||||||
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
|
||||||
|
|
||||||
static {
|
/////////////////////////////////////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
//////////////// API parameters /////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
/////////////////////////////////////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.SOURCE_ZONE_ID, Boolean.TRUE));
|
@Parameter(name="destzoneid", type=CommandType.LONG, required=true)
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DEST_ZONE_ID, Boolean.TRUE));
|
private Long destZoneId;
|
||||||
|
|
||||||
|
@Parameter(name="id", type=CommandType.LONG, required=true)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Parameter(name="sourcezoneid", type=CommandType.LONG, required=true)
|
||||||
|
private Long sourceZoneId;
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getDestinationZoneId() {
|
||||||
|
return destZoneId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getSourceZoneId() {
|
||||||
|
return sourceZoneId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
@ -55,11 +75,7 @@ public class CopyIsoCmd extends BaseCmd {
|
|||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/*
|
||||||
public List<Pair<Enum, Boolean>> getProperties() {
|
|
||||||
return s_properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
||||||
Long isoId = (Long)params.get(BaseCmd.Properties.ID.getName());
|
Long isoId = (Long)params.get(BaseCmd.Properties.ID.getName());
|
||||||
@ -120,6 +136,7 @@ public class CopyIsoCmd extends BaseCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
protected long getInstanceIdFromJobSuccessResult(String result) {
|
protected long getInstanceIdFromJobSuccessResult(String result) {
|
||||||
CopyTemplateResultObject resultObject = (CopyTemplateResultObject)SerializerHelper.fromSerializedString(result);
|
CopyTemplateResultObject resultObject = (CopyTemplateResultObject)SerializerHelper.fromSerializedString(result);
|
||||||
|
|||||||
@ -25,10 +25,9 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.async.AsyncJobResult;
|
|
||||||
import com.cloud.async.executor.CopyTemplateResultObject;
|
import com.cloud.async.executor.CopyTemplateResultObject;
|
||||||
import com.cloud.async.executor.CreatePrivateTemplateResultObject;
|
|
||||||
import com.cloud.serializer.SerializerHelper;
|
import com.cloud.serializer.SerializerHelper;
|
||||||
import com.cloud.storage.Storage;
|
import com.cloud.storage.Storage;
|
||||||
import com.cloud.storage.VMTemplateVO;
|
import com.cloud.storage.VMTemplateVO;
|
||||||
@ -48,6 +47,41 @@ public class CopyTemplateCmd extends BaseCmd {
|
|||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DEST_ZONE_ID, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DEST_ZONE_ID, Boolean.TRUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="destzoneid", type=CommandType.LONG, required=true)
|
||||||
|
private Long destZoneId;
|
||||||
|
|
||||||
|
@Parameter(name="id", type=CommandType.LONG, required=true)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Parameter(name="sourcezoneid", type=CommandType.LONG, required=true)
|
||||||
|
private Long sourceZoneId;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getDestinationZoneId() {
|
||||||
|
return destZoneId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getSourceZoneId() {
|
||||||
|
return sourceZoneId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.domain.DomainVO;
|
import com.cloud.domain.DomainVO;
|
||||||
import com.cloud.exception.InvalidParameterValueException;
|
import com.cloud.exception.InvalidParameterValueException;
|
||||||
@ -48,6 +49,55 @@ public class CreateDiskOfferingCmd extends BaseCmd {
|
|||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.TAGS, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.TAGS, Boolean.FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="disksize", type=CommandType.LONG, required=true)
|
||||||
|
private Long diskSize;
|
||||||
|
|
||||||
|
@Parameter(name="displaytext", type=CommandType.STRING, required=true)
|
||||||
|
private String displayText;
|
||||||
|
|
||||||
|
@Parameter(name="domainid", type=CommandType.LONG)
|
||||||
|
private Long domainId;
|
||||||
|
|
||||||
|
@Parameter(name="name", type=CommandType.STRING, required=true)
|
||||||
|
private String offeringName;
|
||||||
|
|
||||||
|
@Parameter(name="tags", type=CommandType.STRING)
|
||||||
|
private String tags;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getDiskSize() {
|
||||||
|
return diskSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDisplayText() {
|
||||||
|
return displayText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDomainId() {
|
||||||
|
return domainId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOfferingName() {
|
||||||
|
return offeringName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTags() {
|
||||||
|
return tags;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.domain.DomainVO;
|
import com.cloud.domain.DomainVO;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
@ -42,6 +43,34 @@ public class CreateDomainCmd extends BaseCmd {
|
|||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PARENT_DOMAIN_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PARENT_DOMAIN_ID, Boolean.FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="name", type=CommandType.STRING, required=true)
|
||||||
|
private String domainName;
|
||||||
|
|
||||||
|
@Parameter(name="parentdomainid", type=CommandType.LONG)
|
||||||
|
private Long parentDomainId;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getDomainName() {
|
||||||
|
return domainName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getParentDomainId() {
|
||||||
|
return parentDomainId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.exception.NetworkRuleConflictException;
|
import com.cloud.exception.NetworkRuleConflictException;
|
||||||
import com.cloud.network.FirewallRuleVO;
|
import com.cloud.network.FirewallRuleVO;
|
||||||
@ -44,12 +45,61 @@ public class CreateIPForwardingRuleCmd extends BaseCmd {
|
|||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.IP_ADDRESS, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.IP_ADDRESS, Boolean.TRUE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PUBLIC_PORT, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PRIVATE_PORT, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PRIVATE_PORT, Boolean.TRUE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PROTOCOL, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PROTOCOL, Boolean.TRUE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PUBLIC_PORT, Boolean.TRUE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.VIRTUAL_MACHINE_ID, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.VIRTUAL_MACHINE_ID, Boolean.TRUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="ipaddress", type=CommandType.STRING, required=true)
|
||||||
|
private String ipAddress;
|
||||||
|
|
||||||
|
@Parameter(name="privateport", type=CommandType.STRING, required=true)
|
||||||
|
private String privatePort;
|
||||||
|
|
||||||
|
@Parameter(name="protocol", type=CommandType.STRING, required=true)
|
||||||
|
private String protocol;
|
||||||
|
|
||||||
|
@Parameter(name="publicport", type=CommandType.STRING, required=true)
|
||||||
|
private String publicPort;
|
||||||
|
|
||||||
|
@Parameter(name="virtualmachineid", type=CommandType.LONG, required=true)
|
||||||
|
private Long virtualMachineId;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getIpAddress() {
|
||||||
|
return ipAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPrivatePort() {
|
||||||
|
return privatePort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProtocol() {
|
||||||
|
return protocol;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPublicPort() {
|
||||||
|
return publicPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getVirtualMachineId() {
|
||||||
|
return virtualMachineId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
|
|||||||
@ -25,9 +25,10 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.dc.VlanVO;
|
|
||||||
import com.cloud.dc.Vlan.VlanType;
|
import com.cloud.dc.Vlan.VlanType;
|
||||||
|
import com.cloud.dc.VlanVO;
|
||||||
import com.cloud.exception.InvalidParameterValueException;
|
import com.cloud.exception.InvalidParameterValueException;
|
||||||
import com.cloud.exception.PermissionDeniedException;
|
import com.cloud.exception.PermissionDeniedException;
|
||||||
import com.cloud.network.IPAddressVO;
|
import com.cloud.network.IPAddressVO;
|
||||||
@ -47,14 +48,71 @@ public class CreateLoadBalancerRuleCmd extends BaseCmd {
|
|||||||
static {
|
static {
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NAME, Boolean.TRUE));
|
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ALGORITHM, Boolean.TRUE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DESCRIPTION, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DESCRIPTION, Boolean.FALSE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NAME, Boolean.TRUE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PRIVATE_PORT, Boolean.TRUE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PUBLIC_IP, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PUBLIC_IP, Boolean.TRUE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PUBLIC_PORT, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PUBLIC_PORT, Boolean.TRUE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PRIVATE_PORT, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ALGORITHM, Boolean.TRUE));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="algorithm", type=CommandType.STRING, required=true)
|
||||||
|
private String algorithm;
|
||||||
|
|
||||||
|
@Parameter(name="description", type=CommandType.STRING)
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Parameter(name="name", type=CommandType.STRING, required=true)
|
||||||
|
private String loadBalancerRuleName;
|
||||||
|
|
||||||
|
@Parameter(name="privateport", type=CommandType.STRING, required=true)
|
||||||
|
private String privatePort;
|
||||||
|
|
||||||
|
@Parameter(name="publicip", type=CommandType.STRING, required=true)
|
||||||
|
private String publicIp;
|
||||||
|
|
||||||
|
@Parameter(name="publicport", type=CommandType.STRING, required=true)
|
||||||
|
private String publicPort;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getAlgorithm() {
|
||||||
|
return algorithm;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLoadBalancerRuleName() {
|
||||||
|
return loadBalancerRuleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPrivatePort() {
|
||||||
|
return privatePort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPublicIp() {
|
||||||
|
return publicIp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPublicPort() {
|
||||||
|
return publicPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.network.security.NetworkGroupVO;
|
import com.cloud.network.security.NetworkGroupVO;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
@ -39,12 +40,55 @@ public class CreateNetworkGroupCmd extends BaseCmd {
|
|||||||
static {
|
static {
|
||||||
//s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
//s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
||||||
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT, Boolean.FALSE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DESCRIPTION, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NAME, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NAME, Boolean.TRUE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DESCRIPTION, Boolean.FALSE));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="account", type=CommandType.STRING)
|
||||||
|
private String accountName;
|
||||||
|
|
||||||
|
@Parameter(name="description", type=CommandType.STRING)
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Parameter(name="domainid", type=CommandType.LONG)
|
||||||
|
private Long domainId;
|
||||||
|
|
||||||
|
@Parameter(name="name", type=CommandType.STRING, required=true)
|
||||||
|
private String networkGroupName;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getAccountName() {
|
||||||
|
return accountName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDomainId() {
|
||||||
|
return domainId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNetworkGroupName() {
|
||||||
|
return networkGroupName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,10 +25,10 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.dc.DataCenterVO;
|
import com.cloud.dc.DataCenterVO;
|
||||||
import com.cloud.dc.HostPodVO;
|
import com.cloud.dc.HostPodVO;
|
||||||
import com.cloud.test.PodZoneConfig;
|
|
||||||
import com.cloud.user.User;
|
import com.cloud.user.User;
|
||||||
import com.cloud.utils.Pair;
|
import com.cloud.utils.Pair;
|
||||||
|
|
||||||
@ -39,15 +39,72 @@ public class CreatePodCmd extends BaseCmd {
|
|||||||
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NAME, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ZONE_ID, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.GATEWAY, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.CIDR, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.CIDR, Boolean.TRUE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.START_IP, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.END_IP, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.END_IP, Boolean.FALSE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.GATEWAY, Boolean.TRUE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NAME, Boolean.TRUE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.START_IP, Boolean.TRUE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ZONE_ID, Boolean.TRUE));
|
||||||
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="cidr", type=CommandType.STRING, required=true)
|
||||||
|
private String cidr;
|
||||||
|
|
||||||
|
@Parameter(name="endip", type=CommandType.STRING)
|
||||||
|
private String endIp;
|
||||||
|
|
||||||
|
@Parameter(name="gateway", type=CommandType.STRING, required=true)
|
||||||
|
private String gateway;
|
||||||
|
|
||||||
|
@Parameter(name="name", type=CommandType.STRING, required=true)
|
||||||
|
private String podName;
|
||||||
|
|
||||||
|
@Parameter(name="startip", type=CommandType.STRING, required=true)
|
||||||
|
private String startIp;
|
||||||
|
|
||||||
|
@Parameter(name="zoneid", type=CommandType.LONG, required=true)
|
||||||
|
private Long zoneId;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getCidr() {
|
||||||
|
return cidr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEndIp() {
|
||||||
|
return endIp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGateway() {
|
||||||
|
return gateway;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPodName() {
|
||||||
|
return podName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStartIp() {
|
||||||
|
return startIp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getZoneId() {
|
||||||
|
return zoneId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.network.SecurityGroupVO;
|
import com.cloud.network.SecurityGroupVO;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
@ -39,12 +40,55 @@ public class CreatePortForwardingServiceCmd extends BaseCmd {
|
|||||||
static {
|
static {
|
||||||
//s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
//s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
||||||
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT, Boolean.FALSE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DESCRIPTION, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NAME, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NAME, Boolean.TRUE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DESCRIPTION, Boolean.FALSE));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="account", type=CommandType.STRING)
|
||||||
|
private String accountName;
|
||||||
|
|
||||||
|
@Parameter(name="description", type=CommandType.STRING)
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Parameter(name="domainid", type=CommandType.LONG)
|
||||||
|
private Long domainId;
|
||||||
|
|
||||||
|
@Parameter(name="name", type=CommandType.STRING, required=true)
|
||||||
|
private String portForwardingServiceName;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getAccountName() {
|
||||||
|
return accountName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDomainId() {
|
||||||
|
return domainId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPortForwardingServiceName() {
|
||||||
|
return portForwardingServiceName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.async.executor.CreateOrUpdateRuleResultObject;
|
import com.cloud.async.executor.CreateOrUpdateRuleResultObject;
|
||||||
import com.cloud.network.SecurityGroupVO;
|
import com.cloud.network.SecurityGroupVO;
|
||||||
@ -41,12 +42,55 @@ public class CreatePortForwardingServiceRuleCmd extends BaseCmd {
|
|||||||
static {
|
static {
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PUBLIC_PORT, Boolean.TRUE));
|
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PORT_FORWARDING_SERVICE_ID, Boolean.TRUE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PRIVATE_PORT, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PRIVATE_PORT, Boolean.TRUE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PROTOCOL, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PROTOCOL, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PORT_FORWARDING_SERVICE_ID, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PUBLIC_PORT, Boolean.TRUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="portforwardingserviceid", type=CommandType.LONG, required=true)
|
||||||
|
private Long portForwardingServiceId;
|
||||||
|
|
||||||
|
@Parameter(name="privateport", type=CommandType.STRING, required=true)
|
||||||
|
private String privatePort;
|
||||||
|
|
||||||
|
@Parameter(name="protocol", type=CommandType.STRING, required=true)
|
||||||
|
private String protocol;
|
||||||
|
|
||||||
|
@Parameter(name="publicport", type=CommandType.STRING, required=true)
|
||||||
|
private String publicPort;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getPortForwardingServiceId() {
|
||||||
|
return portForwardingServiceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPrivatePort() {
|
||||||
|
return privatePort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProtocol() {
|
||||||
|
return protocol;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPublicPort() {
|
||||||
|
return publicPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.offering.ServiceOffering.GuestIpType;
|
import com.cloud.offering.ServiceOffering.GuestIpType;
|
||||||
import com.cloud.service.ServiceOfferingVO;
|
import com.cloud.service.ServiceOfferingVO;
|
||||||
@ -37,18 +38,96 @@ public class CreateServiceOfferingCmd extends BaseCmd{
|
|||||||
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.CPU_NUMBER, Boolean.TRUE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.CPU_SPEED, Boolean.TRUE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DISPLAY_TEXT, Boolean.TRUE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.MEMORY, Boolean.TRUE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NAME, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NAME, Boolean.TRUE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DISPLAY_TEXT, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.OFFER_HA, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.CPU_NUMBER, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.CPU_SPEED, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.MEMORY, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.STORAGE_TYPE, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.STORAGE_TYPE, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.OFFER_HA, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.TAGS, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USE_VIRTUAL_NETWORK, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USE_VIRTUAL_NETWORK, Boolean.FALSE));
|
||||||
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.TAGS, Boolean.FALSE));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="cpunumber", type=CommandType.LONG, required=true)
|
||||||
|
private Long cpuNumber;
|
||||||
|
|
||||||
|
@Parameter(name="cpuspeed", type=CommandType.LONG, required=true)
|
||||||
|
private Long cpuSpeed;
|
||||||
|
|
||||||
|
@Parameter(name="displaytext", type=CommandType.STRING, required=true)
|
||||||
|
private String displayText;
|
||||||
|
|
||||||
|
@Parameter(name="memory", type=CommandType.LONG, required=true)
|
||||||
|
private Long memory;
|
||||||
|
|
||||||
|
@Parameter(name="name", type=CommandType.STRING, required=true)
|
||||||
|
private String serviceOfferingName;
|
||||||
|
|
||||||
|
@Parameter(name="offerha", type=CommandType.BOOLEAN)
|
||||||
|
private Boolean offerHa;
|
||||||
|
|
||||||
|
@Parameter(name="storagetype", type=CommandType.STRING)
|
||||||
|
private String storageType;
|
||||||
|
|
||||||
|
@Parameter(name="tags", type=CommandType.STRING)
|
||||||
|
private String tags;
|
||||||
|
|
||||||
|
@Parameter(name="usevirtualnetwork", type=CommandType.BOOLEAN)
|
||||||
|
private Boolean useVirtualNetwork;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getCpuNumber() {
|
||||||
|
return cpuNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getCpuSpeed() {
|
||||||
|
return cpuSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDisplayText() {
|
||||||
|
return displayText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMemory() {
|
||||||
|
return memory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getServiceOfferingName() {
|
||||||
|
return serviceOfferingName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getOfferHa() {
|
||||||
|
return offerHa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStorageType() {
|
||||||
|
return storageType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTags() {
|
||||||
|
return tags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getUseVirtualNetwork() {
|
||||||
|
return useVirtualNetwork;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return _name;
|
return _name;
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.async.AsyncJobResult;
|
import com.cloud.async.AsyncJobResult;
|
||||||
import com.cloud.async.AsyncJobVO;
|
import com.cloud.async.AsyncJobVO;
|
||||||
@ -32,7 +33,6 @@ import com.cloud.async.executor.CreateSnapshotResultObject;
|
|||||||
import com.cloud.exception.ResourceAllocationException;
|
import com.cloud.exception.ResourceAllocationException;
|
||||||
import com.cloud.serializer.SerializerHelper;
|
import com.cloud.serializer.SerializerHelper;
|
||||||
import com.cloud.server.ManagementServer;
|
import com.cloud.server.ManagementServer;
|
||||||
import com.cloud.storage.StoragePoolVO;
|
|
||||||
import com.cloud.storage.VolumeVO;
|
import com.cloud.storage.VolumeVO;
|
||||||
import com.cloud.utils.Pair;
|
import com.cloud.utils.Pair;
|
||||||
|
|
||||||
@ -41,14 +41,41 @@ public class CreateSnapshotCmd extends BaseCmd {
|
|||||||
private static final String s_name = "createsnapshotresponse";
|
private static final String s_name = "createsnapshotresponse";
|
||||||
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
||||||
|
|
||||||
static {
|
/////////////////////////////////////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.VOLUME_ID, Boolean.TRUE));
|
//////////////// API parameters /////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE));
|
/////////////////////////////////////////////////////
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT, Boolean.FALSE));
|
@Parameter(name="account", type=CommandType.STRING)
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
private String accountName;
|
||||||
|
|
||||||
|
@Parameter(name="domainid", type=CommandType.LONG)
|
||||||
|
private Long domainId;
|
||||||
|
|
||||||
|
@Parameter(name="volumeid", type=CommandType.LONG, required=true)
|
||||||
|
private Long volumeId;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getAccountName() {
|
||||||
|
return accountName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getDomainId() {
|
||||||
|
return domainId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getVolumeId() {
|
||||||
|
return volumeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
@ -63,8 +90,8 @@ public class CreateSnapshotCmd extends BaseCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
||||||
Long volumeId = (Long) params.get(BaseCmd.Properties.VOLUME_ID.getName());
|
// Long volumeId = (Long) params.get(BaseCmd.Properties.VOLUME_ID.getName());
|
||||||
Long userId = (Long) params.get(BaseCmd.Properties.USER_ID.getName());
|
// Long userId = (Long) params.get(BaseCmd.Properties.USER_ID.getName());
|
||||||
|
|
||||||
ManagementServer managementServer = getManagementServer();
|
ManagementServer managementServer = getManagementServer();
|
||||||
// Verify that a volume exists with a specified volume ID
|
// Verify that a volume exists with a specified volume ID
|
||||||
@ -74,6 +101,7 @@ public class CreateSnapshotCmd extends BaseCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If an account was passed in, make sure that it matches the account of the volume
|
// If an account was passed in, make sure that it matches the account of the volume
|
||||||
|
// FIXME: permission checks go in business logic
|
||||||
checkAccountPermissions(params, volume.getAccountId(), volume.getDomainId(), "volume", volumeId);
|
checkAccountPermissions(params, volume.getAccountId(), volume.getDomainId(), "volume", volumeId);
|
||||||
|
|
||||||
// If command is executed via 8096 port, set userId to the id of System account (1)
|
// If command is executed via 8096 port, set userId to the id of System account (1)
|
||||||
|
|||||||
@ -25,13 +25,13 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.exception.InvalidParameterValueException;
|
import com.cloud.exception.InvalidParameterValueException;
|
||||||
import com.cloud.server.ManagementServer;
|
import com.cloud.server.ManagementServer;
|
||||||
import com.cloud.storage.SnapshotPolicyVO;
|
import com.cloud.storage.SnapshotPolicyVO;
|
||||||
import com.cloud.storage.StoragePoolVO;
|
import com.cloud.storage.StoragePoolVO;
|
||||||
import com.cloud.storage.VolumeVO;
|
import com.cloud.storage.VolumeVO;
|
||||||
import com.cloud.user.Account;
|
|
||||||
import com.cloud.utils.Pair;
|
import com.cloud.utils.Pair;
|
||||||
|
|
||||||
public class CreateSnapshotPolicyCmd extends BaseCmd {
|
public class CreateSnapshotPolicyCmd extends BaseCmd {
|
||||||
@ -41,17 +41,81 @@ public class CreateSnapshotPolicyCmd extends BaseCmd {
|
|||||||
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.VOLUME_ID, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.SCHEDULE, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.TIMEZONE, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.INTERVAL_TYPE, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.INTERVAL_TYPE, Boolean.TRUE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.MAX_SNAPS, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.MAX_SNAPS, Boolean.TRUE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.SCHEDULE, Boolean.TRUE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.TIMEZONE, Boolean.TRUE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.VOLUME_ID, Boolean.TRUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="account", type=CommandType.STRING)
|
||||||
|
private String accountName;
|
||||||
|
|
||||||
|
@Parameter(name="domainid", type=CommandType.LONG)
|
||||||
|
private Long domainId;
|
||||||
|
|
||||||
|
@Parameter(name="intervaltype", type=CommandType.STRING, required=true)
|
||||||
|
private String intervalType;
|
||||||
|
|
||||||
|
@Parameter(name="maxsnaps", type=CommandType.INTEGER, required=true)
|
||||||
|
private Integer maxSnaps;
|
||||||
|
|
||||||
|
@Parameter(name="schedule", type=CommandType.STRING, required=true)
|
||||||
|
private String schedule;
|
||||||
|
|
||||||
|
@Parameter(name="timezone", type=CommandType.STRING, required=true)
|
||||||
|
private String timezone;
|
||||||
|
|
||||||
|
@Parameter(name="volumeid", type=CommandType.LONG, required=true)
|
||||||
|
private Long volumeId;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getAccountName() {
|
||||||
|
return accountName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDomainId() {
|
||||||
|
return domainId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIntervalType() {
|
||||||
|
return intervalType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getMaxSnaps() {
|
||||||
|
return maxSnaps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSchedule() {
|
||||||
|
return schedule;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTimezone() {
|
||||||
|
return timezone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getVolumeId() {
|
||||||
|
return volumeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,6 +31,7 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.dc.ClusterVO;
|
import com.cloud.dc.ClusterVO;
|
||||||
import com.cloud.dc.DataCenterVO;
|
import com.cloud.dc.DataCenterVO;
|
||||||
@ -47,15 +48,78 @@ public class CreateStoragePoolCmd extends BaseCmd {
|
|||||||
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ZONE_ID, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NAME, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.URL, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.POD_ID, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.CLUSTER_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.CLUSTER_ID, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.TAGS, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DETAILS, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DETAILS, Boolean.FALSE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NAME, Boolean.TRUE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.POD_ID, Boolean.FALSE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.TAGS, Boolean.FALSE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.URL, Boolean.TRUE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ZONE_ID, Boolean.TRUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="clusterid", type=CommandType.LONG)
|
||||||
|
private Long clusterId;
|
||||||
|
|
||||||
|
@Parameter(name="details", type=CommandType.MAP)
|
||||||
|
private Map details;
|
||||||
|
|
||||||
|
@Parameter(name="name", type=CommandType.STRING, required=true)
|
||||||
|
private String storagePoolName;
|
||||||
|
|
||||||
|
@Parameter(name="podid", type=CommandType.LONG)
|
||||||
|
private Long podId;
|
||||||
|
|
||||||
|
@Parameter(name="tags", type=CommandType.STRING)
|
||||||
|
private String tags;
|
||||||
|
|
||||||
|
@Parameter(name="url", type=CommandType.STRING, required=true)
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
@Parameter(name="zoneid", type=CommandType.LONG, required=true)
|
||||||
|
private Long zoneId;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getClusterId() {
|
||||||
|
return clusterId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map getDetails() {
|
||||||
|
return details;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStoragePoolName() {
|
||||||
|
return storagePoolName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getPodId() {
|
||||||
|
return podId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTags() {
|
||||||
|
return tags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getZoneId() {
|
||||||
|
return zoneId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
|
|||||||
@ -25,9 +25,8 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.async.AsyncInstanceCreateStatus;
|
|
||||||
import com.cloud.async.AsyncJobResult;
|
|
||||||
import com.cloud.async.executor.CreatePrivateTemplateResultObject;
|
import com.cloud.async.executor.CreatePrivateTemplateResultObject;
|
||||||
import com.cloud.serializer.SerializerHelper;
|
import com.cloud.serializer.SerializerHelper;
|
||||||
import com.cloud.server.Criteria;
|
import com.cloud.server.Criteria;
|
||||||
@ -43,20 +42,105 @@ public class CreateTemplateCmd extends BaseCmd {
|
|||||||
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DISPLAY_TEXT, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NAME, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.VOLUME_ID, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.REQUIRES_HVM, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.BITS, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.BITS, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PASSWORD_ENABLED, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DISPLAY_TEXT, Boolean.TRUE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.IS_FEATURED, Boolean.FALSE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.IS_PUBLIC, Boolean.FALSE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NAME, Boolean.TRUE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.OS_TYPE_ID, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.OS_TYPE_ID, Boolean.TRUE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PASSWORD_ENABLED, Boolean.FALSE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.REQUIRES_HVM, Boolean.FALSE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.SNAPSHOT_ID, Boolean.FALSE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.VOLUME_ID, Boolean.FALSE));
|
||||||
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.IS_PUBLIC, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.IS_FEATURED, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.SNAPSHOT_ID, Boolean.FALSE));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="bits", type=CommandType.INTEGER)
|
||||||
|
private Integer bits;
|
||||||
|
|
||||||
|
@Parameter(name="displaytext", type=CommandType.STRING, required=true)
|
||||||
|
private String displayText;
|
||||||
|
|
||||||
|
@Parameter(name="isfeatured", type=CommandType.BOOLEAN)
|
||||||
|
private Boolean featured;
|
||||||
|
|
||||||
|
@Parameter(name="ispublic", type=CommandType.BOOLEAN)
|
||||||
|
private Boolean publicTemplate;
|
||||||
|
|
||||||
|
@Parameter(name="name", type=CommandType.STRING, required=true)
|
||||||
|
private String templateName;
|
||||||
|
|
||||||
|
@Parameter(name="ostypeid", type=CommandType.LONG, required=true)
|
||||||
|
private Long osTypeId;
|
||||||
|
|
||||||
|
@Parameter(name="passwordenabled", type=CommandType.BOOLEAN)
|
||||||
|
private Boolean passwordEnabled;
|
||||||
|
|
||||||
|
@Parameter(name="requireshvm", type=CommandType.BOOLEAN)
|
||||||
|
private Boolean requiresHvm;
|
||||||
|
|
||||||
|
@Parameter(name="snapshotid", type=CommandType.LONG)
|
||||||
|
private Long snapshotId;
|
||||||
|
|
||||||
|
@Parameter(name="volumeid", type=CommandType.LONG)
|
||||||
|
private Long volumeId;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Integer getBits() {
|
||||||
|
return bits;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDisplayText() {
|
||||||
|
return displayText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean isFeatured() {
|
||||||
|
return featured;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean isPublic() {
|
||||||
|
return publicTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTemplateName() {
|
||||||
|
return templateName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getOsTypeId() {
|
||||||
|
return osTypeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean isPasswordEnabled() {
|
||||||
|
return passwordEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getRequiresHvm() {
|
||||||
|
return requiresHvm;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getSnapshotId() {
|
||||||
|
return snapshotId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getVolumeId() {
|
||||||
|
return volumeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
@ -135,6 +219,14 @@ public class CreateTemplateCmd extends BaseCmd {
|
|||||||
c.addCriteria(Criteria.NAME, name);
|
c.addCriteria(Criteria.NAME, name);
|
||||||
c.addCriteria(Criteria.CREATED_BY, Long.valueOf(volume.getAccountId()));
|
c.addCriteria(Criteria.CREATED_BY, Long.valueOf(volume.getAccountId()));
|
||||||
List<VMTemplateVO> templates = getManagementServer().searchForTemplates(c);
|
List<VMTemplateVO> templates = getManagementServer().searchForTemplates(c);
|
||||||
|
if ((templates != null) && !templates.isEmpty()) {
|
||||||
|
for (VMTemplateVO template : templates) {
|
||||||
|
if (template.getName().equalsIgnoreCase(name)) {
|
||||||
|
throw new ServerApiException(BaseCmd.PARAM_ERROR, "a private template with name " + name + " already exists for account " +
|
||||||
|
volume.getAccountId() + ", please try again with a different name");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If command is executed via 8096 port, set userId to the id of System account (1)
|
// If command is executed via 8096 port, set userId to the id of System account (1)
|
||||||
if (userId == null) {
|
if (userId == null) {
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.domain.DomainVO;
|
import com.cloud.domain.DomainVO;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
@ -39,17 +40,94 @@ public class CreateUserCmd extends BaseCmd {
|
|||||||
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USERNAME, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PASSWORD, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.FIRSTNAME, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.LASTNAME, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.EMAIL, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_TYPE, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_TYPE, Boolean.TRUE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.EMAIL, Boolean.TRUE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.FIRSTNAME, Boolean.TRUE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.LASTNAME, Boolean.TRUE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PASSWORD, Boolean.TRUE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.TIMEZONE, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.TIMEZONE, Boolean.FALSE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USERNAME, Boolean.TRUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="account", type=CommandType.STRING)
|
||||||
|
private String accountName;
|
||||||
|
|
||||||
|
@Parameter(name="accounttype", type=CommandType.LONG, required=true)
|
||||||
|
private Long accountType;
|
||||||
|
|
||||||
|
@Parameter(name="domainid", type=CommandType.LONG)
|
||||||
|
private Long domainId;
|
||||||
|
|
||||||
|
@Parameter(name="email", type=CommandType.STRING, required=true)
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
@Parameter(name="firstname", type=CommandType.STRING, required=true)
|
||||||
|
private String firstname;
|
||||||
|
|
||||||
|
@Parameter(name="lastname", type=CommandType.STRING, required=true)
|
||||||
|
private String lastname;
|
||||||
|
|
||||||
|
@Parameter(name="password", type=CommandType.STRING, required=true)
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@Parameter(name="timezone", type=CommandType.STRING)
|
||||||
|
private String timezone;
|
||||||
|
|
||||||
|
@Parameter(name="username", type=CommandType.STRING, required=true)
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getAccountName() {
|
||||||
|
return accountName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getAccountType() {
|
||||||
|
return accountType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDomainId() {
|
||||||
|
return domainId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFirstname() {
|
||||||
|
return firstname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLastname() {
|
||||||
|
return lastname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTimezone() {
|
||||||
|
return timezone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,12 +25,12 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.dc.HostPodVO;
|
import com.cloud.dc.HostPodVO;
|
||||||
import com.cloud.dc.Vlan;
|
import com.cloud.dc.Vlan;
|
||||||
import com.cloud.dc.VlanVO;
|
|
||||||
import com.cloud.dc.Vlan.VlanType;
|
import com.cloud.dc.Vlan.VlanType;
|
||||||
import com.cloud.exception.InvalidParameterValueException;
|
import com.cloud.dc.VlanVO;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
import com.cloud.user.User;
|
import com.cloud.user.User;
|
||||||
import com.cloud.utils.Pair;
|
import com.cloud.utils.Pair;
|
||||||
@ -42,19 +42,104 @@ public class CreateVlanIpRangeCmd extends BaseCmd {
|
|||||||
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.FOR_VIRTUAL_NETWORK, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.VLAN, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.GATEWAY, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NETMASK, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ZONE_ID, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.END_IP, Boolean.FALSE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.FOR_VIRTUAL_NETWORK, Boolean.FALSE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.GATEWAY, Boolean.TRUE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NETMASK, Boolean.TRUE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.POD_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.POD_ID, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.START_IP, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.START_IP, Boolean.TRUE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.END_IP, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.VLAN, Boolean.FALSE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ZONE_ID, Boolean.TRUE));
|
||||||
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="account", type=CommandType.STRING)
|
||||||
|
private String accountName;
|
||||||
|
|
||||||
|
@Parameter(name="domainid", type=CommandType.LONG)
|
||||||
|
private Long domainId;
|
||||||
|
|
||||||
|
@Parameter(name="endip", type=CommandType.STRING)
|
||||||
|
private String endIp;
|
||||||
|
|
||||||
|
@Parameter(name="forvirtualnetwork", type=CommandType.BOOLEAN)
|
||||||
|
private Boolean forVirtualNetwork;
|
||||||
|
|
||||||
|
@Parameter(name="gateway", type=CommandType.STRING, required=true)
|
||||||
|
private String gateway;
|
||||||
|
|
||||||
|
@Parameter(name="netmask", type=CommandType.STRING, required=true)
|
||||||
|
private String netmask;
|
||||||
|
|
||||||
|
@Parameter(name="podid", type=CommandType.LONG)
|
||||||
|
private Long podId;
|
||||||
|
|
||||||
|
@Parameter(name="startip", type=CommandType.STRING, required=true)
|
||||||
|
private String startIp;
|
||||||
|
|
||||||
|
@Parameter(name="vlan", type=CommandType.STRING)
|
||||||
|
private String vlan;
|
||||||
|
|
||||||
|
@Parameter(name="zoneid", type=CommandType.LONG, required=true)
|
||||||
|
private Long zoneId;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getAccountName() {
|
||||||
|
return accountName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDomainId() {
|
||||||
|
return domainId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEndIp() {
|
||||||
|
return endIp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean isForVirtualNetwork() {
|
||||||
|
return forVirtualNetwork;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGateway() {
|
||||||
|
return gateway;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNetmask() {
|
||||||
|
return netmask;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getPodId() {
|
||||||
|
return podId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStartIp() {
|
||||||
|
return startIp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVlan() {
|
||||||
|
return vlan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getZoneId() {
|
||||||
|
return zoneId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,11 +25,10 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.async.executor.VolumeOperationResultObject;
|
import com.cloud.async.executor.VolumeOperationResultObject;
|
||||||
import com.cloud.exception.InvalidParameterValueException;
|
|
||||||
import com.cloud.serializer.SerializerHelper;
|
import com.cloud.serializer.SerializerHelper;
|
||||||
import com.cloud.storage.DiskOfferingVO;
|
|
||||||
import com.cloud.storage.Snapshot;
|
import com.cloud.storage.Snapshot;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
import com.cloud.utils.Pair;
|
import com.cloud.utils.Pair;
|
||||||
@ -42,15 +41,71 @@ public class CreateVolumeCmd extends BaseCmd {
|
|||||||
static {
|
static {
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
||||||
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT, Boolean.FALSE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DISK_OFFERING_ID, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NAME, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NAME, Boolean.TRUE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ZONE_ID, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DISK_OFFERING_ID, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.SNAPSHOT_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.SNAPSHOT_ID, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.SIZE, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ZONE_ID, Boolean.FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="account", type=CommandType.STRING)
|
||||||
|
private String accountName;
|
||||||
|
|
||||||
|
@Parameter(name="diskofferingid", type=CommandType.LONG)
|
||||||
|
private Long diskOfferingId;
|
||||||
|
|
||||||
|
@Parameter(name="domainid", type=CommandType.LONG)
|
||||||
|
private Long domainId;
|
||||||
|
|
||||||
|
@Parameter(name="name", type=CommandType.STRING, required=true)
|
||||||
|
private String volumeName;
|
||||||
|
|
||||||
|
@Parameter(name="snapshotid", type=CommandType.LONG)
|
||||||
|
private Long snapshotId;
|
||||||
|
|
||||||
|
@Parameter(name="zoneid", type=CommandType.LONG)
|
||||||
|
private Long zoneId;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getAccountName() {
|
||||||
|
return accountName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDiskOfferingId() {
|
||||||
|
return diskOfferingId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDomainId() {
|
||||||
|
return domainId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVolumeName() {
|
||||||
|
return volumeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getSnapshotId() {
|
||||||
|
return snapshotId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getZoneId() {
|
||||||
|
return zoneId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
@ -73,7 +128,6 @@ public class CreateVolumeCmd extends BaseCmd {
|
|||||||
Long zoneId = (Long) params.get(BaseCmd.Properties.ZONE_ID.getName());
|
Long zoneId = (Long) params.get(BaseCmd.Properties.ZONE_ID.getName());
|
||||||
Long diskOfferingId = (Long) params.get(BaseCmd.Properties.DISK_OFFERING_ID.getName());
|
Long diskOfferingId = (Long) params.get(BaseCmd.Properties.DISK_OFFERING_ID.getName());
|
||||||
Long snapshotId = (Long)params.get(BaseCmd.Properties.SNAPSHOT_ID.getName());
|
Long snapshotId = (Long)params.get(BaseCmd.Properties.SNAPSHOT_ID.getName());
|
||||||
Long size = (Long)params.get(BaseCmd.Properties.SIZE.getName());
|
|
||||||
|
|
||||||
if (account == null) {
|
if (account == null) {
|
||||||
// Admin API call
|
// Admin API call
|
||||||
@ -113,45 +167,12 @@ public class CreateVolumeCmd extends BaseCmd {
|
|||||||
userId = Long.valueOf(Account.ACCOUNT_ID_SYSTEM);
|
userId = Long.valueOf(Account.ACCOUNT_ID_SYSTEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(size==null){
|
|
||||||
size = Long.valueOf(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean useSnapshot = false;
|
boolean useSnapshot = false;
|
||||||
if (snapshotId == null)
|
if (snapshotId == null) {
|
||||||
{
|
if ((zoneId == null) || (diskOfferingId == null)) {
|
||||||
if ((zoneId == null))
|
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Missing parameter(s), both zoneid and diskofferingid must be specified.");
|
||||||
{
|
|
||||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Missing parameter,zoneid must be specified.");
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
if(diskOfferingId == null && size == 0)
|
|
||||||
{
|
|
||||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Missing parameter(s),either a positive volume size or a valid disk offering id must be specified.");
|
|
||||||
}
|
|
||||||
else if(diskOfferingId == null && size != 0)
|
|
||||||
{
|
|
||||||
//validate the size to ensure between min and max size range
|
|
||||||
try
|
|
||||||
{
|
|
||||||
boolean ok = getManagementServer().validateCustomVolumeSizeRange(size);
|
|
||||||
|
|
||||||
if(!ok)
|
|
||||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Invalid size for custom volume creation:");
|
|
||||||
|
|
||||||
} catch (InvalidParameterValueException e)
|
|
||||||
{
|
|
||||||
s_logger.warn("Invalid size for custom volume creation");
|
|
||||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Invalid size for custom volume creation:"+e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
//this is the case of creating var size vol with private disk offering
|
|
||||||
List<DiskOfferingVO> privateTemplateList = getManagementServer().findPrivateDiskOffering();
|
|
||||||
diskOfferingId = privateTemplateList.get(0).getId(); //we use this id for creating volume
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
useSnapshot = true;
|
useSnapshot = true;
|
||||||
//Verify parameters
|
//Verify parameters
|
||||||
Snapshot snapshotCheck = getManagementServer().findSnapshotById(snapshotId);
|
Snapshot snapshotCheck = getManagementServer().findSnapshotById(snapshotId);
|
||||||
@ -176,7 +197,7 @@ public class CreateVolumeCmd extends BaseCmd {
|
|||||||
if (useSnapshot) {
|
if (useSnapshot) {
|
||||||
jobId = getManagementServer().createVolumeFromSnapshotAsync(userId, account.getId(), snapshotId, name);
|
jobId = getManagementServer().createVolumeFromSnapshotAsync(userId, account.getId(), snapshotId, name);
|
||||||
} else {
|
} else {
|
||||||
jobId = getManagementServer().createVolumeAsync(userId, account.getId(), name, zoneId, diskOfferingId, size);
|
jobId = getManagementServer().createVolumeAsync(userId, account.getId(), name, zoneId, diskOfferingId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (jobId == 0) {
|
if (jobId == 0) {
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.dc.DataCenterVO;
|
import com.cloud.dc.DataCenterVO;
|
||||||
import com.cloud.user.User;
|
import com.cloud.user.User;
|
||||||
@ -37,16 +38,80 @@ public class CreateZoneCmd extends BaseCmd {
|
|||||||
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NAME, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DNS1, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DNS1, Boolean.TRUE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DNS2, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DNS2, Boolean.FALSE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.GUEST_CIDR_ADDRESS, Boolean.TRUE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.INTERNAL_DNS1, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.INTERNAL_DNS1, Boolean.TRUE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.INTERNAL_DNS2, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.INTERNAL_DNS2, Boolean.FALSE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NAME, Boolean.TRUE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.VNET, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.VNET, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.GUEST_CIDR_ADDRESS, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="dns1", type=CommandType.STRING, required=true)
|
||||||
|
private String dns1;
|
||||||
|
|
||||||
|
@Parameter(name="dns2", type=CommandType.STRING)
|
||||||
|
private String dns2;
|
||||||
|
|
||||||
|
@Parameter(name="guestcidraddress", type=CommandType.STRING, required=true)
|
||||||
|
private String guestCidrAddress;
|
||||||
|
|
||||||
|
@Parameter(name="internaldns1", type=CommandType.STRING, required=true)
|
||||||
|
private String internalDns1;
|
||||||
|
|
||||||
|
@Parameter(name="internaldns2", type=CommandType.STRING)
|
||||||
|
private String internalDns2;
|
||||||
|
|
||||||
|
@Parameter(name="name", type=CommandType.STRING, required=true)
|
||||||
|
private String zoneName;
|
||||||
|
|
||||||
|
@Parameter(name="vlan", type=CommandType.STRING)
|
||||||
|
private String vlan;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getDns1() {
|
||||||
|
return dns1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDns2() {
|
||||||
|
return dns2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGuestCidrAddress() {
|
||||||
|
return guestCidrAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInternalDns1() {
|
||||||
|
return internalDns1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInternalDns2() {
|
||||||
|
return internalDns2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getZoneName() {
|
||||||
|
return zoneName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVlan() {
|
||||||
|
return vlan;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.storage.DiskOfferingVO;
|
import com.cloud.storage.DiskOfferingVO;
|
||||||
import com.cloud.utils.Pair;
|
import com.cloud.utils.Pair;
|
||||||
@ -39,6 +40,28 @@ public class DeleteDiskOfferingCmd extends BaseCmd {
|
|||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.TRUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="id", type=CommandType.LONG, required=true)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.domain.DomainVO;
|
import com.cloud.domain.DomainVO;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
@ -41,6 +42,34 @@ public class DeleteDomainCmd extends BaseCmd{
|
|||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.CLEANUP, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.CLEANUP, Boolean.FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="id", type=CommandType.LONG, required=true)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Parameter(name="cleanup", type=CommandType.BOOLEAN)
|
||||||
|
private Boolean cleanup;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getCleanup() {
|
||||||
|
return cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.host.HostVO;
|
import com.cloud.host.HostVO;
|
||||||
import com.cloud.utils.Pair;
|
import com.cloud.utils.Pair;
|
||||||
@ -39,6 +40,27 @@ public class DeleteHostCmd extends BaseCmd {
|
|||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.TRUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="id", type=CommandType.LONG, required=true)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.exception.InternalErrorException;
|
import com.cloud.exception.InternalErrorException;
|
||||||
import com.cloud.exception.InvalidParameterValueException;
|
import com.cloud.exception.InvalidParameterValueException;
|
||||||
@ -47,6 +48,27 @@ public class DeleteIPForwardingRuleCmd extends BaseCmd {
|
|||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.TRUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="id", type=CommandType.LONG, required=true)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.storage.VMTemplateVO;
|
import com.cloud.storage.VMTemplateVO;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
@ -42,6 +43,34 @@ public class DeleteIsoCmd extends BaseCmd {
|
|||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ZONE_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ZONE_ID, Boolean.FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="id", type=CommandType.LONG, required=true)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Parameter(name="zoneid", type=CommandType.LONG)
|
||||||
|
private Long zoneId;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getZoneId() {
|
||||||
|
return zoneId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.network.LoadBalancerVO;
|
import com.cloud.network.LoadBalancerVO;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
@ -44,6 +45,41 @@ public class DeleteLoadBalancerRuleCmd extends BaseCmd {
|
|||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.TRUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="account", type=CommandType.STRING)
|
||||||
|
private String accountName;
|
||||||
|
|
||||||
|
@Parameter(name="id", type=CommandType.LONG, required=true)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Parameter(name="domainid", type=CommandType.LONG)
|
||||||
|
private Long domainId;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getAccountName() {
|
||||||
|
return accountName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDomainId() {
|
||||||
|
return domainId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.exception.PermissionDeniedException;
|
import com.cloud.exception.PermissionDeniedException;
|
||||||
import com.cloud.exception.ResourceInUseException;
|
import com.cloud.exception.ResourceInUseException;
|
||||||
@ -28,6 +29,41 @@ public class DeleteNetworkGroupCmd extends BaseCmd {
|
|||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NAME, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NAME, Boolean.TRUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="account", type=CommandType.STRING)
|
||||||
|
private String accountName;
|
||||||
|
|
||||||
|
@Parameter(name="domainid", type=CommandType.LONG)
|
||||||
|
private Long domainId;
|
||||||
|
|
||||||
|
@Parameter(name="name", type=CommandType.STRING, required=true)
|
||||||
|
private String networkGroupName;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getAccountName() {
|
||||||
|
return accountName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDomainId() {
|
||||||
|
return domainId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNetworkGroupName() {
|
||||||
|
return networkGroupName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.dc.HostPodVO;
|
import com.cloud.dc.HostPodVO;
|
||||||
import com.cloud.user.User;
|
import com.cloud.user.User;
|
||||||
@ -41,6 +42,27 @@ public class DeletePodCmd extends BaseCmd {
|
|||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="id", type=CommandType.LONG, required=true)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,9 +7,10 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.storage.StoragePoolVO;
|
|
||||||
import com.cloud.storage.Storage.StoragePoolType;
|
import com.cloud.storage.Storage.StoragePoolType;
|
||||||
|
import com.cloud.storage.StoragePoolVO;
|
||||||
import com.cloud.utils.Pair;
|
import com.cloud.utils.Pair;
|
||||||
|
|
||||||
public class DeletePoolCmd extends BaseCmd {
|
public class DeletePoolCmd extends BaseCmd {
|
||||||
@ -22,6 +23,27 @@ public class DeletePoolCmd extends BaseCmd {
|
|||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.TRUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="id", type=CommandType.LONG, required=true)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.network.SecurityGroupVO;
|
import com.cloud.network.SecurityGroupVO;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
@ -43,6 +44,27 @@ public class DeletePortForwardingServiceCmd extends BaseCmd {
|
|||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="id", type=CommandType.LONG, required=true)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.exception.PermissionDeniedException;
|
import com.cloud.exception.PermissionDeniedException;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
@ -42,6 +43,27 @@ public class DeletePortForwardingServiceRuleCmd extends BaseCmd {
|
|||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.TRUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="id", type=CommandType.LONG, required=true)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.service.ServiceOfferingVO;
|
import com.cloud.service.ServiceOfferingVO;
|
||||||
import com.cloud.user.User;
|
import com.cloud.user.User;
|
||||||
@ -40,6 +41,27 @@ public class DeleteServiceOfferingCmd extends BaseCmd{
|
|||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="id", type=CommandType.LONG, required=true)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.storage.Snapshot;
|
import com.cloud.storage.Snapshot;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
@ -36,14 +37,50 @@ public class DeleteSnapshotCmd extends BaseCmd {
|
|||||||
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT, Boolean.FALSE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.TRUE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="account", type=CommandType.STRING)
|
||||||
|
private String accountName;
|
||||||
|
|
||||||
|
@Parameter(name="domainid", type=CommandType.LONG)
|
||||||
|
private Long domainId;
|
||||||
|
|
||||||
|
@Parameter(name="id", type=CommandType.LONG, required=true)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getAccountName() {
|
||||||
|
return accountName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDomainId() {
|
||||||
|
return domainId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -26,12 +26,12 @@ import java.util.StringTokenizer;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.exception.InvalidParameterValueException;
|
import com.cloud.exception.InvalidParameterValueException;
|
||||||
import com.cloud.server.ManagementServer;
|
import com.cloud.server.ManagementServer;
|
||||||
import com.cloud.storage.SnapshotPolicyVO;
|
import com.cloud.storage.SnapshotPolicyVO;
|
||||||
import com.cloud.storage.VolumeVO;
|
import com.cloud.storage.VolumeVO;
|
||||||
import com.cloud.user.Account;
|
|
||||||
import com.cloud.utils.Pair;
|
import com.cloud.utils.Pair;
|
||||||
|
|
||||||
public class DeleteSnapshotPoliciesCmd extends BaseCmd {
|
public class DeleteSnapshotPoliciesCmd extends BaseCmd {
|
||||||
@ -41,14 +41,57 @@ public class DeleteSnapshotPoliciesCmd extends BaseCmd {
|
|||||||
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT, Boolean.FALSE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.IDS, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.IDS, Boolean.FALSE));
|
||||||
|
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="account", type=CommandType.STRING)
|
||||||
|
private String accountName;
|
||||||
|
|
||||||
|
@Parameter(name="domainid", type=CommandType.LONG)
|
||||||
|
private Long domainId;
|
||||||
|
|
||||||
|
@Parameter(name="id", type=CommandType.LONG)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Parameter(name="ids", type=CommandType.LIST, collectionType=CommandType.LONG)
|
||||||
|
private List<Long> ids;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getAccountName() {
|
||||||
|
return accountName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDomainId() {
|
||||||
|
return domainId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Long> getIds() {
|
||||||
|
return ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.storage.VMTemplateVO;
|
import com.cloud.storage.VMTemplateVO;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
@ -42,6 +43,34 @@ public class DeleteTemplateCmd extends BaseCmd {
|
|||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ZONE_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ZONE_ID, Boolean.FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="id", type=CommandType.LONG, required=true)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Parameter(name="zoneid", type=CommandType.LONG)
|
||||||
|
private Long zoneId;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getZoneId() {
|
||||||
|
return zoneId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
import com.cloud.user.User;
|
import com.cloud.user.User;
|
||||||
@ -39,6 +40,27 @@ public class DeleteUserCmd extends BaseCmd {
|
|||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.TRUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="id", type=CommandType.LONG, required=true)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
public static String getStaticName() {
|
public static String getStaticName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,13 +21,12 @@ package com.cloud.api.commands;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.StringTokenizer;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.dc.VlanVO;
|
|
||||||
import com.cloud.exception.InvalidParameterValueException;
|
import com.cloud.exception.InvalidParameterValueException;
|
||||||
import com.cloud.user.User;
|
import com.cloud.user.User;
|
||||||
import com.cloud.utils.Pair;
|
import com.cloud.utils.Pair;
|
||||||
@ -43,6 +42,27 @@ public class DeleteVlanIpRangeCmd extends BaseCmd {
|
|||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="id", type=CommandType.LONG, required=true)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.storage.VolumeVO;
|
import com.cloud.storage.VolumeVO;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
@ -40,6 +41,27 @@ public class DeleteVolumeCmd extends BaseCmd {
|
|||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.TRUE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.TRUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="id", type=CommandType.LONG, required=true)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.dc.DataCenterVO;
|
import com.cloud.dc.DataCenterVO;
|
||||||
import com.cloud.user.User;
|
import com.cloud.user.User;
|
||||||
@ -41,6 +42,27 @@ public class DeleteZoneCmd extends BaseCmd {
|
|||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="id", type=CommandType.LONG, required=true)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.async.executor.DeployVMResultObject;
|
import com.cloud.async.executor.DeployVMResultObject;
|
||||||
import com.cloud.dc.DataCenterVO;
|
import com.cloud.dc.DataCenterVO;
|
||||||
@ -44,21 +45,105 @@ public class DeployVMCmd extends BaseCmd {
|
|||||||
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ZONE_ID, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.SERVICE_OFFERING_ID, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DISK_OFFERING_ID, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.TEMPLATE_ID, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DISPLAY_NAME, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.GROUP, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_DATA, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DISK_OFFERING_ID, Boolean.FALSE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DISPLAY_NAME, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.GROUP, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NETWORK_GROUP_LIST, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NETWORK_GROUP_LIST, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.SIZE, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.SERVICE_OFFERING_ID, Boolean.TRUE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.TEMPLATE_ID, Boolean.TRUE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_DATA, Boolean.FALSE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ZONE_ID, Boolean.TRUE));
|
||||||
|
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
//////////////// API parameters /////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Parameter(name="account", type=CommandType.STRING)
|
||||||
|
private String accountName;
|
||||||
|
|
||||||
|
@Parameter(name="diskofferingid", type=CommandType.LONG)
|
||||||
|
private Long diskOfferingId;
|
||||||
|
|
||||||
|
@Parameter(name="displayname", type=CommandType.STRING)
|
||||||
|
private String displayName;
|
||||||
|
|
||||||
|
@Parameter(name="domainid", type=CommandType.LONG)
|
||||||
|
private Long domainId;
|
||||||
|
|
||||||
|
@Parameter(name="group", type=CommandType.STRING)
|
||||||
|
private String group;
|
||||||
|
|
||||||
|
@Parameter(name="networkgrouplist", type=CommandType.LIST, collectionType=CommandType.STRING)
|
||||||
|
private List<String> networkGroupList;
|
||||||
|
|
||||||
|
@Parameter(name="serviceofferingid", type=CommandType.LONG, required=true)
|
||||||
|
private Long serviceOfferingId;
|
||||||
|
|
||||||
|
@Parameter(name="templateid", type=CommandType.LONG, required=true)
|
||||||
|
private Long templateId;
|
||||||
|
|
||||||
|
@Parameter(name="userdata", type=CommandType.STRING)
|
||||||
|
private String userData;
|
||||||
|
|
||||||
|
@Parameter(name="zoneid", type=CommandType.LONG, required=true)
|
||||||
|
private Long zoneId;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////////// Accessors ///////////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getAccountName() {
|
||||||
|
return accountName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDiskOfferingId() {
|
||||||
|
return diskOfferingId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDisplayName() {
|
||||||
|
return displayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDomainId() {
|
||||||
|
return domainId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGroup() {
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getNetworkGroupList() {
|
||||||
|
return networkGroupList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getServiceOfferingId() {
|
||||||
|
return serviceOfferingId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getTemplateId() {
|
||||||
|
return templateId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserData() {
|
||||||
|
return userData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getZoneId() {
|
||||||
|
return zoneId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
/////////////// API Implementation///////////////////
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
@ -87,13 +172,10 @@ public class DeployVMCmd extends BaseCmd {
|
|||||||
String group = (String)params.get(BaseCmd.Properties.GROUP.getName());
|
String group = (String)params.get(BaseCmd.Properties.GROUP.getName());
|
||||||
String userData = (String) params.get(BaseCmd.Properties.USER_DATA.getName());
|
String userData = (String) params.get(BaseCmd.Properties.USER_DATA.getName());
|
||||||
String networkGroupList = (String)params.get(BaseCmd.Properties.NETWORK_GROUP_LIST.getName());
|
String networkGroupList = (String)params.get(BaseCmd.Properties.NETWORK_GROUP_LIST.getName());
|
||||||
Long size = (Long)params.get(BaseCmd.Properties.SIZE.getName());
|
|
||||||
String password = null;
|
String password = null;
|
||||||
Long accountId = null;
|
Long accountId = null;
|
||||||
|
|
||||||
if(size == null)
|
|
||||||
size = Long.valueOf(0);
|
|
||||||
|
|
||||||
VMTemplateVO template = getManagementServer().findTemplateById(templateId);
|
VMTemplateVO template = getManagementServer().findTemplateById(templateId);
|
||||||
if (template == null) {
|
if (template == null) {
|
||||||
throw new ServerApiException(BaseCmd.VM_INVALID_PARAM_ERROR, "Unable to find template with id " + templateId);
|
throw new ServerApiException(BaseCmd.VM_INVALID_PARAM_ERROR, "Unable to find template with id " + templateId);
|
||||||
@ -171,7 +253,7 @@ public class DeployVMCmd extends BaseCmd {
|
|||||||
long jobId = mgr.deployVirtualMachineAsync(userId.longValue(), accountId.longValue(), zoneId.longValue(),
|
long jobId = mgr.deployVirtualMachineAsync(userId.longValue(), accountId.longValue(), zoneId.longValue(),
|
||||||
serviceOfferingId.longValue(),
|
serviceOfferingId.longValue(),
|
||||||
templateId.longValue(), diskOfferingId,
|
templateId.longValue(), diskOfferingId,
|
||||||
null, password, displayName, group, userData, groups,size);
|
null, password, displayName, group, userData, groups);
|
||||||
|
|
||||||
long vmId = 0;
|
long vmId = 0;
|
||||||
if (jobId == 0) {
|
if (jobId == 0) {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user