mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Committing Kris' big merge
This commit is contained in:
parent
df5aa16f3c
commit
14ae76781e
12
.gitignore
vendored
12
.gitignore
vendored
@ -0,0 +1,12 @@
|
|||||||
|
build/build.number
|
||||||
|
bin
|
||||||
|
cloudstack-proprietary
|
||||||
|
.lock-wscript
|
||||||
|
artifacts
|
||||||
|
.waf-*
|
||||||
|
waf-*
|
||||||
|
target
|
||||||
|
override
|
||||||
|
premium
|
||||||
|
.metadata
|
||||||
|
dist
|
||||||
381
HACKING
381
HACKING
@ -165,11 +165,14 @@ 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 Console Proxy up:
|
2) If you haven't done so yet, set the Agent up:
|
||||||
|
|
||||||
- run $BINDIR/cloud-setup-agent
|
- run $BINDIR/cloud-setup-agent
|
||||||
|
|
||||||
3) Execute $LIBEXECDIR/agent-runner as root
|
3) Execute ./waf run_agent 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):
|
||||||
@ -187,7 +190,183 @@ independently from the install directory:
|
|||||||
|
|
||||||
- run $BINDIR/cloud-setup-console-proxy
|
- run $BINDIR/cloud-setup-console-proxy
|
||||||
|
|
||||||
3) Execute $LIBEXECDIR/console-proxy-runner as root
|
3) Execute ./waf run_console_proxy
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
@ -195,6 +374,22 @@ 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
|
||||||
@ -275,3 +470,183 @@ 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
Normal file
155
INSTALL
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
---------------------------------------------------------------------
|
||||||
|
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,202 +8,19 @@ cloud.
|
|||||||
|
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
TABLE OF CONTENTS
|
HOW TO INSTALL THE CLOUDSTACK
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
1. Really quick start: building and installing a production stack
|
Please refer to the document INSTALL distributed with the source.
|
||||||
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!
|
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
REALLY QUICK START: BUILDING AND INSTALLING A PRODUCTION STACK
|
HOW TO HACK ON THE CLOUDSTACK
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
You have two options. Choose one:
|
Please refer to the document HACKING distributed with the source.
|
||||||
|
|
||||||
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
Normal file
10555
README.html
Normal file
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 -D$x.network.device="$defaultroute
|
SERVICEARGS="$SERVICEARGS $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" $SERVICEARGS "$@" com.cloud.agent.AgentShell &
|
java -Xms128M -Xmx384M -cp "$CLASSPATH" "$@" com.cloud.agent.AgentShell $SERVICEARGS &
|
||||||
agentpid=$!
|
agentpid=$!
|
||||||
echo "Agent started. PID: $!" >&2
|
echo "Agent started. PID: $!" >&2
|
||||||
wait $agentpid
|
wait $agentpid
|
||||||
|
|||||||
@ -114,6 +114,7 @@ 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;
|
||||||
@ -852,8 +853,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);
|
||||||
@ -1069,6 +1070,8 @@ 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) {
|
||||||
@ -1174,7 +1177,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);
|
||||||
new CreateAnswer(cmd, result);
|
return new CreateAnswer(cmd, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd.getTemplateUrl() != null) {
|
if (cmd.getTemplateUrl() != null) {
|
||||||
@ -1182,7 +1185,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);
|
||||||
new CreateAnswer(cmd, result);
|
return 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);
|
||||||
@ -1269,6 +1272,14 @@ 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) {
|
||||||
@ -1278,10 +1289,45 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1475,7 +1521,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 = secondaryPool.storageVolLookupByName(tmpltname);
|
tmplVol = getVolume(secondaryPool, getPathOfStoragePool(secondaryPool) + 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");
|
||||||
}
|
}
|
||||||
@ -1489,6 +1535,7 @@ 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,
|
||||||
@ -1520,6 +1567,8 @@ 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) {
|
||||||
@ -1808,12 +1857,6 @@ 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) {
|
||||||
@ -2025,6 +2068,16 @@ 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 {
|
||||||
@ -2059,8 +2112,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);
|
||||||
@ -2233,8 +2286,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) {
|
||||||
@ -3115,7 +3168,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, "vdb", diskDef.diskBus.IDE, diskDef.diskFmtType.QCOW2);
|
hdb.defFileBasedDisk(datadiskPath, "hdb", diskDef.diskBus.IDE, diskDef.diskFmtType.RAW);
|
||||||
disks.add(hdb);
|
disks.add(hdb);
|
||||||
|
|
||||||
return disks;
|
return disks;
|
||||||
@ -3163,12 +3216,12 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
disks.add(hdb);
|
disks.add(hdb);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isoPath != null) {
|
/*Add a placeholder for iso, even if there is no iso attached*/
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3492,4 +3545,7 @@ 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,15 +17,18 @@
|
|||||||
*/
|
*/
|
||||||
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
|
|
||||||
|
|
||||||
protected VmCharacteristics() {
|
Map<String, String> params;
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public VmCharacteristics(VirtualMachine.Type type) {
|
public VmCharacteristics(VirtualMachine.Type type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
@ -34,4 +37,32 @@ 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
42
build.xml
42
build.xml
@ -10,15 +10,7 @@
|
|||||||
</description>
|
</description>
|
||||||
|
|
||||||
<dirname property="base.dir" file="${ant.file.Cloud.com Cloud Stack Build Dispatch}"/>
|
<dirname property="base.dir" file="${ant.file.Cloud.com Cloud Stack Build Dispatch}"/>
|
||||||
|
<property name="build.dir" location="${base.dir}/build"/>
|
||||||
<condition property="build.dir" value="${base.dir}/build" else="${base.dir}/build"> <!-- silly no-op -->
|
|
||||||
<and>
|
|
||||||
<available file="cloudstack-proprietary/build/build-cloud-premium.xml"/>
|
|
||||||
<not>
|
|
||||||
<isset property="OSS"/>
|
|
||||||
</not>
|
|
||||||
</and>
|
|
||||||
</condition>
|
|
||||||
|
|
||||||
<condition property="build-cloud.properties.file" value="${build.dir}/override/build-cloud.properties" else="${build.dir}/build-cloud.properties">
|
<condition property="build-cloud.properties.file" value="${build.dir}/override/build-cloud.properties" else="${build.dir}/build-cloud.properties">
|
||||||
<available file="${build.dir}/override/build-cloud.properties" />
|
<available file="${build.dir}/override/build-cloud.properties" />
|
||||||
@ -29,57 +21,57 @@
|
|||||||
<property name="dist.dir" location="${base.dir}/dist"/>
|
<property name="dist.dir" location="${base.dir}/dist"/>
|
||||||
<property name="target.dir" location="${base.dir}/target"/>
|
<property name="target.dir" location="${base.dir}/target"/>
|
||||||
|
|
||||||
<condition property="build.file" value="cloudstack-proprietary/build/build-cloud-premium.xml" else="${build.dir}/build-cloud.xml">
|
<condition property="build.file" value="premium/build-cloud-premium.xml" else="build-cloud.xml">
|
||||||
<and>
|
<and>
|
||||||
<available file="cloudstack-proprietary/build/build-cloud-premium.xml"/>
|
<available file="build/premium/build-cloud-premium.xml"/>
|
||||||
<not>
|
<not>
|
||||||
<isset property="OSS"/>
|
<isset property="OSS"/>
|
||||||
</not>
|
</not>
|
||||||
</and>
|
</and>
|
||||||
</condition>
|
</condition>
|
||||||
|
|
||||||
<condition property="package.file" value="cloudstack-proprietary/build/package-premium.xml" else="${build.dir}/package.xml">
|
<condition property="package.file" value="premium/package-premium.xml" else="package.xml">
|
||||||
<and>
|
<and>
|
||||||
<available file="cloudstack-proprietary/build/package-premium.xml"/>
|
<available file="build/premium/package-premium.xml"/>
|
||||||
<not>
|
<not>
|
||||||
<isset property="OSS"/>
|
<isset property="OSS"/>
|
||||||
</not>
|
</not>
|
||||||
</and>
|
</and>
|
||||||
</condition>
|
</condition>
|
||||||
|
|
||||||
<condition property="developer.file" value="cloudstack-proprietary/build/developer-premium.xml" else="${build.dir}/developer.xml">
|
<condition property="developer.file" value="premium/developer-premium.xml" else="developer.xml">
|
||||||
<and>
|
<and>
|
||||||
<available file="cloudstack-proprietary/build/developer-premium.xml"/>
|
<available file="build/premium/developer-premium.xml"/>
|
||||||
<not>
|
<not>
|
||||||
<isset property="OSS"/>
|
<isset property="OSS"/>
|
||||||
</not>
|
</not>
|
||||||
</and>
|
</and>
|
||||||
</condition>
|
</condition>
|
||||||
|
|
||||||
<condition property="docs.file" value="cloudstack-proprietary/build/build-docs-premium.xml" else="${build.dir}/build-docs.xml">
|
<condition property="docs.file" value="premium/build-docs-premium.xml" else="build-docs.xml">
|
||||||
<and>
|
<and>
|
||||||
<available file="cloudstack-proprietary/build/build-docs-premium.xml"/>
|
<available file="build/premium/build-docs-premium.xml"/>
|
||||||
<not>
|
<not>
|
||||||
<isset property="OSS"/>
|
<isset property="OSS"/>
|
||||||
</not>
|
</not>
|
||||||
</and>
|
</and>
|
||||||
</condition>
|
</condition>
|
||||||
|
|
||||||
<condition property="test.file" value="cloudstack-proprietary/build/build-tests-premium.xml" else="${build.dir}/build-tests.xml">
|
<condition property="test.file" value="premium/build-tests-premium.xml" else="build-tests.xml">
|
||||||
<and>
|
<and>
|
||||||
<available file="cloudstack-proprietary/build/build-tests-premium.xml"/>
|
<available file="build/premium/build-tests-premium.xml"/>
|
||||||
<not>
|
<not>
|
||||||
<isset property="OSS"/>
|
<isset property="OSS"/>
|
||||||
</not>
|
</not>
|
||||||
</and>
|
</and>
|
||||||
</condition>
|
</condition>
|
||||||
|
|
||||||
<import file="${base.dir}/cloudstack-proprietary/plugins/zynga/build.xml" optional='true'/>
|
<import file="${base.dir}/plugins/zynga/build.xml" optional='true'/>
|
||||||
<import file="${build.file}" optional="false"/>
|
<import file="${build.dir}/${build.file}" optional="false"/>
|
||||||
<import file="${docs.file}" optional="true"/>
|
<import file="${build.dir}/${docs.file}" optional="true"/>
|
||||||
<import file="${test.file}" optional="true"/>
|
<import file="${build.dir}/${test.file}" optional="true"/>
|
||||||
<import file="${package.file}" optional="true"/>
|
<import file="${build.dir}/${package.file}" optional="true"/>
|
||||||
<import file="${developer.file}" optional="true"/>
|
<import file="${build.dir}/${developer.file}" optional="true"/>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
||||||
|
|||||||
@ -60,9 +60,7 @@
|
|||||||
<property name="dep.cache.dir" location="${target.dir}/dep-cache" />
|
<property name="dep.cache.dir" location="${target.dir}/dep-cache" />
|
||||||
<property name="build.log" location="${target.dir}/ant_verbose.txt" />
|
<property name="build.log" location="${target.dir}/ant_verbose.txt" />
|
||||||
|
|
||||||
<property name="proprietary.dir" location="${base.dir}/cloudstack-proprietary" />
|
<property name="thirdparty.dir" location="${base.dir}/thirdparty" />
|
||||||
|
|
||||||
<property name="thirdparty.dir" location="${proprietary.dir}/thirdparty" />
|
|
||||||
<property name="deps.dir" location="${base.dir}/deps" />
|
<property name="deps.dir" location="${base.dir}/deps" />
|
||||||
|
|
||||||
<!-- directories for client compilation-->
|
<!-- directories for client compilation-->
|
||||||
@ -201,8 +199,7 @@
|
|||||||
<copy todir="${scripts.target.dir}">
|
<copy todir="${scripts.target.dir}">
|
||||||
<fileset dir="${scripts.dir}">
|
<fileset dir="${scripts.dir}">
|
||||||
<include name="**/*"/>
|
<include name="**/*"/>
|
||||||
<exclude name="**/.classpath" />
|
<exclude name="**/.*" />
|
||||||
<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/" />
|
||||||
@ -223,6 +220,7 @@
|
|||||||
<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>
|
||||||
@ -236,6 +234,7 @@
|
|||||||
<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,7 +132,11 @@
|
|||||||
<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>
|
||||||
@ -232,8 +236,7 @@
|
|||||||
</delete>
|
</delete>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- The following target is OBSOLETE. If you need to add a jar file / target, go to the function def runant(target): in wscrpit_build, and list the jar file and the target in the appropriate places -->
|
<target name="sendjarfiles" depends="compile-utils, compile-core, compile-server, compile-agent, compile-console-common, compile-console-proxy, build-console-viewer">
|
||||||
<target name="sendjarfiles" depends="compile-utils, compile-core, compile-server, compile-agent, compile-console-common, compile-console-proxy, build-console-viewer">
|
|
||||||
<copy todir="${waf.artifacts}">
|
<copy todir="${waf.artifacts}">
|
||||||
<fileset dir="${target.dir}/jar"/>
|
<fileset dir="${target.dir}/jar"/>
|
||||||
</copy>
|
</copy>
|
||||||
|
|||||||
41
cloud.spec
41
cloud.spec
@ -237,6 +237,7 @@ 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
|
||||||
@ -450,14 +451,18 @@ 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
|
||||||
@ -465,7 +470,9 @@ 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}
|
||||||
@ -475,7 +482,9 @@ 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
|
||||||
@ -485,19 +494,23 @@ 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
|
||||||
@ -506,7 +519,9 @@ 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
|
||||||
@ -529,13 +544,16 @@ 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
|
||||||
|
|
||||||
@ -545,14 +563,18 @@ 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
|
||||||
@ -572,7 +594,9 @@ 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
|
||||||
@ -614,13 +638,16 @@ 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
|
||||||
|
|
||||||
@ -639,7 +666,9 @@ 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
|
||||||
@ -654,7 +683,9 @@ 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}
|
||||||
@ -667,14 +698,18 @@ 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
|
||||||
@ -688,7 +723,9 @@ 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
|
||||||
@ -701,7 +738,9 @@ 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 -D$x.network.device="$defaultroute
|
SERVICEARGS="$SERVICEARGS $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" $SERVICEARGS "$@" com.cloud.agent.AgentShell &
|
java -Xms128M -Xmx384M -cp "$CLASSPATH" "$@" com.cloud.agent.AgentShell $SERVICEARGS &
|
||||||
agentpid=$!
|
agentpid=$!
|
||||||
echo "Console Proxy started. PID: $!" >&2
|
echo "Console Proxy started. PID: $!" >&2
|
||||||
wait $agentpid
|
wait $agentpid
|
||||||
|
|||||||
@ -18,5 +18,26 @@
|
|||||||
<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,6 +30,7 @@ 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() {
|
||||||
|
|
||||||
@ -56,7 +57,8 @@ 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;
|
||||||
@ -64,6 +66,7 @@ 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() {
|
||||||
@ -86,4 +89,7 @@ public class BackupSnapshotCommand extends SnapshotCommand {
|
|||||||
return isVolumeInactive;
|
return isVolumeInactive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getVmName() {
|
||||||
|
return vmName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -29,6 +29,7 @@ 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();
|
||||||
@ -44,7 +45,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);
|
this(vol, vm, diskCharacteristics, pool, 0);
|
||||||
this.templateUrl = templateUrl;
|
this.templateUrl = templateUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,11 +57,12 @@ public class CreateCommand extends Command {
|
|||||||
* @param diskCharacteristics
|
* @param diskCharacteristics
|
||||||
* @param pool
|
* @param pool
|
||||||
*/
|
*/
|
||||||
public CreateCommand(VolumeVO vol, VMInstanceVO vm, DiskCharacteristicsTO diskCharacteristics, StoragePoolVO pool) {
|
public CreateCommand(VolumeVO vol, VMInstanceVO vm, DiskCharacteristicsTO diskCharacteristics, StoragePoolVO pool, long size) {
|
||||||
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
|
||||||
@ -83,4 +85,8 @@ public class CreateCommand extends Command {
|
|||||||
public long getVolumeId() {
|
public long getVolumeId() {
|
||||||
return volId;
|
return volId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getSize(){
|
||||||
|
return this.size;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,122 @@
|
|||||||
|
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.StorageLayer;
|
|
||||||
import com.cloud.storage.StoragePoolVO;
|
|
||||||
import com.cloud.storage.VolumeVO;
|
|
||||||
import com.cloud.storage.Storage.ImageFormat;
|
import com.cloud.storage.Storage.ImageFormat;
|
||||||
import com.cloud.storage.Storage.StoragePoolType;
|
import com.cloud.storage.Storage.StoragePoolType;
|
||||||
|
import com.cloud.storage.StorageLayer;
|
||||||
|
import com.cloud.storage.StoragePoolVO;
|
||||||
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,6 +171,7 @@ 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;
|
||||||
@ -183,6 +184,10 @@ 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;
|
||||||
@ -190,9 +195,6 @@ 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.
|
||||||
@ -2792,6 +2794,7 @@ 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();
|
||||||
@ -3163,6 +3166,29 @@ 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);
|
||||||
}
|
}
|
||||||
@ -3520,7 +3546,6 @@ 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)) {
|
||||||
@ -3532,7 +3557,6 @@ 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;
|
||||||
|
|
||||||
@ -3548,7 +3572,6 @@ 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);
|
||||||
@ -3656,6 +3679,35 @@ 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{
|
||||||
@ -3668,8 +3720,6 @@ 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);
|
||||||
@ -4016,9 +4066,15 @@ 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);
|
||||||
@ -4225,7 +4281,11 @@ 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;
|
private String _externalIpAllocatorUrl = null;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IpAddr getPrivateIpAddress(String macAddr, long dcId, long podId) {
|
public IpAddr getPrivateIpAddress(String macAddr, long dcId, long podId) {
|
||||||
if (this._externalIpAllocatorUrl.equalsIgnoreCase("")) {
|
if (_externalIpAllocatorUrl == null || 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,10 +102,12 @@ 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*/
|
||||||
String urlString = this._externalIpAllocatorUrl + "?command=releaseIpAddr&ip=" + ip + "&dc=" + dcId + "&pod=" + podId;
|
if (_externalIpAllocatorUrl == null || this._externalIpAllocatorUrl.equalsIgnoreCase("")) {
|
||||||
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,10 +481,11 @@ 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) throws InternalErrorException;
|
VolumeVO createVolume(long accountId, long userId, String name, long zoneId, long diskOfferingId, long startEventId, long size) throws InternalErrorException;
|
||||||
long createVolumeAsync(long accountId, long userId, String name, long zoneId, long diskOfferingId) throws InvalidParameterValueException, InternalErrorException, ResourceAllocationException;
|
long createVolumeAsync(long accountId, long userId, String name, long zoneId, long diskOfferingId, long size) throws InvalidParameterValueException, InternalErrorException, ResourceAllocationException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds the root volume of the VM
|
* Finds the root volume of the VM
|
||||||
@ -643,14 +644,15 @@ 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) 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, long size) 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) 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, long size) throws InvalidParameterValueException, PermissionDeniedException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts a Virtual Machine
|
* Starts a Virtual Machine
|
||||||
@ -712,8 +714,9 @@ 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;
|
boolean recoverVirtualMachine(long vmId) throws ResourceAllocationException, InternalErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Upgrade the virtual machine to a new service offering
|
* Upgrade the virtual machine to a new service offering
|
||||||
@ -1766,6 +1769,12 @@ 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
|
||||||
@ -2173,4 +2182,6 @@ 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,6 +156,10 @@ 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,6 +34,7 @@ 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;
|
||||||
@ -92,9 +93,10 @@ 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) throws StorageUnavailableException, ExecutionException;
|
List<VolumeVO> create(Account account, VMInstanceVO vm, VMTemplateVO template, DataCenterVO dc, HostPodVO pod, ServiceOfferingVO offering, DiskOfferingVO diskOffering, long size) throws StorageUnavailableException, ExecutionException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create StoragePool based on uri
|
* Create StoragePool based on uri
|
||||||
@ -156,7 +158,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);
|
List<StoragePoolVO> avoids, long size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
@ -168,7 +170,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);
|
Answer sendToHostsOnStoragePool(Long poolId, Command cmd, String basicErrMsg, int retriesPerHost, int pauseBeforeRetry, boolean shouldBeSnapshotCapable, Long vmId );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -195,9 +197,10 @@ 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);
|
VolumeVO createVolume(long accountId, long userId, String name, DataCenterVO dc, DiskOfferingVO diskOffering, long startEventId, long size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
@ -230,6 +233,8 @@ 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,4 +25,6 @@ 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,6 +38,7 @@ 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() {
|
||||||
@ -45,6 +46,10 @@ 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");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,6 +61,13 @@ 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,7 +130,6 @@ 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,6 +28,8 @@ 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,6 +146,13 @@ 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();
|
||||||
|
|||||||
@ -155,6 +155,24 @@ 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,6 +122,25 @@ 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,
|
||||||
|
|||||||
651
core/test/com/cloud/vmware/TestVMWare.java
Normal file
651
core/test/com/cloud/vmware/TestVMWare.java
Normal file
@ -0,0 +1,651 @@
|
|||||||
|
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 HACKING
|
dh_installdocs -A README INSTALL HACKING README.html
|
||||||
# dh_installexamples
|
# dh_installexamples
|
||||||
# dh_installmenu
|
# dh_installmenu
|
||||||
# dh_installdebconf
|
# dh_installdebconf
|
||||||
|
|||||||
@ -790,13 +790,14 @@ class SetupFirewall2(ConfigTask):
|
|||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
|
|
||||||
yield "Permitting traffic in the bridge interface and for VNC ports"
|
yield "Permitting traffic in the bridge interface, migration port 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)
|
||||||
@ -813,6 +814,7 @@ 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")
|
||||||
@ -924,7 +926,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",e,confopts["zone"],confopts["pod"])
|
stderr("You selected zone %s pod %s",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.eclipse.jdt.core.javabuilder</name>
|
<name>org.python.pydev.PyDevBuilder</name>
|
||||||
<arguments>
|
<arguments>
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
</buildSpec>
|
</buildSpec>
|
||||||
<natures>
|
<natures>
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
<nature>org.python.pydev.pythonNature</nature>
|
||||||
</natures>
|
</natures>
|
||||||
</projectDescription>
|
</projectDescription>
|
||||||
|
|||||||
7
scripts/.pydevproject
Normal file
7
scripts/.pydevproject
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?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 11474 2010-08-06 05:53:02Z edison $ $HeadURL: svn://svn.lab.vmops.com/repos/vmdev/java/scripts/storage/qcow2/createtmplt.sh $
|
# $Id: createtmplt.sh 11601 2010-08-11 17:26:15Z kris $ $HeadURL: svn://svn.lab.vmops.com/repos/branches/2.1.refactor/java/scripts/storage/qcow2/createtmplt.sh $
|
||||||
# createtmplt.sh -- install a template
|
# createtmplt.sh -- install a template
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
@ -142,6 +142,11 @@ 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 11474 2010-08-06 05:53:02Z edison $ $HeadURL: svn://svn.lab.vmops.com/repos/vmdev/java/scripts/storage/qcow2/managesnapshot.sh $
|
# $Id: managesnapshot.sh 11601 2010-08-11 17:26:15Z kris $ $HeadURL: svn://svn.lab.vmops.com/repos/branches/2.1.refactor/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,16 +34,19 @@ create_snapshot() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
destroy_snapshot() {
|
destroy_snapshot() {
|
||||||
local disk=$1
|
local backupSnapDir=$1
|
||||||
local snapshotname=$2
|
local snapshotname=$2
|
||||||
local failed=0
|
local failed=0
|
||||||
|
|
||||||
qemu-img snapshot -d $snapshotname $disk
|
if [ -f $backupSnapDir/$snapshotname ]
|
||||||
|
|
||||||
if [ $? -gt 0 ]
|
|
||||||
then
|
then
|
||||||
printf "***Failed to delete snapshot $snapshotname for path $disk\n" >&2
|
rm -f $backupSnapDir/$snapshotname
|
||||||
failed=1
|
|
||||||
|
if [ $? -gt 0 ]
|
||||||
|
then
|
||||||
|
printf "***Failed to delete snapshot $snapshotname for path $backupSnapDir\n" >&2
|
||||||
|
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/heartbeat.sh $1 $2 >/var/log/heartbeat.log 2>&1 &
|
nohup /opt/xensource/bin/xenheartbeat.sh $1 $2 >/var/log/heartbeat.log 2>&1 &
|
||||||
echo "======> DONE <======"
|
echo "======> DONE <======"
|
||||||
|
|||||||
@ -23,5 +23,10 @@ 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 11388 2010-08-02 17:04:13Z edison $ $HeadURL: svn://svn.lab.vmops.com/repos/vmdev/java/scripts/vm/network/vnet/modifyvlan.sh $
|
# $Id: modifyvlan.sh 11601 2010-08-11 17:26:15Z kris $ $HeadURL: svn://svn.lab.vmops.com/repos/branches/2.1.refactor/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,6 +128,13 @@ 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
|
||||||
|
|||||||
@ -219,14 +219,6 @@ 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) {
|
||||||
|
|||||||
@ -28,7 +28,9 @@ import com.cloud.api.BaseCmd;
|
|||||||
import com.cloud.api.Parameter;
|
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;
|
||||||
@ -48,6 +50,7 @@ public class CreateVolumeCmd 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));
|
||||||
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.ZONE_ID, Boolean.FALSE));
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ZONE_ID, Boolean.FALSE));
|
||||||
|
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.SIZE, Boolean.FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
@ -128,6 +131,7 @@ 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
|
||||||
@ -167,12 +171,45 @@ 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)) {
|
{
|
||||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Missing parameter(s), both zoneid and diskofferingid must be specified.");
|
if ((zoneId == null))
|
||||||
|
{
|
||||||
|
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);
|
||||||
@ -197,7 +234,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);
|
jobId = getManagementServer().createVolumeAsync(userId, account.getId(), name, zoneId, diskOfferingId, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (jobId == 0) {
|
if (jobId == 0) {
|
||||||
|
|||||||
@ -52,10 +52,10 @@ public class DeployVMCmd extends BaseCmd {
|
|||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.GROUP, 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.SERVICE_OFFERING_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.SIZE, Boolean.FALSE));
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.TEMPLATE_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.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.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.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));
|
||||||
}
|
}
|
||||||
@ -85,6 +85,9 @@ public class DeployVMCmd extends BaseCmd {
|
|||||||
@Parameter(name="serviceofferingid", type=CommandType.LONG, required=true)
|
@Parameter(name="serviceofferingid", type=CommandType.LONG, required=true)
|
||||||
private Long serviceOfferingId;
|
private Long serviceOfferingId;
|
||||||
|
|
||||||
|
@Parameter(name="size", type=CommandType.LONG)
|
||||||
|
private Long size;
|
||||||
|
|
||||||
@Parameter(name="templateid", type=CommandType.LONG, required=true)
|
@Parameter(name="templateid", type=CommandType.LONG, required=true)
|
||||||
private Long templateId;
|
private Long templateId;
|
||||||
|
|
||||||
@ -127,6 +130,10 @@ public class DeployVMCmd extends BaseCmd {
|
|||||||
return serviceOfferingId;
|
return serviceOfferingId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getSize() {
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
public Long getTemplateId() {
|
public Long getTemplateId() {
|
||||||
return templateId;
|
return templateId;
|
||||||
}
|
}
|
||||||
@ -172,10 +179,13 @@ 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);
|
||||||
@ -253,7 +263,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);
|
null, password, displayName, group, userData, groups,size);
|
||||||
|
|
||||||
long vmId = 0;
|
long vmId = 0;
|
||||||
if (jobId == 0) {
|
if (jobId == 0) {
|
||||||
|
|||||||
@ -214,10 +214,14 @@ public class ListTemplatesCmd extends BaseCmd {
|
|||||||
templateData.add(new Pair<String, Object>(BaseCmd.Properties.DISPLAY_TEXT.getName(), template.getDisplayText()));
|
templateData.add(new Pair<String, Object>(BaseCmd.Properties.DISPLAY_TEXT.getName(), template.getDisplayText()));
|
||||||
templateData.add(new Pair<String, Object>(BaseCmd.Properties.IS_PUBLIC.getName(), Boolean.valueOf(template.isPublicTemplate()).toString()));
|
templateData.add(new Pair<String, Object>(BaseCmd.Properties.IS_PUBLIC.getName(), Boolean.valueOf(template.isPublicTemplate()).toString()));
|
||||||
templateData.add(new Pair<String, Object>(BaseCmd.Properties.CREATED.getName(), getDateString(templateHostRef.getCreated())));
|
templateData.add(new Pair<String, Object>(BaseCmd.Properties.CREATED.getName(), getDateString(templateHostRef.getCreated())));
|
||||||
|
if(template.getRemoved() != null){
|
||||||
|
templateData.add(new Pair<String, Object>(BaseCmd.Properties.REMOVED.getName(), getDateString(template.getRemoved())));
|
||||||
|
}
|
||||||
templateData.add(new Pair<String, Object>(BaseCmd.Properties.IS_READY.getName(), Boolean.valueOf(templateHostRef.getDownloadState()==Status.DOWNLOADED).toString()));
|
templateData.add(new Pair<String, Object>(BaseCmd.Properties.IS_READY.getName(), Boolean.valueOf(templateHostRef.getDownloadState()==Status.DOWNLOADED).toString()));
|
||||||
templateData.add(new Pair<String, Object>(BaseCmd.Properties.IS_FEATURED.getName(), Boolean.valueOf(template.isFeatured()).toString()));
|
templateData.add(new Pair<String, Object>(BaseCmd.Properties.IS_FEATURED.getName(), Boolean.valueOf(template.isFeatured()).toString()));
|
||||||
templateData.add(new Pair<String, Object>(BaseCmd.Properties.PASSWORD_ENABLED.getName(), Boolean.valueOf(template.getEnablePassword()).toString()));
|
templateData.add(new Pair<String, Object>(BaseCmd.Properties.PASSWORD_ENABLED.getName(), Boolean.valueOf(template.getEnablePassword()).toString()));
|
||||||
templateData.add(new Pair<String, Object>(BaseCmd.Properties.CROSS_ZONES.getName(), Boolean.valueOf(template.isCrossZones()).toString()));
|
templateData.add(new Pair<String, Object>(BaseCmd.Properties.CROSS_ZONES.getName(), Boolean.valueOf(template.isCrossZones()).toString()));
|
||||||
|
templateData.add(new Pair<String, Object>(BaseCmd.Properties.FORMAT.getName(), template.getFormat()));
|
||||||
|
|
||||||
GuestOS os = getManagementServer().findGuestOSById(template.getGuestOSId());
|
GuestOS os = getManagementServer().findGuestOSById(template.getGuestOSId());
|
||||||
if (os != null) {
|
if (os != null) {
|
||||||
|
|||||||
@ -27,6 +27,7 @@ import org.apache.log4j.Logger;
|
|||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
import com.cloud.api.Parameter;
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
|
import com.cloud.exception.InternalErrorException;
|
||||||
import com.cloud.exception.ResourceAllocationException;
|
import com.cloud.exception.ResourceAllocationException;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
import com.cloud.utils.Pair;
|
import com.cloud.utils.Pair;
|
||||||
@ -100,6 +101,8 @@ public class RecoverVMCmd extends BaseCmd {
|
|||||||
return returnValues;
|
return returnValues;
|
||||||
} catch (ResourceAllocationException ex) {
|
} catch (ResourceAllocationException ex) {
|
||||||
throw new ServerApiException(BaseCmd.VM_RECOVER_ERROR, "Failed to recover virtual machine with id " + vmId + "; " + ex.getMessage());
|
throw new ServerApiException(BaseCmd.VM_RECOVER_ERROR, "Failed to recover virtual machine with id " + vmId + "; " + ex.getMessage());
|
||||||
}
|
} catch (InternalErrorException e) {
|
||||||
|
throw new ServerApiException(BaseCmd.VM_RECOVER_ERROR, "Failed to recover virtual machine with id " + vmId + "; " + e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -270,6 +270,7 @@ public class RegisterTemplateCmd extends BaseCmd {
|
|||||||
listForEmbeddedObject.add(new Pair<String, Object>(BaseCmd.Properties.NAME.getName(), template.getName()));
|
listForEmbeddedObject.add(new Pair<String, Object>(BaseCmd.Properties.NAME.getName(), template.getName()));
|
||||||
listForEmbeddedObject.add(new Pair<String, Object>(BaseCmd.Properties.DISPLAY_TEXT.getName(), template.getDisplayText()));
|
listForEmbeddedObject.add(new Pair<String, Object>(BaseCmd.Properties.DISPLAY_TEXT.getName(), template.getDisplayText()));
|
||||||
listForEmbeddedObject.add(new Pair<String, Object>(BaseCmd.Properties.IS_PUBLIC.getName(), Boolean.valueOf(template.isPublicTemplate()).toString()));
|
listForEmbeddedObject.add(new Pair<String, Object>(BaseCmd.Properties.IS_PUBLIC.getName(), Boolean.valueOf(template.isPublicTemplate()).toString()));
|
||||||
|
listForEmbeddedObject.add(new Pair<String, Object>(BaseCmd.Properties.CROSS_ZONES.getName(), Boolean.valueOf(template.isCrossZones()).toString()));
|
||||||
|
|
||||||
if (templateHostRef != null) {
|
if (templateHostRef != null) {
|
||||||
listForEmbeddedObject.add(new Pair<String, Object>(BaseCmd.Properties.CREATED.getName(), getDateString(templateHostRef.getCreated())));
|
listForEmbeddedObject.add(new Pair<String, Object>(BaseCmd.Properties.CREATED.getName(), getDateString(templateHostRef.getCreated())));
|
||||||
|
|||||||
@ -162,6 +162,7 @@ public class UpdateTemplateCmd extends BaseCmd {
|
|||||||
templateData.add(new Pair<String, Object>(BaseCmd.Properties.FORMAT.getName(), updatedTemplate.getFormat()));
|
templateData.add(new Pair<String, Object>(BaseCmd.Properties.FORMAT.getName(), updatedTemplate.getFormat()));
|
||||||
templateData.add(new Pair<String, Object>(BaseCmd.Properties.OS_TYPE_ID.getName(), updatedTemplate.getGuestOSId()));
|
templateData.add(new Pair<String, Object>(BaseCmd.Properties.OS_TYPE_ID.getName(), updatedTemplate.getGuestOSId()));
|
||||||
templateData.add(new Pair<String, Object>(BaseCmd.Properties.PASSWORD_ENABLED.getName(), updatedTemplate.getEnablePassword()));
|
templateData.add(new Pair<String, Object>(BaseCmd.Properties.PASSWORD_ENABLED.getName(), updatedTemplate.getEnablePassword()));
|
||||||
|
templateData.add(new Pair<String, Object>(BaseCmd.Properties.CROSS_ZONES.getName(), Boolean.valueOf(updatedTemplate.isCrossZones()).toString()));
|
||||||
return templateData;
|
return templateData;
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "internal error updating template");
|
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "internal error updating template");
|
||||||
|
|||||||
@ -131,6 +131,12 @@ public abstract class UpdateTemplateOrIsoPermissionsCmd extends BaseCmd {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the template is removed throw an error.
|
||||||
|
if (template.getRemoved() != null){
|
||||||
|
s_logger.error("unable to update permissions for " + getMediaType() + " with id " + id + " as it is removed ");
|
||||||
|
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "unable to update permissions for " + getMediaType() + " with id " + id + " as it is removed ");
|
||||||
|
}
|
||||||
|
|
||||||
if (id == Long.valueOf(1)) {
|
if (id == Long.valueOf(1)) {
|
||||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "unable to update permissions for " + getMediaType() + " with id " + id);
|
throw new ServerApiException(BaseCmd.PARAM_ERROR, "unable to update permissions for " + getMediaType() + " with id " + id);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -188,6 +188,7 @@ public class CreatePrivateTemplateExecutor extends VolumeOperationExecutor {
|
|||||||
resultObject.setCreated(templateHostRef.getCreated());
|
resultObject.setCreated(templateHostRef.getCreated());
|
||||||
resultObject.setReady(templateHostRef != null && templateHostRef.getDownloadState() == Status.DOWNLOADED);
|
resultObject.setReady(templateHostRef != null && templateHostRef.getDownloadState() == Status.DOWNLOADED);
|
||||||
resultObject.setPasswordEnabled(template.getEnablePassword());
|
resultObject.setPasswordEnabled(template.getEnablePassword());
|
||||||
|
resultObject.setCrossZones(template.isCrossZones());
|
||||||
ManagementServer managerServer = getAsyncJobMgr().getExecutorContext().getManagementServer();
|
ManagementServer managerServer = getAsyncJobMgr().getExecutorContext().getManagementServer();
|
||||||
GuestOS os = managerServer.findGuestOSById(template.getGuestOSId());
|
GuestOS os = managerServer.findGuestOSById(template.getGuestOSId());
|
||||||
if (os != null) {
|
if (os != null) {
|
||||||
|
|||||||
@ -52,6 +52,9 @@ public class CreatePrivateTemplateResultObject {
|
|||||||
@Param(name="passwordenabled")
|
@Param(name="passwordenabled")
|
||||||
private boolean passwordEnabled;
|
private boolean passwordEnabled;
|
||||||
|
|
||||||
|
@Param(name="crossZones")
|
||||||
|
private boolean crossZones;
|
||||||
|
|
||||||
@Param(name="ostypeid")
|
@Param(name="ostypeid")
|
||||||
private Long osTypeId;
|
private Long osTypeId;
|
||||||
|
|
||||||
@ -197,6 +200,14 @@ public class CreatePrivateTemplateResultObject {
|
|||||||
this.passwordEnabled = passwordEnabled;
|
this.passwordEnabled = passwordEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isCrossZones() {
|
||||||
|
return crossZones;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCrossZones(boolean crossZones) {
|
||||||
|
this.crossZones = crossZones;
|
||||||
|
}
|
||||||
|
|
||||||
public long getDomainId() {
|
public long getDomainId() {
|
||||||
return domainId;
|
return domainId;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,7 +60,7 @@ public class DeployVMExecutor extends VMOperationExecutor {
|
|||||||
param.getUserId(), param.getAccountId(), param.getDataCenterId(),
|
param.getUserId(), param.getAccountId(), param.getDataCenterId(),
|
||||||
param.getServiceOfferingId(),
|
param.getServiceOfferingId(),
|
||||||
param.getTemplateId(), param.getDiskOfferingId(), param.getDomain(),
|
param.getTemplateId(), param.getDiskOfferingId(), param.getDomain(),
|
||||||
param.getPassword(), param.getDisplayName(), param.getGroup(), param.getUserData(), param.getNetworkGroup(), param.getEventId());
|
param.getPassword(), param.getDisplayName(), param.getGroup(), param.getUserData(), param.getNetworkGroup(), param.getEventId(), param.getSize());
|
||||||
|
|
||||||
asyncMgr.completeAsyncJob(getJob().getId(),
|
asyncMgr.completeAsyncJob(getJob().getId(),
|
||||||
AsyncJobResult.STATUS_SUCCEEDED, 0, composeResultObject(param.getUserId(), vm, param));
|
AsyncJobResult.STATUS_SUCCEEDED, 0, composeResultObject(param.getUserId(), vm, param));
|
||||||
|
|||||||
@ -31,6 +31,7 @@ public class DeployVMParam extends VMOperationParam {
|
|||||||
private String userData;
|
private String userData;
|
||||||
private long domainId;
|
private long domainId;
|
||||||
private String [] networkGroups;
|
private String [] networkGroups;
|
||||||
|
private long size;
|
||||||
|
|
||||||
public DeployVMParam() {
|
public DeployVMParam() {
|
||||||
}
|
}
|
||||||
@ -58,7 +59,7 @@ public class DeployVMParam extends VMOperationParam {
|
|||||||
long serviceOfferingId, long templateId,
|
long serviceOfferingId, long templateId,
|
||||||
Long diskOfferingId, String domain, String password,
|
Long diskOfferingId, String domain, String password,
|
||||||
String displayName, String group, String userData,
|
String displayName, String group, String userData,
|
||||||
String [] networkGroups, long eventId) {
|
String [] networkGroups, long eventId, long size) {
|
||||||
|
|
||||||
setUserId(userId);
|
setUserId(userId);
|
||||||
setAccountId(accountId);
|
setAccountId(accountId);
|
||||||
@ -73,8 +74,13 @@ public class DeployVMParam extends VMOperationParam {
|
|||||||
this.userData = userData;
|
this.userData = userData;
|
||||||
this.setNetworkGroups(networkGroups);
|
this.setNetworkGroups(networkGroups);
|
||||||
this.eventId = eventId;
|
this.eventId = eventId;
|
||||||
|
this.size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getSize(){
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
public long getDataCenterId() {
|
public long getDataCenterId() {
|
||||||
return dataCenterId;
|
return dataCenterId;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,7 +62,7 @@ public class VolumeOperationExecutor extends BaseAsyncJobExecutor {
|
|||||||
if (op == VolumeOp.Create) {
|
if (op == VolumeOp.Create) {
|
||||||
eventType = EventTypes.EVENT_VOLUME_CREATE;
|
eventType = EventTypes.EVENT_VOLUME_CREATE;
|
||||||
failureDescription = "Failed to create volume";
|
failureDescription = "Failed to create volume";
|
||||||
volume = asyncMgr.getExecutorContext().getManagementServer().createVolume(param.getUserId(), param.getAccountId(), param.getName(), param.getZoneId(), param.getDiskOfferingId(), param.getEventId());
|
volume = asyncMgr.getExecutorContext().getManagementServer().createVolume(param.getUserId(), param.getAccountId(), param.getName(), param.getZoneId(), param.getDiskOfferingId(), param.getEventId(), param.getSize());
|
||||||
if (volume.getStatus() == AsyncInstanceCreateStatus.Corrupted) {
|
if (volume.getStatus() == AsyncInstanceCreateStatus.Corrupted) {
|
||||||
asyncMgr.completeAsyncJob(getJob().getId(), AsyncJobResult.STATUS_FAILED, BaseCmd.INTERNAL_ERROR, "Failed to create volume.");
|
asyncMgr.completeAsyncJob(getJob().getId(), AsyncJobResult.STATUS_FAILED, BaseCmd.INTERNAL_ERROR, "Failed to create volume.");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -31,6 +31,7 @@ public class VolumeOperationParam {
|
|||||||
private long zoneId;
|
private long zoneId;
|
||||||
private String name;
|
private String name;
|
||||||
private long diskOfferingId;
|
private long diskOfferingId;
|
||||||
|
private long size;
|
||||||
|
|
||||||
// Used for Attach and Detach
|
// Used for Attach and Detach
|
||||||
private long vmId;
|
private long vmId;
|
||||||
@ -124,4 +125,11 @@ public class VolumeOperationParam {
|
|||||||
return deviceId;
|
return deviceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getSize(){
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSize(long size){
|
||||||
|
this.size = size;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -96,6 +96,7 @@ public interface ConfigurationManager extends Manager {
|
|||||||
* @param description
|
* @param description
|
||||||
* @param numGibibytes
|
* @param numGibibytes
|
||||||
* @param mirrored
|
* @param mirrored
|
||||||
|
* @param size
|
||||||
* @return ID
|
* @return ID
|
||||||
*/
|
*/
|
||||||
DiskOfferingVO createDiskOffering(long domainId, String name, String description, int numGibibytes, String tags);
|
DiskOfferingVO createDiskOffering(long domainId, String name, String description, int numGibibytes, String tags);
|
||||||
|
|||||||
@ -142,7 +142,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
|
|||||||
saveConfigurationEvent(userId, null, EventTypes.EVENT_CONFIGURATION_VALUE_EDIT, "Successfully edited configuration value.", "name=" + name, "value=" + value);
|
saveConfigurationEvent(userId, null, EventTypes.EVENT_CONFIGURATION_VALUE_EDIT, "Successfully edited configuration value.", "name=" + name, "value=" + value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String validateConfigurationValue(String name, String value) {
|
private String validateConfigurationValue(String name, String value) throws InvalidParameterValueException {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -170,11 +170,18 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(type.equals(String.class)) {
|
if(type.equals(String.class)) {
|
||||||
if (range.equals("privateip")) {
|
if (range.equals("privateip"))
|
||||||
if (!NetUtils.isSiteLocalAddress(value)) {
|
{
|
||||||
s_logger.error("privateip range " + value
|
try {
|
||||||
+ " is not a site local address for configuration variable " + name);
|
if (!NetUtils.isSiteLocalAddress(value)) {
|
||||||
return "Please enter a site local IP address.";
|
s_logger.error("privateip range " + value
|
||||||
|
+ " is not a site local address for configuration variable " + name);
|
||||||
|
return "Please enter a site local IP address.";
|
||||||
|
}
|
||||||
|
} catch (NullPointerException e)
|
||||||
|
{
|
||||||
|
s_logger.error("Error parsing ip address for " + name);
|
||||||
|
throw new InvalidParameterValueException("Error parsing ip address");
|
||||||
}
|
}
|
||||||
} else if (range.equals("netmask")) {
|
} else if (range.equals("netmask")) {
|
||||||
if (!NetUtils.isValidNetmask(value)) {
|
if (!NetUtils.isValidNetmask(value)) {
|
||||||
|
|||||||
@ -985,7 +985,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager,
|
|||||||
final AccountVO account = _accountDao.findById(Account.ACCOUNT_ID_SYSTEM);
|
final AccountVO account = _accountDao.findById(Account.ACCOUNT_ID_SYSTEM);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
List<VolumeVO> vols = _storageMgr.create(account, proxy, _template, dc, pod, _serviceOffering, null);
|
List<VolumeVO> vols = _storageMgr.create(account, proxy, _template, dc, pod, _serviceOffering, null,0);
|
||||||
if (vols == null) {
|
if (vols == null) {
|
||||||
s_logger.error("Unable to alloc storage for console proxy");
|
s_logger.error("Unable to alloc storage for console proxy");
|
||||||
return null;
|
return null;
|
||||||
@ -1383,10 +1383,9 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager,
|
|||||||
if (s_logger.isTraceEnabled())
|
if (s_logger.isTraceEnabled())
|
||||||
s_logger.trace("Begin console proxy capacity scan");
|
s_logger.trace("Begin console proxy capacity scan");
|
||||||
|
|
||||||
//config var for consoleproxy.restart check
|
// config var for consoleproxy.restart check
|
||||||
String restart = _configDao.getValue("consoleproxy.restart");
|
String restart = _configDao.getValue("consoleproxy.restart");
|
||||||
|
if(restart != null && restart.equalsIgnoreCase("false"))
|
||||||
if(restart.equalsIgnoreCase("false"))
|
|
||||||
{
|
{
|
||||||
s_logger.debug("Capacity scan disabled purposefully, consoleproxy.restart = false. This happens when the primarystorage is in maintenance mode");
|
s_logger.debug("Capacity scan disabled purposefully, consoleproxy.restart = false. This happens when the primarystorage is in maintenance mode");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -0,0 +1,40 @@
|
|||||||
|
package com.cloud.hypervisor.vmware.discoverer;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.ejb.Local;
|
||||||
|
import javax.naming.ConfigurationException;
|
||||||
|
|
||||||
|
import com.cloud.exception.DiscoveryException;
|
||||||
|
import com.cloud.host.HostVO;
|
||||||
|
import com.cloud.resource.Discoverer;
|
||||||
|
import com.cloud.resource.DiscovererBase;
|
||||||
|
import com.cloud.resource.ServerResource;
|
||||||
|
|
||||||
|
@Local(value=Discoverer.class)
|
||||||
|
public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<? extends ServerResource, Map<String, String>> find(long dcId, Long podId, Long clusterId, URI url,
|
||||||
|
String username, String password) throws DiscoveryException {
|
||||||
|
|
||||||
|
// ???
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postDiscovery(List<HostVO> hosts, long msId) {
|
||||||
|
//do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
|
||||||
|
super.configure(name, params);
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -214,17 +214,17 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
|
|||||||
details.put(HostInfo.HOST_OS_KERNEL_VERSION, hostKernelVer);
|
details.put(HostInfo.HOST_OS_KERNEL_VERSION, hostKernelVer);
|
||||||
details.put(HostInfo.HYPERVISOR_VERSION, xenVersion);
|
details.put(HostInfo.HYPERVISOR_VERSION, xenVersion);
|
||||||
|
|
||||||
if (!params.containsKey("public.network.device")) {
|
if (!params.containsKey("public.network.device") && _publicNic != null) {
|
||||||
params.put("public.network.device", _publicNic);
|
params.put("public.network.device", _publicNic);
|
||||||
details.put("public.network.device", _publicNic);
|
details.put("public.network.device", _publicNic);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!params.containsKey("guest.network.device")) {
|
if (!params.containsKey("guest.network.device") && _guestNic != null) {
|
||||||
params.put("guest.network.device", _guestNic);
|
params.put("guest.network.device", _guestNic);
|
||||||
details.put("guest.network.device", _guestNic);
|
details.put("guest.network.device", _guestNic);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!params.containsKey("private.network.device")) {
|
if (!params.containsKey("private.network.device") && _privateNic != null) {
|
||||||
params.put("private.network.device", _privateNic);
|
params.put("private.network.device", _privateNic);
|
||||||
details.put("private.network.device", _privateNic);
|
details.put("private.network.device", _privateNic);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -94,6 +94,7 @@ import com.cloud.ha.HighAvailabilityManager;
|
|||||||
import com.cloud.host.Host;
|
import com.cloud.host.Host;
|
||||||
import com.cloud.host.HostVO;
|
import com.cloud.host.HostVO;
|
||||||
import com.cloud.host.dao.HostDao;
|
import com.cloud.host.dao.HostDao;
|
||||||
|
import com.cloud.hypervisor.Hypervisor;
|
||||||
import com.cloud.network.dao.FirewallRulesDao;
|
import com.cloud.network.dao.FirewallRulesDao;
|
||||||
import com.cloud.network.dao.IPAddressDao;
|
import com.cloud.network.dao.IPAddressDao;
|
||||||
import com.cloud.network.dao.LoadBalancerDao;
|
import com.cloud.network.dao.LoadBalancerDao;
|
||||||
@ -430,7 +431,7 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
|||||||
|
|
||||||
txn.commit();
|
txn.commit();
|
||||||
|
|
||||||
List<VolumeVO> vols = _storageMgr.create(account, router, rtrTemplate, dc, pod, _offering, null);
|
List<VolumeVO> vols = _storageMgr.create(account, router, rtrTemplate, dc, pod, _offering, null,0);
|
||||||
if (vols == null){
|
if (vols == null){
|
||||||
_ipAddressDao.unassignIpAddress(guestIp);
|
_ipAddressDao.unassignIpAddress(guestIp);
|
||||||
_routerDao.delete(router.getId());
|
_routerDao.delete(router.getId());
|
||||||
@ -603,7 +604,7 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
|||||||
router.setLastHostId(pod.second());
|
router.setLastHostId(pod.second());
|
||||||
router = _routerDao.persist(router);
|
router = _routerDao.persist(router);
|
||||||
|
|
||||||
List<VolumeVO> vols = _storageMgr.create(account, router, template, dc, pod.first(), _offering, null);
|
List<VolumeVO> vols = _storageMgr.create(account, router, template, dc, pod.first(), _offering, null,0);
|
||||||
if(vols != null) {
|
if(vols != null) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
@ -2231,7 +2232,7 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
|||||||
final HashSet<Host> avoid = new HashSet<Host>();
|
final HashSet<Host> avoid = new HashSet<Host>();
|
||||||
|
|
||||||
final HostVO fromHost = _hostDao.findById(router.getHostId());
|
final HostVO fromHost = _hostDao.findById(router.getHostId());
|
||||||
if (fromHost.getClusterId() == null) {
|
if (fromHost.getHypervisorType() != Hypervisor.Type.KVM && fromHost.getClusterId() == null) {
|
||||||
s_logger.debug("The host is not in a cluster");
|
s_logger.debug("The host is not in a cluster");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -145,6 +145,7 @@ public class ConfigurationServerImpl implements ConfigurationServer {
|
|||||||
_configMgr.createDiskOffering(DomainVO.ROOT_DOMAIN, "Small", "Small Disk, 5 GB", 5, null);
|
_configMgr.createDiskOffering(DomainVO.ROOT_DOMAIN, "Small", "Small Disk, 5 GB", 5, null);
|
||||||
_configMgr.createDiskOffering(DomainVO.ROOT_DOMAIN, "Medium", "Medium Disk, 20 GB", 20, null);
|
_configMgr.createDiskOffering(DomainVO.ROOT_DOMAIN, "Medium", "Medium Disk, 20 GB", 20, null);
|
||||||
_configMgr.createDiskOffering(DomainVO.ROOT_DOMAIN, "Large", "Large Disk, 100 GB", 100, null);
|
_configMgr.createDiskOffering(DomainVO.ROOT_DOMAIN, "Large", "Large Disk, 100 GB", 100, null);
|
||||||
|
_configMgr.createDiskOffering(DomainVO.ROOT_DOMAIN, "Private", "Private Disk", 0, null);
|
||||||
|
|
||||||
//Add default manual snapshot policy
|
//Add default manual snapshot policy
|
||||||
SnapshotPolicyVO snapPolicy = new SnapshotPolicyVO(0L, "00", "GMT", (short)4, 0);
|
SnapshotPolicyVO snapPolicy = new SnapshotPolicyVO(0L, "00", "GMT", (short)4, 0);
|
||||||
|
|||||||
@ -922,8 +922,6 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
if (!_vmMgr.destroyVirtualMachine(userId, vm.getId())) {
|
if (!_vmMgr.destroyVirtualMachine(userId, vm.getId())) {
|
||||||
s_logger.error("Unable to destroy vm: " + vm.getId());
|
s_logger.error("Unable to destroy vm: " + vm.getId());
|
||||||
accountCleanupNeeded = true;
|
accountCleanupNeeded = true;
|
||||||
} else {
|
|
||||||
//_vmMgr.releaseGuestIpAddress(vm); FIXME FIXME bug 5561
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1657,6 +1655,11 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
throw new IllegalArgumentException("only ip addresses that belong to a virtual network may be disassociated.");
|
throw new IllegalArgumentException("only ip addresses that belong to a virtual network may be disassociated.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Check for account wide pool. It will have an entry for account_vlan_map.
|
||||||
|
if (_accountVlanMapDao.findAccountVlanMap(accountId,ipVO.getVlanDbId()) != null){
|
||||||
|
throw new PermissionDeniedException(publicIPAddress + " belongs to Account wide IP pool and cannot be disassociated");
|
||||||
|
}
|
||||||
|
|
||||||
txn.start();
|
txn.start();
|
||||||
boolean success = _networkMgr.releasePublicIpAddress(userId, publicIPAddress);
|
boolean success = _networkMgr.releasePublicIpAddress(userId, publicIPAddress);
|
||||||
if (success)
|
if (success)
|
||||||
@ -1727,11 +1730,11 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VolumeVO createVolume(long userId, long accountId, String name, long zoneId, long diskOfferingId, long startEventId) throws InternalErrorException {
|
public VolumeVO createVolume(long userId, long accountId, String name, long zoneId, long diskOfferingId, long startEventId, long size) throws InternalErrorException {
|
||||||
saveStartedEvent(userId, accountId, EventTypes.EVENT_VOLUME_CREATE, "Creating volume", startEventId);
|
saveStartedEvent(userId, accountId, EventTypes.EVENT_VOLUME_CREATE, "Creating volume", startEventId);
|
||||||
DataCenterVO zone = _dcDao.findById(zoneId);
|
DataCenterVO zone = _dcDao.findById(zoneId);
|
||||||
DiskOfferingVO diskOffering = _diskOfferingDao.findById(diskOfferingId);
|
DiskOfferingVO diskOffering = _diskOfferingDao.findById(diskOfferingId);
|
||||||
VolumeVO createdVolume = _storageMgr.createVolume(accountId, userId, name, zone, diskOffering, startEventId);
|
VolumeVO createdVolume = _storageMgr.createVolume(accountId, userId, name, zone, diskOffering, startEventId,size);
|
||||||
|
|
||||||
if (createdVolume != null)
|
if (createdVolume != null)
|
||||||
return createdVolume;
|
return createdVolume;
|
||||||
@ -1740,7 +1743,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long createVolumeAsync(long userId, long accountId, String name, long zoneId, long diskOfferingId) throws InvalidParameterValueException, InternalErrorException, ResourceAllocationException {
|
public long createVolumeAsync(long userId, long accountId, String name, long zoneId, long diskOfferingId, long size) throws InvalidParameterValueException, InternalErrorException, ResourceAllocationException {
|
||||||
// Check that the account is valid
|
// Check that the account is valid
|
||||||
AccountVO account = _accountDao.findById(accountId);
|
AccountVO account = _accountDao.findById(accountId);
|
||||||
if (account == null) {
|
if (account == null) {
|
||||||
@ -1795,6 +1798,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
param.setZoneId(zoneId);
|
param.setZoneId(zoneId);
|
||||||
param.setDiskOfferingId(diskOfferingId);
|
param.setDiskOfferingId(diskOfferingId);
|
||||||
param.setEventId(eventId);
|
param.setEventId(eventId);
|
||||||
|
param.setSize(size);
|
||||||
|
|
||||||
Gson gson = GsonHelper.getBuilder().create();
|
Gson gson = GsonHelper.getBuilder().create();
|
||||||
|
|
||||||
@ -2188,7 +2192,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserVm deployVirtualMachine(long userId, long accountId, long dataCenterId, long serviceOfferingId, long templateId, Long diskOfferingId,
|
public 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 [] networkGroups, long startEventId) throws ResourceAllocationException, InvalidParameterValueException, InternalErrorException,
|
String domain, String password, String displayName, String group, String userData, String [] networkGroups, long startEventId, long size) throws ResourceAllocationException, InvalidParameterValueException, InternalErrorException,
|
||||||
InsufficientStorageCapacityException, PermissionDeniedException, ExecutionException, StorageUnavailableException, ConcurrentOperationException {
|
InsufficientStorageCapacityException, PermissionDeniedException, ExecutionException, StorageUnavailableException, ConcurrentOperationException {
|
||||||
|
|
||||||
saveStartedEvent(userId, accountId, EventTypes.EVENT_VM_CREATE, "Deploying Vm", startEventId);
|
saveStartedEvent(userId, accountId, EventTypes.EVENT_VM_CREATE, "Deploying Vm", startEventId);
|
||||||
@ -2272,7 +2276,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
ArrayList<StoragePoolVO> a = new ArrayList<StoragePoolVO>(avoids.values());
|
ArrayList<StoragePoolVO> a = new ArrayList<StoragePoolVO>(avoids.values());
|
||||||
if (_directAttachNetworkExternalIpAllocator) {
|
if (_directAttachNetworkExternalIpAllocator) {
|
||||||
try {
|
try {
|
||||||
created = _vmMgr.createDirectlyAttachedVMExternal(vmId, userId, account, dc, offering, template, diskOffering, displayName, group, userData, a, networkGroupVOs, startEventId);
|
created = _vmMgr.createDirectlyAttachedVMExternal(vmId, userId, account, dc, offering, template, diskOffering, displayName, group, userData, a, networkGroupVOs, startEventId, size);
|
||||||
} catch (ResourceAllocationException rae) {
|
} catch (ResourceAllocationException rae) {
|
||||||
throw rae;
|
throw rae;
|
||||||
}
|
}
|
||||||
@ -2293,13 +2297,13 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
created = _vmMgr.createVirtualMachine(vmId, userId, account, dc, offering, template, diskOffering, displayName, group, userData, a, startEventId);
|
created = _vmMgr.createVirtualMachine(vmId, userId, account, dc, offering, template, diskOffering, displayName, group, userData, a, startEventId, size);
|
||||||
} catch (ResourceAllocationException rae) {
|
} catch (ResourceAllocationException rae) {
|
||||||
throw rae;
|
throw rae;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
created = _vmMgr.createDirectlyAttachedVM(vmId, userId, account, dc, offering, template, diskOffering, displayName, group, userData, a, networkGroupVOs, startEventId);
|
created = _vmMgr.createDirectlyAttachedVM(vmId, userId, account, dc, offering, template, diskOffering, displayName, group, userData, a, networkGroupVOs, startEventId, size);
|
||||||
} catch (ResourceAllocationException rae) {
|
} catch (ResourceAllocationException rae) {
|
||||||
throw rae;
|
throw rae;
|
||||||
}
|
}
|
||||||
@ -2418,7 +2422,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long deployVirtualMachineAsync(long userId, long accountId, long dataCenterId, long serviceOfferingId, long templateId,
|
public 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 [] networkGroups) throws InvalidParameterValueException, PermissionDeniedException {
|
Long diskOfferingId, String domain, String password, String displayName, String group, String userData, String [] networkGroups, long size) throws InvalidParameterValueException, PermissionDeniedException {
|
||||||
|
|
||||||
AccountVO account = _accountDao.findById(accountId);
|
AccountVO account = _accountDao.findById(accountId);
|
||||||
if (account == null) {
|
if (account == null) {
|
||||||
@ -2512,7 +2516,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
long eventId = saveScheduledEvent(userId, accountId, EventTypes.EVENT_VM_CREATE, "deploying Vm");
|
long eventId = saveScheduledEvent(userId, accountId, EventTypes.EVENT_VM_CREATE, "deploying Vm");
|
||||||
|
|
||||||
DeployVMParam param = new DeployVMParam(userId, accountId, dataCenterId, serviceOfferingId, templateId, diskOfferingId, domain, password,
|
DeployVMParam param = new DeployVMParam(userId, accountId, dataCenterId, serviceOfferingId, templateId, diskOfferingId, domain, password,
|
||||||
displayName, group, userData, networkGroups, eventId);
|
displayName, group, userData, networkGroups, eventId, size);
|
||||||
Gson gson = GsonHelper.getBuilder().create();
|
Gson gson = GsonHelper.getBuilder().create();
|
||||||
|
|
||||||
AsyncJobVO job = new AsyncJobVO();
|
AsyncJobVO job = new AsyncJobVO();
|
||||||
@ -2623,7 +2627,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean recoverVirtualMachine(long vmId) throws ResourceAllocationException {
|
public boolean recoverVirtualMachine(long vmId) throws ResourceAllocationException, InternalErrorException {
|
||||||
return _vmMgr.recoverVirtualMachine(vmId);
|
return _vmMgr.recoverVirtualMachine(vmId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4228,6 +4232,14 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
template = _templateDao.findById(templateId);
|
template = _templateDao.findById(templateId);
|
||||||
if (template == null) {
|
if (template == null) {
|
||||||
throw new InvalidParameterValueException("Please specify a valid template ID.");
|
throw new InvalidParameterValueException("Please specify a valid template ID.");
|
||||||
|
}// If ISO requested then it should be ISO.
|
||||||
|
if (isIso && template.getFormat() != ImageFormat.ISO){
|
||||||
|
s_logger.error("Template Id " + templateId + " is not an ISO");
|
||||||
|
throw new InvalidParameterValueException("Template Id " + templateId + " is not an ISO");
|
||||||
|
}// If ISO not requested then it shouldn't be an ISO.
|
||||||
|
if (!isIso && template.getFormat() == ImageFormat.ISO){
|
||||||
|
s_logger.error("Incorrect format of the template id " + templateId);
|
||||||
|
throw new InvalidParameterValueException("Incorrect format " + template.getFormat() + " of the template id " + templateId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4267,7 +4279,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
return _templateHostDao.listByHostTemplate(secondaryStorageHost.getId(), templateId);
|
return _templateHostDao.listByHostTemplate(secondaryStorageHost.getId(), templateId);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return _templateHostDao.listByTemplateId(templateId);
|
return _templateHostDao.listByOnlyTemplateId(templateId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4761,20 +4773,6 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
VMTemplateVO template = _templateDao.createForUpdate(id);
|
VMTemplateVO template = _templateDao.createForUpdate(id);
|
||||||
|
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
// Check for duplicate name
|
|
||||||
VMTemplateVO foundTemplate = _templateDao.findByTemplateName(name);
|
|
||||||
if (foundTemplate != null)
|
|
||||||
{
|
|
||||||
if(foundTemplate.getId()==id)
|
|
||||||
{
|
|
||||||
//do nothing, you are updating the same template you own
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
s_logger.error("updateTemplate - Template name " + name + " already exists ");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
template.setName(name);
|
template.setName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6657,6 +6655,11 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
return _diskOfferingDao.findById(diskOfferingId);
|
return _diskOfferingDao.findById(diskOfferingId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DiskOfferingVO> findPrivateDiskOffering() {
|
||||||
|
return _diskOfferingDao.findPrivateDiskOffering();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@DB
|
@DB
|
||||||
public boolean updateTemplatePermissions(long templateId, String operation, Boolean isPublic, Boolean isFeatured, List<String> accountNames) throws InvalidParameterValueException,
|
public boolean updateTemplatePermissions(long templateId, String operation, Boolean isPublic, Boolean isFeatured, List<String> accountNames) throws InvalidParameterValueException,
|
||||||
@ -6810,7 +6813,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DiskOfferingVO createDiskOffering(long domainId, String name, String description, int numGibibytes, String tags) throws InvalidParameterValueException {
|
public DiskOfferingVO createDiskOffering(long domainId, String name, String description, int numGibibytes, String tags) throws InvalidParameterValueException {
|
||||||
if (numGibibytes < 1) {
|
if (numGibibytes!=0 && numGibibytes < 1) {
|
||||||
throw new InvalidParameterValueException("Please specify a disk size of at least 1 Gb.");
|
throw new InvalidParameterValueException("Please specify a disk size of at least 1 Gb.");
|
||||||
} else if (numGibibytes > _maxVolumeSizeInGb) {
|
} else if (numGibibytes > _maxVolumeSizeInGb) {
|
||||||
throw new InvalidParameterValueException("The maximum size for a disk is " + _maxVolumeSizeInGb + " Gb.");
|
throw new InvalidParameterValueException("The maximum size for a disk is " + _maxVolumeSizeInGb + " Gb.");
|
||||||
@ -7584,7 +7587,10 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Transaction txn = null;
|
||||||
try {
|
try {
|
||||||
|
txn = Transaction.open(Transaction.CLOUD_DB);
|
||||||
|
|
||||||
List<AccountVO> accounts = _accountDao.findCleanups();
|
List<AccountVO> accounts = _accountDao.findCleanups();
|
||||||
s_logger.info("Found " + accounts.size() + " accounts to cleanup");
|
s_logger.info("Found " + accounts.size() + " accounts to cleanup");
|
||||||
for (AccountVO account : accounts) {
|
for (AccountVO account : accounts) {
|
||||||
@ -7598,6 +7604,9 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
s_logger.error("Exception ", e);
|
s_logger.error("Exception ", e);
|
||||||
} finally {
|
} finally {
|
||||||
|
if(txn != null)
|
||||||
|
txn.close();
|
||||||
|
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -8352,5 +8361,16 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
return _asyncMgr.submitAsyncJob(job);
|
return _asyncMgr.submitAsyncJob(job);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean validateCustomVolumeSizeRange(long size) throws InvalidParameterValueException {
|
||||||
|
if (size<0 || (size>0 && size < 1)) {
|
||||||
|
throw new InvalidParameterValueException("Please specify a size of at least 1 Gb.");
|
||||||
|
} else if (size > _maxVolumeSizeInGb) {
|
||||||
|
throw new InvalidParameterValueException("The maximum size allowed is " + _maxVolumeSizeInGb + " Gb.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -41,10 +41,12 @@ import org.apache.log4j.Logger;
|
|||||||
|
|
||||||
import com.cloud.agent.AgentManager;
|
import com.cloud.agent.AgentManager;
|
||||||
import com.cloud.agent.api.Answer;
|
import com.cloud.agent.api.Answer;
|
||||||
|
import com.cloud.agent.api.BackupSnapshotCommand;
|
||||||
import com.cloud.agent.api.Command;
|
import com.cloud.agent.api.Command;
|
||||||
import com.cloud.agent.api.CreateVolumeFromSnapshotAnswer;
|
import com.cloud.agent.api.CreateVolumeFromSnapshotAnswer;
|
||||||
import com.cloud.agent.api.CreateVolumeFromSnapshotCommand;
|
import com.cloud.agent.api.CreateVolumeFromSnapshotCommand;
|
||||||
import com.cloud.agent.api.DeleteStoragePoolCommand;
|
import com.cloud.agent.api.DeleteStoragePoolCommand;
|
||||||
|
import com.cloud.agent.api.ManageSnapshotCommand;
|
||||||
import com.cloud.agent.api.ModifyStoragePoolAnswer;
|
import com.cloud.agent.api.ModifyStoragePoolAnswer;
|
||||||
import com.cloud.agent.api.ModifyStoragePoolCommand;
|
import com.cloud.agent.api.ModifyStoragePoolCommand;
|
||||||
import com.cloud.agent.api.storage.CopyVolumeAnswer;
|
import com.cloud.agent.api.storage.CopyVolumeAnswer;
|
||||||
@ -203,7 +205,7 @@ public class StorageManagerImpl implements StorageManager {
|
|||||||
private int _totalRetries;
|
private int _totalRetries;
|
||||||
private int _pauseInterval;
|
private int _pauseInterval;
|
||||||
private final boolean _shouldBeSnapshotCapable = true;
|
private final boolean _shouldBeSnapshotCapable = true;
|
||||||
private String _hypervisorType;
|
private Hypervisor.Type _hypervisorType;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean share(VMInstanceVO vm, List<VolumeVO> vols, HostVO host, boolean cancelPreviousShare) {
|
public boolean share(VMInstanceVO vm, List<VolumeVO> vols, HostVO host, boolean cancelPreviousShare) {
|
||||||
@ -266,7 +268,7 @@ public class StorageManagerImpl implements StorageManager {
|
|||||||
} else {
|
} else {
|
||||||
offering = _offeringDao.findById(vol.getDiskOfferingId());
|
offering = _offeringDao.findById(vol.getDiskOfferingId());
|
||||||
}
|
}
|
||||||
VolumeVO created = createVolume(create, vm, template, dc, pod, host.getClusterId(), offering, diskOffering, new ArrayList<StoragePoolVO>());
|
VolumeVO created = createVolume(create, vm, template, dc, pod, host.getClusterId(), offering, diskOffering, new ArrayList<StoragePoolVO>(),0);
|
||||||
if (created == null) {
|
if (created == null) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -671,7 +673,7 @@ public class StorageManagerImpl implements StorageManager {
|
|||||||
basicErrMsg,
|
basicErrMsg,
|
||||||
_totalRetries,
|
_totalRetries,
|
||||||
_pauseInterval,
|
_pauseInterval,
|
||||||
_shouldBeSnapshotCapable);
|
_shouldBeSnapshotCapable, null);
|
||||||
if (answer != null && answer.getResult()) {
|
if (answer != null && answer.getResult()) {
|
||||||
vdiUUID = answer.getVdi();
|
vdiUUID = answer.getVdi();
|
||||||
}
|
}
|
||||||
@ -684,7 +686,7 @@ public class StorageManagerImpl implements StorageManager {
|
|||||||
|
|
||||||
@DB
|
@DB
|
||||||
protected VolumeVO createVolume(VolumeVO volume, VMInstanceVO vm, VMTemplateVO template, DataCenterVO dc, HostPodVO pod, Long clusterId,
|
protected VolumeVO createVolume(VolumeVO volume, VMInstanceVO vm, VMTemplateVO template, DataCenterVO dc, HostPodVO pod, Long clusterId,
|
||||||
ServiceOfferingVO offering, DiskOfferingVO diskOffering, List<StoragePoolVO> avoids) {
|
ServiceOfferingVO offering, DiskOfferingVO diskOffering, List<StoragePoolVO> avoids, long size) {
|
||||||
StoragePoolVO pool = null;
|
StoragePoolVO pool = null;
|
||||||
final HashSet<StoragePool> avoidPools = new HashSet<StoragePool>(avoids);
|
final HashSet<StoragePool> avoidPools = new HashSet<StoragePool>(avoids);
|
||||||
|
|
||||||
@ -741,7 +743,7 @@ public class StorageManagerImpl implements StorageManager {
|
|||||||
}
|
}
|
||||||
cmd = new CreateCommand(volume, vm, dskCh, tmpltStoredOn.getLocalDownloadPath(), pool);
|
cmd = new CreateCommand(volume, vm, dskCh, tmpltStoredOn.getLocalDownloadPath(), pool);
|
||||||
} else {
|
} else {
|
||||||
cmd = new CreateCommand(volume, vm, dskCh, pool);
|
cmd = new CreateCommand(volume, vm, dskCh, pool, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
Answer answer = sendToPool(pool, cmd);
|
Answer answer = sendToPool(pool, cmd);
|
||||||
@ -778,21 +780,21 @@ public class StorageManagerImpl implements StorageManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<VolumeVO> create(Account account, VMInstanceVO vm, VMTemplateVO template, DataCenterVO dc, HostPodVO pod, ServiceOfferingVO offering, DiskOfferingVO diskOffering) throws StorageUnavailableException, ExecutionException {
|
public List<VolumeVO> create(Account account, VMInstanceVO vm, VMTemplateVO template, DataCenterVO dc, HostPodVO pod, ServiceOfferingVO offering, DiskOfferingVO diskOffering, long size) throws StorageUnavailableException, ExecutionException {
|
||||||
List<StoragePoolVO> avoids = new ArrayList<StoragePoolVO>();
|
List<StoragePoolVO> avoids = new ArrayList<StoragePoolVO>();
|
||||||
return create(account, vm, template, dc, pod, offering, diskOffering, avoids);
|
return create(account, vm, template, dc, pod, offering, diskOffering, avoids, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DB
|
@DB
|
||||||
protected List<VolumeVO> create(Account account, VMInstanceVO vm, VMTemplateVO template, DataCenterVO dc, HostPodVO pod,
|
protected List<VolumeVO> create(Account account, VMInstanceVO vm, VMTemplateVO template, DataCenterVO dc, HostPodVO pod,
|
||||||
ServiceOfferingVO offering, DiskOfferingVO diskOffering, List<StoragePoolVO> avoids) {
|
ServiceOfferingVO offering, DiskOfferingVO diskOffering, List<StoragePoolVO> avoids, long size) {
|
||||||
ArrayList<VolumeVO> vols = new ArrayList<VolumeVO>(2);
|
ArrayList<VolumeVO> vols = new ArrayList<VolumeVO>(2);
|
||||||
VolumeVO dataVol = null;
|
VolumeVO dataVol = null;
|
||||||
VolumeVO rootVol = null;
|
VolumeVO rootVol = null;
|
||||||
Transaction txn = Transaction.currentTxn();
|
Transaction txn = Transaction.currentTxn();
|
||||||
txn.start();
|
txn.start();
|
||||||
if (Storage.ImageFormat.ISO == template.getFormat()) {
|
if (Storage.ImageFormat.ISO == template.getFormat()) {
|
||||||
rootVol = new VolumeVO(VolumeType.ROOT, vm.getId(), vm.getInstanceName() + "-ROOT", dc.getId(), pod.getId(), account.getId(), account.getDomainId(), diskOffering.getDiskSizeInBytes());
|
rootVol = new VolumeVO(VolumeType.ROOT, vm.getId(), vm.getInstanceName() + "-ROOT", dc.getId(), pod.getId(), account.getId(), account.getDomainId(),(size>0)? size : diskOffering.getDiskSizeInBytes());
|
||||||
rootVol.setDiskOfferingId(diskOffering.getId());
|
rootVol.setDiskOfferingId(diskOffering.getId());
|
||||||
rootVol.setDeviceId(0l);
|
rootVol.setDeviceId(0l);
|
||||||
rootVol = _volsDao.persist(rootVol);
|
rootVol = _volsDao.persist(rootVol);
|
||||||
@ -804,7 +806,7 @@ public class StorageManagerImpl implements StorageManager {
|
|||||||
rootVol = _volsDao.persist(rootVol);
|
rootVol = _volsDao.persist(rootVol);
|
||||||
|
|
||||||
if (diskOffering != null && diskOffering.getDiskSizeInBytes() > 0) {
|
if (diskOffering != null && diskOffering.getDiskSizeInBytes() > 0) {
|
||||||
dataVol = new VolumeVO(VolumeType.DATADISK, vm.getId(), vm.getInstanceName() + "-DATA", dc.getId(), pod.getId(), account.getId(), account.getDomainId(), diskOffering.getDiskSizeInBytes());
|
dataVol = new VolumeVO(VolumeType.DATADISK, vm.getId(), vm.getInstanceName() + "-DATA", dc.getId(), pod.getId(), account.getId(), account.getDomainId(), (size>0)? size : diskOffering.getDiskSizeInBytes());
|
||||||
dataVol.setDiskOfferingId(diskOffering.getId());
|
dataVol.setDiskOfferingId(diskOffering.getId());
|
||||||
dataVol.setDeviceId(1l);
|
dataVol.setDeviceId(1l);
|
||||||
dataVol = _volsDao.persist(dataVol);
|
dataVol = _volsDao.persist(dataVol);
|
||||||
@ -815,7 +817,7 @@ public class StorageManagerImpl implements StorageManager {
|
|||||||
VolumeVO dataCreated = null;
|
VolumeVO dataCreated = null;
|
||||||
VolumeVO rootCreated = null;
|
VolumeVO rootCreated = null;
|
||||||
try {
|
try {
|
||||||
rootCreated = createVolume(rootVol, vm, template, dc, pod, null, offering, diskOffering, avoids);
|
rootCreated = createVolume(rootVol, vm, template, dc, pod, null, offering, diskOffering, avoids,size);
|
||||||
if (rootCreated == null) {
|
if (rootCreated == null) {
|
||||||
throw new CloudRuntimeException("Unable to create " + rootVol);
|
throw new CloudRuntimeException("Unable to create " + rootVol);
|
||||||
}
|
}
|
||||||
@ -824,7 +826,7 @@ public class StorageManagerImpl implements StorageManager {
|
|||||||
|
|
||||||
if (dataVol != null) {
|
if (dataVol != null) {
|
||||||
StoragePoolVO pool = _storagePoolDao.findById(rootCreated.getPoolId());
|
StoragePoolVO pool = _storagePoolDao.findById(rootCreated.getPoolId());
|
||||||
dataCreated = createVolume(dataVol, vm, template, dc, pod, pool.getClusterId(), offering, diskOffering, avoids);
|
dataCreated = createVolume(dataVol, vm, template, dc, pod, pool.getClusterId(), offering, diskOffering, avoids,size);
|
||||||
if (dataCreated == null) {
|
if (dataCreated == null) {
|
||||||
throw new CloudRuntimeException("Unable to create " + dataVol);
|
throw new CloudRuntimeException("Unable to create " + dataVol);
|
||||||
}
|
}
|
||||||
@ -845,8 +847,8 @@ public class StorageManagerImpl implements StorageManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long createUserVM(Account account, VMInstanceVO vm, VMTemplateVO template, DataCenterVO dc, HostPodVO pod, ServiceOfferingVO offering, DiskOfferingVO diskOffering,
|
public long createUserVM(Account account, VMInstanceVO vm, VMTemplateVO template, DataCenterVO dc, HostPodVO pod, ServiceOfferingVO offering, DiskOfferingVO diskOffering,
|
||||||
List<StoragePoolVO> avoids) {
|
List<StoragePoolVO> avoids, long size) {
|
||||||
List<VolumeVO> volumes = create(account, vm, template, dc, pod, offering, diskOffering, avoids);
|
List<VolumeVO> volumes = create(account, vm, template, dc, pod, offering, diskOffering, avoids, size);
|
||||||
|
|
||||||
for (VolumeVO v : volumes) {
|
for (VolumeVO v : volumes) {
|
||||||
long volumeId = v.getId();
|
long volumeId = v.getId();
|
||||||
@ -866,13 +868,22 @@ public class StorageManagerImpl implements StorageManager {
|
|||||||
return volumes.get(0).getPoolId();
|
return volumes.get(0).getPoolId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public StoragePoolHostVO chooseHostForStoragePool(StoragePoolVO poolVO, List<Long> avoidHosts) {
|
public Long chooseHostForStoragePool(StoragePoolVO poolVO, List<Long> avoidHosts, boolean sendToVmResidesOn, Long vmId) {
|
||||||
|
if (sendToVmResidesOn) {
|
||||||
|
if (vmId != null) {
|
||||||
|
VMInstanceVO vmInstance = _vmInstanceDao.findById(vmId);
|
||||||
|
if (vmInstance != null) {
|
||||||
|
return vmInstance.getHostId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
List<StoragePoolHostVO> poolHosts = _poolHostDao.listByHostStatus(poolVO.getId(), Status.Up);
|
List<StoragePoolHostVO> poolHosts = _poolHostDao.listByHostStatus(poolVO.getId(), Status.Up);
|
||||||
Collections.shuffle(poolHosts);
|
Collections.shuffle(poolHosts);
|
||||||
if (poolHosts != null && poolHosts.size() > 0) {
|
if (poolHosts != null && poolHosts.size() > 0) {
|
||||||
for (StoragePoolHostVO sphvo : poolHosts) {
|
for (StoragePoolHostVO sphvo : poolHosts) {
|
||||||
if (!avoidHosts.contains(sphvo.getHostId())) {
|
if (!avoidHosts.contains(sphvo.getHostId())) {
|
||||||
return sphvo;
|
return sphvo.getHostId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -982,8 +993,10 @@ public class StorageManagerImpl implements StorageManager {
|
|||||||
_totalRetries = NumbersUtil.parseInt(configDao.getValue("total.retries"), 4);
|
_totalRetries = NumbersUtil.parseInt(configDao.getValue("total.retries"), 4);
|
||||||
_pauseInterval = 2*NumbersUtil.parseInt(configDao.getValue("ping.interval"), 60);
|
_pauseInterval = 2*NumbersUtil.parseInt(configDao.getValue("ping.interval"), 60);
|
||||||
|
|
||||||
_hypervisorType = configDao.getValue("hypervisor.type");
|
String hypervisoType = configDao.getValue("hypervisor.type");
|
||||||
|
if (hypervisoType.equalsIgnoreCase("KVM")) {
|
||||||
|
_hypervisorType = Hypervisor.Type.KVM;
|
||||||
|
}
|
||||||
_agentMgr.registerForHostEvents(new StoragePoolMonitor(this, _hostDao, _storagePoolDao), true, false, true);
|
_agentMgr.registerForHostEvents(new StoragePoolMonitor(this, _hostDao, _storagePoolDao), true, false, true);
|
||||||
|
|
||||||
String storageCleanupEnabled = configs.get("storage.cleanup.enabled");
|
String storageCleanupEnabled = configs.get("storage.cleanup.enabled");
|
||||||
@ -1065,6 +1078,19 @@ public class StorageManagerImpl implements StorageManager {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getVmNameOnVolume(VolumeVO volume) {
|
||||||
|
Long vmId = volume.getInstanceId();
|
||||||
|
if (vmId != null) {
|
||||||
|
VMInstanceVO vm = _vmInstanceDao.findById(vmId);
|
||||||
|
|
||||||
|
if (vm == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return vm.getInstanceName();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public String getAbsoluteIsoPath(long templateId, long dataCenterId) {
|
public String getAbsoluteIsoPath(long templateId, long dataCenterId) {
|
||||||
String isoPath = null;
|
String isoPath = null;
|
||||||
|
|
||||||
@ -1162,7 +1188,7 @@ public class StorageManagerImpl implements StorageManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hypervisorType == null) {
|
if (hypervisorType == null) {
|
||||||
if (_hypervisorType.equalsIgnoreCase("KVM")) {
|
if (_hypervisorType == Hypervisor.Type.KVM) {
|
||||||
hypervisorType = Hypervisor.Type.KVM;
|
hypervisorType = Hypervisor.Type.KVM;
|
||||||
} else {
|
} else {
|
||||||
s_logger.debug("Couldn't find a host to serve in the server pool");
|
s_logger.debug("Couldn't find a host to serve in the server pool");
|
||||||
@ -1244,7 +1270,7 @@ public class StorageManagerImpl implements StorageManager {
|
|||||||
// perhaps do this on demand, or perhaps mount on a couple of hosts per
|
// perhaps do this on demand, or perhaps mount on a couple of hosts per
|
||||||
// pod
|
// pod
|
||||||
List<HostVO> allHosts = _hostDao.listBy(Host.Type.Routing, clusterId, podId, zoneId);
|
List<HostVO> allHosts = _hostDao.listBy(Host.Type.Routing, clusterId, podId, zoneId);
|
||||||
if (allHosts.isEmpty() && !_hypervisorType.equalsIgnoreCase("KVM")) {
|
if (allHosts.isEmpty() && _hypervisorType != Hypervisor.Type.KVM) {
|
||||||
throw new ResourceAllocationException("No host exists to associate a storage pool with");
|
throw new ResourceAllocationException("No host exists to associate a storage pool with");
|
||||||
}
|
}
|
||||||
long poolId = _storagePoolDao.getNextInSequence(Long.class, "id");
|
long poolId = _storagePoolDao.getNextInSequence(Long.class, "id");
|
||||||
@ -1258,7 +1284,7 @@ public class StorageManagerImpl implements StorageManager {
|
|||||||
pool.setClusterId(clusterId);
|
pool.setClusterId(clusterId);
|
||||||
pool.setStatus(Status.Up);
|
pool.setStatus(Status.Up);
|
||||||
pool = _storagePoolDao.persist(pool, details);
|
pool = _storagePoolDao.persist(pool, details);
|
||||||
if (_hypervisorType.equalsIgnoreCase("KVM") && allHosts.isEmpty()) {
|
if (_hypervisorType == Hypervisor.Type.KVM && allHosts.isEmpty()) {
|
||||||
return pool;
|
return pool;
|
||||||
}
|
}
|
||||||
s_logger.debug("In createPool Adding the pool to each of the hosts");
|
s_logger.debug("In createPool Adding the pool to each of the hosts");
|
||||||
@ -1477,7 +1503,7 @@ public class StorageManagerImpl implements StorageManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@DB
|
@DB
|
||||||
public VolumeVO createVolume(long accountId, long userId, String userSpecifiedName, DataCenterVO dc, DiskOfferingVO diskOffering, long startEventId)
|
public VolumeVO createVolume(long accountId, long userId, String userSpecifiedName, DataCenterVO dc, DiskOfferingVO diskOffering, long startEventId, long size)
|
||||||
{
|
{
|
||||||
String volumeName = "";
|
String volumeName = "";
|
||||||
VolumeVO createdVolume = null;
|
VolumeVO createdVolume = null;
|
||||||
@ -1520,7 +1546,7 @@ public class StorageManagerImpl implements StorageManager {
|
|||||||
Pair<HostPodVO, Long> pod = null;
|
Pair<HostPodVO, Long> pod = null;
|
||||||
|
|
||||||
while ((pod = _agentMgr.findPod(null, null, dc, account.getId(), podsToAvoid)) != null) {
|
while ((pod = _agentMgr.findPod(null, null, dc, account.getId(), podsToAvoid)) != null) {
|
||||||
if ((createdVolume = createVolume(volume, null, null, dc, pod.first(), null, null, diskOffering, poolsToAvoid)) != null) {
|
if ((createdVolume = createVolume(volume, null, null, dc, pod.first(), null, null, diskOffering, poolsToAvoid, size)) != null) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
podsToAvoid.add(pod.first().getId());
|
podsToAvoid.add(pod.first().getId());
|
||||||
@ -1643,18 +1669,21 @@ public class StorageManagerImpl implements StorageManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Answer sendToHostsOnStoragePool(Long poolId, Command cmd, String basicErrMsg) {
|
public Answer sendToHostsOnStoragePool(Long poolId, Command cmd, String basicErrMsg) {
|
||||||
return sendToHostsOnStoragePool(poolId, cmd, basicErrMsg, 1, 0, false);
|
return sendToHostsOnStoragePool(poolId, cmd, basicErrMsg, 1, 0, false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Answer sendToHostsOnStoragePool(Long poolId, Command cmd, String basicErrMsg, int totalRetries, int pauseBeforeRetry, boolean shouldBeSnapshotCapable) {
|
public Answer sendToHostsOnStoragePool(Long poolId, Command cmd, String basicErrMsg, int totalRetries, int pauseBeforeRetry, boolean shouldBeSnapshotCapable,
|
||||||
|
Long vmId) {
|
||||||
Answer answer = null;
|
Answer answer = null;
|
||||||
Long hostId = null;
|
Long hostId = null;
|
||||||
StoragePoolVO storagePool = _storagePoolDao.findById(poolId);
|
StoragePoolVO storagePool = _storagePoolDao.findById(poolId);
|
||||||
List<Long> hostsToAvoid = new ArrayList<Long>();
|
List<Long> hostsToAvoid = new ArrayList<Long>();
|
||||||
StoragePoolHostVO storagePoolHost;
|
|
||||||
int tryCount = 0;
|
int tryCount = 0;
|
||||||
if (chooseHostForStoragePool(storagePool, hostsToAvoid) == null) {
|
boolean sendToVmHost = sendToVmResidesOn(cmd);
|
||||||
|
|
||||||
|
if (chooseHostForStoragePool(storagePool, hostsToAvoid, sendToVmHost, vmId) == null) {
|
||||||
// Don't just fail. The host could be reconnecting.
|
// Don't just fail. The host could be reconnecting.
|
||||||
// wait for some time for it to get connected
|
// wait for some time for it to get connected
|
||||||
// Wait for 3*ping.interval, since the code attempts a manual
|
// Wait for 3*ping.interval, since the code attempts a manual
|
||||||
@ -1666,10 +1695,9 @@ public class StorageManagerImpl implements StorageManager {
|
|||||||
// continue.
|
// continue.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while ((storagePoolHost = chooseHostForStoragePool(storagePool, hostsToAvoid)) != null && tryCount++ < totalRetries) {
|
while ((hostId = chooseHostForStoragePool(storagePool, hostsToAvoid, sendToVmHost, vmId)) != null && tryCount++ < totalRetries) {
|
||||||
String errMsg = basicErrMsg + " on host: " + hostId + " try: " + tryCount + ", reason: ";
|
String errMsg = basicErrMsg + " on host: " + hostId + " try: " + tryCount + ", reason: ";
|
||||||
try {
|
try {
|
||||||
hostId = storagePoolHost.getHostId();
|
|
||||||
HostVO hostVO = _hostDao.findById(hostId);
|
HostVO hostVO = _hostDao.findById(hostId);
|
||||||
if (shouldBeSnapshotCapable) {
|
if (shouldBeSnapshotCapable) {
|
||||||
if (hostVO == null ) {
|
if (hostVO == null ) {
|
||||||
@ -2147,4 +2175,14 @@ public class StorageManagerImpl implements StorageManager {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean sendToVmResidesOn(Command cmd) {
|
||||||
|
if ((_hypervisorType == Hypervisor.Type.KVM) &&
|
||||||
|
((cmd instanceof ManageSnapshotCommand) ||
|
||||||
|
(cmd instanceof BackupSnapshotCommand))) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -784,7 +784,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
|||||||
final AccountVO account = _accountDao.findById(Account.ACCOUNT_ID_SYSTEM);
|
final AccountVO account = _accountDao.findById(Account.ACCOUNT_ID_SYSTEM);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
List<VolumeVO> vols = _storageMgr.create(account, secStorageVm, _template, dc, pod, _serviceOffering, null);
|
List<VolumeVO> vols = _storageMgr.create(account, secStorageVm, _template, dc, pod, _serviceOffering, null,0);
|
||||||
if( vols == null ){
|
if( vols == null ){
|
||||||
s_logger.error("Unable to alloc storage for secondary storage vm");
|
s_logger.error("Unable to alloc storage for secondary storage vm");
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -86,6 +86,7 @@ import com.cloud.user.AccountManager;
|
|||||||
import com.cloud.user.AccountVO;
|
import com.cloud.user.AccountVO;
|
||||||
import com.cloud.user.dao.AccountDao;
|
import com.cloud.user.dao.AccountDao;
|
||||||
import com.cloud.user.dao.UserDao;
|
import com.cloud.user.dao.UserDao;
|
||||||
|
import com.cloud.uservm.UserVm;
|
||||||
import com.cloud.utils.DateUtil;
|
import com.cloud.utils.DateUtil;
|
||||||
import com.cloud.utils.NumbersUtil;
|
import com.cloud.utils.NumbersUtil;
|
||||||
import com.cloud.utils.component.ComponentLocator;
|
import com.cloud.utils.component.ComponentLocator;
|
||||||
@ -134,6 +135,7 @@ public class SnapshotManagerImpl implements SnapshotManager {
|
|||||||
protected SearchBuilder<SnapshotVO> PolicySnapshotSearch;
|
protected SearchBuilder<SnapshotVO> PolicySnapshotSearch;
|
||||||
protected SearchBuilder<SnapshotPolicyVO> PoliciesForSnapSearch;
|
protected SearchBuilder<SnapshotPolicyVO> PoliciesForSnapSearch;
|
||||||
|
|
||||||
|
private String _hypervisorType;
|
||||||
private final boolean _shouldBeSnapshotCapable = true; // all methods here should be snapshot capable.
|
private final boolean _shouldBeSnapshotCapable = true; // all methods here should be snapshot capable.
|
||||||
|
|
||||||
@Override @DB
|
@Override @DB
|
||||||
@ -344,9 +346,12 @@ public class SnapshotManagerImpl implements SnapshotManager {
|
|||||||
txn.commit();
|
txn.commit();
|
||||||
|
|
||||||
// Send a ManageSnapshotCommand to the agent
|
// Send a ManageSnapshotCommand to the agent
|
||||||
ManageSnapshotCommand cmd = new ManageSnapshotCommand(ManageSnapshotCommand.CREATE_SNAPSHOT, id, volume.getPath(), snapshotName, _vmDao.findById(volume.getInstanceId()).getInstanceName());
|
String vmName = _storageMgr.getVmNameOnVolume(volume);
|
||||||
|
|
||||||
|
ManageSnapshotCommand cmd = new ManageSnapshotCommand(ManageSnapshotCommand.CREATE_SNAPSHOT, id, volume.getPath(), snapshotName, vmName);
|
||||||
String basicErrMsg = "Failed to create snapshot for volume: " + volume.getId();
|
String basicErrMsg = "Failed to create snapshot for volume: " + volume.getId();
|
||||||
ManageSnapshotAnswer answer = (ManageSnapshotAnswer) _storageMgr.sendToHostsOnStoragePool(volume.getPoolId(), cmd, basicErrMsg, _totalRetries, _pauseInterval, _shouldBeSnapshotCapable);
|
ManageSnapshotAnswer answer = (ManageSnapshotAnswer) _storageMgr.sendToHostsOnStoragePool(volume.getPoolId(), cmd, basicErrMsg, _totalRetries, _pauseInterval,
|
||||||
|
_shouldBeSnapshotCapable, volume.getInstanceId());
|
||||||
|
|
||||||
txn = Transaction.currentTxn();
|
txn = Transaction.currentTxn();
|
||||||
txn.start();
|
txn.start();
|
||||||
@ -521,6 +526,7 @@ public class SnapshotManagerImpl implements SnapshotManager {
|
|||||||
}
|
}
|
||||||
String firstBackupUuid = volume.getFirstSnapshotBackupUuid();
|
String firstBackupUuid = volume.getFirstSnapshotBackupUuid();
|
||||||
boolean isVolumeInactive = _storageMgr.volumeInactive(volume);
|
boolean isVolumeInactive = _storageMgr.volumeInactive(volume);
|
||||||
|
String vmName = _storageMgr.getVmNameOnVolume(volume);
|
||||||
BackupSnapshotCommand backupSnapshotCommand =
|
BackupSnapshotCommand backupSnapshotCommand =
|
||||||
new BackupSnapshotCommand(primaryStoragePoolNameLabel,
|
new BackupSnapshotCommand(primaryStoragePoolNameLabel,
|
||||||
secondaryStoragePoolUrl,
|
secondaryStoragePoolUrl,
|
||||||
@ -533,7 +539,8 @@ public class SnapshotManagerImpl implements SnapshotManager {
|
|||||||
prevBackupUuid,
|
prevBackupUuid,
|
||||||
firstBackupUuid,
|
firstBackupUuid,
|
||||||
isFirstSnapshotOfRootVolume,
|
isFirstSnapshotOfRootVolume,
|
||||||
isVolumeInactive);
|
isVolumeInactive,
|
||||||
|
vmName);
|
||||||
|
|
||||||
String backedUpSnapshotUuid = null;
|
String backedUpSnapshotUuid = null;
|
||||||
// By default, assume failed.
|
// By default, assume failed.
|
||||||
@ -544,7 +551,8 @@ public class SnapshotManagerImpl implements SnapshotManager {
|
|||||||
basicErrMsg,
|
basicErrMsg,
|
||||||
_totalRetries,
|
_totalRetries,
|
||||||
_pauseInterval,
|
_pauseInterval,
|
||||||
_shouldBeSnapshotCapable);
|
_shouldBeSnapshotCapable,
|
||||||
|
volume.getInstanceId());
|
||||||
if (answer != null && answer.getResult()) {
|
if (answer != null && answer.getResult()) {
|
||||||
backedUpSnapshotUuid = answer.getBackupSnapshotName();
|
backedUpSnapshotUuid = answer.getBackupSnapshotName();
|
||||||
if (backedUpSnapshotUuid != null) {
|
if (backedUpSnapshotUuid != null) {
|
||||||
@ -734,7 +742,8 @@ public class SnapshotManagerImpl implements SnapshotManager {
|
|||||||
basicErrMsg,
|
basicErrMsg,
|
||||||
_totalRetries,
|
_totalRetries,
|
||||||
_pauseInterval,
|
_pauseInterval,
|
||||||
_shouldBeSnapshotCapable);
|
_shouldBeSnapshotCapable,
|
||||||
|
volume.getInstanceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
return answer;
|
return answer;
|
||||||
@ -893,7 +902,7 @@ public class SnapshotManagerImpl implements SnapshotManager {
|
|||||||
details,
|
details,
|
||||||
_totalRetries,
|
_totalRetries,
|
||||||
_pauseInterval,
|
_pauseInterval,
|
||||||
_shouldBeSnapshotCapable);
|
_shouldBeSnapshotCapable, volume.getInstanceId());
|
||||||
|
|
||||||
if ((answer != null) && answer.getResult()) {
|
if ((answer != null) && answer.getResult()) {
|
||||||
// This is not the last snapshot.
|
// This is not the last snapshot.
|
||||||
@ -1020,7 +1029,7 @@ public class SnapshotManagerImpl implements SnapshotManager {
|
|||||||
Long poolId = volume.getPoolId();
|
Long poolId = volume.getPoolId();
|
||||||
if (poolId != null) {
|
if (poolId != null) {
|
||||||
// Retry only once for this command. There's low chance of failure because of a connection problem.
|
// Retry only once for this command. There's low chance of failure because of a connection problem.
|
||||||
answer = _storageMgr.sendToHostsOnStoragePool(poolId, cmd, basicErrMsg, 1, _pauseInterval, _shouldBeSnapshotCapable);
|
answer = _storageMgr.sendToHostsOnStoragePool(poolId, cmd, basicErrMsg, 1, _pauseInterval, _shouldBeSnapshotCapable, volume.getInstanceId());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
s_logger.info("Pool id for volume id: " + volumeId + " belonging to account id: " + accountId + " is null. Assuming the snapshotsDir for the account has already been deleted");
|
s_logger.info("Pool id for volume id: " + volumeId + " belonging to account id: " + accountId + " is null. Assuming the snapshotsDir for the account has already been deleted");
|
||||||
@ -1230,7 +1239,7 @@ public class SnapshotManagerImpl implements SnapshotManager {
|
|||||||
snapshot.getName(),
|
snapshot.getName(),
|
||||||
backupOfNextSnapshot);
|
backupOfNextSnapshot);
|
||||||
String basicErrMsg = "Failed to destroy snapshot id: " + snapshotId + " for volume id: " + volumeId;
|
String basicErrMsg = "Failed to destroy snapshot id: " + snapshotId + " for volume id: " + volumeId;
|
||||||
Answer answer = _storageMgr.sendToHostsOnStoragePool(volume.getPoolId(), cmd, basicErrMsg, _totalRetries, _pauseInterval, _shouldBeSnapshotCapable);
|
Answer answer = _storageMgr.sendToHostsOnStoragePool(volume.getPoolId(), cmd, basicErrMsg, _totalRetries, _pauseInterval, _shouldBeSnapshotCapable, volume.getInstanceId());
|
||||||
|
|
||||||
if ((answer != null) && answer.getResult()) {
|
if ((answer != null) && answer.getResult()) {
|
||||||
success = true;
|
success = true;
|
||||||
@ -1287,6 +1296,8 @@ public class SnapshotManagerImpl implements SnapshotManager {
|
|||||||
throw new ConfigurationException("Unable to get the configuration dao.");
|
throw new ConfigurationException("Unable to get the configuration dao.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_hypervisorType = configDao.getValue("hypervisor.type");
|
||||||
|
|
||||||
DateUtil.IntervalType.HOURLY.setMax(NumbersUtil.parseInt(configDao.getValue("snapshot.max.hourly"), HOURLYMAX));
|
DateUtil.IntervalType.HOURLY.setMax(NumbersUtil.parseInt(configDao.getValue("snapshot.max.hourly"), HOURLYMAX));
|
||||||
DateUtil.IntervalType.DAILY.setMax(NumbersUtil.parseInt(configDao.getValue("snapshot.max.daily"), DAILYMAX));
|
DateUtil.IntervalType.DAILY.setMax(NumbersUtil.parseInt(configDao.getValue("snapshot.max.daily"), DAILYMAX));
|
||||||
DateUtil.IntervalType.WEEKLY.setMax(NumbersUtil.parseInt(configDao.getValue("snapshot.max.weekly"), WEEKLYMAX));
|
DateUtil.IntervalType.WEEKLY.setMax(NumbersUtil.parseInt(configDao.getValue("snapshot.max.weekly"), WEEKLYMAX));
|
||||||
@ -1330,4 +1341,6 @@ public class SnapshotManagerImpl implements SnapshotManager {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,12 +29,14 @@ import com.cloud.async.executor.StopVMExecutor;
|
|||||||
import com.cloud.async.executor.VMOperationParam;
|
import com.cloud.async.executor.VMOperationParam;
|
||||||
import com.cloud.dc.DataCenterVO;
|
import com.cloud.dc.DataCenterVO;
|
||||||
import com.cloud.exception.ConcurrentOperationException;
|
import com.cloud.exception.ConcurrentOperationException;
|
||||||
|
import com.cloud.exception.InsufficientCapacityException;
|
||||||
import com.cloud.exception.InsufficientStorageCapacityException;
|
import com.cloud.exception.InsufficientStorageCapacityException;
|
||||||
import com.cloud.exception.InternalErrorException;
|
import com.cloud.exception.InternalErrorException;
|
||||||
import com.cloud.exception.InvalidParameterValueException;
|
import com.cloud.exception.InvalidParameterValueException;
|
||||||
import com.cloud.exception.ResourceAllocationException;
|
import com.cloud.exception.ResourceAllocationException;
|
||||||
import com.cloud.exception.StorageUnavailableException;
|
import com.cloud.exception.StorageUnavailableException;
|
||||||
import com.cloud.network.security.NetworkGroupVO;
|
import com.cloud.network.security.NetworkGroupVO;
|
||||||
|
import com.cloud.offerings.NetworkOfferingVO;
|
||||||
import com.cloud.service.ServiceOfferingVO;
|
import com.cloud.service.ServiceOfferingVO;
|
||||||
import com.cloud.storage.DiskOfferingVO;
|
import com.cloud.storage.DiskOfferingVO;
|
||||||
import com.cloud.storage.SnapshotVO;
|
import com.cloud.storage.SnapshotVO;
|
||||||
@ -53,6 +55,7 @@ import com.cloud.vm.VirtualMachine.Event;
|
|||||||
*/
|
*/
|
||||||
public interface UserVmManager extends Manager, VirtualMachineManager<UserVmVO> {
|
public interface UserVmManager extends Manager, VirtualMachineManager<UserVmVO> {
|
||||||
|
|
||||||
|
UserVmVO allocate(String displayName, VMTemplateVO template, ServiceOfferingVO serviceOffering, NetworkOfferingVO[] networkOfferings, DiskOfferingVO[] diskOfferings, AccountVO owner, long userId) throws InsufficientCapacityException;
|
||||||
|
|
||||||
static final int MAX_USER_DATA_LENGTH_BYTES = 2048;
|
static final int MAX_USER_DATA_LENGTH_BYTES = 2048;
|
||||||
/**
|
/**
|
||||||
@ -77,11 +80,11 @@ public interface UserVmManager extends Manager, VirtualMachineManager<UserVmVO>
|
|||||||
* @param diskOffering the disk offering for the root disk (deploying from ISO) or the data disk (deploying from a normal template)
|
* @param diskOffering the disk offering for the root disk (deploying from ISO) or the data disk (deploying from a normal template)
|
||||||
* @return UserVmVO if created; null if not.
|
* @return UserVmVO if created; null if not.
|
||||||
*/
|
*/
|
||||||
UserVmVO createVirtualMachine(Long vmId, long userId, AccountVO account, DataCenterVO dc, ServiceOfferingVO offering, VMTemplateVO template, DiskOfferingVO diskOffering, String displayName, String group, String userData, List<StoragePoolVO> avoids, long startEventId) throws InsufficientStorageCapacityException, InternalErrorException, ResourceAllocationException;
|
UserVmVO createVirtualMachine(Long vmId, long userId, AccountVO account, DataCenterVO dc, ServiceOfferingVO offering, VMTemplateVO template, DiskOfferingVO diskOffering, String displayName, String group, String userData, List<StoragePoolVO> avoids, long startEventId, long size) throws InsufficientStorageCapacityException, InternalErrorException, ResourceAllocationException;
|
||||||
|
|
||||||
UserVmVO createDirectlyAttachedVM(Long vmId, long userId, AccountVO account, DataCenterVO dc, ServiceOfferingVO offering, VMTemplateVO template, DiskOfferingVO diskOffering, String displayName, String group, String userData, List<StoragePoolVO> a, List<NetworkGroupVO> networkGroupVO, long startEventId) throws InternalErrorException, ResourceAllocationException;
|
UserVmVO createDirectlyAttachedVM(Long vmId, long userId, AccountVO account, DataCenterVO dc, ServiceOfferingVO offering, VMTemplateVO template, DiskOfferingVO diskOffering, String displayName, String group, String userData, List<StoragePoolVO> a, List<NetworkGroupVO> networkGroupVO, long startEventId, long size) throws InternalErrorException, ResourceAllocationException;
|
||||||
|
|
||||||
UserVmVO createDirectlyAttachedVMExternal(Long vmId, long userId, AccountVO account, DataCenterVO dc, ServiceOfferingVO offering, VMTemplateVO template, DiskOfferingVO diskOffering, String displayName, String group, String userData, List<StoragePoolVO> a, List<NetworkGroupVO> networkGroupVO, long startEventId) throws InternalErrorException, ResourceAllocationException;
|
UserVmVO createDirectlyAttachedVMExternal(Long vmId, long userId, AccountVO account, DataCenterVO dc, ServiceOfferingVO offering, VMTemplateVO template, DiskOfferingVO diskOffering, String displayName, String group, String userData, List<StoragePoolVO> a, List<NetworkGroupVO> networkGroupVO, long startEventId, long size) throws InternalErrorException, ResourceAllocationException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys one virtual machine
|
* Destroys one virtual machine
|
||||||
@ -181,7 +184,7 @@ public interface UserVmManager extends Manager, VirtualMachineManager<UserVmVO>
|
|||||||
boolean rebootVirtualMachine(long userId, long vmId);
|
boolean rebootVirtualMachine(long userId, long vmId);
|
||||||
OperationResponse executeRebootVM(RebootVMExecutor executor, VMOperationParam param);
|
OperationResponse executeRebootVM(RebootVMExecutor executor, VMOperationParam param);
|
||||||
|
|
||||||
boolean recoverVirtualMachine(long vmId) throws ResourceAllocationException;
|
boolean recoverVirtualMachine(long vmId) throws ResourceAllocationException, InternalErrorException;
|
||||||
|
|
||||||
VMTemplateVO createPrivateTemplateRecord(Long userId, long vmId, String name, String description, long guestOsId, Boolean requiresHvm, Integer bits, Boolean passwordEnabled, boolean isPublic, boolean featured)
|
VMTemplateVO createPrivateTemplateRecord(Long userId, long vmId, String name, String description, long guestOsId, Boolean requiresHvm, Integer bits, Boolean passwordEnabled, boolean isPublic, boolean featured)
|
||||||
throws InvalidParameterValueException;
|
throws InvalidParameterValueException;
|
||||||
|
|||||||
@ -82,8 +82,8 @@ import com.cloud.configuration.dao.ConfigurationDao;
|
|||||||
import com.cloud.configuration.dao.ResourceLimitDao;
|
import com.cloud.configuration.dao.ResourceLimitDao;
|
||||||
import com.cloud.dc.DataCenterVO;
|
import com.cloud.dc.DataCenterVO;
|
||||||
import com.cloud.dc.HostPodVO;
|
import com.cloud.dc.HostPodVO;
|
||||||
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.dc.dao.DataCenterDao;
|
import com.cloud.dc.dao.DataCenterDao;
|
||||||
import com.cloud.dc.dao.HostPodDao;
|
import com.cloud.dc.dao.HostPodDao;
|
||||||
import com.cloud.dc.dao.VlanDao;
|
import com.cloud.dc.dao.VlanDao;
|
||||||
@ -94,6 +94,7 @@ import com.cloud.event.EventVO;
|
|||||||
import com.cloud.event.dao.EventDao;
|
import com.cloud.event.dao.EventDao;
|
||||||
import com.cloud.exception.AgentUnavailableException;
|
import com.cloud.exception.AgentUnavailableException;
|
||||||
import com.cloud.exception.ConcurrentOperationException;
|
import com.cloud.exception.ConcurrentOperationException;
|
||||||
|
import com.cloud.exception.InsufficientCapacityException;
|
||||||
import com.cloud.exception.InternalErrorException;
|
import com.cloud.exception.InternalErrorException;
|
||||||
import com.cloud.exception.InvalidParameterValueException;
|
import com.cloud.exception.InvalidParameterValueException;
|
||||||
import com.cloud.exception.OperationTimedoutException;
|
import com.cloud.exception.OperationTimedoutException;
|
||||||
@ -121,24 +122,25 @@ import com.cloud.network.security.NetworkGroupManager;
|
|||||||
import com.cloud.network.security.NetworkGroupVO;
|
import com.cloud.network.security.NetworkGroupVO;
|
||||||
import com.cloud.offering.ServiceOffering;
|
import com.cloud.offering.ServiceOffering;
|
||||||
import com.cloud.offering.ServiceOffering.GuestIpType;
|
import com.cloud.offering.ServiceOffering.GuestIpType;
|
||||||
|
import com.cloud.offerings.NetworkOfferingVO;
|
||||||
import com.cloud.service.ServiceOfferingVO;
|
import com.cloud.service.ServiceOfferingVO;
|
||||||
import com.cloud.service.dao.ServiceOfferingDao;
|
import com.cloud.service.dao.ServiceOfferingDao;
|
||||||
import com.cloud.storage.DiskOfferingVO;
|
import com.cloud.storage.DiskOfferingVO;
|
||||||
import com.cloud.storage.GuestOSVO;
|
import com.cloud.storage.GuestOSVO;
|
||||||
import com.cloud.storage.Snapshot;
|
import com.cloud.storage.Snapshot;
|
||||||
|
import com.cloud.storage.Snapshot.SnapshotType;
|
||||||
import com.cloud.storage.SnapshotVO;
|
import com.cloud.storage.SnapshotVO;
|
||||||
import com.cloud.storage.Storage;
|
import com.cloud.storage.Storage;
|
||||||
|
import com.cloud.storage.Storage.ImageFormat;
|
||||||
import com.cloud.storage.StorageManager;
|
import com.cloud.storage.StorageManager;
|
||||||
import com.cloud.storage.StoragePoolVO;
|
import com.cloud.storage.StoragePoolVO;
|
||||||
import com.cloud.storage.VMTemplateHostVO;
|
import com.cloud.storage.VMTemplateHostVO;
|
||||||
import com.cloud.storage.VMTemplateVO;
|
|
||||||
import com.cloud.storage.Volume;
|
|
||||||
import com.cloud.storage.VolumeVO;
|
|
||||||
import com.cloud.storage.Snapshot.SnapshotType;
|
|
||||||
import com.cloud.storage.Storage.ImageFormat;
|
|
||||||
import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
|
import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
|
||||||
|
import com.cloud.storage.VMTemplateVO;
|
||||||
import com.cloud.storage.VirtualMachineTemplate.BootloaderType;
|
import com.cloud.storage.VirtualMachineTemplate.BootloaderType;
|
||||||
|
import com.cloud.storage.Volume;
|
||||||
import com.cloud.storage.Volume.VolumeType;
|
import com.cloud.storage.Volume.VolumeType;
|
||||||
|
import com.cloud.storage.VolumeVO;
|
||||||
import com.cloud.storage.dao.DiskOfferingDao;
|
import com.cloud.storage.dao.DiskOfferingDao;
|
||||||
import com.cloud.storage.dao.DiskTemplateDao;
|
import com.cloud.storage.dao.DiskTemplateDao;
|
||||||
import com.cloud.storage.dao.GuestOSCategoryDao;
|
import com.cloud.storage.dao.GuestOSCategoryDao;
|
||||||
@ -1199,11 +1201,180 @@ public class UserVmManagerImpl implements UserVmManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
userVm.setGuestIpAddress(null);
|
userVm.setGuestIpAddress(null);
|
||||||
//_vmDao.update(userVm.getId(), userVm); FIXME need an updateIf
|
_vmDao.update(userVm.getId(), userVm);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserVmVO allocate(String displayName, VMTemplateVO template, ServiceOfferingVO serviceOffering, NetworkOfferingVO[] networkOfferings, DiskOfferingVO[] diskOfferings, AccountVO owner, long userId) throws InsufficientCapacityException {
|
||||||
|
/*
|
||||||
|
long accountId = account.getId();
|
||||||
|
long dataCenterId = dc.getId();
|
||||||
|
long serviceOfferingId = offering.getId();
|
||||||
|
UserVmVO vm = new UserVmVO();
|
||||||
|
|
||||||
|
if (s_logger.isDebugEnabled()) {
|
||||||
|
s_logger.debug("Creating vm for account id=" + account.getId() +
|
||||||
|
", name="+ account.getAccountName() + "; dc=" + dc.getName() +
|
||||||
|
"; offering=" + offering.getId() + "; diskOffering=" + ((diskOffering != null) ? diskOffering.getName() : "none") +
|
||||||
|
"; template=" + template.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
DomainRouterVO router = _routerDao.findBy(accountId, dataCenterId, Role.DHCP_FIREWALL_LB_PASSWD_USERDATA);
|
||||||
|
if (router == null) {
|
||||||
|
throw new InternalErrorException("Cannot find a router for account (" + accountId + "/" +
|
||||||
|
account.getAccountName() + ") in " + dataCenterId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine the Guest OS Id
|
||||||
|
long guestOSId;
|
||||||
|
if (template != null) {
|
||||||
|
guestOSId = template.getGuestOSId();
|
||||||
|
} else {
|
||||||
|
throw new InternalErrorException("No template or ISO was specified for the VM.");
|
||||||
|
}
|
||||||
|
long numVolumes = -1;
|
||||||
|
Transaction txn = Transaction.currentTxn();
|
||||||
|
long routerId = router.getId();
|
||||||
|
|
||||||
|
String name;
|
||||||
|
txn.start();
|
||||||
|
|
||||||
|
account = _accountDao.lock(accountId, true);
|
||||||
|
if (account == null) {
|
||||||
|
throw new InternalErrorException("Unable to lock up the account: " + accountId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// First check that the maximum number of UserVMs for the given accountId will not be exceeded
|
||||||
|
if (_accountMgr.resourceLimitExceeded(account, ResourceType.user_vm)) {
|
||||||
|
ResourceAllocationException rae = new ResourceAllocationException("Maximum number of virtual machines for account: " + account.getAccountName() + " has been exceeded.");
|
||||||
|
rae.setResourceType("vm");
|
||||||
|
throw rae;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isIso = Storage.ImageFormat.ISO.equals(template.getFormat());
|
||||||
|
numVolumes = (isIso || (diskOffering == null)) ? 1 : 2;
|
||||||
|
_accountMgr.incrementResourceCount(account.getId(), ResourceType.user_vm);
|
||||||
|
_accountMgr.incrementResourceCount(account.getId(), ResourceType.volume, numVolumes);
|
||||||
|
txn.commit();
|
||||||
|
|
||||||
|
name = VirtualMachineName.getVmName(vmId, accountId, _instance);
|
||||||
|
|
||||||
|
String diskOfferingIdentifier = (diskOffering != null) ? String.valueOf(diskOffering.getId()) : "-1";
|
||||||
|
String eventParams = "id=" + vmId + "\nvmName=" + name + "\nsoId=" + serviceOfferingId + "\ndoId=" + diskOfferingIdentifier + "\ntId=" + template.getId() + "\ndcId=" + dataCenterId;
|
||||||
|
EventVO event = new EventVO();
|
||||||
|
event.setUserId(userId);
|
||||||
|
event.setAccountId(accountId);
|
||||||
|
event.setStartId(startEventId);
|
||||||
|
event.setState(EventState.Completed);
|
||||||
|
event.setType(EventTypes.EVENT_VM_CREATE);
|
||||||
|
event.setParameters(eventParams);
|
||||||
|
|
||||||
|
try {
|
||||||
|
Pair<HostPodVO, Long> pod = null;
|
||||||
|
long poolid = 0;
|
||||||
|
Set<Long> podsToAvoid = new HashSet<Long>();
|
||||||
|
|
||||||
|
while ((pod = _agentMgr.findPod(template, offering, dc, account.getId(), podsToAvoid)) != null) {
|
||||||
|
if (vm == null) {
|
||||||
|
vm = new UserVmVO(vmId, name, template.getId(), guestOSId, accountId, account.getDomainId().longValue(),
|
||||||
|
serviceOfferingId, null, null, router.getGuestNetmask(),
|
||||||
|
null,null,null,
|
||||||
|
routerId, pod.first().getId(), dataCenterId,
|
||||||
|
offering.getOfferHA(), displayName, group, userData);
|
||||||
|
|
||||||
|
if (diskOffering != null) {
|
||||||
|
vm.setMirroredVols(diskOffering.isMirrored());
|
||||||
|
}
|
||||||
|
|
||||||
|
vm.setLastHostId(pod.second());
|
||||||
|
|
||||||
|
vm = _vmDao.persist(vm);
|
||||||
|
} else {
|
||||||
|
vm.setPodId(pod.first().getId());
|
||||||
|
_vmDao.updateIf(vm, Event.OperationRetry, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
String ipAddressStr = acquireGuestIpAddress(dataCenterId, accountId, vm);
|
||||||
|
if (ipAddressStr == null) {
|
||||||
|
s_logger.warn("Failed user vm creation : no guest ip address available");
|
||||||
|
releaseGuestIpAddress(vm);
|
||||||
|
ResourceAllocationException rae = new ResourceAllocationException("No guest ip addresses available for " + account.getAccountName() + " (try destroying some instances)");
|
||||||
|
rae.setResourceType("vm");
|
||||||
|
throw rae;
|
||||||
|
}
|
||||||
|
|
||||||
|
poolid = _storageMgr.createUserVM(account, vm, template, dc, pod.first(), offering, diskOffering, avoids);
|
||||||
|
if ( poolid != 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (s_logger.isDebugEnabled()) {
|
||||||
|
s_logger.debug("Unable to find storage host in pod " + pod.first().getName() + " (id:" + pod.first().getId() + ") while creating " + vm.toString() + ", checking other pods");
|
||||||
|
}
|
||||||
|
|
||||||
|
// if it fails at storage allocation round, reset lastHostId to "release"
|
||||||
|
// the CPU/memory allocation on the candidate host
|
||||||
|
vm.setLastHostId(null);
|
||||||
|
_vmDao.update(vm.getId(), vm);
|
||||||
|
|
||||||
|
podsToAvoid.add(pod.first().getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((vm == null) || (poolid == 0)) {
|
||||||
|
throw new ResourceAllocationException("Create VM " + ((vm == null) ? vmId : vm.toString()) + " failed due to no Storage Pool is available");
|
||||||
|
}
|
||||||
|
|
||||||
|
txn.start();
|
||||||
|
if(vm != null && vm.getName() != null && vm.getDisplayName() != null)
|
||||||
|
{
|
||||||
|
if(!vm.getName().equals(vm.getDisplayName()))
|
||||||
|
event.setDescription("successfully created VM instance : " + vm.getName()+"("+vm.getDisplayName()+")");
|
||||||
|
else
|
||||||
|
event.setDescription("successfully created VM instance : " + vm.getName());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
event.setDescription("successfully created VM instance :"+name);
|
||||||
|
}
|
||||||
|
|
||||||
|
_eventDao.persist(event);
|
||||||
|
|
||||||
|
_vmDao.updateIf(vm, Event.OperationSucceeded, null);
|
||||||
|
if (s_logger.isDebugEnabled()) {
|
||||||
|
s_logger.debug("vm created " + vmId);
|
||||||
|
}
|
||||||
|
txn.commit();
|
||||||
|
|
||||||
|
return _vmDao.findById(vmId);
|
||||||
|
} catch (Throwable th) {
|
||||||
|
s_logger.error("Unable to create vm", th);
|
||||||
|
if (vm != null) {
|
||||||
|
_vmDao.delete(vmId);
|
||||||
|
}
|
||||||
|
_accountMgr.decrementResourceCount(account.getId(), ResourceType.user_vm);
|
||||||
|
_accountMgr.decrementResourceCount(account.getId(), ResourceType.volume, numVolumes);
|
||||||
|
|
||||||
|
String eventDescription = "Failed to create VM: ";
|
||||||
|
if (vm == null) {
|
||||||
|
eventDescription += "new instance";
|
||||||
|
} else {
|
||||||
|
eventDescription += vm.getName();
|
||||||
|
if (!vm.getName().equals(vm.getDisplayName())) {
|
||||||
|
eventDescription += " (" + vm.getDisplayName() + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (th instanceof ResourceAllocationException) {
|
||||||
|
throw (ResourceAllocationException)th;
|
||||||
|
}
|
||||||
|
throw new CloudRuntimeException("Unable to create vm", th);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @DB
|
@Override @DB
|
||||||
public UserVmVO createVirtualMachine(Long vmId, long userId, AccountVO account, DataCenterVO dc, ServiceOfferingVO offering, VMTemplateVO template, DiskOfferingVO diskOffering, String displayName, String group, String userData, List<StoragePoolVO> avoids, long startEventId) throws InternalErrorException, ResourceAllocationException {
|
public UserVmVO createVirtualMachine(Long vmId, long userId, AccountVO account, DataCenterVO dc, ServiceOfferingVO offering, VMTemplateVO template, DiskOfferingVO diskOffering, String displayName, String group, String userData, List<StoragePoolVO> avoids, long startEventId, long size) throws InternalErrorException, ResourceAllocationException {
|
||||||
long accountId = account.getId();
|
long accountId = account.getId();
|
||||||
long dataCenterId = dc.getId();
|
long dataCenterId = dc.getId();
|
||||||
long serviceOfferingId = offering.getId();
|
long serviceOfferingId = offering.getId();
|
||||||
@ -1300,7 +1471,7 @@ public class UserVmManagerImpl implements UserVmManager {
|
|||||||
throw rae;
|
throw rae;
|
||||||
}
|
}
|
||||||
|
|
||||||
poolid = _storageMgr.createUserVM(account, vm, template, dc, pod.first(), offering, diskOffering, avoids);
|
poolid = _storageMgr.createUserVM(account, vm, template, dc, pod.first(), offering, diskOffering, avoids,size);
|
||||||
if ( poolid != 0) {
|
if ( poolid != 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1526,8 +1697,9 @@ public class UserVmManagerImpl implements UserVmManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override @DB
|
@Override @DB
|
||||||
public boolean recoverVirtualMachine(long vmId) throws ResourceAllocationException {
|
public boolean recoverVirtualMachine(long vmId) throws ResourceAllocationException, InternalErrorException {
|
||||||
UserVmVO vm = _vmDao.findById(vmId);
|
UserVmVO vm = _vmDao.findById(vmId);
|
||||||
|
|
||||||
if (vm == null || vm.getRemoved() != null) {
|
if (vm == null || vm.getRemoved() != null) {
|
||||||
if (s_logger.isDebugEnabled()) {
|
if (s_logger.isDebugEnabled()) {
|
||||||
s_logger.debug("Unable to find vm or vm is removed: " + vmId);
|
s_logger.debug("Unable to find vm or vm is removed: " + vmId);
|
||||||
@ -1558,6 +1730,10 @@ public class UserVmManagerImpl implements UserVmManager {
|
|||||||
|
|
||||||
account = _accountDao.lock(vm.getAccountId(), true);
|
account = _accountDao.lock(vm.getAccountId(), true);
|
||||||
|
|
||||||
|
//if the account is deleted, throw error
|
||||||
|
if(account.getRemoved()!=null)
|
||||||
|
throw new InternalErrorException("Unable to recover VM as the account is deleted");
|
||||||
|
|
||||||
// First check that the maximum number of UserVMs for the given accountId will not be exceeded
|
// First check that the maximum number of UserVMs for the given accountId will not be exceeded
|
||||||
if (_accountMgr.resourceLimitExceeded(account, ResourceType.user_vm)) {
|
if (_accountMgr.resourceLimitExceeded(account, ResourceType.user_vm)) {
|
||||||
ResourceAllocationException rae = new ResourceAllocationException("Maximum number of virtual machines for account: " + account.getAccountName() + " has been exceeded.");
|
ResourceAllocationException rae = new ResourceAllocationException("Maximum number of virtual machines for account: " + account.getAccountName() + " has been exceeded.");
|
||||||
@ -2382,7 +2558,7 @@ public class UserVmManagerImpl implements UserVmManager {
|
|||||||
|
|
||||||
@DB
|
@DB
|
||||||
@Override
|
@Override
|
||||||
public UserVmVO createDirectlyAttachedVM(Long vmId, long userId, AccountVO account, DataCenterVO dc, ServiceOfferingVO offering, VMTemplateVO template, DiskOfferingVO diskOffering, String displayName, String group, String userData, List<StoragePoolVO> a, List<NetworkGroupVO> networkGroups, long startEventId) throws InternalErrorException, ResourceAllocationException {
|
public UserVmVO createDirectlyAttachedVM(Long vmId, long userId, AccountVO account, DataCenterVO dc, ServiceOfferingVO offering, VMTemplateVO template, DiskOfferingVO diskOffering, String displayName, String group, String userData, List<StoragePoolVO> a, List<NetworkGroupVO> networkGroups, long startEventId, long size) throws InternalErrorException, ResourceAllocationException {
|
||||||
|
|
||||||
long accountId = account.getId();
|
long accountId = account.getId();
|
||||||
long dataCenterId = dc.getId();
|
long dataCenterId = dc.getId();
|
||||||
@ -2509,7 +2685,7 @@ public class UserVmManagerImpl implements UserVmManager {
|
|||||||
|
|
||||||
vm = _vmDao.findById(vmId);
|
vm = _vmDao.findById(vmId);
|
||||||
try {
|
try {
|
||||||
poolId = _storageMgr.createUserVM(account, vm, template, dc, pod.first(), offering, diskOffering, a);
|
poolId = _storageMgr.createUserVM(account, vm, template, dc, pod.first(), offering, diskOffering, a,size);
|
||||||
} catch (CloudRuntimeException e) {
|
} catch (CloudRuntimeException e) {
|
||||||
_vmDao.delete(vmId);
|
_vmDao.delete(vmId);
|
||||||
_ipAddressDao.unassignIpAddress(guestIp);
|
_ipAddressDao.unassignIpAddress(guestIp);
|
||||||
@ -2582,7 +2758,7 @@ public class UserVmManagerImpl implements UserVmManager {
|
|||||||
|
|
||||||
@DB
|
@DB
|
||||||
@Override
|
@Override
|
||||||
public UserVmVO createDirectlyAttachedVMExternal(Long vmId, long userId, AccountVO account, DataCenterVO dc, ServiceOfferingVO offering, VMTemplateVO template, DiskOfferingVO diskOffering, String displayName, String group, String userData, List<StoragePoolVO> a, List<NetworkGroupVO> networkGroups, long startEventId) throws InternalErrorException, ResourceAllocationException {
|
public UserVmVO createDirectlyAttachedVMExternal(Long vmId, long userId, AccountVO account, DataCenterVO dc, ServiceOfferingVO offering, VMTemplateVO template, DiskOfferingVO diskOffering, String displayName, String group, String userData, List<StoragePoolVO> a, List<NetworkGroupVO> networkGroups, long startEventId, long size) throws InternalErrorException, ResourceAllocationException {
|
||||||
long accountId = account.getId();
|
long accountId = account.getId();
|
||||||
long dataCenterId = dc.getId();
|
long dataCenterId = dc.getId();
|
||||||
long serviceOfferingId = offering.getId();
|
long serviceOfferingId = offering.getId();
|
||||||
@ -2668,7 +2844,7 @@ public class UserVmManagerImpl implements UserVmManager {
|
|||||||
|
|
||||||
vm = _vmDao.findById(vmId);
|
vm = _vmDao.findById(vmId);
|
||||||
try {
|
try {
|
||||||
poolId = _storageMgr.createUserVM(account, vm, template, dc, pod.first(), offering, diskOffering, a);
|
poolId = _storageMgr.createUserVM(account, vm, template, dc, pod.first(), offering, diskOffering,a,size);
|
||||||
} catch (CloudRuntimeException e) {
|
} catch (CloudRuntimeException e) {
|
||||||
_vmDao.delete(vmId);
|
_vmDao.delete(vmId);
|
||||||
_accountMgr.decrementResourceCount(account.getId(), ResourceType.user_vm);
|
_accountMgr.decrementResourceCount(account.getId(), ResourceType.user_vm);
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
<script type="text/javascript" src="scripts/cloud.core.accounts.js"></script>
|
||||||
|
|
||||||
<!-- Accounts -->
|
<!-- Accounts -->
|
||||||
<div class="maincontent" style="display:block;" id="submenu_content_account">
|
<div class="maincontent" style="display:block;" id="submenu_content_account">
|
||||||
<div id="maincontent_title">
|
<div id="maincontent_title">
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
<script type="text/javascript" src="scripts/cloud.core.configuration.js"></script>
|
||||||
|
|
||||||
<!-- Content Panel -->
|
<!-- Content Panel -->
|
||||||
<!-- Submenu -->
|
<!-- Submenu -->
|
||||||
<div class="submenu_links">
|
<div class="submenu_links">
|
||||||
@ -135,7 +137,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<!--Zone -->
|
<!--Zone -->
|
||||||
<div class="maincontent" style="display:block;" id="submenu_content_zones">
|
<div class="maincontent" style="display:none;" id="submenu_content_zones">
|
||||||
<div id="maincontent_title">
|
<div id="maincontent_title">
|
||||||
<div class="maintitle_icon"> <img src="images/zonestitle_icons.gif" title="zones" /> </div>
|
<div class="maintitle_icon"> <img src="images/zonestitle_icons.gif" title="zones" /> </div>
|
||||||
<h1>Zones</h1>
|
<h1>Zones</h1>
|
||||||
@ -670,7 +672,7 @@
|
|||||||
<!-- END Service offerings Template -->
|
<!-- END Service offerings Template -->
|
||||||
|
|
||||||
<!-- Add Service Offering Dialog -->
|
<!-- Add Service Offering Dialog -->
|
||||||
<div id="dialog_add_service" title="Add Service Offering" style="display:block">
|
<div id="dialog_add_service" title="Add Service Offering" style="display:none">
|
||||||
<p>Please fill in the following data to add a new Service Offering.</p>
|
<p>Please fill in the following data to add a new Service Offering.</p>
|
||||||
<div class="dialog_formcontent">
|
<div class="dialog_formcontent">
|
||||||
<form action="#" method="post" id="form_acquire">
|
<form action="#" method="post" id="form_acquire">
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
<script type="text/javascript" src="scripts/cloud.core.events.js"></script>
|
||||||
|
|
||||||
<!-- Content Panel -->
|
<!-- Content Panel -->
|
||||||
<!-- Submenus -->
|
<!-- Submenus -->
|
||||||
<div class="submenu_links">
|
<div class="submenu_links">
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
<script type="text/javascript" src="scripts/cloud.core.hosts.js"></script>
|
||||||
|
|
||||||
<div class="maincontent" id="submenu_content_routing" style="display:block">
|
<div class="maincontent" id="submenu_content_routing" style="display:block">
|
||||||
<div id="maincontent_title">
|
<div id="maincontent_title">
|
||||||
<div class="maintitle_icon"> <img src="images/hosttitle_icons.gif" title="host" /> </div>
|
<div class="maintitle_icon"> <img src="images/hosttitle_icons.gif" title="host" /> </div>
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
<script type="text/javascript" src="scripts/cloud.core.instances.js"></script>
|
||||||
|
|
||||||
<!-- Content Panel -->
|
<!-- Content Panel -->
|
||||||
<!-- Submenu -->
|
<!-- Submenu -->
|
||||||
<div class="submenu_links" id="submenu_links">
|
<div class="submenu_links" id="submenu_links">
|
||||||
@ -9,7 +11,7 @@
|
|||||||
System</div>
|
System</div>
|
||||||
</div>
|
</div>
|
||||||
<!--VM -->
|
<!--VM -->
|
||||||
<div class="maincontent" style="display: block;" id="submenu_content_vms">
|
<div class="maincontent" style="display: none;" id="submenu_content_vms">
|
||||||
<div id="maincontent_title">
|
<div id="maincontent_title">
|
||||||
<div class="maintitle_icon">
|
<div class="maintitle_icon">
|
||||||
<img src="images/instancetitle_icons.gif" title="instance" />
|
<img src="images/instancetitle_icons.gif" title="instance" />
|
||||||
@ -389,7 +391,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Create Template Dialog -->
|
<!-- Create Template Dialog -->
|
||||||
<div id="dialog_create_template" title="Create Template">
|
<div id="dialog_create_template" title="Create Template" style="display:none">
|
||||||
<p>
|
<p>
|
||||||
Please specify the following information before creating a template of your disk
|
Please specify the following information before creating a template of your disk
|
||||||
volume: <b><span id="volume_name"></span></b>. Creating a template could take up
|
volume: <b><span id="volume_name"></span></b>. Creating a template could take up
|
||||||
@ -866,7 +868,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- New VM Wizard (end) -->
|
<!-- New VM Wizard (end) -->
|
||||||
<!-- Change Service Offering Dialog -->
|
<!-- Change Service Offering Dialog -->
|
||||||
<div id="dialog_change_service_offering" title="Change Service Offering">
|
<div id="dialog_change_service_offering" title="Change Service Offering" style="display:none">
|
||||||
<p>
|
<p>
|
||||||
To change your service for <b><span id="change_vm_name"></span></b>, please select
|
To change your service for <b><span id="change_vm_name"></span></b>, please select
|
||||||
from the following services and select 'Change'. You must restart your virtual instance
|
from the following services and select 'Change'. You must restart your virtual instance
|
||||||
@ -893,7 +895,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<!-- List Network Groups Dialog (end) -->
|
<!-- List Network Groups Dialog (end) -->
|
||||||
<!-- Change Group Dialog -->
|
<!-- Change Group Dialog -->
|
||||||
<div id="dialog_change_group" title="Change Group">
|
<div id="dialog_change_group" title="Change Group" style="display:none">
|
||||||
<p>
|
<p>
|
||||||
Please specify the new group you want to assign to your Virtual Instance: <b><span
|
Please specify the new group you want to assign to your Virtual Instance: <b><span
|
||||||
id="vm_name"></span></b>. If no such group exists, a new one will be created
|
id="vm_name"></span></b>. If no such group exists, a new one will be created
|
||||||
@ -913,7 +915,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Change Name Dialog -->
|
<!-- Change Name Dialog -->
|
||||||
<div id="dialog_change_name" title="Change Name">
|
<div id="dialog_change_name" title="Change Name" style="display:none">
|
||||||
<p>
|
<p>
|
||||||
Please specify the new name you want to change for your Virtual Instance: <b><span
|
Please specify the new name you want to change for your Virtual Instance: <b><span
|
||||||
id="vm_name"></span></b>.</p>
|
id="vm_name"></span></b>.</p>
|
||||||
@ -932,7 +934,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Attach ISO Dialog -->
|
<!-- Attach ISO Dialog -->
|
||||||
<div id="dialog_attach_iso" title="Attach ISO">
|
<div id="dialog_attach_iso" title="Attach ISO" style="display:none">
|
||||||
<p>
|
<p>
|
||||||
Please specify the ISO you wish to attach to your Virtual Instance: <b><span id="vm_name">
|
Please specify the ISO you wish to attach to your Virtual Instance: <b><span id="vm_name">
|
||||||
</span></b>.</p>
|
</span></b>.</p>
|
||||||
@ -1695,7 +1697,7 @@
|
|||||||
Terms and Conditions Dialog
|
Terms and Conditions Dialog
|
||||||
**** Please change this accordingly ****
|
**** Please change this accordingly ****
|
||||||
-->
|
-->
|
||||||
<div id="dialog_t_and_c" title="Terms and Conditions">
|
<div id="dialog_t_and_c" title="Terms and Conditions" style="display:none">
|
||||||
<p>
|
<p>
|
||||||
<b>Terms and Conditions</b><br />
|
<b>Terms and Conditions</b><br />
|
||||||
</br> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
|
</br> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
|
||||||
|
|||||||
@ -774,7 +774,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- Network Group's Ingress Rule - add row (end) -->
|
<!-- Network Group's Ingress Rule - add row (end) -->
|
||||||
<!-- Add Ingress Rule Dialog (begin) -->
|
<!-- Add Ingress Rule Dialog (begin) -->
|
||||||
<div id="dialog_add_ingress_rule" title="Add Ingress Rule" style="display: block">
|
<div id="dialog_add_ingress_rule" title="Add Ingress Rule" style="display: none">
|
||||||
<div class="dialog_formcontent">
|
<div class="dialog_formcontent">
|
||||||
<form action="#" method="post">
|
<form action="#" method="post">
|
||||||
<ol>
|
<ol>
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
<script type="text/javascript" src="scripts/cloud.core.storage.js"></script>
|
||||||
|
|
||||||
<div class="submenu_links">
|
<div class="submenu_links">
|
||||||
<div class="submenu_links_on" id="submenu_pool">
|
<div class="submenu_links_on" id="submenu_pool">
|
||||||
Primary Storage</div>
|
Primary Storage</div>
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
<script type="text/javascript" src="scripts/cloud.core.templates.js"></script>
|
||||||
|
|
||||||
<div class="submenu_links">
|
<div class="submenu_links">
|
||||||
<div class="submenu_links_on" id="submenu_template">Template</div>
|
<div class="submenu_links_on" id="submenu_template">Template</div>
|
||||||
<div class="submenu_links_off" id="submenu_iso">ISO</div>
|
<div class="submenu_links_off" id="submenu_iso">ISO</div>
|
||||||
@ -5,7 +7,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<!-- *** Template (begin) *** -->
|
<!-- *** Template (begin) *** -->
|
||||||
<div class="maincontent" id="submenu_content_template" style="display:block;">
|
<div class="maincontent" id="submenu_content_template" style="display:none;">
|
||||||
<div id="maincontent_title">
|
<div id="maincontent_title">
|
||||||
<div class="maintitle_icon"> <img src="images/templatestitle_icons.gif" title="templates" /> </div>
|
<div class="maintitle_icon"> <img src="images/templatestitle_icons.gif" title="templates" /> </div>
|
||||||
<h1>Templates</h1>
|
<h1>Templates</h1>
|
||||||
@ -324,7 +326,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<!-- *** ISO (begin) *** -->
|
<!-- *** ISO (begin) *** -->
|
||||||
<div class="maincontent" id="submenu_content_iso" style="display:block;">
|
<div class="maincontent" id="submenu_content_iso" style="display:none;">
|
||||||
<div id="maincontent_title">
|
<div id="maincontent_title">
|
||||||
<div class="maintitle_icon"> <img src="images/isotitle_icons.gif" title="templates" /> </div>
|
<div class="maintitle_icon"> <img src="images/isotitle_icons.gif" title="templates" /> </div>
|
||||||
<h1>ISO</h1>
|
<h1>ISO</h1>
|
||||||
|
|||||||
@ -43,14 +43,6 @@
|
|||||||
<script type="text/javascript" src="scripts/cloud.logger.js"></script>
|
<script type="text/javascript" src="scripts/cloud.logger.js"></script>
|
||||||
<script type="text/javascript" src="scripts/cloud.core.js"></script>
|
<script type="text/javascript" src="scripts/cloud.core.js"></script>
|
||||||
<script type="text/javascript" src="scripts/cloud.core.init.js"></script>
|
<script type="text/javascript" src="scripts/cloud.core.init.js"></script>
|
||||||
<script type="text/javascript" src="scripts/cloud.core.instances.js"></script>
|
|
||||||
<script type="text/javascript" src="scripts/cloud.core.templates.js"></script>
|
|
||||||
<script type="text/javascript" src="scripts/cloud.core.events.js"></script>
|
|
||||||
<script type="text/javascript" src="scripts/cloud.core.hosts.js"></script>
|
|
||||||
<script type="text/javascript" src="scripts/cloud.core.storage.js"></script>
|
|
||||||
<script type="text/javascript" src="scripts/cloud.core.accounts.js"></script>
|
|
||||||
<script type="text/javascript" src="scripts/cloud.core.domains.js"></script>
|
|
||||||
<script type="text/javascript" src="scripts/cloud.core.configuration.js"></script>
|
|
||||||
|
|
||||||
<!-- Favicon -->
|
<!-- Favicon -->
|
||||||
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
|
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
|
||||||
|
|||||||
@ -1,3 +1,12 @@
|
|||||||
|
<%@ page import="java.util.*" %>
|
||||||
|
|
||||||
|
<%
|
||||||
|
Locale browserLocale = request.getLocale();
|
||||||
|
ResourceBundle t = ResourceBundle.getBundle("resources/resource", browserLocale);
|
||||||
|
%>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="scripts/cloud.core.domains.js"></script>
|
||||||
|
|
||||||
<!-- Content Panel -->
|
<!-- Content Panel -->
|
||||||
<div class="maincontent" style="display:block;" id="submenu_content_domains">
|
<div class="maincontent" style="display:block;" id="submenu_content_domains">
|
||||||
<div id="maincontent_title">
|
<div id="maincontent_title">
|
||||||
@ -66,7 +75,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="domain_detailsbox_right"></div>
|
<div class="domain_detailsbox_right"></div>
|
||||||
</div>
|
</div>
|
||||||
|
<div style="display:none">
|
||||||
|
<p>browser locale: <%=browserLocale%></p> <br>
|
||||||
|
<span style="padding-left:3px"><%=t.getString("computer")%></span>
|
||||||
|
<span style="padding-left:3px"><%=t.getString("computer_disk_hahaha")%></span>
|
||||||
|
<span style="padding-left:3px"><%=t.getString("disk")%></span>
|
||||||
|
<span style="padding-left:3px"><%=t.getString("monitor")%></span>
|
||||||
|
<span style="padding-left:3px"><%=t.getString("keyboard")%></span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
<%@ page import="java.util.*" %>
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<body>
|
|
||||||
<p>This is test at <%= new Date() %></p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
||||||
5
ui/resources/resource.properties
Normal file
5
ui/resources/resource.properties
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
computer = computer
|
||||||
|
disk = disk
|
||||||
|
computer_disk_hahaha = computer disk hahaha
|
||||||
|
monitor = monitor
|
||||||
|
keyboard = keyboard
|
||||||
5
ui/resources/resource_zh.properties
Normal file
5
ui/resources/resource_zh.properties
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
computer = 電腦
|
||||||
|
disk = 硬碟
|
||||||
|
computer_disk_hahaha = 電腦 硬碟 哈哈哈 !!!
|
||||||
|
monitor = 瑩幕
|
||||||
|
keyboard = 鍵盤
|
||||||
@ -19,308 +19,304 @@
|
|||||||
// Version: @VERSION@
|
// Version: @VERSION@
|
||||||
|
|
||||||
function showAccountsTab(domainId) {
|
function showAccountsTab(domainId) {
|
||||||
// Manage Events
|
var systemAccountId = 1;
|
||||||
mainContainer.load("content/tab_accounts.html", function() {
|
var adminAccountId = 2;
|
||||||
var systemAccountId = 1;
|
|
||||||
var adminAccountId = 2;
|
|
||||||
|
|
||||||
activateDialog($("#dialog_resource_limits").dialog({
|
activateDialog($("#dialog_resource_limits").dialog({
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
modal: true,
|
modal: true,
|
||||||
zIndex: 2000
|
zIndex: 2000
|
||||||
}));
|
}));
|
||||||
|
|
||||||
activateDialog($("#dialog_disable_account").dialog({
|
activateDialog($("#dialog_disable_account").dialog({
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
modal: true,
|
modal: true,
|
||||||
zIndex: 2000
|
zIndex: 2000
|
||||||
}));
|
}));
|
||||||
|
|
||||||
function updateResourceLimit(domainId, account, type, max) {
|
function updateResourceLimit(domainId, account, type, max) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: createURL("command=updateResourceLimit&domainid="+domainId+"&account="+account+"&resourceType="+type+"&max="+max+"&response=json"),
|
data: createURL("command=updateResourceLimit&domainid="+domainId+"&account="+account+"&resourceType="+type+"&max="+max+"&response=json"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#account_template #account_enable").bind("click", function(event) {
|
$("#account_template #account_enable").bind("click", function(event) {
|
||||||
var accountId = $(this).data("accountId");
|
var accountId = $(this).data("accountId");
|
||||||
var template = $("#account"+accountId);
|
var template = $("#account"+accountId);
|
||||||
var accountName = template.data("accountName");
|
var accountName = template.data("accountName");
|
||||||
var domainId = template.data("domainId");
|
var domainId = template.data("domainId");
|
||||||
|
|
||||||
|
$("#dialog_confirmation")
|
||||||
|
.html("<p>Please confirm you want to enable account: </b>" + accountName + "</b></p>")
|
||||||
|
.dialog('option', 'buttons', {
|
||||||
|
"Yes": function() {
|
||||||
|
$(this).dialog("close");
|
||||||
|
$.ajax({
|
||||||
|
data: createURL("command=enableAccount&account="+accountName+"&domainId="+domainId+"&response=json"),
|
||||||
|
dataType: "json",
|
||||||
|
success: function(json) {
|
||||||
|
template.find("#account_state").text("enabled");
|
||||||
|
template.find("#account_enable_container").hide();
|
||||||
|
template.find("#account_disable_container").show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
"Cancel": function() {
|
||||||
|
$(this).dialog("close");
|
||||||
|
}
|
||||||
|
}).dialog("open");
|
||||||
|
|
||||||
|
return false; //event.preventDefault() + event.stopPropagation()
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#account_template #account_disable").bind("click", function(event) {
|
||||||
|
var accountId = $(this).data("accountId");
|
||||||
|
var template = $("#account"+accountId);
|
||||||
|
var accountName = template.data("accountName");
|
||||||
|
var domainId = template.data("domainId");
|
||||||
|
|
||||||
|
var dialogDisableAccount = $("#dialog_disable_account");
|
||||||
|
dialogDisableAccount.find("#change_state_type").val("disable");
|
||||||
|
|
||||||
|
dialogDisableAccount
|
||||||
|
.dialog('option', 'buttons', {
|
||||||
|
"Save": function() {
|
||||||
|
dialogDisableAccount.dialog("close");
|
||||||
|
if(dialogDisableAccount.find("#change_state_type").val()=="disable") { //disable the account
|
||||||
|
var loadingImg = template.find(".adding_loading");
|
||||||
|
var rowContainer = template.find("#account_body");
|
||||||
|
loadingImg.find(".adding_text").text("Disabling....");
|
||||||
|
loadingImg.show();
|
||||||
|
rowContainer.hide();
|
||||||
|
|
||||||
$("#dialog_confirmation")
|
|
||||||
.html("<p>Please confirm you want to enable account: </b>" + accountName + "</b></p>")
|
|
||||||
.dialog('option', 'buttons', {
|
|
||||||
"Yes": function() {
|
|
||||||
$(this).dialog("close");
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: createURL("command=enableAccount&account="+accountName+"&domainId="+domainId+"&response=json"),
|
data: createURL("command=disableAccount&account="+accountName+"&domainId="+domainId+"&response=json"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
template.find("#account_state").text("enabled");
|
var jobId = json.disableaccountresponse.jobid;
|
||||||
template.find("#account_enable_container").hide();
|
var timerKey = "disableAccountJob"+jobId;
|
||||||
template.find("#account_disable_container").show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
"Cancel": function() {
|
|
||||||
$(this).dialog("close");
|
|
||||||
}
|
|
||||||
}).dialog("open");
|
|
||||||
|
|
||||||
return false; //event.preventDefault() + event.stopPropagation()
|
$("body").everyTime(2000, timerKey, function() {
|
||||||
});
|
$.ajax({
|
||||||
|
data: createURL("command=queryAsyncJobResult&jobId="+json.disableaccountresponse.jobid+"&response=json"),
|
||||||
$("#account_template #account_disable").bind("click", function(event) {
|
dataType: "json",
|
||||||
var accountId = $(this).data("accountId");
|
success: function(json) {
|
||||||
var template = $("#account"+accountId);
|
var result = json.queryasyncjobresultresponse;
|
||||||
var accountName = template.data("accountName");
|
if (result.jobstatus == 0) {
|
||||||
var domainId = template.data("domainId");
|
return; //Job has not completed
|
||||||
|
} else {
|
||||||
var dialogDisableAccount = $("#dialog_disable_account");
|
|
||||||
dialogDisableAccount.find("#change_state_type").val("disable");
|
|
||||||
|
|
||||||
dialogDisableAccount
|
|
||||||
.dialog('option', 'buttons', {
|
|
||||||
"Save": function() {
|
|
||||||
dialogDisableAccount.dialog("close");
|
|
||||||
if(dialogDisableAccount.find("#change_state_type").val()=="disable") { //disable the account
|
|
||||||
var loadingImg = template.find(".adding_loading");
|
|
||||||
var rowContainer = template.find("#account_body");
|
|
||||||
loadingImg.find(".adding_text").text("Disabling....");
|
|
||||||
loadingImg.show();
|
|
||||||
rowContainer.hide();
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
data: createURL("command=disableAccount&account="+accountName+"&domainId="+domainId+"&response=json"),
|
|
||||||
dataType: "json",
|
|
||||||
success: function(json) {
|
|
||||||
var jobId = json.disableaccountresponse.jobid;
|
|
||||||
var timerKey = "disableAccountJob"+jobId;
|
|
||||||
|
|
||||||
$("body").everyTime(2000, timerKey, function() {
|
|
||||||
$.ajax({
|
|
||||||
data: createURL("command=queryAsyncJobResult&jobId="+json.disableaccountresponse.jobid+"&response=json"),
|
|
||||||
dataType: "json",
|
|
||||||
success: function(json) {
|
|
||||||
var result = json.queryasyncjobresultresponse;
|
|
||||||
if (result.jobstatus == 0) {
|
|
||||||
return; //Job has not completed
|
|
||||||
} else {
|
|
||||||
$("body").stopTime(timerKey);
|
|
||||||
if (result.jobstatus == 1) {
|
|
||||||
// Succeeded
|
|
||||||
template.find("#account_state").text("disabled");
|
|
||||||
template.find("#account_disable_container").hide();
|
|
||||||
template.find("#account_enable_container").show();
|
|
||||||
loadingImg.hide();
|
|
||||||
rowContainer.show();
|
|
||||||
} else if (result.jobstatus == 2) {
|
|
||||||
$("#dialog_alert").html("<p>" + sanitizeXSS(result.jobresult) + "</p>").dialog("open");
|
|
||||||
loadingImg.hide();
|
|
||||||
rowContainer.show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function(XMLHttpResponse) {
|
|
||||||
$("body").stopTime(timerKey);
|
$("body").stopTime(timerKey);
|
||||||
handleError(XMLHttpResponse);
|
if (result.jobstatus == 1) {
|
||||||
loadingImg.hide();
|
// Succeeded
|
||||||
rowContainer.show();
|
template.find("#account_state").text("disabled");
|
||||||
|
template.find("#account_disable_container").hide();
|
||||||
|
template.find("#account_enable_container").show();
|
||||||
|
loadingImg.hide();
|
||||||
|
rowContainer.show();
|
||||||
|
} else if (result.jobstatus == 2) {
|
||||||
|
$("#dialog_alert").html("<p>" + sanitizeXSS(result.jobresult) + "</p>").dialog("open");
|
||||||
|
loadingImg.hide();
|
||||||
|
rowContainer.show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
}, 0);
|
error: function(XMLHttpResponse) {
|
||||||
},
|
$("body").stopTime(timerKey);
|
||||||
error: function(XMLHttpResponse) {
|
handleError(XMLHttpResponse);
|
||||||
handleError(XMLHttpResponse);
|
loadingImg.hide();
|
||||||
loadingImg.hide();
|
rowContainer.show();
|
||||||
rowContainer.show();
|
}
|
||||||
}
|
});
|
||||||
});
|
}, 0);
|
||||||
}
|
},
|
||||||
else { //lock the account
|
error: function(XMLHttpResponse) {
|
||||||
if(template.find("#account_state").text() == "locked") //if the state is locked already, do nothing.
|
handleError(XMLHttpResponse);
|
||||||
return;
|
loadingImg.hide();
|
||||||
$.ajax({
|
rowContainer.show();
|
||||||
data: createURL("command=lockAccount&account="+accountName+"&domainId="+domainId+"&response=json"),
|
}
|
||||||
dataType: "json",
|
});
|
||||||
success: function(json) {
|
|
||||||
template.find("#account_state").text("locked");
|
|
||||||
template.find("#account_enable_container").show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Cancel": function() {
|
|
||||||
$(this).dialog("close");
|
|
||||||
}
|
}
|
||||||
}).dialog("open");
|
else { //lock the account
|
||||||
|
if(template.find("#account_state").text() == "locked") //if the state is locked already, do nothing.
|
||||||
|
return;
|
||||||
|
$.ajax({
|
||||||
|
data: createURL("command=lockAccount&account="+accountName+"&domainId="+domainId+"&response=json"),
|
||||||
|
dataType: "json",
|
||||||
|
success: function(json) {
|
||||||
|
template.find("#account_state").text("locked");
|
||||||
|
template.find("#account_enable_container").show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Cancel": function() {
|
||||||
|
$(this).dialog("close");
|
||||||
|
}
|
||||||
|
}).dialog("open");
|
||||||
|
|
||||||
return false; //event.preventDefault() + event.stopPropagation()
|
return false; //event.preventDefault() + event.stopPropagation()
|
||||||
});
|
});
|
||||||
|
|
||||||
function accountJSONToTemplate(json, template) {
|
function accountJSONToTemplate(json, template) {
|
||||||
(index++ % 2 == 0)? template.addClass("smallrow_even"): template.addClass("smallrow_odd");
|
(index++ % 2 == 0)? template.addClass("smallrow_even"): template.addClass("smallrow_odd");
|
||||||
var accountId = json.id;
|
var accountId = json.id;
|
||||||
var accountName = json.name;
|
var accountName = json.name;
|
||||||
var domainId = json.domainid;
|
var domainId = json.domainid;
|
||||||
template.attr("id", "account"+accountId).data("accountId", accountId).data("accountName", sanitizeXSS(accountName)).data("domainId", sanitizeXSS(domainId));
|
template.attr("id", "account"+accountId).data("accountId", accountId).data("accountName", sanitizeXSS(accountName)).data("domainId", sanitizeXSS(domainId));
|
||||||
|
|
||||||
template.find("#account_role").text(toRole(json.accounttype));
|
template.find("#account_role").text(toRole(json.accounttype));
|
||||||
template.find("#account_accountid").text(json.id);
|
template.find("#account_accountid").text(json.id);
|
||||||
template.find("#account_accountname").text(accountName);
|
template.find("#account_accountname").text(accountName);
|
||||||
template.find("#account_domain").text(json.domain);
|
template.find("#account_domain").text(json.domain);
|
||||||
template.find("#account_vms_link").text(json.vmtotal);
|
template.find("#account_vms_link").text(json.vmtotal);
|
||||||
template.find("#account_ips_link").text(json.iptotal);
|
template.find("#account_ips_link").text(json.iptotal);
|
||||||
template.find("#account_received").text(convertBytes(json.receivedbytes));
|
template.find("#account_received").text(convertBytes(json.receivedbytes));
|
||||||
template.find("#account_sent").text(convertBytes(json.sentbytes));
|
template.find("#account_sent").text(convertBytes(json.sentbytes));
|
||||||
template.find("#account_state").text(json.state);
|
template.find("#account_state").text(json.state);
|
||||||
|
|
||||||
template.find("#account_vms_link").bind("click", function(event) {
|
template.find("#account_vms_link").bind("click", function(event) {
|
||||||
$("#menutab_vm").data("domainId", domainId).data("account", accountName).click();
|
$("#menutab_vm").data("domainId", domainId).data("account", accountName).click();
|
||||||
return false; //event.preventDefault() + event.stopPropagation()
|
return false; //event.preventDefault() + event.stopPropagation()
|
||||||
});
|
});
|
||||||
|
|
||||||
template.find("#account_ips_link").bind("click", function(event) {
|
template.find("#account_ips_link").bind("click", function(event) {
|
||||||
$("#menutab_networking").data("domainId", domainId).data("account", accountName).click();
|
$("#menutab_networking").data("domainId", domainId).data("account", accountName).click();
|
||||||
return false; //event.preventDefault() + event.stopPropagation()
|
return false; //event.preventDefault() + event.stopPropagation()
|
||||||
});
|
});
|
||||||
|
|
||||||
if(accountId == systemAccountId || accountId == adminAccountId)
|
if(accountId == systemAccountId || accountId == adminAccountId)
|
||||||
template.find("#action_links").hide();
|
template.find("#action_links").hide();
|
||||||
|
|
||||||
if(json.state == "enabled")
|
if(json.state == "enabled")
|
||||||
template.find("#account_enable_container").hide();
|
template.find("#account_enable_container").hide();
|
||||||
else if(json.state == "disabled")
|
else if(json.state == "disabled")
|
||||||
template.find("#account_disable_container").hide();
|
template.find("#account_disable_container").hide();
|
||||||
|
|
||||||
template.find("#account_enable, #account_disable").data("accountId", accountId);
|
template.find("#account_enable, #account_disable").data("accountId", accountId);
|
||||||
|
|
||||||
if (json.accounttype == roleTypeUser || json.accounttype == roleTypeDomainAdmin) {
|
if (json.accounttype == roleTypeUser || json.accounttype == roleTypeDomainAdmin) {
|
||||||
template.find("#account_resource_limits_container").show();
|
template.find("#account_resource_limits_container").show();
|
||||||
var that = template;
|
var that = template;
|
||||||
template.find("#account_resource_limits").bind("click", function() {
|
template.find("#account_resource_limits").bind("click", function() {
|
||||||
var domainId = that.data("domainId");
|
var domainId = that.data("domainId");
|
||||||
var account = that.data("accountName");
|
var account = that.data("accountName");
|
||||||
$.ajax({
|
$.ajax({
|
||||||
cache: false,
|
cache: false,
|
||||||
data: createURL("command=listResourceLimits&domainid="+domainId+"&account="+account+"&response=json"),
|
data: createURL("command=listResourceLimits&domainid="+domainId+"&account="+account+"&response=json"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
var limits = json.listresourcelimitsresponse.resourcelimit;
|
var limits = json.listresourcelimitsresponse.resourcelimit;
|
||||||
var preInstanceLimit, preIpLimit, preDiskLimit, preSnapshotLimit, preTemplateLimit = -1;
|
var preInstanceLimit, preIpLimit, preDiskLimit, preSnapshotLimit, preTemplateLimit = -1;
|
||||||
if (limits != null) {
|
if (limits != null) {
|
||||||
for (var i = 0; i < limits.length; i++) {
|
for (var i = 0; i < limits.length; i++) {
|
||||||
var limit = limits[i];
|
var limit = limits[i];
|
||||||
switch (limit.resourcetype) {
|
switch (limit.resourcetype) {
|
||||||
case "0":
|
case "0":
|
||||||
preInstanceLimit = limit.max;
|
preInstanceLimit = limit.max;
|
||||||
$("#dialog_resource_limits #limits_vm").val(limit.max);
|
$("#dialog_resource_limits #limits_vm").val(limit.max);
|
||||||
break;
|
break;
|
||||||
case "1":
|
case "1":
|
||||||
preIpLimit = limit.max;
|
preIpLimit = limit.max;
|
||||||
$("#dialog_resource_limits #limits_ip").val(limit.max);
|
$("#dialog_resource_limits #limits_ip").val(limit.max);
|
||||||
break;
|
break;
|
||||||
case "2":
|
case "2":
|
||||||
preDiskLimit = limit.max;
|
preDiskLimit = limit.max;
|
||||||
$("#dialog_resource_limits #limits_volume").val(limit.max);
|
$("#dialog_resource_limits #limits_volume").val(limit.max);
|
||||||
break;
|
break;
|
||||||
case "3":
|
case "3":
|
||||||
preSnapshotLimit = limit.max;
|
preSnapshotLimit = limit.max;
|
||||||
$("#dialog_resource_limits #limits_snapshot").val(limit.max);
|
$("#dialog_resource_limits #limits_snapshot").val(limit.max);
|
||||||
break;
|
break;
|
||||||
case "4":
|
case "4":
|
||||||
preTemplateLimit = limit.max;
|
preTemplateLimit = limit.max;
|
||||||
$("#dialog_resource_limits #limits_template").val(limit.max);
|
$("#dialog_resource_limits #limits_template").val(limit.max);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$("#dialog_resource_limits")
|
|
||||||
.dialog('option', 'buttons', {
|
|
||||||
"Save": function() {
|
|
||||||
// validate values
|
|
||||||
var isValid = true;
|
|
||||||
isValid &= validateNumber("Instance Limit", $("#dialog_resource_limits #limits_vm"), $("#dialog_resource_limits #limits_vm_errormsg"), -1, 32000, false);
|
|
||||||
isValid &= validateNumber("Public IP Limit", $("#dialog_resource_limits #limits_ip"), $("#dialog_resource_limits #limits_ip_errormsg"), -1, 32000, false);
|
|
||||||
isValid &= validateNumber("Disk Volume Limit", $("#dialog_resource_limits #limits_volume"), $("#dialog_resource_limits #limits_volume_errormsg"), -1, 32000, false);
|
|
||||||
isValid &= validateNumber("Snapshot Limit", $("#dialog_resource_limits #limits_snapshot"), $("#dialog_resource_limits #limits_snapshot_errormsg"), -1, 32000, false);
|
|
||||||
isValid &= validateNumber("Template Limit", $("#dialog_resource_limits #limits_template"), $("#dialog_resource_limits #limits_template_errormsg"), -1, 32000, false);
|
|
||||||
if (!isValid) return;
|
|
||||||
|
|
||||||
var instanceLimit = trim($("#dialog_resource_limits #limits_vm").val());
|
|
||||||
var ipLimit = trim($("#dialog_resource_limits #limits_ip").val());
|
|
||||||
var diskLimit = trim($("#dialog_resource_limits #limits_volume").val());
|
|
||||||
var snapshotLimit = trim($("#dialog_resource_limits #limits_snapshot").val());
|
|
||||||
var templateLimit = trim($("#dialog_resource_limits #limits_template").val());
|
|
||||||
|
|
||||||
$(this).dialog("close");
|
|
||||||
if (instanceLimit != preInstanceLimit) {
|
|
||||||
updateResourceLimit(domainId, account, 0, instanceLimit);
|
|
||||||
}
|
|
||||||
if (ipLimit != preIpLimit) {
|
|
||||||
updateResourceLimit(domainId, account, 1, ipLimit);
|
|
||||||
}
|
|
||||||
if (diskLimit != preDiskLimit) {
|
|
||||||
updateResourceLimit(domainId, account, 2, diskLimit);
|
|
||||||
}
|
|
||||||
if (snapshotLimit != preSnapshotLimit) {
|
|
||||||
updateResourceLimit(domainId, account, 3, snapshotLimit);
|
|
||||||
}
|
|
||||||
if (templateLimit != preTemplateLimit) {
|
|
||||||
updateResourceLimit(domainId, account, 4, templateLimit);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Cancel": function() {
|
|
||||||
$(this).dialog("close");
|
|
||||||
}
|
|
||||||
}).dialog("open");
|
|
||||||
}
|
}
|
||||||
});
|
$("#dialog_resource_limits")
|
||||||
return false;
|
.dialog('option', 'buttons', {
|
||||||
|
"Save": function() {
|
||||||
|
// validate values
|
||||||
|
var isValid = true;
|
||||||
|
isValid &= validateNumber("Instance Limit", $("#dialog_resource_limits #limits_vm"), $("#dialog_resource_limits #limits_vm_errormsg"), -1, 32000, false);
|
||||||
|
isValid &= validateNumber("Public IP Limit", $("#dialog_resource_limits #limits_ip"), $("#dialog_resource_limits #limits_ip_errormsg"), -1, 32000, false);
|
||||||
|
isValid &= validateNumber("Disk Volume Limit", $("#dialog_resource_limits #limits_volume"), $("#dialog_resource_limits #limits_volume_errormsg"), -1, 32000, false);
|
||||||
|
isValid &= validateNumber("Snapshot Limit", $("#dialog_resource_limits #limits_snapshot"), $("#dialog_resource_limits #limits_snapshot_errormsg"), -1, 32000, false);
|
||||||
|
isValid &= validateNumber("Template Limit", $("#dialog_resource_limits #limits_template"), $("#dialog_resource_limits #limits_template_errormsg"), -1, 32000, false);
|
||||||
|
if (!isValid) return;
|
||||||
|
|
||||||
|
var instanceLimit = trim($("#dialog_resource_limits #limits_vm").val());
|
||||||
|
var ipLimit = trim($("#dialog_resource_limits #limits_ip").val());
|
||||||
|
var diskLimit = trim($("#dialog_resource_limits #limits_volume").val());
|
||||||
|
var snapshotLimit = trim($("#dialog_resource_limits #limits_snapshot").val());
|
||||||
|
var templateLimit = trim($("#dialog_resource_limits #limits_template").val());
|
||||||
|
|
||||||
|
$(this).dialog("close");
|
||||||
|
if (instanceLimit != preInstanceLimit) {
|
||||||
|
updateResourceLimit(domainId, account, 0, instanceLimit);
|
||||||
|
}
|
||||||
|
if (ipLimit != preIpLimit) {
|
||||||
|
updateResourceLimit(domainId, account, 1, ipLimit);
|
||||||
|
}
|
||||||
|
if (diskLimit != preDiskLimit) {
|
||||||
|
updateResourceLimit(domainId, account, 2, diskLimit);
|
||||||
|
}
|
||||||
|
if (snapshotLimit != preSnapshotLimit) {
|
||||||
|
updateResourceLimit(domainId, account, 3, snapshotLimit);
|
||||||
|
}
|
||||||
|
if (templateLimit != preTemplateLimit) {
|
||||||
|
updateResourceLimit(domainId, account, 4, templateLimit);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Cancel": function() {
|
||||||
|
$(this).dialog("close");
|
||||||
|
}
|
||||||
|
}).dialog("open");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
return false;
|
||||||
template.find("#account_resource_limits_container").hide();
|
});
|
||||||
}
|
} else {
|
||||||
}
|
template.find("#account_resource_limits_container").hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function listAccounts() {
|
function listAccounts() {
|
||||||
var submenuContent = $("#submenu_content_account");
|
var submenuContent = $("#submenu_content_account");
|
||||||
|
|
||||||
var commandString;
|
var commandString;
|
||||||
var advanced = submenuContent.find("#search_button").data("advanced");
|
var advanced = submenuContent.find("#search_button").data("advanced");
|
||||||
if (advanced != null && advanced) {
|
if (advanced != null && advanced) {
|
||||||
var name = submenuContent.find("#advanced_search #adv_search_name").val();
|
var name = submenuContent.find("#advanced_search #adv_search_name").val();
|
||||||
var role = submenuContent.find("#advanced_search #adv_search_role").val();
|
var role = submenuContent.find("#advanced_search #adv_search_role").val();
|
||||||
var moreCriteria = [];
|
var moreCriteria = [];
|
||||||
if (name!=null && trim(name).length > 0)
|
if (name!=null && trim(name).length > 0)
|
||||||
moreCriteria.push("&name="+encodeURIComponent(trim(name)));
|
moreCriteria.push("&name="+encodeURIComponent(trim(name)));
|
||||||
if (trim(role).length > 0)
|
if (trim(role).length > 0)
|
||||||
moreCriteria.push("&accounttype="+role);
|
moreCriteria.push("&accounttype="+role);
|
||||||
commandString = "command=listAccounts&page="+currentPage+moreCriteria.join("")+"&response=json";
|
commandString = "command=listAccounts&page="+currentPage+moreCriteria.join("")+"&response=json";
|
||||||
} else {
|
} else {
|
||||||
var moreCriteria = [];
|
var moreCriteria = [];
|
||||||
if(domainId!=null)
|
if(domainId!=null)
|
||||||
moreCriteria.push("&domainid="+domainId);
|
moreCriteria.push("&domainid="+domainId);
|
||||||
var searchInput = submenuContent.find("#search_input").val();
|
var searchInput = submenuContent.find("#search_input").val();
|
||||||
if (searchInput != null && searchInput.length > 0)
|
if (searchInput != null && searchInput.length > 0)
|
||||||
commandString = "command=listAccounts&page="+currentPage+moreCriteria.join("")+"&keyword="+searchInput+"&response=json"
|
commandString = "command=listAccounts&page="+currentPage+moreCriteria.join("")+"&keyword="+searchInput+"&response=json"
|
||||||
else
|
else
|
||||||
commandString = "command=listAccounts&page="+currentPage+moreCriteria.join("")+"&response=json";
|
commandString = "command=listAccounts&page="+currentPage+moreCriteria.join("")+"&response=json";
|
||||||
}
|
}
|
||||||
|
|
||||||
//listItems(submenuContent, commandString, jsonResponse1, jsonResponse2, template, fnJSONToTemplate);
|
//listItems(submenuContent, commandString, jsonResponse1, jsonResponse2, template, fnJSONToTemplate);
|
||||||
listItems(submenuContent, commandString, "listaccountsresponse", "account", $("#account_template"), accountJSONToTemplate);
|
listItems(submenuContent, commandString, "listaccountsresponse", "account", $("#account_template"), accountJSONToTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
submenuContentEventBinder($("#submenu_content_account"), listAccounts);
|
submenuContentEventBinder($("#submenu_content_account"), listAccounts);
|
||||||
|
|
||||||
var index;
|
var index;
|
||||||
currentPage = 1;
|
currentPage = 1;
|
||||||
listAccounts();
|
listAccounts();
|
||||||
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -19,383 +19,381 @@
|
|||||||
// Version: @VERSION@
|
// Version: @VERSION@
|
||||||
|
|
||||||
function showDomainsTab() {
|
function showDomainsTab() {
|
||||||
mainContainer.load("content/tab_domains.html", function() {
|
var defaultRootDomainId = g_domainid;
|
||||||
var defaultRootDomainId = g_domainid;
|
var defaultRootLevel = 0;
|
||||||
var defaultRootLevel = 0;
|
var index = 1;
|
||||||
var index = 1;
|
var treeContentBox = $("#tree_contentbox");
|
||||||
var treeContentBox = $("#tree_contentbox");
|
var treenodeTemplate = $("#treenode_template");
|
||||||
var treenodeTemplate = $("#treenode_template");
|
var grid = $("#right_panel_grid");
|
||||||
var grid = $("#right_panel_grid");
|
var gridRowTemplate = $("#grid_row_template");
|
||||||
var gridRowTemplate = $("#grid_row_template");
|
var gridContent = grid.find("#grid_content");
|
||||||
var gridContent = grid.find("#grid_content");
|
var gridHeader = grid.find("#grid_header");
|
||||||
var gridHeader = grid.find("#grid_header");
|
var rightPanelDetailContent = $("#right_panel_detail_content");
|
||||||
var rightPanelDetailContent = $("#right_panel_detail_content");
|
var rightPanelSearchResult = $("#right_panel_search_result");
|
||||||
var rightPanelSearchResult = $("#right_panel_search_result");
|
var rightPanelGrid = rightPanelDetailContent.find("#right_panel_grid");
|
||||||
var rightPanelGrid = rightPanelDetailContent.find("#right_panel_grid");
|
var domainDetail = rightPanelDetailContent.find("#domain_detail");
|
||||||
var domainDetail = rightPanelDetailContent.find("#domain_detail");
|
var submenuContent = $("#submenu_content_domains");
|
||||||
var submenuContent = $("#submenu_content_domains");
|
var searchButton = submenuContent.find("#search_button");
|
||||||
var searchButton = submenuContent.find("#search_button");
|
var searchInput = submenuContent.find("#search_input");
|
||||||
var searchInput = submenuContent.find("#search_input");
|
var searchResultsContainer = submenuContent.find("#search_results_container");
|
||||||
var searchResultsContainer = submenuContent.find("#search_results_container");
|
var searchResultTemplate = $("#search_result_template");
|
||||||
var searchResultTemplate = $("#search_result_template");
|
var breadcrumbBox = submenuContent.find("#breadcrumb_box");
|
||||||
var breadcrumbBox = submenuContent.find("#breadcrumb_box");
|
var breadcrumbPieceTemplate = $("#breadcrumb_piece_template");
|
||||||
var breadcrumbPieceTemplate = $("#breadcrumb_piece_template");
|
var childParentMap = {}; //map childDomainId to parentDomainId
|
||||||
var childParentMap = {}; //map childDomainId to parentDomainId
|
var domainIdNameMap = {}; //map domainId to domainName
|
||||||
var domainIdNameMap = {}; //map domainId to domainName
|
|
||||||
|
|
||||||
activateDialog($("#dialog_resource_limits").dialog({
|
activateDialog($("#dialog_resource_limits").dialog({
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
modal: true,
|
modal: true,
|
||||||
zIndex: 2000
|
zIndex: 2000
|
||||||
}));
|
}));
|
||||||
|
|
||||||
function drawNode(json, level, container) {
|
function drawNode(json, level, container) {
|
||||||
if("parentdomainid" in json)
|
if("parentdomainid" in json)
|
||||||
childParentMap[json.id] = json.parentdomainid; //map childDomainId to parentDomainId
|
childParentMap[json.id] = json.parentdomainid; //map childDomainId to parentDomainId
|
||||||
domainIdNameMap[json.id] = json.name; //map domainId to domainName
|
domainIdNameMap[json.id] = json.name; //map domainId to domainName
|
||||||
|
|
||||||
var template = treenodeTemplate.clone(true);
|
var template = treenodeTemplate.clone(true);
|
||||||
template.attr("id", "domain_"+json.id);
|
template.attr("id", "domain_"+json.id);
|
||||||
template.data("domainId", json.id).data("domainName", sanitizeXSS(json.name)).data("domainLevel", level);
|
template.data("domainId", json.id).data("domainName", sanitizeXSS(json.name)).data("domainLevel", level);
|
||||||
template.find("#domain_title_container").attr("id", "domain_title_container_"+json.id);
|
template.find("#domain_title_container").attr("id", "domain_title_container_"+json.id);
|
||||||
template.find("#domain_expand_icon").attr("id", "domain_expand_icon_"+json.id);
|
template.find("#domain_expand_icon").attr("id", "domain_expand_icon_"+json.id);
|
||||||
template.find("#domain_name").attr("id", "domain_name_"+json.id).text(json.name);
|
template.find("#domain_name").attr("id", "domain_name_"+json.id).text(json.name);
|
||||||
template.find("#domain_children_container").attr("id", "domain_children_container_"+json.id);
|
template.find("#domain_children_container").attr("id", "domain_children_container_"+json.id);
|
||||||
container.append(template.show());
|
container.append(template.show());
|
||||||
return template;
|
return template;
|
||||||
|
}
|
||||||
|
|
||||||
|
function drawTree(id, level, container) {
|
||||||
|
$.ajax({
|
||||||
|
data: createURL("command=listDomainChildren&id="+id+"&response=json"),
|
||||||
|
dataType: "json",
|
||||||
|
async: false,
|
||||||
|
success: function(json) {
|
||||||
|
var domains = json.listdomainchildrenresponse.domain;
|
||||||
|
if (domains != null && domains.length > 0) {
|
||||||
|
for (var i = 0; i < domains.length; i++) {
|
||||||
|
drawNode(domains[i], level, container);
|
||||||
|
if(domains[i].haschild=="true")
|
||||||
|
drawTree(domains[i].id, (level+1), $("#domain_children_container_"+domains[i].id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function clickExpandIcon(domainId) {
|
||||||
|
var template = $("#domain_"+domainId);
|
||||||
|
var expandIcon = template.find("#domain_expand_icon_"+domainId);
|
||||||
|
if (expandIcon.hasClass("zonetree_closedarrows")) {
|
||||||
|
template.find("#domain_children_container_"+domainId).show();
|
||||||
|
expandIcon.removeClass().addClass("zonetree_openarrows");
|
||||||
|
} else {
|
||||||
|
template.find("#domain_children_container_"+domainId).hide();
|
||||||
|
expandIcon.removeClass().addClass("zonetree_closedarrows");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function accountJSONToTemplate(json, template) {
|
||||||
|
if (index++ % 2 == 0) {
|
||||||
|
template.addClass("smallrow_odd");
|
||||||
|
} else {
|
||||||
|
template.addClass("smallrow_even");
|
||||||
}
|
}
|
||||||
|
template.find("#grid_row_cell1").text(json.domain);
|
||||||
|
template.find("#grid_row_cell2").text(json.name);
|
||||||
|
}
|
||||||
|
|
||||||
function drawTree(id, level, container) {
|
function updateResourceLimit(domainId, type, max) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: createURL("command=listDomainChildren&id="+id+"&response=json"),
|
data: createURL("command=updateResourceLimit&domainid="+domainId+"&resourceType="+type+"&max="+max+"&response=json"),
|
||||||
|
dataType: "json",
|
||||||
|
success: function(json) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function listAdminAccounts(domainId) {
|
||||||
|
gridContent.empty();
|
||||||
|
index = 0;
|
||||||
|
rightPanelDetailContent.find("#loading_gridtable").show();
|
||||||
|
var accountType = (domainId==1)? 1: 2;
|
||||||
|
$.ajax({
|
||||||
|
cache: false,
|
||||||
|
data: createURL("command=listAccounts&domainid="+domainId+"&accounttype="+accountType+"&response=json"+maxPageSize),
|
||||||
|
dataType: "json",
|
||||||
|
success: function(json) {
|
||||||
|
var accounts = json.listaccountsresponse.account;
|
||||||
|
if (accounts != null && accounts.length > 0) {
|
||||||
|
for (var i = 0; i < accounts.length; i++) {
|
||||||
|
var template = gridRowTemplate.clone(true).attr("id","account"+accounts[i].id);
|
||||||
|
accountJSONToTemplate(accounts[i], template);
|
||||||
|
gridContent.append(template.show());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rightPanelDetailContent.find("#loading_gridtable").hide();
|
||||||
|
},
|
||||||
|
error: function(XMLHttpResponse) {
|
||||||
|
handleError(XMLHttpResponse);
|
||||||
|
rightPanelDetailContent.find("#loading_gridtable").hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
treenodeTemplate.bind("click", function(event) {
|
||||||
|
var template = $(this);
|
||||||
|
var target = $(event.target);
|
||||||
|
var action = target.attr("id");
|
||||||
|
var id = template.attr("id");
|
||||||
|
var domainId = template.data("domainId");
|
||||||
|
var domainName = template.data("domainName");
|
||||||
|
if (action.indexOf("domain_expand_icon")!=-1) {
|
||||||
|
clickExpandIcon(domainId);
|
||||||
|
}
|
||||||
|
else if(action.indexOf("domain_name")!=-1) {
|
||||||
|
domainDetail.find("#domain_name").text(domainName);
|
||||||
|
domainDetail.find("#domain_id").text(domainId);
|
||||||
|
$.ajax({
|
||||||
|
cache: false,
|
||||||
|
data: createURL("command=listAccounts&domainid="+domainId+"&response=json"+maxPageSize),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
async: false,
|
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
var domains = json.listdomainchildrenresponse.domain;
|
var accounts = json.listaccountsresponse.account;
|
||||||
if (domains != null && domains.length > 0) {
|
if (accounts != null) {
|
||||||
for (var i = 0; i < domains.length; i++) {
|
domainDetail.find("#redirect_to_account_page").text(accounts.length);
|
||||||
drawNode(domains[i], level, container);
|
domainDetail.find("#redirect_to_account_page").bind("click", function() {
|
||||||
if(domains[i].haschild=="true")
|
$("#menutab_role_root #menutab_accounts").data("domainId", domainId).click();
|
||||||
drawTree(domains[i].id, (level+1), $("#domain_children_container_"+domains[i].id));
|
});
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
domainDetail.find("#redirect_to_account_page").text("");
|
||||||
|
domainDetail.find("#redirect_to_account_page").unbind("click");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
function clickExpandIcon(domainId) {
|
|
||||||
var template = $("#domain_"+domainId);
|
|
||||||
var expandIcon = template.find("#domain_expand_icon_"+domainId);
|
|
||||||
if (expandIcon.hasClass("zonetree_closedarrows")) {
|
|
||||||
template.find("#domain_children_container_"+domainId).show();
|
|
||||||
expandIcon.removeClass().addClass("zonetree_openarrows");
|
|
||||||
} else {
|
|
||||||
template.find("#domain_children_container_"+domainId).hide();
|
|
||||||
expandIcon.removeClass().addClass("zonetree_closedarrows");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function accountJSONToTemplate(json, template) {
|
|
||||||
if (index++ % 2 == 0) {
|
|
||||||
template.addClass("smallrow_odd");
|
|
||||||
} else {
|
|
||||||
template.addClass("smallrow_even");
|
|
||||||
}
|
|
||||||
template.find("#grid_row_cell1").text(json.domain);
|
|
||||||
template.find("#grid_row_cell2").text(json.name);
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateResourceLimit(domainId, type, max) {
|
|
||||||
$.ajax({
|
|
||||||
data: createURL("command=updateResourceLimit&domainid="+domainId+"&resourceType="+type+"&max="+max+"&response=json"),
|
|
||||||
dataType: "json",
|
|
||||||
success: function(json) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function listAdminAccounts(domainId) {
|
|
||||||
gridContent.empty();
|
|
||||||
index = 0;
|
|
||||||
rightPanelDetailContent.find("#loading_gridtable").show();
|
|
||||||
var accountType = (domainId==1)? 1: 2;
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
cache: false,
|
cache: false,
|
||||||
data: createURL("command=listAccounts&domainid="+domainId+"&accounttype="+accountType+"&response=json"+maxPageSize),
|
data: createURL("command=listVirtualMachines&domainid="+domainId+"&response=json"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
var accounts = json.listaccountsresponse.account;
|
var instances = json.listvirtualmachinesresponse.virtualmachine;
|
||||||
if (accounts != null && accounts.length > 0) {
|
if (instances != null) {
|
||||||
for (var i = 0; i < accounts.length; i++) {
|
domainDetail.find("#redirect_to_instance_page").text(instances.length);
|
||||||
var template = gridRowTemplate.clone(true).attr("id","account"+accounts[i].id);
|
domainDetail.find("#redirect_to_instance_page").bind("click", function() {
|
||||||
accountJSONToTemplate(accounts[i], template);
|
$("#menutab_role_root #menutab_vm").data("domainId", domainId).click();
|
||||||
gridContent.append(template.show());
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
rightPanelDetailContent.find("#loading_gridtable").hide();
|
|
||||||
},
|
|
||||||
error: function(XMLHttpResponse) {
|
|
||||||
handleError(XMLHttpResponse);
|
|
||||||
rightPanelDetailContent.find("#loading_gridtable").hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
treenodeTemplate.bind("click", function(event) {
|
|
||||||
var template = $(this);
|
|
||||||
var target = $(event.target);
|
|
||||||
var action = target.attr("id");
|
|
||||||
var id = template.attr("id");
|
|
||||||
var domainId = template.data("domainId");
|
|
||||||
var domainName = template.data("domainName");
|
|
||||||
if (action.indexOf("domain_expand_icon")!=-1) {
|
|
||||||
clickExpandIcon(domainId);
|
|
||||||
}
|
|
||||||
else if(action.indexOf("domain_name")!=-1) {
|
|
||||||
domainDetail.find("#domain_name").text(domainName);
|
|
||||||
domainDetail.find("#domain_id").text(domainId);
|
|
||||||
$.ajax({
|
|
||||||
cache: false,
|
|
||||||
data: createURL("command=listAccounts&domainid="+domainId+"&response=json"+maxPageSize),
|
|
||||||
dataType: "json",
|
|
||||||
success: function(json) {
|
|
||||||
var accounts = json.listaccountsresponse.account;
|
|
||||||
if (accounts != null) {
|
|
||||||
domainDetail.find("#redirect_to_account_page").text(accounts.length);
|
|
||||||
domainDetail.find("#redirect_to_account_page").bind("click", function() {
|
|
||||||
$("#menutab_role_root #menutab_accounts").data("domainId", domainId).click();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
domainDetail.find("#redirect_to_account_page").text("");
|
|
||||||
domainDetail.find("#redirect_to_account_page").unbind("click");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
else {
|
||||||
|
domainDetail.find("#redirect_to_instance_page").text("");
|
||||||
$.ajax({
|
domainDetail.find("#redirect_to_instance_page").unbind("click");
|
||||||
cache: false,
|
|
||||||
data: createURL("command=listVirtualMachines&domainid="+domainId+"&response=json"),
|
|
||||||
dataType: "json",
|
|
||||||
success: function(json) {
|
|
||||||
var instances = json.listvirtualmachinesresponse.virtualmachine;
|
|
||||||
if (instances != null) {
|
|
||||||
domainDetail.find("#redirect_to_instance_page").text(instances.length);
|
|
||||||
domainDetail.find("#redirect_to_instance_page").bind("click", function() {
|
|
||||||
$("#menutab_role_root #menutab_vm").data("domainId", domainId).click();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
domainDetail.find("#redirect_to_instance_page").text("");
|
|
||||||
domainDetail.find("#redirect_to_instance_page").unbind("click");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
cache: false,
|
cache: false,
|
||||||
data: createURL("command=listVolumes&domainid="+domainId+"&response=json"),
|
data: createURL("command=listVolumes&domainid="+domainId+"&response=json"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
var volumes = json.listvolumesresponse.volume;
|
var volumes = json.listvolumesresponse.volume;
|
||||||
if (volumes != null) {
|
if (volumes != null) {
|
||||||
domainDetail.find("#redirect_to_volume_page").text(volumes.length);
|
domainDetail.find("#redirect_to_volume_page").text(volumes.length);
|
||||||
domainDetail.find("#redirect_to_volume_page").bind("click", function() {
|
domainDetail.find("#redirect_to_volume_page").bind("click", function() {
|
||||||
$("#menutab_role_root #menutab_storage").data("domainId", domainId).data("targetTab", "submenu_volume").click();
|
$("#menutab_role_root #menutab_storage").data("domainId", domainId).data("targetTab", "submenu_volume").click();
|
||||||
});
|
});
|
||||||
}
|
|
||||||
else {
|
|
||||||
domainDetail.find("#redirect_to_volume_page").text("");
|
|
||||||
domainDetail.find("#redirect_to_volume_page").unbind("click");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
else {
|
||||||
|
domainDetail.find("#redirect_to_volume_page").text("");
|
||||||
|
domainDetail.find("#redirect_to_volume_page").unbind("click");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (isAdmin() || (isDomainAdmin() && (g_domainid != domainId))) {
|
if (isAdmin() || (isDomainAdmin() && (g_domainid != domainId))) {
|
||||||
$("#limits_container").show();
|
$("#limits_container").show();
|
||||||
$("#account_resource_limits").data("domainId", domainId).unbind("click").bind("click", function() {
|
$("#account_resource_limits").data("domainId", domainId).unbind("click").bind("click", function() {
|
||||||
var domainId = $(this).data("domainId");
|
var domainId = $(this).data("domainId");
|
||||||
$.ajax({
|
$.ajax({
|
||||||
cache: false,
|
cache: false,
|
||||||
data: createURL("command=listResourceLimits&domainid="+domainId+"&response=json"),
|
data: createURL("command=listResourceLimits&domainid="+domainId+"&response=json"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
var limits = json.listresourcelimitsresponse.resourcelimit;
|
var limits = json.listresourcelimitsresponse.resourcelimit;
|
||||||
var preInstanceLimit, preIpLimit, preDiskLimit, preSnapshotLimit, preTemplateLimit = -1;
|
var preInstanceLimit, preIpLimit, preDiskLimit, preSnapshotLimit, preTemplateLimit = -1;
|
||||||
if (limits != null) {
|
if (limits != null) {
|
||||||
for (var i = 0; i < limits.length; i++) {
|
for (var i = 0; i < limits.length; i++) {
|
||||||
var limit = limits[i];
|
var limit = limits[i];
|
||||||
switch (limit.resourcetype) {
|
switch (limit.resourcetype) {
|
||||||
case "0":
|
case "0":
|
||||||
preInstanceLimit = limit.max;
|
preInstanceLimit = limit.max;
|
||||||
$("#dialog_resource_limits #limits_vm").val(limit.max);
|
$("#dialog_resource_limits #limits_vm").val(limit.max);
|
||||||
break;
|
break;
|
||||||
case "1":
|
case "1":
|
||||||
preIpLimit = limit.max;
|
preIpLimit = limit.max;
|
||||||
$("#dialog_resource_limits #limits_ip").val(limit.max);
|
$("#dialog_resource_limits #limits_ip").val(limit.max);
|
||||||
break;
|
break;
|
||||||
case "2":
|
case "2":
|
||||||
preDiskLimit = limit.max;
|
preDiskLimit = limit.max;
|
||||||
$("#dialog_resource_limits #limits_volume").val(limit.max);
|
$("#dialog_resource_limits #limits_volume").val(limit.max);
|
||||||
break;
|
break;
|
||||||
case "3":
|
case "3":
|
||||||
preSnapshotLimit = limit.max;
|
preSnapshotLimit = limit.max;
|
||||||
$("#dialog_resource_limits #limits_snapshot").val(limit.max);
|
$("#dialog_resource_limits #limits_snapshot").val(limit.max);
|
||||||
break;
|
break;
|
||||||
case "4":
|
case "4":
|
||||||
preTemplateLimit = limit.max;
|
preTemplateLimit = limit.max;
|
||||||
$("#dialog_resource_limits #limits_template").val(limit.max);
|
$("#dialog_resource_limits #limits_template").val(limit.max);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$("#dialog_resource_limits")
|
|
||||||
.dialog('option', 'buttons', {
|
|
||||||
"Save": function() {
|
|
||||||
// validate values
|
|
||||||
var isValid = true;
|
|
||||||
isValid &= validateNumber("Instance Limit", $("#dialog_resource_limits #limits_vm"), $("#dialog_resource_limits #limits_vm_errormsg"), -1, 32000, false);
|
|
||||||
isValid &= validateNumber("Public IP Limit", $("#dialog_resource_limits #limits_ip"), $("#dialog_resource_limits #limits_ip_errormsg"), -1, 32000, false);
|
|
||||||
isValid &= validateNumber("Disk Volume Limit", $("#dialog_resource_limits #limits_volume"), $("#dialog_resource_limits #limits_volume_errormsg"), -1, 32000, false);
|
|
||||||
isValid &= validateNumber("Snapshot Limit", $("#dialog_resource_limits #limits_snapshot"), $("#dialog_resource_limits #limits_snapshot_errormsg"), -1, 32000, false);
|
|
||||||
isValid &= validateNumber("Template Limit", $("#dialog_resource_limits #limits_template"), $("#dialog_resource_limits #limits_template_errormsg"), -1, 32000, false);
|
|
||||||
if (!isValid) return;
|
|
||||||
|
|
||||||
var instanceLimit = trim($("#dialog_resource_limits #limits_vm").val());
|
|
||||||
var ipLimit = trim($("#dialog_resource_limits #limits_ip").val());
|
|
||||||
var diskLimit = trim($("#dialog_resource_limits #limits_volume").val());
|
|
||||||
var snapshotLimit = trim($("#dialog_resource_limits #limits_snapshot").val());
|
|
||||||
var templateLimit = trim($("#dialog_resource_limits #limits_template").val());
|
|
||||||
|
|
||||||
$(this).dialog("close");
|
|
||||||
if (instanceLimit != preInstanceLimit) {
|
|
||||||
updateResourceLimit(domainId, 0, instanceLimit);
|
|
||||||
}
|
|
||||||
if (ipLimit != preIpLimit) {
|
|
||||||
updateResourceLimit(domainId, 1, ipLimit);
|
|
||||||
}
|
|
||||||
if (diskLimit != preDiskLimit) {
|
|
||||||
updateResourceLimit(domainId, 2, diskLimit);
|
|
||||||
}
|
|
||||||
if (snapshotLimit != preSnapshotLimit) {
|
|
||||||
updateResourceLimit(domainId, 3, snapshotLimit);
|
|
||||||
}
|
|
||||||
if (templateLimit != preTemplateLimit) {
|
|
||||||
updateResourceLimit(domainId, 4, templateLimit);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Cancel": function() {
|
|
||||||
$(this).dialog("close");
|
|
||||||
}
|
|
||||||
}).dialog("open");
|
|
||||||
}
|
}
|
||||||
});
|
$("#dialog_resource_limits")
|
||||||
return false;
|
.dialog('option', 'buttons', {
|
||||||
|
"Save": function() {
|
||||||
|
// validate values
|
||||||
|
var isValid = true;
|
||||||
|
isValid &= validateNumber("Instance Limit", $("#dialog_resource_limits #limits_vm"), $("#dialog_resource_limits #limits_vm_errormsg"), -1, 32000, false);
|
||||||
|
isValid &= validateNumber("Public IP Limit", $("#dialog_resource_limits #limits_ip"), $("#dialog_resource_limits #limits_ip_errormsg"), -1, 32000, false);
|
||||||
|
isValid &= validateNumber("Disk Volume Limit", $("#dialog_resource_limits #limits_volume"), $("#dialog_resource_limits #limits_volume_errormsg"), -1, 32000, false);
|
||||||
|
isValid &= validateNumber("Snapshot Limit", $("#dialog_resource_limits #limits_snapshot"), $("#dialog_resource_limits #limits_snapshot_errormsg"), -1, 32000, false);
|
||||||
|
isValid &= validateNumber("Template Limit", $("#dialog_resource_limits #limits_template"), $("#dialog_resource_limits #limits_template_errormsg"), -1, 32000, false);
|
||||||
|
if (!isValid) return;
|
||||||
|
|
||||||
|
var instanceLimit = trim($("#dialog_resource_limits #limits_vm").val());
|
||||||
|
var ipLimit = trim($("#dialog_resource_limits #limits_ip").val());
|
||||||
|
var diskLimit = trim($("#dialog_resource_limits #limits_volume").val());
|
||||||
|
var snapshotLimit = trim($("#dialog_resource_limits #limits_snapshot").val());
|
||||||
|
var templateLimit = trim($("#dialog_resource_limits #limits_template").val());
|
||||||
|
|
||||||
|
$(this).dialog("close");
|
||||||
|
if (instanceLimit != preInstanceLimit) {
|
||||||
|
updateResourceLimit(domainId, 0, instanceLimit);
|
||||||
|
}
|
||||||
|
if (ipLimit != preIpLimit) {
|
||||||
|
updateResourceLimit(domainId, 1, ipLimit);
|
||||||
|
}
|
||||||
|
if (diskLimit != preDiskLimit) {
|
||||||
|
updateResourceLimit(domainId, 2, diskLimit);
|
||||||
|
}
|
||||||
|
if (snapshotLimit != preSnapshotLimit) {
|
||||||
|
updateResourceLimit(domainId, 3, snapshotLimit);
|
||||||
|
}
|
||||||
|
if (templateLimit != preTemplateLimit) {
|
||||||
|
updateResourceLimit(domainId, 4, templateLimit);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Cancel": function() {
|
||||||
|
$(this).dialog("close");
|
||||||
|
}
|
||||||
|
}).dialog("open");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
return false;
|
||||||
$("#limits_container").hide();
|
});
|
||||||
}
|
} else {
|
||||||
|
$("#limits_container").hide();
|
||||||
rightPanelDetailContent.show();
|
|
||||||
rightPanelSearchResult.hide();
|
|
||||||
|
|
||||||
listAdminAccounts(domainId);
|
|
||||||
rightPanelGrid.show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
rightPanelDetailContent.show();
|
||||||
});
|
rightPanelSearchResult.hide();
|
||||||
|
|
||||||
searchResultTemplate.bind("click", function(event) {
|
listAdminAccounts(domainId);
|
||||||
var template = $(this);
|
rightPanelGrid.show();
|
||||||
var target = $(event.target);
|
}
|
||||||
var action = target.attr("id");
|
|
||||||
var id = template.attr("id");
|
|
||||||
var domainId = template.data("domainId");
|
|
||||||
if(action=="domain_name")
|
|
||||||
refreshWholeTree(domainId, defaultRootLevel);
|
|
||||||
});
|
|
||||||
|
|
||||||
searchButton.bind("click", function(event) {
|
return false;
|
||||||
searchResultsContainer.empty();
|
});
|
||||||
rightPanelDetailContent.hide();
|
|
||||||
rightPanelSearchResult.show();
|
searchResultTemplate.bind("click", function(event) {
|
||||||
var keyword = searchInput.val();
|
var template = $(this);
|
||||||
$.ajax({
|
var target = $(event.target);
|
||||||
data: createURL("command=listDomains&keyword="+keyword+"&response=json"+maxPageSize),
|
var action = target.attr("id");
|
||||||
dataType: "json",
|
var id = template.attr("id");
|
||||||
async: false,
|
var domainId = template.data("domainId");
|
||||||
success: function(json) {
|
if(action=="domain_name")
|
||||||
var domains = json.listdomainsresponse.domain;
|
refreshWholeTree(domainId, defaultRootLevel);
|
||||||
if (domains != null && domains.length > 0) {
|
});
|
||||||
for(var i=0; i<domains.length; i++) {
|
|
||||||
var template = searchResultTemplate.clone(true).attr("id", "searchresult"+domains[i].id).data("domainId", domains[i].id);
|
searchButton.bind("click", function(event) {
|
||||||
template.find("#domain_name").text(domains[i].name);
|
searchResultsContainer.empty();
|
||||||
searchResultsContainer.append(template.show());
|
rightPanelDetailContent.hide();
|
||||||
}
|
rightPanelSearchResult.show();
|
||||||
}
|
var keyword = searchInput.val();
|
||||||
|
$.ajax({
|
||||||
|
data: createURL("command=listDomains&keyword="+keyword+"&response=json"+maxPageSize),
|
||||||
|
dataType: "json",
|
||||||
|
async: false,
|
||||||
|
success: function(json) {
|
||||||
|
var domains = json.listdomainsresponse.domain;
|
||||||
|
if (domains != null && domains.length > 0) {
|
||||||
|
for(var i=0; i<domains.length; i++) {
|
||||||
|
var template = searchResultTemplate.clone(true).attr("id", "searchresult"+domains[i].id).data("domainId", domains[i].id);
|
||||||
|
template.find("#domain_name").text(domains[i].name);
|
||||||
|
searchResultsContainer.append(template.show());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
searchInput.bind("keypress", function(event) {
|
|
||||||
if(event.keyCode == keycode_Enter) {
|
|
||||||
searchButton.click();
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
searchInput.bind("keypress", function(event) {
|
||||||
|
if(event.keyCode == keycode_Enter) {
|
||||||
|
searchButton.click();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
//draw root node
|
//draw root node
|
||||||
function drawRootNode(rootDomainId) {
|
function drawRootNode(rootDomainId) {
|
||||||
treeContentBox.empty();
|
treeContentBox.empty();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: createURL("command=listDomains&id="+rootDomainId+"&response=json"),
|
data: createURL("command=listDomains&id="+rootDomainId+"&response=json"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
async: false,
|
async: false,
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
var domains = json.listdomainsresponse.domain;
|
var domains = json.listdomainsresponse.domain;
|
||||||
if (domains != null && domains.length > 0) {
|
if (domains != null && domains.length > 0) {
|
||||||
var node = drawNode(domains[0], defaultRootLevel, treeContentBox);
|
var node = drawNode(domains[0], defaultRootLevel, treeContentBox);
|
||||||
|
|
||||||
var treeLevelsbox = node.find(".tree_levelsbox"); //root node shouldn't have margin-left:20px
|
var treeLevelsbox = node.find(".tree_levelsbox"); //root node shouldn't have margin-left:20px
|
||||||
if(treeLevelsbox!=null && treeLevelsbox.length >0)
|
if(treeLevelsbox!=null && treeLevelsbox.length >0)
|
||||||
treeLevelsbox[0].style.marginLeft="0px"; //set root node's margin-left to 0px.
|
treeLevelsbox[0].style.marginLeft="0px"; //set root node's margin-left to 0px.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
breadcrumbPieceTemplate.bind("click", function(event) {
|
breadcrumbPieceTemplate.bind("click", function(event) {
|
||||||
var domainId = $(this).data("domainId");
|
var domainId = $(this).data("domainId");
|
||||||
refreshWholeTree(domainId);
|
refreshWholeTree(domainId);
|
||||||
});
|
|
||||||
|
|
||||||
//draw breadcrumb all the way up
|
|
||||||
function drawBreadcrumb(domainId) {
|
|
||||||
var domainName = domainIdNameMap[domainId];
|
|
||||||
if(domainName == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var onePiece = breadcrumbPieceTemplate.clone(true).attr("id", "breadcrumb_"+domainId).data("domainId", domainId).text(" > "+domainName);
|
|
||||||
breadcrumbBox.prepend(onePiece.show());
|
|
||||||
|
|
||||||
var parentDomainId = childParentMap[domainId];
|
|
||||||
if(parentDomainId!=null)
|
|
||||||
drawBreadcrumb(parentDomainId);
|
|
||||||
}
|
|
||||||
|
|
||||||
function refreshWholeTree(rootDomainId, rootLevel) {
|
|
||||||
drawRootNode(rootDomainId);
|
|
||||||
drawTree(rootDomainId, (rootLevel+1), $("#domain_children_container_"+rootDomainId)); //draw the whole tree (under root node)
|
|
||||||
$("#domain_"+rootDomainId).show(); //show root node
|
|
||||||
clickExpandIcon(rootDomainId); //expand root node
|
|
||||||
|
|
||||||
breadcrumbBox.empty();
|
|
||||||
drawBreadcrumb(rootDomainId);
|
|
||||||
}
|
|
||||||
|
|
||||||
refreshWholeTree(defaultRootDomainId, defaultRootLevel);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//draw breadcrumb all the way up
|
||||||
|
function drawBreadcrumb(domainId) {
|
||||||
|
var domainName = domainIdNameMap[domainId];
|
||||||
|
if(domainName == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var onePiece = breadcrumbPieceTemplate.clone(true).attr("id", "breadcrumb_"+domainId).data("domainId", domainId).text(" > "+domainName);
|
||||||
|
breadcrumbBox.prepend(onePiece.show());
|
||||||
|
|
||||||
|
var parentDomainId = childParentMap[domainId];
|
||||||
|
if(parentDomainId!=null)
|
||||||
|
drawBreadcrumb(parentDomainId);
|
||||||
|
}
|
||||||
|
|
||||||
|
function refreshWholeTree(rootDomainId, rootLevel) {
|
||||||
|
drawRootNode(rootDomainId);
|
||||||
|
drawTree(rootDomainId, (rootLevel+1), $("#domain_children_container_"+rootDomainId)); //draw the whole tree (under root node)
|
||||||
|
$("#domain_"+rootDomainId).show(); //show root node
|
||||||
|
clickExpandIcon(rootDomainId); //expand root node
|
||||||
|
|
||||||
|
breadcrumbBox.empty();
|
||||||
|
drawBreadcrumb(rootDomainId);
|
||||||
|
}
|
||||||
|
|
||||||
|
refreshWholeTree(defaultRootDomainId, defaultRootLevel);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -175,112 +175,110 @@ function showEventsTab(showEvents) {
|
|||||||
|
|
||||||
|
|
||||||
// Manage Events
|
// Manage Events
|
||||||
mainContainer.load("content/tab_events.html", function() {
|
var advancedSearch = $("#advanced_search");
|
||||||
var advancedSearch = $("#advanced_search");
|
advancedSearch.find("#adv_search_startdate, #adv_search_enddate").datepicker({dateFormat: 'yy-mm-dd'});
|
||||||
advancedSearch.find("#adv_search_startdate, #adv_search_enddate").datepicker({dateFormat: 'yy-mm-dd'});
|
|
||||||
|
|
||||||
if (isAdmin()) {
|
if (isAdmin()) {
|
||||||
// *** Alerts (begin) ***
|
// *** Alerts (begin) ***
|
||||||
var alertIndex = 0;
|
var alertIndex = 0;
|
||||||
function alertJSONToTemplate(json, template) {
|
function alertJSONToTemplate(json, template) {
|
||||||
if (alertIndex++ % 2 == 0) {
|
if (alertIndex++ % 2 == 0) {
|
||||||
template.addClass("smallrow_odd");
|
template.addClass("smallrow_odd");
|
||||||
} else {
|
} else {
|
||||||
template.addClass("smallrow_even");
|
template.addClass("smallrow_even");
|
||||||
}
|
}
|
||||||
|
|
||||||
template.find("#alert_type").text((toAlertType(json.type)));
|
template.find("#alert_type").text((toAlertType(json.type)));
|
||||||
template.find("#alert_desc").text(json.description);
|
template.find("#alert_desc").text(json.description);
|
||||||
|
|
||||||
setDateField(json.sent, template.find("#alert_sent"));
|
setDateField(json.sent, template.find("#alert_sent"));
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#submenu_content_alerts .grid_container .grid_header .grid_genheader_cell").bind("click", function(event) {
|
||||||
|
var headerColumn = $(this);
|
||||||
|
var sortingIcon = headerColumn.find(".gridsorting_arrow");
|
||||||
|
|
||||||
|
if (sortingIcon.hasClass("up") == false) { //If it's not in ascending order, sort it ascending.
|
||||||
|
$("#submenu_content_alerts .grid_container .grid_header .grid_genheader_cell .gridsorting_arrow").removeClass("down up"); //remove arrow from all header columns first
|
||||||
|
sortingIcon.addClass("up"); //add up arrow to this specific header column
|
||||||
|
sortingOrder = "asc";
|
||||||
|
}
|
||||||
|
else if (sortingIcon.hasClass("up") == true) { //If it's in ascending order, sort it descending.
|
||||||
|
$("#submenu_content_alerts .grid_container .grid_header .grid_genheader_cell .gridsorting_arrow").removeClass("down up"); //remove arrow from all header columns first
|
||||||
|
sortingIcon.addClass("down"); //add down arrow to this specific header column
|
||||||
|
sortingOrder = "desc";
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#submenu_content_alerts .grid_container .grid_header .grid_genheader_cell").bind("click", function(event) {
|
switch(headerColumn[0].id) {
|
||||||
var headerColumn = $(this);
|
case "alert_type_header":
|
||||||
var sortingIcon = headerColumn.find(".gridsorting_arrow");
|
sortBy = "type";
|
||||||
|
parseFunction = toAlertType;
|
||||||
|
items.sort(sortArrayAlphabeticallyParse);
|
||||||
|
break;
|
||||||
|
case "alert_description_header":
|
||||||
|
sortBy = "description";
|
||||||
|
items.sort(sortArrayAlphabetically);
|
||||||
|
break;
|
||||||
|
case "alert_date_header":
|
||||||
|
sortBy = "sent";
|
||||||
|
items.sort(sortArrayAlphabetically);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (sortingIcon.hasClass("up") == false) { //If it's not in ascending order, sort it ascending.
|
drawGrid(items, $("#submenu_content_alerts"), $("#alert_template"), alertJSONToTemplate);
|
||||||
$("#submenu_content_alerts .grid_container .grid_header .grid_genheader_cell .gridsorting_arrow").removeClass("down up"); //remove arrow from all header columns first
|
return false;
|
||||||
sortingIcon.addClass("up"); //add up arrow to this specific header column
|
});
|
||||||
sortingOrder = "asc";
|
|
||||||
}
|
|
||||||
else if (sortingIcon.hasClass("up") == true) { //If it's in ascending order, sort it descending.
|
|
||||||
$("#submenu_content_alerts .grid_container .grid_header .grid_genheader_cell .gridsorting_arrow").removeClass("down up"); //remove arrow from all header columns first
|
|
||||||
sortingIcon.addClass("down"); //add down arrow to this specific header column
|
|
||||||
sortingOrder = "desc";
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(headerColumn[0].id) {
|
function listAlerts() {
|
||||||
case "alert_type_header":
|
var submenuContent = $("#submenu_content_alerts");
|
||||||
sortBy = "type";
|
|
||||||
parseFunction = toAlertType;
|
|
||||||
items.sort(sortArrayAlphabeticallyParse);
|
|
||||||
break;
|
|
||||||
case "alert_description_header":
|
|
||||||
sortBy = "description";
|
|
||||||
items.sort(sortArrayAlphabetically);
|
|
||||||
break;
|
|
||||||
case "alert_date_header":
|
|
||||||
sortBy = "sent";
|
|
||||||
items.sort(sortArrayAlphabetically);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
drawGrid(items, $("#submenu_content_alerts"), $("#alert_template"), alertJSONToTemplate);
|
var commandString;
|
||||||
return false;
|
var advanced = submenuContent.find("#search_button").data("advanced");
|
||||||
});
|
if (advanced != null && advanced) {
|
||||||
|
var type = submenuContent.find("#advanced_search #adv_search_type").val();
|
||||||
|
var moreCriteria = [];
|
||||||
|
if (type!=null && trim(type).length > 0)
|
||||||
|
moreCriteria.push("&type="+encodeURIComponent(trim(type)));
|
||||||
|
commandString = "command=listAlerts&page="+currentPage+moreCriteria.join("")+"&response=json";
|
||||||
|
} else {
|
||||||
|
var searchInput = submenuContent.find("#search_input").val();
|
||||||
|
if (searchInput != null && searchInput.length > 0)
|
||||||
|
commandString = "command=listAlerts&page="+currentPage+"&keyword="+searchInput+"&response=json"
|
||||||
|
else
|
||||||
|
commandString = "command=listAlerts&page="+currentPage+"&response=json";
|
||||||
|
}
|
||||||
|
|
||||||
function listAlerts() {
|
//listItems(submenuContent, commandString, jsonResponse1, jsonResponse2, template, fnJSONToTemplate);
|
||||||
var submenuContent = $("#submenu_content_alerts");
|
listItems(submenuContent, commandString, "listalertsresponse", "alert", $("#alert_template"), alertJSONToTemplate);
|
||||||
|
}
|
||||||
|
|
||||||
var commandString;
|
submenuContentEventBinder($("#submenu_content_alerts"), listAlerts);
|
||||||
var advanced = submenuContent.find("#search_button").data("advanced");
|
|
||||||
if (advanced != null && advanced) {
|
|
||||||
var type = submenuContent.find("#advanced_search #adv_search_type").val();
|
|
||||||
var moreCriteria = [];
|
|
||||||
if (type!=null && trim(type).length > 0)
|
|
||||||
moreCriteria.push("&type="+encodeURIComponent(trim(type)));
|
|
||||||
commandString = "command=listAlerts&page="+currentPage+moreCriteria.join("")+"&response=json";
|
|
||||||
} else {
|
|
||||||
var searchInput = submenuContent.find("#search_input").val();
|
|
||||||
if (searchInput != null && searchInput.length > 0)
|
|
||||||
commandString = "command=listAlerts&page="+currentPage+"&keyword="+searchInput+"&response=json"
|
|
||||||
else
|
|
||||||
commandString = "command=listAlerts&page="+currentPage+"&response=json";
|
|
||||||
}
|
|
||||||
|
|
||||||
//listItems(submenuContent, commandString, jsonResponse1, jsonResponse2, template, fnJSONToTemplate);
|
$("#submenu_alerts").bind("click", function(event) {
|
||||||
listItems(submenuContent, commandString, "listalertsresponse", "alert", $("#alert_template"), alertJSONToTemplate);
|
event.preventDefault();
|
||||||
}
|
|
||||||
|
|
||||||
submenuContentEventBinder($("#submenu_content_alerts"), listAlerts);
|
$(this).removeClass().addClass("submenu_links_on");
|
||||||
|
currentSubMenu.removeClass().toggleClass("submenu_links_off");
|
||||||
|
currentSubMenu = $(this);
|
||||||
|
|
||||||
$("#submenu_alerts").bind("click", function(event) {
|
var submenuContent = $("#submenu_content_alerts").show();
|
||||||
event.preventDefault();
|
$("#submenu_content_events").hide();
|
||||||
|
|
||||||
$(this).removeClass().addClass("submenu_links_on");
|
currentPage = 1;
|
||||||
currentSubMenu.removeClass().toggleClass("submenu_links_off");
|
listAlerts();
|
||||||
currentSubMenu = $(this);
|
});
|
||||||
|
// *** Alerts (end) ***
|
||||||
|
|
||||||
var submenuContent = $("#submenu_content_alerts").show();
|
// *** Events (begin) ***
|
||||||
$("#submenu_content_events").hide();
|
initializeEventTab(true);
|
||||||
|
// *** Events (end) ***
|
||||||
currentPage = 1;
|
|
||||||
listAlerts();
|
|
||||||
});
|
|
||||||
// *** Alerts (end) ***
|
|
||||||
|
|
||||||
// *** Events (begin) ***
|
|
||||||
initializeEventTab(true);
|
|
||||||
// *** Events (end) ***
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// *** Events (begin) ***
|
// *** Events (begin) ***
|
||||||
initializeEventTab(false);
|
initializeEventTab(false);
|
||||||
// *** Events (end) ***
|
// *** Events (end) ***
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@ -285,25 +285,41 @@ $(document).ready(function() {
|
|||||||
if (tabId == "menutab_dashboard_user" || tabId == "menutab_dashboard_root" || tabId == "menutab_dashboard_domain") {
|
if (tabId == "menutab_dashboard_user" || tabId == "menutab_dashboard_root" || tabId == "menutab_dashboard_domain") {
|
||||||
showDashboardTab();
|
showDashboardTab();
|
||||||
} else if (tabId == "menutab_vm") {
|
} else if (tabId == "menutab_vm") {
|
||||||
showInstancesTab(tab.data("domainId"), tab.data("account"));
|
mainContainer.load("content/tab_instances.html", function() {
|
||||||
|
showInstancesTab(tab.data("domainId"), tab.data("account"));
|
||||||
|
});
|
||||||
} else if (tabId == "menutab_networking") {
|
} else if (tabId == "menutab_networking") {
|
||||||
mainContainer.load("content/tab_networking.html", function() {
|
mainContainer.load("content/tab_networking.html", function() {
|
||||||
showNetworkingTab(tab.data("domainId"), tab.data("account"));
|
showNetworkingTab(tab.data("domainId"), tab.data("account"));
|
||||||
});
|
});
|
||||||
} else if (tabId == "menutab_templates") {
|
} else if (tabId == "menutab_templates") {
|
||||||
showTemplatesTab();
|
mainContainer.load("content/tab_templates.html", function() {
|
||||||
|
showTemplatesTab();
|
||||||
|
});
|
||||||
} else if (tabId == "menutab_events") {
|
} else if (tabId == "menutab_events") {
|
||||||
showEventsTab(tab.data("showEvents"));
|
mainContainer.load("content/tab_events.html", function() {
|
||||||
|
showEventsTab(tab.data("showEvents"));
|
||||||
|
});
|
||||||
} else if (tabId == "menutab_hosts") {
|
} else if (tabId == "menutab_hosts") {
|
||||||
showHostsTab();
|
mainContainer.load("content/tab_hosts.html", function() {
|
||||||
|
showHostsTab();
|
||||||
|
});
|
||||||
} else if (tabId == "menutab_storage") {
|
} else if (tabId == "menutab_storage") {
|
||||||
showStorageTab(tab.data("domainId"), tab.data("targetTab"));
|
mainContainer.load("content/tab_storage.html", function() {
|
||||||
|
showStorageTab(tab.data("domainId"), tab.data("targetTab"));
|
||||||
|
});
|
||||||
} else if (tabId == "menutab_accounts") {
|
} else if (tabId == "menutab_accounts") {
|
||||||
showAccountsTab(tab.data("domainId"));
|
mainContainer.load("content/tab_accounts.html", function() {
|
||||||
|
showAccountsTab(tab.data("domainId"));
|
||||||
|
});
|
||||||
} else if (tabId == "menutab_domain") {
|
} else if (tabId == "menutab_domain") {
|
||||||
showDomainsTab();
|
mainContainer.load("jsp/tab_domains.jsp", function() {
|
||||||
|
showDomainsTab();
|
||||||
|
});
|
||||||
} else if (tabId == "menutab_configuration") {
|
} else if (tabId == "menutab_configuration") {
|
||||||
showConfigurationTab();
|
mainContainer.load("content/tab_configuration.html", function() {
|
||||||
|
showConfigurationTab();
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -278,8 +278,6 @@ public class Merovingian {
|
|||||||
|
|
||||||
Ternary<Savepoint, Integer, Long> lock = _locks.get(key);
|
Ternary<Savepoint, Integer, Long> lock = _locks.get(key);
|
||||||
if (lock != null) {
|
if (lock != null) {
|
||||||
validLock = true;
|
|
||||||
|
|
||||||
if (lock.second() > 1) {
|
if (lock.second() > 1) {
|
||||||
lock.second(lock.second() - 1);
|
lock.second(lock.second() - 1);
|
||||||
if (s_logger.isTraceEnabled()) {
|
if (s_logger.isTraceEnabled()) {
|
||||||
@ -288,6 +286,15 @@ public class Merovingian {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// set this to true only if we are really done with the DB lock. Which means, the lock count has been
|
||||||
|
// reached to zero
|
||||||
|
//
|
||||||
|
// While we are holding the DB lock, we also need to hold the memory lock as well, to lock the first gate
|
||||||
|
// and prevent others to come in and test with DB lock unnecessarily
|
||||||
|
//
|
||||||
|
validLock = true;
|
||||||
|
|
||||||
if (s_logger.isDebugEnabled() && !_locks.keySet().iterator().next().equals(key)) {
|
if (s_logger.isDebugEnabled() && !_locks.keySet().iterator().next().equals(key)) {
|
||||||
s_logger.trace("Lock: Releasing out of order for " + key);
|
s_logger.trace("Lock: Releasing out of order for " + key);
|
||||||
}
|
}
|
||||||
@ -298,7 +305,10 @@ public class Merovingian {
|
|||||||
Connection conn = getConnection(key, true);
|
Connection conn = getConnection(key, true);
|
||||||
|
|
||||||
conn.rollback(lock.first());
|
conn.rollback(lock.first());
|
||||||
|
} else {
|
||||||
|
s_logger.warn("Merovingian.release() is called against key " + key + " but the lock of this key does not exist!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_locks.size() == 0) {
|
if (_locks.size() == 0) {
|
||||||
closeConnection();
|
closeConnection();
|
||||||
}
|
}
|
||||||
@ -308,13 +318,17 @@ public class Merovingian {
|
|||||||
} finally {
|
} finally {
|
||||||
synchronized(s_memLocks) {
|
synchronized(s_memLocks) {
|
||||||
Pair<Lock, Integer> memLock = s_memLocks.get(key);
|
Pair<Lock, Integer> memLock = s_memLocks.get(key);
|
||||||
memLock.second(memLock.second() - 1);
|
if(memLock != null) {
|
||||||
if (memLock.second() <= 0) {
|
memLock.second(memLock.second() - 1);
|
||||||
s_memLocks.remove(key);
|
if (memLock.second() <= 0) {
|
||||||
}
|
s_memLocks.remove(key);
|
||||||
|
}
|
||||||
|
|
||||||
if(validLock)
|
if(validLock)
|
||||||
memLock.first().unlock();
|
memLock.first().unlock();
|
||||||
|
} else {
|
||||||
|
throw new CloudRuntimeException("Merovingian.release() is called for key " + key + ", but its memory lock no longer exist! This is not good, guys");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
14
wscript
14
wscript
@ -48,7 +48,7 @@ for _globber in [
|
|||||||
for f in _globber: Scripting.excludes.append(_basename(f)) # _basename() only the filename
|
for f in _globber: Scripting.excludes.append(_basename(f)) # _basename() only the filename
|
||||||
|
|
||||||
# things never to consider when building or installing
|
# things never to consider when building or installing
|
||||||
for pattern in ["**/.project","**/.classpath"]: Node.exclude_regs += "\n%s"%pattern
|
for pattern in ["**/.project","**/.classpath","**/.pydevproject"]: Node.exclude_regs += "\n%s"%pattern
|
||||||
|
|
||||||
# Support functions
|
# Support functions
|
||||||
|
|
||||||
@ -790,6 +790,18 @@ def debug(ctx):
|
|||||||
"""runs the management server in debug mode"""
|
"""runs the management server in debug mode"""
|
||||||
run("debug")
|
run("debug")
|
||||||
|
|
||||||
|
@throws_command_errors
|
||||||
|
def run_agent(args):
|
||||||
|
"""runs the management server"""
|
||||||
|
conf = _getbuildcontext()
|
||||||
|
_check_call("sudo",[_join(conf.env.LIBEXECDIR,"agent-runner")])
|
||||||
|
|
||||||
|
@throws_command_errors
|
||||||
|
def run_console_proxy(args):
|
||||||
|
"""runs the management server"""
|
||||||
|
conf = _getbuildcontext()
|
||||||
|
_check_call("sudo",[_join(conf.env.LIBEXECDIR,"console-proxy-runner")])
|
||||||
|
|
||||||
def simulate_agent(args):
|
def simulate_agent(args):
|
||||||
"""runs the agent simulator, compiling and installing files as needed
|
"""runs the agent simulator, compiling and installing files as needed
|
||||||
- Any parameter specified after the simulate_agent is appended to
|
- Any parameter specified after the simulate_agent is appended to
|
||||||
|
|||||||
@ -482,7 +482,7 @@ bld.install_files("${MSENVIRON}/webapps/client",
|
|||||||
cwd=start_path,relative_trick=True)
|
cwd=start_path,relative_trick=True)
|
||||||
|
|
||||||
# -> source files with tokens
|
# -> source files with tokens
|
||||||
patterns = 'ui/*html ui/**/*html ui/**/*js ui/**/*css'
|
patterns = 'ui/*html ui/**/*html ui/**/*js ui/**/*css ui/**/*properties ui/**/*jsp'
|
||||||
src_files = Utils.to_list(filelist(patterns,flat=True))
|
src_files = Utils.to_list(filelist(patterns,flat=True))
|
||||||
subst_files = [ x+".subst" for x in src_files ]
|
subst_files = [ x+".subst" for x in src_files ]
|
||||||
inst_files = [ Utils.relpath(x,"ui") for x in src_files ]
|
inst_files = [ Utils.relpath(x,"ui") for x in src_files ]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user