From 6484467ce2eeba1150fd315963e811763715163f Mon Sep 17 00:00:00 2001 From: "Manuel Amador (Rudd-O)" Date: Wed, 11 Aug 2010 09:13:54 -0700 Subject: [PATCH] Branch 2.1.x committed --- HACKING | 383 +- INSTALL | 155 - README | 191 +- README.html | 10555 ---------------- agent/.classpath | 32 +- agent/libexec/agent-runner.in | 4 +- .../computing/LibvirtComputingResource.java | 100 +- build/build-cloud.xml | 5 +- build/package.xml | 4 - client/tomcatconf/components.xml.in | 5 - cloud.spec | 41 +- console-proxy/libexec/console-proxy-runner.in | 4 +- core/.classpath | 65 +- .../agent/api/BackupSnapshotCommand.java | 8 +- .../agent/api/storage/CreateCommand.java | 10 +- .../src/com/cloud/hypervisor/Hypervisor.java | 0 .../vmware/resource/VmwareResource.java | 122 - .../xen/resource/CitrixResourceBase.java | 84 +- .../network/ExteralIpAddressAllocator.java | 10 +- .../com/cloud/server/ManagementServer.java | 23 +- .../src/com/cloud/storage/DiskOfferingVO.java | 6 +- .../src/com/cloud/storage/StorageManager.java | 13 +- .../cloud/storage/dao/DiskOfferingDao.java | 4 +- .../storage/dao/DiskOfferingDaoImpl.java | 12 - .../cloud/storage/dao/VMTemplateDaoImpl.java | 1 + .../cloud/storage/dao/VMTemplateHostDao.java | 2 - .../storage/dao/VMTemplateHostDaoImpl.java | 7 - core/src/com/cloud/user/UserContext.java | 203 +- core/src/com/cloud/vm/UserVmVO.java | 18 - core/src/com/cloud/vm/VMInstanceVO.java | 21 +- .../src/com/cloud/vm/VmCharacteristics.java | 47 +- core/test/com/cloud/vmware/TestVMWare.java | 651 - debian/rules | 2 +- python/lib/cloud_utils.py | 6 +- scripts/.project | 4 +- scripts/.pydevproject | 7 - scripts/storage/qcow2/createtmplt.sh | 7 +- scripts/storage/qcow2/managesnapshot.sh | 17 +- scripts/vm/hypervisor/xenserver/launch_hb.sh | 2 +- .../vm/hypervisor/xenserver/setupxenserver.sh | 5 - scripts/vm/network/vnet/modifyvlan.sh | 9 +- server/src/com/cloud/api/ApiServer.java | 120 +- server/src/com/cloud/api/ApiServlet.java | 39 +- server/src/com/cloud/api/BaseCmd.java | 159 +- server/src/com/cloud/api/BaseListCmd.java | 34 + server/src/com/cloud/api/Parameter.java | 37 + .../com/cloud/api/commands/AddConfigCmd.java | 59 +- .../com/cloud/api/commands/AddHostCmd.java | 76 +- .../api/commands/AddSecondaryStorageCmd.java | 30 +- .../AssignPortForwardingServiceCmd.java | 57 +- .../commands/AssignToLoadBalancerRuleCmd.java | 98 +- .../api/commands/AssociateIPAddrCmd.java | 52 +- .../com/cloud/api/commands/AttachIsoCmd.java | 29 + .../cloud/api/commands/AttachVolumeCmd.java | 36 + .../AuthorizeNetworkGroupIngressCmd.java | 88 + .../api/commands/CancelMaintenanceCmd.java | 34 +- .../CancelPrimaryStorageMaintenanceCmd.java | 22 + .../com/cloud/api/commands/CopyIsoCmd.java | 36 + .../cloud/api/commands/CopyTemplateCmd.java | 38 +- .../api/commands/CreateDiskOfferingCmd.java | 50 + .../cloud/api/commands/CreateDomainCmd.java | 41 +- .../commands/CreateIPForwardingRuleCmd.java | 54 +- .../commands/CreateLoadBalancerRuleCmd.java | 66 +- .../api/commands/CreateNetworkGroupCmd.java | 46 +- .../com/cloud/api/commands/CreatePodCmd.java | 67 +- .../CreatePortForwardingServiceCmd.java | 60 +- .../CreatePortForwardingServiceRuleCmd.java | 52 +- .../commands/CreateServiceOfferingCmd.java | 91 +- .../cloud/api/commands/CreateSnapshotCmd.java | 44 +- .../api/commands/CreateSnapshotPolicyCmd.java | 90 +- .../api/commands/CreateStoragePoolCmd.java | 74 +- .../cloud/api/commands/CreateTemplateCmd.java | 110 +- .../com/cloud/api/commands/CreateUserCmd.java | 90 +- .../api/commands/CreateVlanIpRangeCmd.java | 117 +- .../cloud/api/commands/CreateVolumeCmd.java | 109 +- .../com/cloud/api/commands/CreateZoneCmd.java | 69 +- .../api/commands/DeleteDiskOfferingCmd.java | 35 +- .../cloud/api/commands/DeleteDomainCmd.java | 41 +- .../com/cloud/api/commands/DeleteHostCmd.java | 22 + .../commands/DeleteIPForwardingRuleCmd.java | 54 +- .../com/cloud/api/commands/DeleteIsoCmd.java | 41 +- .../commands/DeleteLoadBalancerRuleCmd.java | 48 +- .../api/commands/DeleteNetworkGroupCmd.java | 36 + .../com/cloud/api/commands/DeletePodCmd.java | 22 + .../com/cloud/api/commands/DeletePoolCmd.java | 24 +- .../DeletePortForwardingServiceCmd.java | 22 + .../DeletePortForwardingServiceRuleCmd.java | 34 +- .../commands/DeleteServiceOfferingCmd.java | 34 +- .../cloud/api/commands/DeleteSnapshotCmd.java | 55 +- .../commands/DeleteSnapshotPoliciesCmd.java | 49 +- .../cloud/api/commands/DeleteTemplateCmd.java | 41 +- .../com/cloud/api/commands/DeleteUserCmd.java | 34 +- .../api/commands/DeleteVlanIpRangeCmd.java | 36 +- .../cloud/api/commands/DeleteVolumeCmd.java | 22 + .../com/cloud/api/commands/DeleteZoneCmd.java | 22 + .../com/cloud/api/commands/DeployVMCmd.java | 116 +- .../api/commands/DestroyConsoleProxyCmd.java | 34 +- .../com/cloud/api/commands/DestroyVMCmd.java | 34 +- .../com/cloud/api/commands/DetachIsoCmd.java | 34 +- .../cloud/api/commands/DetachVolumeCmd.java | 22 + .../cloud/api/commands/DisableAccountCmd.java | 41 +- .../cloud/api/commands/DisableUserCmd.java | 34 +- .../api/commands/DisassociateIPAddrCmd.java | 34 +- .../cloud/api/commands/EnableAccountCmd.java | 41 +- .../com/cloud/api/commands/EnableUserCmd.java | 34 +- .../api/commands/GetCloudIdentifierCmd.java | 18 + .../cloud/api/commands/ListAccountsCmd.java | 80 +- .../com/cloud/api/commands/ListAlertsCmd.java | 177 +- .../cloud/api/commands/ListAsyncJobsCmd.java | 37 + .../cloud/api/commands/ListCapacityCmd.java | 81 +- .../com/cloud/api/commands/ListCfgsByCmd.java | 30 + .../cloud/api/commands/ListClustersCmd.java | 45 +- .../api/commands/ListDiskOfferingsCmd.java | 38 + .../api/commands/ListDomainChildrenCmd.java | 42 +- .../cloud/api/commands/ListDomainsCmd.java | 40 +- .../com/cloud/api/commands/ListEventsCmd.java | 90 +- .../commands/ListGuestOsCategoriesCmd.java | 22 + .../cloud/api/commands/ListGuestOsCmd.java | 30 + .../com/cloud/api/commands/ListHostsCmd.java | 73 +- .../com/cloud/api/commands/ListIsosCmd.java | 92 +- .../ListLoadBalancerRuleInstancesCmd.java | 32 +- .../commands/ListLoadBalancerRulesCmd.java | 76 +- .../api/commands/ListNetworkGroupsCmd.java | 44 + .../com/cloud/api/commands/ListPodsByCmd.java | 35 + .../commands/ListPortForwardingRulesCmd.java | 21 + .../ListPortForwardingServiceRulesCmd.java | 45 +- .../ListPortForwardingServicesByVmCmd.java | 63 +- .../ListPortForwardingServicesCmd.java | 58 +- .../api/commands/ListPreallocatedLunsCmd.java | 31 +- .../commands/ListPublicIpAddressesCmd.java | 91 +- .../ListRecurringSnapshotScheduleCmd.java | 35 +- .../api/commands/ListResourceLimitsCmd.java | 48 +- .../cloud/api/commands/ListRoutersCmd.java | 75 +- .../api/commands/ListServiceOfferingsCmd.java | 35 + .../api/commands/ListSnapshotPoliciesCmd.java | 34 + .../cloud/api/commands/ListSnapshotsCmd.java | 79 +- .../commands/ListStoragePoolsAndHostsCmd.java | 86 +- .../api/commands/ListStoragePoolsCmd.java | 65 +- .../cloud/api/commands/ListSystemVMsCmd.java | 73 +- .../ListTemplateOrIsoPermissionsCmd.java | 34 + .../commands/ListTemplatePermissionsCmd.java | 15 +- .../cloud/api/commands/ListTemplatesCmd.java | 69 +- .../com/cloud/api/commands/ListUsersCmd.java | 78 +- .../com/cloud/api/commands/ListVMsCmd.java | 84 +- .../api/commands/ListVlanIpRangesCmd.java | 81 +- .../cloud/api/commands/ListVolumesCmd.java | 90 +- .../cloud/api/commands/ListZonesByCmd.java | 33 +- .../cloud/api/commands/LockAccountCmd.java | 47 +- .../com/cloud/api/commands/LockUserCmd.java | 44 +- .../commands/PrepareForMaintenanceCmd.java | 32 +- ...reparePrimaryStorageForMaintenanceCmd.java | 24 +- .../api/commands/QueryAsyncJobResultCmd.java | 34 +- .../cloud/api/commands/RebootRouterCmd.java | 32 +- .../cloud/api/commands/RebootSystemVmCmd.java | 32 +- .../com/cloud/api/commands/RebootVMCmd.java | 32 +- .../cloud/api/commands/ReconnectHostCmd.java | 32 +- .../com/cloud/api/commands/RecoverVMCmd.java | 37 +- .../com/cloud/api/commands/RegisterCmd.java | 20 + .../cloud/api/commands/RegisterIsoCmd.java | 87 +- .../api/commands/RegisterTemplateCmd.java | 116 +- .../RemoveFromLoadBalancerRuleCmd.java | 51 +- .../RemovePortForwardingServiceCmd.java | 47 +- .../api/commands/ResetVMPasswordCmd.java | 32 +- .../RevokeNetworkGroupIngressCmd.java | 102 +- .../cloud/api/commands/StartRouterCmd.java | 32 +- .../cloud/api/commands/StartSystemVMCmd.java | 33 +- .../com/cloud/api/commands/StartVMCmd.java | 32 +- .../com/cloud/api/commands/StopRouterCmd.java | 32 +- .../cloud/api/commands/StopSystemVmCmd.java | 35 +- .../src/com/cloud/api/commands/StopVMCmd.java | 32 +- .../cloud/api/commands/UpdateAccountCmd.java | 47 +- .../com/cloud/api/commands/UpdateCfgCmd.java | 28 + .../api/commands/UpdateDiskOfferingCmd.java | 47 +- .../cloud/api/commands/UpdateDomainCmd.java | 27 + .../com/cloud/api/commands/UpdateHostCmd.java | 29 +- .../commands/UpdateIPForwardingRuleCmd.java | 60 +- .../com/cloud/api/commands/UpdateIsoCmd.java | 67 +- .../commands/UpdateLoadBalancerRuleCmd.java | 55 +- .../com/cloud/api/commands/UpdatePodCmd.java | 62 +- .../api/commands/UpdateResourceLimitCmd.java | 48 +- .../commands/UpdateServiceOfferingCmd.java | 72 +- .../api/commands/UpdateStoragePoolCmd.java | 33 +- .../cloud/api/commands/UpdateTemplateCmd.java | 73 +- .../UpdateTemplateOrIsoPermissionsCmd.java | 61 +- .../com/cloud/api/commands/UpdateUserCmd.java | 102 +- .../com/cloud/api/commands/UpdateVMCmd.java | 60 +- .../com/cloud/api/commands/UpdateZoneCmd.java | 76 +- .../com/cloud/api/commands/UpgradeVMCmd.java | 41 +- .../AssignToLoadBalancerExecutor.java | 11 +- .../CreatePrivateTemplateExecutor.java | 1 - .../CreatePrivateTemplateResultObject.java | 11 - .../async/executor/DeployVMExecutor.java | 2 +- .../cloud/async/executor/DeployVMParam.java | 10 +- .../executor/VolumeOperationExecutor.java | 2 +- .../async/executor/VolumeOperationParam.java | 10 +- .../configuration/ConfigurationManager.java | 1 - .../ConfigurationManagerImpl.java | 19 +- .../consoleproxy/ConsoleProxyManagerImpl.java | 7 +- .../discoverer/VmwareServerDiscoverer.java | 40 - .../xen/discoverer/XcpServerDiscoverer.java | 6 +- .../com/cloud/network/NetworkManagerImpl.java | 7 +- .../cloud/server/ConfigurationServerImpl.java | 3 +- .../cloud/server/ManagementServerImpl.java | 253 +- .../com/cloud/storage/StorageManagerImpl.java | 96 +- .../SecondaryStorageManagerImpl.java | 2 +- .../storage/snapshot/SnapshotManagerImpl.java | 29 +- server/src/com/cloud/vm/UserVmManager.java | 13 +- .../src/com/cloud/vm/UserVmManagerImpl.java | 204 +- setup/.project | 6 + ui/content/tab_accounts.html | 2 - ui/content/tab_configuration.html | 6 +- .../tab_domains.html} | 296 +- ui/content/tab_events.html | 2 - ui/content/tab_hosts.html | 2 - ui/content/tab_instances.html | 16 +- ui/content/tab_networking.html | 2 +- ui/content/tab_storage.html | 2 - ui/content/tab_templates.html | 6 +- ui/index.html | 8 + ui/jsp/test.jsp | 8 + ui/resources/resource.properties | 5 - ui/resources/resource_zh.properties | 5 - ui/scripts/cloud.core.accounts.js | 596 +- ui/scripts/cloud.core.configuration.js | 3390 ++--- ui/scripts/cloud.core.domains.js | 748 +- ui/scripts/cloud.core.events.js | 200 +- ui/scripts/cloud.core.hosts.js | 1348 +- ui/scripts/cloud.core.init.js | 32 +- ui/scripts/cloud.core.instances.js | 5092 ++++---- ui/scripts/cloud.core.storage.js | 1055 +- ui/scripts/cloud.core.templates.js | 2077 +-- utils/src/com/cloud/utils/db/Merovingian.java | 30 +- wscript | 14 +- wscript_build | 2 +- 234 files changed, 14888 insertions(+), 21394 deletions(-) delete mode 100644 INSTALL delete mode 100644 README.html rename {api => core}/src/com/cloud/hypervisor/Hypervisor.java (100%) delete mode 100644 core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java rename {api => core}/src/com/cloud/vm/VmCharacteristics.java (56%) delete mode 100644 core/test/com/cloud/vmware/TestVMWare.java delete mode 100644 scripts/.pydevproject create mode 100644 server/src/com/cloud/api/BaseListCmd.java create mode 100644 server/src/com/cloud/api/Parameter.java delete mode 100644 server/src/com/cloud/hypervisor/vmware/discoverer/VmwareServerDiscoverer.java rename ui/{jsp/tab_domains.jsp => content/tab_domains.html} (87%) create mode 100644 ui/jsp/test.jsp delete mode 100644 ui/resources/resource.properties delete mode 100644 ui/resources/resource_zh.properties diff --git a/HACKING b/HACKING index b6a16c3ef5e..140ae446134 100644 --- a/HACKING +++ b/HACKING @@ -165,14 +165,11 @@ independently from the install directory: from happening. Or resort to the override method discussed above (search for "override" in this document). - 2) If you haven't done so yet, set the Agent up: + 2) If you haven't done so yet, set the Console Proxy up: - run $BINDIR/cloud-setup-agent - 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 + 3) Execute $LIBEXECDIR/agent-runner as root - Console Proxy (Linux-only): @@ -190,183 +187,7 @@ independently from the install directory: - run $BINDIR/cloud-setup-console-proxy - 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 /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. + 3) Execute $LIBEXECDIR/console-proxy-runner as root --------------------------------------------------------------------- @@ -374,22 +195,6 @@ UNDERSTANDING THE BUILD SYSTEM --------------------------------------------------------------------- -=== Documentation for the build system === - -The first and foremost reference material: - -- http://freehackers.org/~tnagy/wafbook/index.html - -Examples - -- http://code.google.com/p/waf/wiki/CodeSnippets -- http://code.google.com/p/waf/w/list - -FAQ - -- http://code.google.com/p/waf/wiki/FAQ - - === Why waf === The CloudStack uses waf to build itself. waf is a relative newcomer @@ -469,184 +274,4 @@ If you add to the ant build files a new ant target that uses the 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 add the produced JAR name to the packaging manifests (cloud.spec and -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//agent -h -t computing -m expert -5.4.2 Deploy agent on routing server - -deploy-agent.sh -d /root//agent -h -t routing -m expert -5.4.3 Deploy agent on storage server - -deploy-agent.sh -d /root//agent -h -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//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= - port=8250 - pod= - zone= - instance= - 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//agent/conf/log4j-cloud.xml to update the location of logs to somewhere under /root/ - -Once you have deployed and configured the agent software, you are ready to launch it. Under the agent root directory (in our example, /root//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..pid - -To Stop the agent: - -kill - - \ No newline at end of file +debian/{name-of-package}.install). \ No newline at end of file diff --git a/INSTALL b/INSTALL deleted file mode 100644 index bcf10e20b23..00000000000 --- a/INSTALL +++ /dev/null @@ -1,155 +0,0 @@ ---------------------------------------------------------------------- -TABLE OF CONTENTS ---------------------------------------------------------------------- - - -1. Really quick start: building and installing a production stack -2. Post-install: setting the CloudStack components up -3. Installation paths: where the stack is installed on your system -4. Uninstalling the CloudStack from your system - - ---------------------------------------------------------------------- -REALLY QUICK START: BUILDING AND INSTALLING A PRODUCTION STACK ---------------------------------------------------------------------- - - -You have two options. Choose one: - -a) Building distribution packages from the source and installing them -b) Building from the source and installing directly from there - - -=== I want to build and install distribution packages === - -This is the recommended way to run your CloudStack cloud. The -advantages are that dependencies are taken care of automatically -for you, and you can verify the integrity of the installed files -using your system's package manager. - -1. As root, install the build dependencies. - - a) Fedora / CentOS: ./waf installrpmdeps - - b) Ubuntu: ./waf installdebdeps - -2. As a non-root user, build the CloudStack packages. - - a) Fedora / CentOS: ./waf rpm - - b) Ubuntu: ./waf deb - -3. As root, install the CloudStack packages. - You can choose which components to install on your system. - - a) Fedora / CentOS: the installable RPMs are in artifacts/rpmbuild - install as root: rpm -ivh artifacts/rpmbuild/RPMS/{x86_64,noarch,i386}/*.rpm - - b) Ubuntu: the installable DEBs are in artifacts/debbuild - install as root: dpkg -i artifacts/debbuild/*.deb - -4. Configure and start the components you intend to run. - Consult the Installation Guide to find out how to - configure each component, and "Installation paths" for information - on where programs, initscripts and config files are installed. - - -=== I want to build and install directly from the source === - -This is the recommended way to run your CloudStack cloud if you -intend to modify the source, if you intend to port the CloudStack to -another distribution, or if you intend to run the CloudStack on a -distribution for which packages are not built. - -1. As root, install the build dependencies. - See below for a list. - -2. As non-root, configure the build. - See below to discover configuration options. - - ./waf configure - -3. As non-root, build the CloudStack. - To learn more, see "Quick guide to developing, building and - installing from source" below. - - ./waf build - -4. As root, install the runtime dependencies. - See below for a list. - -5. As root, Install the CloudStack - - ./waf install - -6. Configure and start the components you intend to run. - Consult the Installation Guide to find out how to - configure each component, and "Installation paths" for information - on where to find programs, initscripts and config files mentioned - in the Installation Guide (paths may vary). - - -=== Dependencies of the CloudStack === - -- Build dependencies: - - 1. FIXME DEPENDENCIES LIST THEM HERE - -- Runtime dependencies: - - 2. FIXME DEPENDENCIES LIST THEM HERE - - ---------------------------------------------------------------------- -INSTALLATION PATHS: WHERE THE STACK IS INSTALLED ON YOUR SYSTEM ---------------------------------------------------------------------- - - -The CloudStack build system installs files on a variety of paths, each -one of which is selectable when building from source. - -- $PREFIX: - the default prefix where the entire stack is installed - defaults to /usr/local on source builds - defaults to /usr on package builds - -- $SYSCONFDIR/cloud: - - the prefix for CloudStack configuration files - defaults to $PREFIX/etc/cloud on source builds - defaults to /etc/cloud on package builds - -- $SYSCONFDIR/init.d: - the prefix for CloudStack initscripts - defaults to $PREFIX/etc/init.d on source builds - defaults to /etc/init.d on package builds - -- $BINDIR: - the CloudStack installs programs there - defaults to $PREFIX/bin on source builds - defaults to /usr/bin on package builds - -- $LIBEXECDIR: - the CloudStack installs service runners there - defaults to $PREFIX/libexec on source builds - defaults to /usr/libexec on package builds (/usr/bin on Ubuntu) - - ---------------------------------------------------------------------- -UNINSTALLING THE CLOUDSTACK FROM YOUR SYSTEM ---------------------------------------------------------------------- - - -- If you installed the CloudStack using packages, use your operating - system package manager to remove the CloudStack packages. - - a) Fedora / CentOS: the installable RPMs are in artifacts/rpmbuild - as root: rpm -qa | grep ^cloud- | xargs rpm -e - - b) Ubuntu: the installable DEBs are in artifacts/debbuild - aptitude purge '~ncloud' - -- If you installed from a source tree: - - ./waf uninstall - diff --git a/README b/README index b0478ff475f..5b0f0768dfe 100644 --- a/README +++ b/README @@ -8,19 +8,202 @@ cloud. --------------------------------------------------------------------- -HOW TO INSTALL THE CLOUDSTACK +TABLE OF CONTENTS --------------------------------------------------------------------- -Please refer to the document INSTALL distributed with the source. +1. Really quick start: building and installing a production stack +2. Post-install: setting the CloudStack components up +3. Installation paths: where the stack is installed on your system +4. Uninstalling the CloudStack from your system +5. Be part of the Cloud.com community! --------------------------------------------------------------------- -HOW TO HACK ON THE CLOUDSTACK +REALLY QUICK START: BUILDING AND INSTALLING A PRODUCTION STACK --------------------------------------------------------------------- -Please refer to the document HACKING distributed with the source. +You have two options. Choose one: + +a) Building distribution packages from the source and installing them +b) Building from the source and installing directly from there + + +=== I want to build and install distribution packages === + +This is the recommended way to run your CloudStack cloud. The +advantages are that dependencies are taken care of automatically +for you, and you can verify the integrity of the installed files +using your system's package manager. + +1. As root, install the build dependencies. + + a) Fedora / CentOS: ./waf installrpmdeps + + b) Ubuntu: ./waf installdebdeps + +2. As a non-root user, build the CloudStack packages. + + a) Fedora / CentOS: ./waf rpm + + b) Ubuntu: ./waf deb + +3. As root, install the CloudStack packages. + You can choose which components to install on your system. + + a) Fedora / CentOS: the installable RPMs are in artifacts/rpmbuild + + b) Ubuntu: the installable DEBs are in artifacts/debbuild + +4. Configure and start the components you intend to run. + See "Setting the CloudStack components up" to find out how to + configure each component, and "Installation paths" for information + on where programs, initscripts and config files are installed. + + +=== I want to build and install directly from the source === + +This is the recommended way to run your CloudStack cloud if you +intend to modify the source, if you intend to port the CloudStack to +another distribution, or if you intend to run the CloudStack on a +distribution for which packages are not built. + +1. As root, install the build dependencies. + See below for a list. + +2. As non-root, configure the build. + See below to discover configuration options. + + ./waf configure + +3. As non-root, build the CloudStack. + To learn more, see "Quick guide to developing, building and + installing from source" below. + + ./waf build + +4. As root, install the runtime dependencies. + See below for a list. + +5. As root, Install the CloudStack + + ./waf install + +6. Configure and start the components you intend to run. + See "Setting the CloudStack components up" to find out how to + configure each component, and "Installation paths" for information + on where programs, initscripts and config files are installed. + + +=== Dependencies of the CloudStack === + +- Build dependencies: + + 1. FIXME DEPENDENCIES LIST THEM HERE + +- Runtime dependencies: + + 2. FIXME DEPENDENCIES LIST THEM HERE + + +--------------------------------------------------------------------- +POST-INSTALL: SETTING THE CLOUDSTACK COMPONENTS UP +--------------------------------------------------------------------- + + +The CloudStack installs several components on your system. + +Each component usually installs an initscript on your system, along +with one configuration command that will set your system up to run +said component properly. You must set each component up before +you can run it. The Installation Manual will guide you through the +process of setting each component up, and the section "Installation +paths" will explain where to find the installed files and what each +$VARIABLE means. + + +=== cloud-management: the Management Server === + +This Tomcat-based service runs your cloud and lets you manage it. +Its initscript is called cloud-management, and its setup command is +called cloud-setup-databases. + + +=== cloud-usage: the Usage Monitor === + +This Java-based service accounts usage metrics for your cloud. +Its initscript is called cloud-usage, and it takes its configuration +from the Management Server, so to set the Usage Monitor up, set the +management server up. + + +=== cloud-agent: the Cloud Agent === + +This Java-based service runs virtual machines based on orders from +the Management Service, connecting to it at startup. Its initscript +is called cloud-agent, and its setup command is called cloud-setup-agent. + + +=== cloud-console-proxy: the Cloud Console Proxy === + +This Java-based service provides access to virtual machine consoles +based on orders from the Management Service, connecting to it at +startup. Its initscript is called cloud-console-proxy, and its setup +command is called cloud-setup-console-proxy. + + +=== cloud-vnet: the Cloud Virtual Networking Arbiter === + +This C-based service provides network virtualization and isolation for +virtual machines based on security settings established by the cloud +operator. Its initscript is called cloud-vnet; it requires no setup. + + +--------------------------------------------------------------------- +INSTALLATION PATHS: WHERE THE STACK IS INSTALLED ON YOUR SYSTEM +--------------------------------------------------------------------- + + +The CloudStack build system installs files on a variety of paths, each +one of which is selectable when building from source. + +- $PREFIX: + the default prefix where the entire stack is installed + defaults to /usr/local on source builds + defaults to /usr on package builds + +- $SYSCONFDIR/cloud: + + the prefix for CloudStack configuration files + defaults to $PREFIX/etc/cloud on source builds + defaults to /etc/cloud on package builds + +- $SYSCONFDIR/init.d: + the prefix for CloudStack initscripts + defaults to $PREFIX/etc/init.d on source builds + defaults to /etc/init.d on package builds + +- $BINDIR: + the CloudStack installs programs there + defaults to $PREFIX/bin on source builds + defaults to /usr/bin on package builds + +- $LIBEXECDIR: + the CloudStack installs service runners there + defaults to $PREFIX/libexec on source builds + defaults to /usr/libexec on package builds (/usr/bin on Ubuntu) + + +--------------------------------------------------------------------- +UNINSTALLING THE CLOUDSTACK FROM YOUR SYSTEM +--------------------------------------------------------------------- + + +If you installed the CloudStack using packages, use your operating +system package manager to remove the CloudStack packages. + +If you installed from the source: ./waf uninstall --------------------------------------------------------------------- diff --git a/README.html b/README.html deleted file mode 100644 index 2ece7a070e7..00000000000 --- a/README.html +++ /dev/null @@ -1,10555 +0,0 @@ - - - - - - - - - - - - - Cloud.com CloudStack - Documentation - - - - - - - - - - - -
-
-
-
-
-
-
-
-
-
-
-
<!--{{{-->
-<link rel='alternate' type='application/rss+xml' title='RSS' href='index.xml' />
-<!--}}}-->
-
-
-
-
Background: #fff
-Foreground: #000
-PrimaryPale: #8cf
-PrimaryLight: #18f
-PrimaryMid: #04b
-PrimaryDark: #014
-SecondaryPale: #ffc
-SecondaryLight: #fe8
-SecondaryMid: #db4
-SecondaryDark: #841
-TertiaryPale: #eee
-TertiaryLight: #ccc
-TertiaryMid: #999
-TertiaryDark: #666
-Error: #f88
-
-
-
-
/*{{{*/
-body {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
-
-a {color:[[ColorPalette::PrimaryMid]];}
-a:hover {background-color:[[ColorPalette::PrimaryMid]]; color:[[ColorPalette::Background]];}
-a img {border:0;}
-
-h1,h2,h3,h4,h5,h6 {color:[[ColorPalette::SecondaryDark]]; background:transparent;}
-h1 {border-bottom:2px solid [[ColorPalette::TertiaryLight]];}
-h2,h3 {border-bottom:1px solid [[ColorPalette::TertiaryLight]];}
-
-.button {color:[[ColorPalette::PrimaryDark]]; border:1px solid [[ColorPalette::Background]];}
-.button:hover {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::SecondaryLight]]; border-color:[[ColorPalette::SecondaryMid]];}
-.button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::SecondaryDark]];}
-
-.header {background:[[ColorPalette::PrimaryMid]];}
-.headerShadow {color:[[ColorPalette::Foreground]];}
-.headerShadow a {font-weight:normal; color:[[ColorPalette::Foreground]];}
-.headerForeground {color:[[ColorPalette::Background]];}
-.headerForeground a {font-weight:normal; color:[[ColorPalette::PrimaryPale]];}
-
-.tabSelected{color:[[ColorPalette::PrimaryDark]];
-	background:[[ColorPalette::TertiaryPale]];
-	border-left:1px solid [[ColorPalette::TertiaryLight]];
-	border-top:1px solid [[ColorPalette::TertiaryLight]];
-	border-right:1px solid [[ColorPalette::TertiaryLight]];
-}
-.tabUnselected {color:[[ColorPalette::Background]]; background:[[ColorPalette::TertiaryMid]];}
-.tabContents {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::TertiaryPale]]; border:1px solid [[ColorPalette::TertiaryLight]];}
-.tabContents .button {border:0;}
-
-#sidebar {}
-#sidebarOptions input {border:1px solid [[ColorPalette::PrimaryMid]];}
-#sidebarOptions .sliderPanel {background:[[ColorPalette::PrimaryPale]];}
-#sidebarOptions .sliderPanel a {border:none;color:[[ColorPalette::PrimaryMid]];}
-#sidebarOptions .sliderPanel a:hover {color:[[ColorPalette::Background]]; background:[[ColorPalette::PrimaryMid]];}
-#sidebarOptions .sliderPanel a:active {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::Background]];}
-
-.wizard {background:[[ColorPalette::PrimaryPale]]; border:1px solid [[ColorPalette::PrimaryMid]];}
-.wizard h1 {color:[[ColorPalette::PrimaryDark]]; border:none;}
-.wizard h2 {color:[[ColorPalette::Foreground]]; border:none;}
-.wizardStep {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];
-	border:1px solid [[ColorPalette::PrimaryMid]];}
-.wizardStep.wizardStepDone {background:[[ColorPalette::TertiaryLight]];}
-.wizardFooter {background:[[ColorPalette::PrimaryPale]];}
-.wizardFooter .status {background:[[ColorPalette::PrimaryDark]]; color:[[ColorPalette::Background]];}
-.wizard .button {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryLight]]; border: 1px solid;
-	border-color:[[ColorPalette::SecondaryPale]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryPale]];}
-.wizard .button:hover {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Background]];}
-.wizard .button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::Foreground]]; border: 1px solid;
-	border-color:[[ColorPalette::PrimaryDark]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryDark]];}
-
-.wizard .notChanged {background:transparent;}
-.wizard .changedLocally {background:#80ff80;}
-.wizard .changedServer {background:#8080ff;}
-.wizard .changedBoth {background:#ff8080;}
-.wizard .notFound {background:#ffff80;}
-.wizard .putToServer {background:#ff80ff;}
-.wizard .gotFromServer {background:#80ffff;}
-
-#messageArea {border:1px solid [[ColorPalette::SecondaryMid]]; background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]];}
-#messageArea .button {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::SecondaryPale]]; border:none;}
-
-.popupTiddler {background:[[ColorPalette::TertiaryPale]]; border:2px solid [[ColorPalette::TertiaryMid]];}
-
-.popup {background:[[ColorPalette::TertiaryPale]]; color:[[ColorPalette::TertiaryDark]]; border-left:1px solid [[ColorPalette::TertiaryMid]]; border-top:1px solid [[ColorPalette::TertiaryMid]]; border-right:2px solid [[ColorPalette::TertiaryDark]]; border-bottom:2px solid [[ColorPalette::TertiaryDark]];}
-.popup hr {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::PrimaryDark]]; border-bottom:1px;}
-.popup li.disabled {color:[[ColorPalette::TertiaryMid]];}
-.popup li a, .popup li a:visited {color:[[ColorPalette::Foreground]]; border: none;}
-.popup li a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border: none;}
-.popup li a:active {background:[[ColorPalette::SecondaryPale]]; color:[[ColorPalette::Foreground]]; border: none;}
-.popupHighlight {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
-.listBreak div {border-bottom:1px solid [[ColorPalette::TertiaryDark]];}
-
-.tiddler .defaultCommand {font-weight:bold;}
-
-.shadow .title {color:[[ColorPalette::TertiaryDark]];}
-
-.title {color:[[ColorPalette::SecondaryDark]];}
-.subtitle {color:[[ColorPalette::TertiaryDark]];}
-
-.toolbar {color:[[ColorPalette::PrimaryMid]];}
-.toolbar a {color:[[ColorPalette::TertiaryLight]];}
-.selected .toolbar a {color:[[ColorPalette::TertiaryMid]];}
-.selected .toolbar a:hover {color:[[ColorPalette::Foreground]];}
-
-.tagging, .tagged {border:1px solid [[ColorPalette::TertiaryPale]]; background-color:[[ColorPalette::TertiaryPale]];}
-.selected .tagging, .selected .tagged {background-color:[[ColorPalette::TertiaryLight]]; border:1px solid [[ColorPalette::TertiaryMid]];}
-.tagging .listTitle, .tagged .listTitle {color:[[ColorPalette::PrimaryDark]];}
-.tagging .button, .tagged .button {border:none;}
-
-.footer {color:[[ColorPalette::TertiaryLight]];}
-.selected .footer {color:[[ColorPalette::TertiaryMid]];}
-
-.sparkline {background:[[ColorPalette::PrimaryPale]]; border:0;}
-.sparktick {background:[[ColorPalette::PrimaryDark]];}
-
-.error, .errorButton {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Error]];}
-.warning {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryPale]];}
-.lowlight {background:[[ColorPalette::TertiaryLight]];}
-
-.zoomer {background:none; color:[[ColorPalette::TertiaryMid]]; border:3px solid [[ColorPalette::TertiaryMid]];}
-
-.imageLink, #displayArea .imageLink {background:transparent;}
-
-.annotation {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border:2px solid [[ColorPalette::SecondaryMid]];}
-
-.viewer .listTitle {list-style-type:none; margin-left:-2em;}
-.viewer .button {border:1px solid [[ColorPalette::SecondaryMid]];}
-.viewer blockquote {border-left:3px solid [[ColorPalette::TertiaryDark]];}
-
-.viewer table, table.twtable {border:2px solid [[ColorPalette::TertiaryDark]];}
-.viewer th, .viewer thead td, .twtable th, .twtable thead td {background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::Background]];}
-.viewer td, .viewer tr, .twtable td, .twtable tr {border:1px solid [[ColorPalette::TertiaryDark]];}
-
-.viewer pre {border:1px solid [[ColorPalette::SecondaryLight]]; background:[[ColorPalette::SecondaryPale]];}
-.viewer code {color:[[ColorPalette::SecondaryDark]];}
-.viewer hr {border:0; border-top:dashed 1px [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::TertiaryDark]];}
-
-.highlight, .marked {background:[[ColorPalette::SecondaryLight]];}
-
-.editor input {border:1px solid [[ColorPalette::PrimaryMid]];}
-.editor textarea {border:1px solid [[ColorPalette::PrimaryMid]]; width:100%;}
-.editorFooter {color:[[ColorPalette::TertiaryMid]];}
-.readOnly {background:[[ColorPalette::TertiaryPale]];}
-
-#backstageArea {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::TertiaryMid]];}
-#backstageArea a {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
-#backstageArea a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; }
-#backstageArea a.backstageSelTab {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
-#backstageButton a {background:none; color:[[ColorPalette::Background]]; border:none;}
-#backstageButton a:hover {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
-#backstagePanel {background:[[ColorPalette::Background]]; border-color: [[ColorPalette::Background]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]];}
-.backstagePanelFooter .button {border:none; color:[[ColorPalette::Background]];}
-.backstagePanelFooter .button:hover {color:[[ColorPalette::Foreground]];}
-#backstageCloak {background:[[ColorPalette::Foreground]]; opacity:0.6; filter:'alpha(opacity=60)';}
-/*}}}*/
-
-
-
/*{{{*/
-* html .tiddler {height:1%;}
-
-body {font-size:.75em; font-family:arial,helvetica; margin:0; padding:0;}
-
-h1,h2,h3,h4,h5,h6 {font-weight:bold; text-decoration:none;}
-h1,h2,h3 {padding-bottom:1px; margin-top:1.2em;margin-bottom:0.3em;}
-h4,h5,h6 {margin-top:1em;}
-h1 {font-size:1.35em;}
-h2 {font-size:1.25em;}
-h3 {font-size:1.1em;}
-h4 {font-size:1em;}
-h5 {font-size:.9em;}
-
-hr {height:1px;}
-
-a {text-decoration:none;}
-
-dt {font-weight:bold;}
-
-ol {list-style-type:decimal;}
-ol ol {list-style-type:lower-alpha;}
-ol ol ol {list-style-type:lower-roman;}
-ol ol ol ol {list-style-type:decimal;}
-ol ol ol ol ol {list-style-type:lower-alpha;}
-ol ol ol ol ol ol {list-style-type:lower-roman;}
-ol ol ol ol ol ol ol {list-style-type:decimal;}
-
-.txtOptionInput {width:11em;}
-
-#contentWrapper .chkOptionInput {border:0;}
-
-.externalLink {text-decoration:underline;}
-
-.indent {margin-left:3em;}
-.outdent {margin-left:3em; text-indent:-3em;}
-code.escaped {white-space:nowrap;}
-
-.tiddlyLinkExisting {font-weight:bold;}
-.tiddlyLinkNonExisting {font-style:italic;}
-
-/* the 'a' is required for IE, otherwise it renders the whole tiddler in bold */
-a.tiddlyLinkNonExisting.shadow {font-weight:bold;}
-
-#mainMenu .tiddlyLinkExisting,
-	#mainMenu .tiddlyLinkNonExisting,
-	#sidebarTabs .tiddlyLinkNonExisting {font-weight:normal; font-style:normal;}
-#sidebarTabs .tiddlyLinkExisting {font-weight:bold; font-style:normal;}
-
-.header {position:relative;}
-.header a:hover {background:transparent;}
-.headerShadow {position:relative; padding:4.5em 0 1em 1em; left:-1px; top:-1px;}
-.headerForeground {position:absolute; padding:4.5em 0 1em 1em; left:0px; top:0px;}
-
-.siteTitle {font-size:3em;}
-.siteSubtitle {font-size:1.2em;}
-
-#mainMenu {position:absolute; left:0; width:10em; text-align:right; line-height:1.6em; padding:1.5em 0.5em 0.5em 0.5em; font-size:1.1em;}
-
-#sidebar {position:absolute; right:3px; width:16em; font-size:.9em;}
-#sidebarOptions {padding-top:0.3em;}
-#sidebarOptions a {margin:0 0.2em; padding:0.2em 0.3em; display:block;}
-#sidebarOptions input {margin:0.4em 0.5em;}
-#sidebarOptions .sliderPanel {margin-left:1em; padding:0.5em; font-size:.85em;}
-#sidebarOptions .sliderPanel a {font-weight:bold; display:inline; padding:0;}
-#sidebarOptions .sliderPanel input {margin:0 0 0.3em 0;}
-#sidebarTabs .tabContents {width:15em; overflow:hidden;}
-
-.wizard {padding:0.1em 1em 0 2em;}
-.wizard h1 {font-size:2em; font-weight:bold; background:none; padding:0; margin:0.4em 0 0.2em;}
-.wizard h2 {font-size:1.2em; font-weight:bold; background:none; padding:0; margin:0.4em 0 0.2em;}
-.wizardStep {padding:1em 1em 1em 1em;}
-.wizard .button {margin:0.5em 0 0; font-size:1.2em;}
-.wizardFooter {padding:0.8em 0.4em 0.8em 0;}
-.wizardFooter .status {padding:0 0.4em; margin-left:1em;}
-.wizard .button {padding:0.1em 0.2em;}
-
-#messageArea {position:fixed; top:2em; right:0; margin:0.5em; padding:0.5em; z-index:2000; _position:absolute;}
-.messageToolbar {display:block; text-align:right; padding:0.2em;}
-#messageArea a {text-decoration:underline;}
-
-.tiddlerPopupButton {padding:0.2em;}
-.popupTiddler {position: absolute; z-index:300; padding:1em; margin:0;}
-
-.popup {position:absolute; z-index:300; font-size:.9em; padding:0; list-style:none; margin:0;}
-.popup .popupMessage {padding:0.4em;}
-.popup hr {display:block; height:1px; width:auto; padding:0; margin:0.2em 0;}
-.popup li.disabled {padding:0.4em;}
-.popup li a {display:block; padding:0.4em; font-weight:normal; cursor:pointer;}
-.listBreak {font-size:1px; line-height:1px;}
-.listBreak div {margin:2px 0;}
-
-.tabset {padding:1em 0 0 0.5em;}
-.tab {margin:0 0 0 0.25em; padding:2px;}
-.tabContents {padding:0.5em;}
-.tabContents ul, .tabContents ol {margin:0; padding:0;}
-.txtMainTab .tabContents li {list-style:none;}
-.tabContents li.listLink { margin-left:.75em;}
-
-#contentWrapper {display:block;}
-#splashScreen {display:none;}
-
-#displayArea {margin:1em 17em 0 14em;}
-
-.toolbar {text-align:right; font-size:.9em;}
-
-.tiddler {padding:1em 1em 0;}
-
-.missing .viewer,.missing .title {font-style:italic;}
-
-.title {font-size:1.6em; font-weight:bold;}
-
-.missing .subtitle {display:none;}
-.subtitle {font-size:1.1em;}
-
-.tiddler .button {padding:0.2em 0.4em;}
-
-.tagging {margin:0.5em 0.5em 0.5em 0; float:left; display:none;}
-.isTag .tagging {display:block;}
-.tagged {margin:0.5em; float:right;}
-.tagging, .tagged {font-size:0.9em; padding:0.25em;}
-.tagging ul, .tagged ul {list-style:none; margin:0.25em; padding:0;}
-.tagClear {clear:both;}
-
-.footer {font-size:.9em;}
-.footer li {display:inline;}
-
-.annotation {padding:0.5em; margin:0.5em;}
-
-* html .viewer pre {width:99%; padding:0 0 1em 0;}
-.viewer {line-height:1.4em; padding-top:0.5em;}
-.viewer .button {margin:0 0.25em; padding:0 0.25em;}
-.viewer blockquote {line-height:1.5em; padding-left:0.8em;margin-left:2.5em;}
-.viewer ul, .viewer ol {margin-left:0.5em; padding-left:1.5em;}
-
-.viewer table, table.twtable {border-collapse:collapse; margin:0.8em 1.0em;}
-.viewer th, .viewer td, .viewer tr,.viewer caption,.twtable th, .twtable td, .twtable tr,.twtable caption {padding:3px;}
-table.listView {font-size:0.85em; margin:0.8em 1.0em;}
-table.listView th, table.listView td, table.listView tr {padding:0px 3px 0px 3px;}
-
-.viewer pre {padding:0.5em; margin-left:0.5em; font-size:1.2em; line-height:1.4em; overflow:auto;}
-.viewer code {font-size:1.2em; line-height:1.4em;}
-
-.editor {font-size:1.1em;}
-.editor input, .editor textarea {display:block; width:100%; font:inherit;}
-.editorFooter {padding:0.25em 0; font-size:.9em;}
-.editorFooter .button {padding-top:0px; padding-bottom:0px;}
-
-.fieldsetFix {border:0; padding:0; margin:1px 0px;}
-
-.sparkline {line-height:1em;}
-.sparktick {outline:0;}
-
-.zoomer {font-size:1.1em; position:absolute; overflow:hidden;}
-.zoomer div {padding:1em;}
-
-* html #backstage {width:99%;}
-* html #backstageArea {width:99%;}
-#backstageArea {display:none; position:relative; overflow: hidden; z-index:150; padding:0.3em 0.5em;}
-#backstageToolbar {position:relative;}
-#backstageArea a {font-weight:bold; margin-left:0.5em; padding:0.3em 0.5em;}
-#backstageButton {display:none; position:absolute; z-index:175; top:0; right:0;}
-#backstageButton a {padding:0.1em 0.4em; margin:0.1em;}
-#backstage {position:relative; width:100%; z-index:50;}
-#backstagePanel {display:none; z-index:100; position:absolute; width:90%; margin-left:3em; padding:1em;}
-.backstagePanelFooter {padding-top:0.2em; float:right;}
-.backstagePanelFooter a {padding:0.2em 0.4em;}
-#backstageCloak {display:none; z-index:20; position:absolute; width:100%; height:100px;}
-
-.whenBackstage {display:none;}
-.backstageVisible .whenBackstage {display:block;}
-/*}}}*/
-
-
-
-
/***
-StyleSheet for use when a translation requires any css style changes.
-This StyleSheet can be used directly by languages such as Chinese, Japanese and Korean which need larger font sizes.
-***/
-/*{{{*/
-body {font-size:0.8em;}
-#sidebarOptions {font-size:1.05em;}
-#sidebarOptions a {font-style:normal;}
-#sidebarOptions .sliderPanel {font-size:0.95em;}
-.subtitle {font-size:0.8em;}
-.viewer table.listView {font-size:0.95em;}
-/*}}}*/
-
-
-
/*{{{*/
-@media print {
-#mainMenu, #sidebar, #messageArea, .toolbar, #backstageButton, #backstageArea {display: none !important;}
-#displayArea {margin: 1em 1em 0em;}
-noscript {display:none;} /* Fixes a feature in Firefox 1.5.0.2 where print preview displays the noscript content */
-}
-/*}}}*/
-
-
-
<!--{{{-->
-<div class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
-<div class='headerShadow'>
-<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
-<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
-</div>
-<div class='headerForeground'>
-<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
-<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
-</div>
-</div>
-<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
-<div id='sidebar'>
-<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
-<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>
-</div>
-<div id='displayArea'>
-<div id='messageArea'></div>
-<div id='tiddlerDisplay'></div>
-</div>
-<!--}}}-->
-
-
-
<!--{{{-->
-<div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'></div>
-<div class='title' macro='view title'></div>
-<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date'></span>)</div>
-<div class='tagging' macro='tagging'></div>
-<div class='tagged' macro='tags'></div>
-<div class='viewer' macro='view text wikified'></div>
-<div class='tagClear'></div>
-<!--}}}-->
-
-
-
<!--{{{-->
-<div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'></div>
-<div class='title' macro='view title'></div>
-<div class='editor' macro='edit title'></div>
-<div macro='annotations'></div>
-<div class='editor' macro='edit text'></div>
-<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser excludeLists'></span></div>
-<!--}}}-->
-
-
-
To get started with this blank [[TiddlyWiki]], you'll need to modify the following tiddlers:
-* [[SiteTitle]] & [[SiteSubtitle]]: The title and subtitle of the site, as shown above (after saving, they will also appear in the browser title bar)
-* [[MainMenu]]: The menu (usually on the left)
-* [[DefaultTiddlers]]: Contains the names of the tiddlers that you want to appear when the TiddlyWiki is opened
-You'll also need to enter your username for signing your edits: <<option txtUserName>>
-
-
-
These [[InterfaceOptions]] for customising [[TiddlyWiki]] are saved in your browser
-
-Your username for signing your edits. Write it as a [[WikiWord]] (eg [[JoeBloggs]])
-
-<<option txtUserName>>
-<<option chkSaveBackups>> [[SaveBackups]]
-<<option chkAutoSave>> [[AutoSave]]
-<<option chkRegExpSearch>> [[RegExpSearch]]
-<<option chkCaseSensitiveSearch>> [[CaseSensitiveSearch]]
-<<option chkAnimate>> [[EnableAnimations]]
-
-----
-Also see [[AdvancedOptions]]
-
-
-
<<importTiddlers>>
-
-
- -
-
-
---------------------------------------------------------------------
-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>
-
- 
-
-
-
!Fedora / CentOS
-# [[Install the build dependencies|waf installrpmdeps]] with {{{./waf installrpmdeps}}} in the source directory.
-# As a non-root user, run the command {{{./waf rpm}}} in the source directory.
-Once this command is done, the packages will be built in the directory {{{artifacts/rpmbuild}}}.
-!Ubuntu
-# [[Install the build dependencies|waf installdebdeps]] with {{{./waf installdebdeps}}} in the source directory.
-# As a non-root user, run the command {{{./waf deb}}} in the source directory.
-Once this command is done, the packages will be built in the directory {{{artifacts/debbuild}}}.
-
-
-
!Obtain the source for the CloudStack
-If you aren't reading this from a local copy of the source code, see [[Obtaining the source]].
-!Prepare your development environment
-See [[Preparing your development environment]].
-!Configure the build on the builder machine
-As non-root, run the command {{{./waf configure}}}.  See [[waf configure]] to discover configuration options for that command.
-!Build the CloudStack on the builder machine
-As non-root, run the command {{{./waf build}}}.  See [[waf build]] for an explanation.
-!Install the CloudStack on the target systems
-On each machine where you intend to run a CloudStack component:
-# upload the entire source code tree after compilation, //ensuring that the source ends up in the same path as the machine in which you compiled it//,
-## {{{rsync}}} is [[usually very handy|Using rsync to quickly transport the source tree to another machine]] for this
-# in that newly uploaded directory of the target machine, run the command {{{./waf install}}} //as root//.
-Consult [[waf install]] for information on installation.
-
-
-
!Changing the [[configuration|waf configure]] process
-See file {{{wscript_configure}}}.
-!Changing the [[build|waf build]] and [[install|waf install]] processes
-!!Changing / adding / removing JAR targets
-You generally need to add a new {{{compile-xyz}}} target following the model of the existing ones, and add that target to the list of dependencies of the other pertinent targets.  See  [[How waf uses ant]] and the ant build project files within the {{{build/}}} folder.
-
-We have some old ant information that you might find useful: AntInformation.
-!!Other changes
-See file {{{wscript_build}}}.
-!Changing packaging
-!!Fedora / """CentOS""" packaging
-See {{{cloud.spec}}} in the source directory.
-!!Ubuntu packaging
-See the files in the {{{debian/}}} folder.
-
-
-
The Cloud.com CloudStack is an open source software product that enables the deployment, management, and configuration of multi-tier and multi-tenant infrastructure cloud services by enterprises and service providers.
-
-
-
Not done yet!
-
-
-
Not done yet!
-
-
-
[[Welcome]]
-
-
-
#[[Source layout guide]]
-
-
-
Not done yet!
-
-
-
Start here if you want to learn the essentials to extend, modify and enhance the CloudStack.  This assumes that you've already familiarized yourself with CloudStack concepts, installation and configuration using the [[Getting started|Welcome]] instructions.
-* [[Obtain the source|Obtaining the source]]
-* [[Prepare your environment|Preparing your development environment]]
-* [[Get acquainted with the development lifecycle|Your development lifecycle]]
-* [[Familiarize yourself with our development conventions|Development conventions]]
-Extra developer information:
-* [[What is this waf thing?|waf]]
-* [[How to change the build, install and packaging processes|Changing the build, install and packaging processes]]
-* [[How to integrate with Eclipse]]
-* [[Starting over]]
-* [[Making a source release|waf dist]]
-
-
-
-
!Importing the projects in the source
-#Open Eclipse
-#Select //Import projects//
-#Point it to the source directory and import all the projects within it
-!Management Server execution
-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.  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.
-!Agent or Console Proxy execution
-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|Setting sudo up for passwordless root]] 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.
-
-
-
-
-
By now, you have probably noticed that we do, indeed, ship ant build files in the CloudStack.  During the build process, waf calls ant directly to build the Java portions of our stack, and it uses the resulting JAR files to perform the installation.
-
-Any ant target added to the ant project files will automatically be detected -- if it is named {{{compile-xyz}}} waf will know it builds a JAR file and knows to use / install that JAR file.  In general, this means you only need to add the JAR file to the appropriate  packaging manifests ({{{cloud.spec}}} and {{{debian/{name-of-package}.install}}}).
-
-The reason we do this rather than use the native waf capabilities for building Java projects is simple: by using ant, we can leverage the support built-in for ant in [[Eclipse|How to integrate with Eclipse]] and many other """IDEs""".  Another reason to do this is because Java developers are familiar with ant, so adding a new JAR file or modifying what gets built into the existing JAR files is facilitated for Java developers.
-
-
-
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)
-
-
-
These instructions cover the installation of the entire CloudStack.  If you want to install only specific components, be sure to modify the example commands given here sensibly, so that only the desired packages get installed
-!Fedora / CentOS
-After building packages, they will be available in the directory {{{artifacts/rpmbuild}}}.  You can install them by executing {{{rpm -ivh artifacts/rpmbuild/RPMS/*/*.rpm}}} from the source directory, as root.
-!Ubuntu
-After building packages, they will be available in {{{artifacts/debbuild}}}.  A {{{sudo dpkg -i artifacts/debbuild/*.deb}}} should suffice to install them.
-
-
-
You have three options.  Choose one:
-# [[Installing the CloudStack from the official package repositories]].<br>This is the recommended (and quickest) way to run a stable release of your CloudStack cloud.  The advantages of using this method are that these packages has been tested by (awesome) Cloud.com engineers, you can easily [[update to new CloudStack releases|Updating the CloudStack software]] later on, dependencies are taken care of automatically for you, and you can verify the integrity of the installed files using your system's package manager.
-# [[Building distribution packages]] from the source, then [[installing them|Installing distribution packages built by you]].<br>This is the recommended way to run your CloudStack cloud from unstable sources.  The advantages of using this method 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.
-# [[Building from the source and installing directly from there]].<br>This option is suitable for you if you want to develop the CloudStack or you have an unsupported distribution.  It is also the recommended way to run your CloudStack cloud if you intend to customize or reconfigure 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 by us.
-
-
-
!Fedora
-!!Add the CloudStack repository to your operating system
-{{{
-cd /etc/yum.repos.d/
-wget http://download.cloud.com/foss/fedora/cloud.repo
-}}}
-!!Install the component you want
-* Management Server: {{{yum install cloud-client}}}
-* Agent: {{{yum install cloud-agent}}}
-* Console Proxy: {{{yum install cloud-console-proxy}}}
-!CentOS
-!!Add the CloudStack repository to your operating system
-{{{
-cd /etc/yum.repos.d/
-wget http://download.cloud.com/foss/centos/cloud.repo
-}}}
-!!Install the component you want
-* Management Server: {{{yum install cloud-client}}}
-* Agent: {{{yum install cloud-agent}}}
-* Console Proxy: {{{yum install cloud-console-proxy}}}
-!Ubuntu
-!!Add the CloudStack repository to your operating system
-Add the following line to {{{/etc/apt/sources.list}}}:
-{{{
-deb http://download.cloud.com/apt/ubuntu/stable/oss ./
-}}}
-!!Install the component you want
-* Management Server: {{{aptitude install cloud-client}}}
-* Agent: {{{aptitude install cloud-agent}}}
-* Console Proxy: {{{aptitude install cloud-console-proxy}}}
-
-
-
 * 
-
-
-
Copyright:
-
-    <Copyright (C) 2009-2010 Cloud.com.>
-
-License:
-
-    This program is dual-licensed.
-    
-    For the free software portions: you can redistribute it and/or modify   it under the terms of the GNU General Public License as published by     the Free Software Foundation, either version 3 of the License, or     (at your option) any later version.  These portions -- clearly marked     throughout the program sources -- are also distributed under the    Cloud.com Software License 1.1.
-    
-    For the proprietary portions: these portions are made available to you    on the terms of the Cloud.com Software License 1.1.
-
-    This package is distributed in the hope that it will be useful,    but WITHOUT ANY WARRANTY; without even the implied warranty of    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-    You should have received a copy of the GNU General Public License    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-
-
[[Welcome]]
-[[Using this wiki]]
-
-[[Getting started|Welcome]]
-[[Developer info|Hacking on the CloudStack]]
-
-[[Cloud.com|http://cloud.com/]]
-[[Our community|http://cloud.com/community]]
-[[Forums|http://cloud.com/community/forum]]
-[[Report a bug|http://bugs.cloud.com/enter_bug.cgi]]
-
-
-
If you are reading this file directly from a local copy of the source code in your machine, hmmm, well, you can skip this.
-
-Otherwise, there are two options to obtain the source code for the CloudStack:
-!Getting a stable release
-Download the latest tarball from the [[Cloud.com downloads section|http://cloud.com/community/downloads]].
-!Getting the latest, bleeding-edge code
-Use [[Git]] to clone the following URL:
-{{{
-git clone http://git.cloud.com/cloudstack-oss
-}}}
-This will create a folder called {{{cloudstack-oss}}} in your current folder.
-!Browsing the source code online
-You can browse the CloudStack source code through [[our CGit Web interface|http://git.cloud.com/cloudstack-oss]].
-
-
-
!Install the build dependencies on the machine where you will compile the CloudStack
-!!Fedora / CentOS
-The command [[waf installrpmdeps]] issued from the source tree gets it done.
-!!Ubuntu
-The command [[waf installdebdeps]] issues from the source tree gets it done.
-!!Other distributions
-See [[CloudStack build dependencies]]
-!Install the run-time dependencies on the machines where you will run the CloudStack
-See [[CloudStack run-time dependencies]].
-
-
-
Every time you run {{{./waf install}}} to deploy changed code, waf will install configuration files once again.  This can be a nuisance if you are developing the stack.
-
-There are, however, two ways to get around this.
-!Append {{{--preserve-config}}} to executions of {{{./waf install}}}
-{{{./waf install}}} has an option {{{--preserve-config}}}.  If you pass       this option when installing, configuration files are never        overwritten.
-This option is useful when you have modified source files and          you need to deploy them on a system that already has the          CloudStack installed and configured, but you do //not// want to          overwrite the existing configuration of the CloudStack.
-          
-If, however, you have reconfigured and rebuilt the source          since the last time you did ./waf install, then you are          advised to replace the configuration files and set the          components up again, because some configuration files          in the source use identifiers that may have changed during          the last {{{./waf configure}}}.  So, if this is your case, check      out the next technique.
-!Override configuration files in the source tree          
-Every configuration file can be overridden in the source          without touching the original.
-# Look for the specific config file {{{X}}} (or {{{X.in}}}) in the source, then
-# create an {{{override/}}} folder in the folder that contains {{{X}}}, then
-# place a file named {{{X}}} (or {{{X.in}}}) inside {{{override/}}}, then
-# put the desired contents inside {{{X}}} (or {{{X.in}}})
-Now, every time you run {{{./waf install}}}, the file that will be      installed is {{{path/to/override/X.in}}}, instead of {{{path/to/X.in}}}.
-
-This option is useful if you are developing the CloudStack          and constantly reinstalling it.  It guarantees that every          time you install the CloudStack, the installation will have           the correct configuration straight from your source tree and will be ready to run.
-
-
-
It is not technically possible to run the CloudStack components directly from the source tree.  That, however, is fine -- each component can be run independently from the install directory.  Here are instructions to do that, [[after you've set the desired component up|Setting the CloudStack components up]].
-!Management Server
-# Execute {{{./waf run}}} as your current user [[(more info)|waf run]].<br>Alternatively, you can use {{{./waf debug}}} and this will [[run with debugging enabled|waf debug]].
-!Agent (Linux-only):
-# Execute {{{./waf run_agent}}} [[(more info)|waf run_agent]]<br>This will implicitly  launch {{{sudo}}} and require your root password unless you have  set {{{sudo}}} up [[not to ask for it|Setting sudo up for passwordless root]] (advisable).
-!Console Proxy (Linux-only):
-# Execute {{{./waf run_console_proxy}}} [[(more info)|waf run_console_proxy]]<br>This will implicitly  launch {{{sudo}}} and require your root password unless you have  set {{{sudo}}} up [[not to ask for it|Setting sudo up for passwordless root]] (advisable).
-
-
-
When building a source distribution ([[waf dist]]), or distribution packages ([[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.  Packages and [[waf install]] will install this file into {{{$DOCDIR/sccs-info}}.
-
-If this source code control information cannot be calculated, then the old {{{sccs-info}}} file is preserved -- if it existed -- across [[dist|waf 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.
-
-
-
-
#Comment option {{{Defaults requiretty}}} in {{{/etc/sudoers}}}
-# Add a line {{{yourusername:    ALL=(ALL)      NOPASSWD: ALL}}} with your username instead of {{{yourusername}}}
-''Warning'': this can be ''insecure'' as it leaves your computer open to root access to whomever touches your console or logs in as your user.
-
-
-
Agent setup requires some system configuration changes, but is fully automated for your benefit.  To set up your Agent, just run {{{$BINDIR/cloud-setup-agent}}}.  It will ask you some questions about the zone and pod it will run on, and then set it up to start on boot.
-
-The configuration files for the Agent live in {{{agent/conf}}} and get deployed to {{{$SYSCONFDIR/cloud/agent}}}.
-
-
-
!Management Server
-Set up the management server database:
-# either run {{{./waf deploydb_kvm}}} for a [[quick development-type database setup|waf deploydb]], or
-# run {{{$BINDIR/cloud-setup-databases}}} to [[set up the Management Server database in production mode|Setting the Management Server up]]
-!Agent (Linux-only)
-[[Set the Agent up|Setting the Agent up]] with {{{$BINDIR/cloud-setup-agent}}}.
-!Console Proxy (Linux-only):
-[[Set the Console Proxy up|Setting the Console Proxy up]] with {{{$BINDIR/cloud-setup-console-proxy}}}.
-
-
-
Please consult the [[Installation Guide|http://cloud.com/community/cloudstack-21-community-edition-installation-guide]] to find out how to configure each component of the CloudStack.  Refer to the [[Installation paths]] document for information on where to find the programs, initscripts and configuration files mentioned in the Installation Guide (paths may vary).
-
-
-
-
Console Proxy setup is fully automated for your benefit.  To set up your Console Proxy, just run {{{$BINDIR/cloud-setup-console-proxy}}}.  It will ask you some questions about the zone and pod it will run on, and then set it up to start on boot.
-
-The configuration files for the Console Proxy live in {{{console-proxy/conf.dom0}}} and get deployed to {{{$SYSCONFDIR/cloud/console-proxy}}}.
-
-
-
Management Server setup is fully automated for your benefit.  To set up your Management Server, just run {{{$BINDIR/cloud-setup-databases}}} with the appropriate command-line options (you can invoke {{{cloud-setup-databases}}} without parameters to get documentation on its options).  This will deploy the database and adjust the Management Server configuration files to use that database.
-
-The configuration files for the Management Server live in {{{client/tomcatconf}}} and get deployed to {{{$SYSCONFDIR/cloud/client}}}.
-
-
-
Documentation
-
-
-
[[Cloud.com|http://cloud.com/]] """CloudStack"""
-
-
-
Here, you'll discover how the source is laid out, what happens to the sources, and where they get installed in target systems.  Refer to the [[Installation paths]] and [[Token substitution of configure-time variables]] documents to find out about the tokens and paths used below.
-* {{{deps/*jar}}}
-** installed in {{{@JAVADIR@/}}}
-* {{{thirdparty/*jar}}}
-** installed in {{{@PREMIUMJAVADIR@/}}}
-* {{{scripts/*}}}
-** @token identifiers are substituted
-** auto-installed in {{{@AGENTLIBDIR@/scripts}}}
-* {{{patches/<virttech>/*}}}
-** @token identifiers are substituted
-** tarred up in a file called {{{patch-<virttech>.tgz}}} (the name is only used in the artifacts directory)
-** tarball auto-installed as {{{@AGENTLIBDIR@/scripts/vm/hypervisor/<virttech>/patch.tgz}}}
-* {{{<project>/src/**/*java}}}
-** runs through [[ant|How waf uses ant]]
-** turns into {{{cloud-<project>.jar}}}
-** installed in{{{ @JAVADIR@/}}}
-* {{{<project>/bindir/*}}}
-** if the file ends in .in, @token identifiers are substituted
-** auto-installed in {{{@BINDIR@/}}}
-* {{{<project>/libexec/*}}}
-** if the file ends in .in, @token identifiers are substituted
-** auto-installed in {{{@LIBEXECDIR@/}}}
-* {{{<project>/tomcatconf/*}}}
-** if the file ends in .in, @token identifiers are substituted
-** auto-installed in {{{@MSCONF@/}}}
-* {{{<project>/db/*}}}
-** auto-installed in {{{@SETUPDATADIR@/}}}
-* {{{<project>/<distro>/SOMEDIRECTORY}}}
-** if the file ends in .in, token identifiers are substituted
-** auto-installed only in specific {{{<distro>}}}, in {{{@SOMEDIRECTORY@/}}} (that is, the uppercase directory name is taken to be an identifier and substituted dynamically for the path that it represents).
-* {{{plugins/<project>/src/**/*java}}}
-** runs through ant
-** turns into {{{cloud-<project>.jar}}}
-** installed in {{{@PLUGINJAVADIR@/}}}
-** will automatically appear in the management server classpath at runtime
-* {{{vendor/<vendor>/tomcatconf/*}}}
-** if the file ends in .in, @token identifiers from ./waf showconfig are substituted
-** auto-installed in {{{@MSCONF@/vendor/<vendor>}}}
-** gets listed first in the management server classpath, so any files there will override files in {{{@MSCONF@}}}
-With your help, by being disciplined -- e.g. thinking about where to add a file, avoiding special cases -- and your suggestions (new classes of files?  we can install them!), we can make this source standards guide grow, with the ultimate goal of making it easier to just add files and have them magically be installed in the right places.
-
-
-
You shouldn't have to.  But:
-# To clean build products: [[waf clean]].
-# To clean the entire artifacts directory and configure-time variables: [[waf distclean]].
-# To uninstall: refer to the source section of [[Uninstalling the CloudStack]].
-
-
-
The prerelease mechanism ({{{--prerelease=BRANCHNAME}}} argument to [[./waf deb|waf deb]] or [[./waf rpm|waf rpm]]) 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 distribution documentation:
-*   http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version
-*   http://fedoraproject.org/wiki/PackageNamingGuidelines#Pre-Release_packages
-!How the [[build number|waf build]] is treated when the prerelease mechanism is enabled
-The build number gets appended to the Release tag of the package.
-
-
-
In short:
-#Files with an extension of {{{.in}}} and files in the {{conf}}, {{tomcatconf}}, {{bindir}}, {{libexec}} and similar directories within the source have tokens {{{@SOMETOKEN@}}} automatically substituted for the corresponding [[configure variable|waf configure]].
-#Files in the {{{scripts/}}} folder have the token {{@VERSION@}} replaced by the version of the CloudStack upon installation.
-#There is a more detailed layout of how tokens are used in the document [[Source layout guide]].
-
-
-
!For installations done using distribution packages
-If you installed the CloudStack using distribution packages, use your operating system package manager to remove the CloudStack packages.  Examples follow:
-!!Fedora / CentOS
-{{{
-rpm -qa | grep ^cloud- | xargs rpm -e
-}}}
-will erase the CloudStack packages, but will not erase any modified configuration files, cache files or log files.  If you want to remove them:
-{{{
-rm -rf /var/log/cloud /etc/cloud /var/cache/cloud
-}}}
-!!Ubuntu
-{{{
-aptitude purge '~ncloud'
-}}}
-will remove all cloud packages and purge configuration files.
-{{{
-aptitude remove
-}}}
-will remove packages and leave configuration files.
-!For installations done from compiled source
-{{{
-./waf uninstall
-}}}
-issued from the source directory as root, will go through every single file that the install process installed, [[and remove it|waf uninstall]].
-
-
-
!If you installed the CloudStack using [[the official package repositories|Installing the CloudStack from the official package repositories]]
-!!Fedora
-{{{yum update}}}.
-!!CentOS
-{{{yum update}}}.
-!!Ubuntu
-{{{
-aptitude update
-aptitude safe-upgrade
-}}}
-!If you installed from the source, or packages built from the source
-#Download the latest CloudStack release
-#Follow the same procedure you used to install the CloudStack the first time
-
-
-
You can use {{{rsync}}} to very quickly deploy a tree of files into another machine.
-
-Let's assume that you have your source tree in {{{/home/joe/cloud-2.3.4}}}.  To take that tree to another machine:
-{{{
-rsync -avzx --delete /home/joe/cloud-2.3.4/ root@othermachine:/home/joe/cloud-2.3.4/
-}}}
-(assuming, of course, the existence of {{{/home/joe}}} in {{{othermachine}}})
-
-
-
This wiki is organized by bite-size topics called //tiddlers//, heavily linked between each other.  Normally, you can browse through each topic -- the topic opens up in a new section of this window -- or you can use the search mechanism at the top of the right sidebar.  The right sidebar also contains a list of all the tiddlers in this document.
-!Yes, you can edit it
-If you have a local copy of this file, you can edit it.  We encourage you to [[send us your edited file through our bug tracker|http://bugs.cloud.com/enter_bug.cgi]] so we can merge your enhancements!
-
-#Enter your username for signing your edits: <<option txtUserName>>.  This will be stored in a cookie on your browser.
-#Set your options to the right of this page.  I personally prefer to keep AutoSave enabled so I don't have to think about saving the file.  If you have not saved your changes to the wiki yet, this wiki will warn you to save when you close it.
-#Be warned that your browser may ask for authorization to save this file on disk.  It's a scary dialog box, but it's perfectly safe -- go ahead.
-#Learn the wiki [[formatting style|http://tiddlywiki.org/wiki/TiddlyWiki_Markup]].
-#Double-click on the text of a tiddler to modify it.  Hit //done// at the top of the tiddler once you're done.
-#Add your tiddlers:
-##To do so, create a link {{{[[Your article name|Hyperlink title]]}}}in an existing tiddler, save it, and then click the italicized link.
-##As a principle: //keep the tiddlers bite-sized and rely heavily on hyperlinking to make them useful to the readers!//  This practice also makes merging the file into the source code that much easier and reduces the opportunity for merge conflicts.
-##Don't repeat yourself!  If you foresee that a particular chunk of text will be reused in different contexts, put it in a //separate// tiddler and link to that tiddler from the appropriate places.
-##The All and More tabs in the right sidebar lets you find tiddler names to link to, and also orphan tiddlers (tiddlers that nobody links to) or missing tiddlers (nonexistent tiddlers that are linked somewhere).
-#Fundamental tiddlers in this wiki:
-##[[SiteTitle]] & [[SiteSubtitle]]: The title and subtitle of the site, as shown above (after saving, they will also appear in the browser title bar)
-##[[MainMenu]]: The menu (usually on the left)
-##[[DefaultTiddlers]]: Contains the names of the tiddlers that you want to appear when the TiddlyWiki is opened
-
-
-
-
waf supports an intelligent cache mechanism (disabled by default). waf can resurrect compiled code if the source files that produced it have not changed.  waf will use advanced checksums to prevent stale object files from being resurrected.
-
-To activate it, just set an environment variable {{{WAFCACHE}}} to point to a directory (that you must create) where waf will store the result of compiled files.
-
-
-
Hello, and thanks for your interest in the [[Cloud.com|http://cloud.com/]] CloudStack™!  The Cloud.com CloudStack™ is Open Source Software that allows organizations to build Infrastructure as a Service (Iaas) clouds.  Working with server, storage, and networking equipment of your choice, the CloudStack provides a turn-key software stack that dramatically simplifies the process of deploying and managing a cloud.
-!Get started with the CloudStack right now
-We've prepared comprehensive instructions to help you.
-# First, review the [[Installation Guide|http://cloud.com/community/cloudstack-21-community-edition-installation-guide]] sections titled //Overview// and //Prerequisites//.
-#Then, [[install the CloudStack components you want|Installing the CloudStack]] on your target machines.
-# After you're done installing, see [[Setting the CloudStack up]] to configure and run it.
-And, in the unlikely case you would want to uninstall the CloudStack, the document [[Uninstalling the CloudStack]] has you covered.
-!Be part of the [[Cloud.com community|http://cloud.com/community/]]!
-We are more than happy to have you ask us questions, hack our source code, and receive your contributions.
-* To get started developing with the CloudStack, please read [[Hacking on the CloudStack]] for more information.
-* If you are reading this from a copy of the source code in your machine, [[you can edit this document too|Using this wiki]], then share your changes with us.
-* Come to  [[our forums|http://cloud.com/community/forum]], [[sign up|http://cloud.com/community/user/register]] as a member, and post there.  We engineers lurk there to answer your questions.
-* If you find bugs, please [[register|http://bugs.cloud.com/createaccount.cgi]] on [[our bug tracker|http://bugs.cloud.com/]] and [[file a report|http://bugs.cloud.com/enter_bug.cgi]].
-* If you have patches or files to send us get in touch with us at [[info@cloud.com|mailto:info@cloud.com]] or file them as attachments in our bug tracker above.
-!Contact us!
-Cloud.com's contact information is:
->20400 Stevens Creek Blvd
->Suite 390
->Cupertino, CA 95014
->Tel: +1 (888) 384-0962
-!Legal information
-//Unless otherwise specified// by Cloud.com, Inc., or in the sources themselves, [[this software is OSI certified Open Source Software distributed under the GNU General Public License, version 3|License statement]].  OSI Certified is a certification mark of the Open Source Initiative.  The software powering this documentation is """BSD-licensed""" and obtained from [[TiddlyWiki.com|http://tiddlywiki.com/]].
-
-
-
This is the typical lifecycle that you would follow when hacking on a CloudStack component, assuming that your [[development environment has been set up|Preparing your development environment]]:
-# [[Configure|waf configure]] the source code<br>{{{./waf configure --prefix=/home/youruser/cloudstack}}}
-# [[Build|waf build]] and [[install|waf install]] the CloudStack
-## {{{./waf install}}}
-## [[How to perform these tasks from Eclipse|How to integrate with Eclipse]]
-# [[Set the CloudStack component up|Setting the CloudStack components up]]
-# [[Run the CloudStack component|Running a CloudStack component from source]]
-# Hack on the code
-# Build and install the CloudStack again, [[preserving your existing configuration|Preserving the CloudStack configuration across source reinstalls]]<br>{{{./waf install --preserve-config}}}
-#{{{GOTO 4}}}
-
-
-
See [[Setting sudo up for passwordless root]].
-
-
-
[[waf|http://code.google.com/p/waf/]] is a self-contained, advanced build system written by Thomas Nagy, in the spirit of SCons or the GNU autotools suite.
-* To run waf on Linux / Mac: {{{./waf [...commands...]}}}
-* To run waf on Windows:     {{{waf.bat [...commands...]}}}
-{{{./waf --help}}} should be your first discovery point to find out both the configure-time options and the different processes that you can run using waf.
-!Where to learn more about waf
-* The first and foremost reference material: [[the waf book|http://freehackers.org/~tnagy/wafbook/index.html]].
-* http://code.google.com/p/waf/wiki/CodeSnippets
-* http://code.google.com/p/waf/w/list
-* http://code.google.com/p/waf/wiki/FAQ
-!Why does the CloudStack use waf?
-The CloudStack uses waf to build itself.  waf is a relative newcomer to the build system world; it borrows concepts from SCons and other later-generation build systems:
-# waf is very flexible and rich; unlike other build systems, it covers  the entire life cycle, from compilation to installation to  uninstallation.  it also supports [[dist|waf dist]] (create source tarball),  distcheck (check that the source tarball compiles and installs),  autoconf-like checks for dependencies at compilation time,  and more.  With waf, there is no need to maintain fragile shell scripts to do these tasks -- all of these tasks are already built-in and configurable in a descriptive rather than imperative fashion.
-# waf is self-contained.  A single file, distributed with the project,  enables everything to be built, with only a dependency on Python or Jython,  both of which are freely available and shipped in all Linux computers.
-# waf also supports building projects written in multiple languages   (in the case of the CloudStack, we build from C, Java and Python).
-# Since waf is written in Python, the entire library of the Python  language is available to use in the build process.
-!What happens when waf runs?
-When you run waf, this happens behind the scenes:
-# When you run waf for the first time, it unpacks itself to a hidden  directory {{{.waf-1.X.Y.MD5SUM}}}, including the main program and all the Python libraries it provides and needs.
-# Immediately after unpacking itself, waf reads the {{{wscript}}} file  at the root of the source directory.  After parsing this file and loading the functions defined here, it reads {{{wscript_build}} and {{{wscript_configure}} (from which it builds a {{{build()}}} and a {{{configure()}}} function dynamically) 
-# After loading the build scripts as explained above, waf calls  the functions you specified in the command line as commands
-So, for example, {{{./waf configure build install}}} will:
-* call [[configure()|waf configure]] from {{{wscript_configure}}},
-* call [[build()|waf build]] loaded from the contents of {{{wscript_build}}},
-* call [[build()|waf build]] once more but with {{{Options.is_install = True}}}.
-As part of build(), waf invokes ant to build the Java portion of our stack.
-!If you have waf, why are there ant project files in my source tree?
-See [[How waf uses ant]].
-
-
-
{{{
-./waf build
-}}}
-!What does this do?
-This compiles every file that requires compilation or substitution.  The artifacts of this compilation end up, unless otherwise specified, in {{{artifacts/default}}}
-!When / why should I run this?
-You run this command once after you've [[configured the source|waf configure]], and to trigger compilation of any modifications you have made.  However, if you plan on installing your modifications, you can just run [[waf install]] directly -- install implicitly builds.
-!How does this work?
-This runs the contents of {{{wscript_build}}}, which takes care of discovering and describing what needs to be built, which build products / sources need to be installed, and where they should be installed.  In detail:
-# It compiles source code to object code, calling the C compiler, Python compiler, and [[invoking several ant targets|How waf uses ant]].
-# It [[substitutes configure-time variables|Token substitution of configure-time variables]] in the files that require token substitution.
-# It creates packages for those components that require packaging.
-# It creates the [[SCCS info]] file that you can use to track the provenance of an installation.
-!Viewing a progress bar when building
-Append the {{{--progress}}} option to {{{./waf build}}}.
-!Accelerating builds
-See [[WAFCACHE]].
-
-The commands [[waf deb]] and [[waf rpm]] take advantage of the waf cache.
-!Debugging the build process
-#Almost everything that gets built has a target name. [[waf list_targets]] will list the target names.
-#{{{./waf build -vvvvv}}} will give you //a lot of debugging information// on what waf is doing.
-!Specifying a build number
-Normally, the build number is auto-detected from the [[source code control system|SCCS info]].  You can override it by passing the parameter {{{--build-number}}} when building.  The build number is used internally in the JAR files to construct the {{{Implementation-Version}}} property of the metafile manifest included in the JAR file.
-
-The commands [[waf deb]] and [[waf rpm]] also support the {{{--build-number}}} build-time option.
-
-
-
{{{
-./waf clean
-}}}
-Makes an inventory of all build products in {{{artifacts/default}}}, and removes them.
-
-Contrast to [[waf distclean]].
-
-
-
{{{
-./waf configure --prefix=/directory/that/you/have/write/permission/to
-}}}
-!What does this do?
-This runs the file {{{wscript_configure}}}, which takes care of setting the  variables and options that waf will use for compilation and installation, including the installation directory|Installation paths {{{PREFIX}}} and many other installation paths.  Some of these variables refer to the [[paths where waf will install|Installation paths]] different types of files; some other variables refer to defaults or values that will get [[compiled / substituted in the object code|Token substitution of configure-time variables]].  Some of these settings are //auto-detected// based on the platform you're compiling the code on.
-!When / why should I run this?
-You run this command //once//, in preparation to building the stack, or every time you need to change a configure-time variable.  Once you find an acceptable set of configure-time variables, you should not need to run {{{configure}}} again.
-!What happens if I don't run it?
-For convenience reasons, if you forget to configure the source, waf will autoconfigure itself and select some sensible default configuration options.  By default, {{{PREFIX}}} is {{{/usr/local}}}, but you can set it e.g. to  {{{/home/youruser/cloudstack}}} if you plan to do a non-root install.  Be ware that you can later install the stack as a regular user, but most components need to //run// as root.
-!What variables / options exist for configure?
-In general: refer to the output of {{{./waf configure --help}}}.
-
-Specific, useful options:
-* {{{--no-dep-check}}}: will skip dependency checks for java packages needed to compile (saves 20 seconds when redoing the configure)
-* {{{--with-db-user}}}, {{{--with-db-pw}}}, {{{--with-db-host}}}: informs the build system of the """MySQL""" configuration needed to be able to run [[waf deploydb]]
-After configuration, the configure variables will be available inside the file {{{artifacts/c4che/build.default.py}}} and you will be able to list them with [[waf showconfig]].
-
-
-
{{{
-./waf deb
-}}}
-[[builds Debian packages|Building distribution packages]] of the CloudStack.
-
-This command supports [[the prerelease mechanism|The prerelease mechanism]] and [[custom build numbers|waf build]].  It also supports [[accelerated builds|WAFCACHE]], so if you've already compiled your source tree once with the waf cache enabled, creating packages will be orders of magnitude faster.
-
-
-
See [[waf run]].
-
-
-
{{{
-./waf deploydb_kvm
-}}}
-!What does this do?
-This command runs the function {{{deploydb}}} in {{{wscript}}}, with a paramenter {{{"kvm"}}}.  The function uses the MySQL client to recreate / deploy the database schema and default initialized data for the Cloud.com Management Server.  The credentials and database host this command will use are the ones specified at [[configure time|waf configure]] with the options {{{--with-db-user}}}, {{{--with-db-pw}} and {{{--with-db-host}}}.
-
-''Warning'': This function will //destroy// any existing Cloud.com databases on the target host.
-
-
-
{{{
-./waf dist
-}}}
-Creates a source distribution (bzip2-compressed tarball) of the CloudStack in the source directory.  [[SCCS info]] is automatically determined by {{{dist}}} and included in the tarball.
-
-
-
{{{
-./waf distclean
-}}}
-Completely nukes the {{{artifacts}}} directory, thereby eliminating all build products and [[waf configuration|waf configure]].
-
-Contrast to [[waf clean]].
-
-
-
{{{
-./waf install
-}}}
-!When / why should I run this?
-You run this command when you want to install the CloudStack to the directories specified in the [[configuration|waf configure]].
-
-''Warning'': each time you do {{{./waf install}}}, the configuration files  in the installation directory are ''overwritten''.  Consult the document [[Preserving the CloudStack configuration across source reinstalls]] for techniques to prevent this.
-
-If you are going to install for production, //you should run this  process as root//; that guarantees that the proper permissions and file ownerships are set on certain secure files.   If, conversely, you only want to install the    stack as your own user and in a directory that you have write   permission, it's fine to run {{{./waf install}}} as your own user.
-!What does this do?
-This runs the contents of {{{wscript_build}}}, with an option variable  {{{Options.is_install = True}}}.  When this variable is set, waf will, in addition to compiling whatever needs compilation, install the files described in {{{wscript_build}}}.
-!{{{--destdir}}}
-When installing, you may specify the {{{--destdir=/example/dir}}} option.  This will cause the installation of files to be performed relative to the {{{/example/dir}}} specified as argument to the option.  By way of example, if waf would install the file {{{/usr/bin/cloud-setup-databases}}}, the file would actually be installed in {{{/example/dir/usr/bin/cloud-setup-databases}}}; and so on for all installed files.
-
-This option is implicitly used in the packaging commands [[waf deb]] and [[waf rpm]].
-
-
-
-
-
{{{
-./waf installdebdeps
-}}}
-Parses the build dependency list for DEB packaging and uses aptitude (through [[sudo]]) to install them on your system.
-{{{
-./waf viewdebdeps
-}}}
-Shows a [[list of dependencies|waf viewdebdeps]].
-
-
-
{{{
-./waf installrpmdeps
-}}}
-Parses the build dependency list for RPM packaging and uses yum (through [[sudo]]) to install them on your system.
-{{{
-./waf viewrpmdeps
-}}}
-Shows a [[list of dependencies|waf viewrpmdeps]].
-
-
-
{{{
-./waf list_targets
-}}}
-prints out a list of all known build targets.
-
-You can then run
-{{{
-./waf build --targets=targetname
-}}}
-to build only that specific {{{targetname}}}.
-
-
-
{{{
-./waf rpm
-}}}
-[[builds Fedora or CentOS packages|Building distribution packages]] of the CloudStack.
-
-This command supports [[the prerelease mechanism|The prerelease mechanism]] and [[custom build numbers|waf build]].  It also supports [[accelerated builds|WAFCACHE]], so if you've already compiled your source tree once with the waf cache enabled, creating packages will be orders of magnitude faster.
-
-
-
{{{
-./waf run
-}}}
-!What does this do?
-This command starts the Management Server.
-
-More specifically, what it does is create an environment for the Apache Tomcat server, pre-configured during {{{./waf install}}}, and then start it in the foreground, to run the Management Server servlets and components.  When the Tomcat server starts, the management server is running and you can visit it by opening http://localhost:8080/
-
-Once it's running, you can log on as administrator with the user combination {{{admin}}} / {{{password}}}
-!Run with debugging enabled
-If you are developing the CloudStack, it is useful to be able to latch onto the Management Server process with your debugger.  To do that:
-{{{
-./waf debug
-}}}
-If you prefer the process to be stopped during startup and to have it continue only when your debugger has attached itself:
-{{{
-./waf debug --debug-suspend
-}}}
-
-
-
{{{
-./waf run_agent
-}}}
-Runs the Agent as root by using {{{sudo}}} to invoke it.
-
-
-
{{{
-./waf run_console_proxy
-}}}
-Runs the Console Proxy as root by using {{{sudo}}} to invoke it.
-
-
-
{{{
-./waf showconfig
-}}}
-Displays a summary of the values for each configure-time variable.
-
-
-
{{{
-./waf uninstall
-}}}
-Makes a listing of all the files and directories that would be installed, then removes them from the installation directory.
-
-This command supports the {{{--destdir}}} option as documented in [[waf install]].
-
-
-
See [[waf installdebdeps]].
-
-
-
See [[waf installrpmdeps]].
-
-
- - - - - - - - - - - - - diff --git a/agent/.classpath b/agent/.classpath index 662a6fa7415..f36c50ee1f6 100644 --- a/agent/.classpath +++ b/agent/.classpath @@ -1,16 +1,16 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/agent/libexec/agent-runner.in b/agent/libexec/agent-runner.in index 8983aeda738..fd2819b84f9 100755 --- a/agent/libexec/agent-runner.in +++ b/agent/libexec/agent-runner.in @@ -33,7 +33,7 @@ for x in private public ; do defaultroute=`ip route | grep ^default | cut -d ' ' -f 5` test -n "$defaultroute" echo "Using auto-discovered network device $defaultroute which is the default route" - SERVICEARGS="$SERVICEARGS $x.network.device="$defaultroute + SERVICEARGS="$SERVICEARGS -D$x.network.device="$defaultroute fi done @@ -52,7 +52,7 @@ function termagent() { trap termagent TERM while true ; do - java -Xms128M -Xmx384M -cp "$CLASSPATH" "$@" com.cloud.agent.AgentShell $SERVICEARGS & + java -Xms128M -Xmx384M -cp "$CLASSPATH" $SERVICEARGS "$@" com.cloud.agent.AgentShell & agentpid=$! echo "Agent started. PID: $!" >&2 wait $agentpid diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java b/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java index 915b9ee2c26..0421dcfbeb3 100644 --- a/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java +++ b/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java @@ -114,7 +114,6 @@ import com.cloud.agent.api.ReadyAnswer; import com.cloud.agent.api.ReadyCommand; import com.cloud.agent.api.RebootAnswer; import com.cloud.agent.api.RebootCommand; -import com.cloud.agent.api.RebootRouterCommand; import com.cloud.agent.api.StartAnswer; import com.cloud.agent.api.StartCommand; import com.cloud.agent.api.StartConsoleProxyAnswer; @@ -853,8 +852,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv } } - /*if (isDirectAttachedNetwork(router.getVlanId())) - default_network_rules_for_systemvm(vmName);*/ + if (isDirectAttachedNetwork(router.getVlanId())) + default_network_rules_for_systemvm(vmName); } catch (LibvirtException e) { if (nics != null) { cleanupVMNetworks(nics); @@ -1070,8 +1069,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv return execute((StopCommand)cmd); } else if (cmd instanceof GetVmStatsCommand) { return execute((GetVmStatsCommand)cmd); - } else if (cmd instanceof RebootRouterCommand) { - return execute((RebootRouterCommand)cmd); } else if (cmd instanceof RebootCommand) { return execute((RebootCommand)cmd); } else if (cmd instanceof GetHostStatsCommand) { @@ -1177,7 +1174,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv if (primaryPool == null) { String result = "Failed to get primary pool"; s_logger.debug(result); - return new CreateAnswer(cmd, result); + new CreateAnswer(cmd, result); } if (cmd.getTemplateUrl() != null) { @@ -1185,7 +1182,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv if (tmplVol == null) { String result = "Failed to get tmpl vol"; s_logger.debug(result); - return new CreateAnswer(cmd, result); + new CreateAnswer(cmd, result); } LibvirtStorageVolumeDef volDef = new LibvirtStorageVolumeDef(UUID.randomUUID().toString(), tmplVol.getInfo().capacity, volFormat.QCOW2, tmplVol.getPath(), volFormat.QCOW2); @@ -1272,14 +1269,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv s_logger.debug("Failed to backup snaptshot: " + result); 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) { return new BackupSnapshotAnswer(cmd, false, e.toString(), null); } catch (URISyntaxException e) { @@ -1289,45 +1278,10 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv } 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); } 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); } @@ -1521,7 +1475,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv if (secondaryPool == null) { return new Answer(cmd, false, " Failed to create storage pool"); } - tmplVol = getVolume(secondaryPool, getPathOfStoragePool(secondaryPool) + tmpltname); + tmplVol = secondaryPool.storageVolLookupByName(tmpltname); if (tmplVol == null) { return new Answer(cmd, false, " Can't find volume"); } @@ -1535,7 +1489,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv if (primaryVol == null) { return new Answer(cmd, false, " Can't create storage volume on storage pool"); } - StorageVolInfo priVolInfo = primaryVol.getInfo(); DownloadAnswer answer = new DownloadAnswer(null, 100, @@ -1567,8 +1520,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv } if (secondaryPool != null) { - secondaryPool.destroy(); - secondaryPool.undefine(); secondaryPool.free(); } } catch (LibvirtException l) { @@ -1857,6 +1808,12 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv } 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()); Integer vncPort = null; if (state == State.Running) { @@ -2067,16 +2024,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv } } } - - protected Answer execute(RebootRouterCommand cmd) { - RebootAnswer answer = (RebootAnswer) execute((RebootCommand) cmd); - String result = _virtRouterResource.connect(cmd.getPrivateIpAddress()); - if (result == null) { - return answer; - } else { - return new Answer(cmd, false, result); - } - } protected GetVmStatsAnswer execute(GetVmStatsCommand cmd) { List vmNames = cmd.getVmNames(); @@ -2112,8 +2059,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv _vms.put(vmName, State.Stopping); } try { - /*if (isDirectAttachedNetwork(cmd.getVnet())) - destroy_network_rules_for_vm(vmName);*/ + if (isDirectAttachedNetwork(cmd.getVnet())) + destroy_network_rules_for_vm(vmName); String result = stopVM(vmName, defineOps.UNDEFINE_VM); answer = new StopAnswer(cmd, null, port, bytesSent, bytesReceived); @@ -2286,8 +2233,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv } } - /*if (isDirectAttachedNetwork(cmd.getGuestNetworkId())) - default_network_rules(cmd.getVmName(), cmd.getGuestIpAddress());*/ + if (isDirectAttachedNetwork(cmd.getGuestNetworkId())) + default_network_rules(cmd.getVmName(), cmd.getGuestIpAddress()); return null; } catch(LibvirtException e) { @@ -3168,7 +3115,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv disks.add(hda); diskDef hdb = new diskDef(); - hdb.defFileBasedDisk(datadiskPath, "hdb", diskDef.diskBus.IDE, diskDef.diskFmtType.RAW); + hdb.defFileBasedDisk(datadiskPath, "vdb", diskDef.diskBus.IDE, diskDef.diskFmtType.QCOW2); disks.add(hdb); return disks; @@ -3216,12 +3163,12 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv disks.add(hdb); } - /*Add a placeholder for iso, even if there is no iso attached*/ - diskDef hdc = new diskDef(); - hdc.defFileBasedDisk(isoPath, "hdc", diskDef.diskBus.IDE, diskDef.diskFmtType.RAW); - hdc.setDeviceType(diskDef.deviceType.CDROM); - disks.add(hdc); - + if (isoPath != null) { + diskDef hdc = new diskDef(); + hdc.defFileBasedDisk(isoPath, "hdc", diskDef.diskBus.IDE, diskDef.diskFmtType.RAW); + hdc.setDeviceType(diskDef.deviceType.CDROM); + disks.add(hdc); + } return disks; } @@ -3545,7 +3492,4 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv } return vol; } - private String getPathOfStoragePool(StoragePool pool) throws LibvirtException { - return _mountPoint + File.separator + pool.getUUIDString() + File.separator; - } } diff --git a/build/build-cloud.xml b/build/build-cloud.xml index fde4bb491f6..515fdb34999 100755 --- a/build/build-cloud.xml +++ b/build/build-cloud.xml @@ -199,7 +199,8 @@ - + + @@ -220,7 +221,6 @@ - @@ -234,7 +234,6 @@ - diff --git a/build/package.xml b/build/package.xml index 2476eea3bbe..1551d044a15 100755 --- a/build/package.xml +++ b/build/package.xml @@ -132,11 +132,7 @@ - - - - diff --git a/client/tomcatconf/components.xml.in b/client/tomcatconf/components.xml.in index a10c9c2e9cd..293f580c184 100755 --- a/client/tomcatconf/components.xml.in +++ b/client/tomcatconf/components.xml.in @@ -129,9 +129,6 @@ - - - @@ -171,8 +168,6 @@ - - diff --git a/cloud.spec b/cloud.spec index d7643ec5485..f167ba65dd1 100644 --- a/cloud.spec +++ b/cloud.spec @@ -237,7 +237,6 @@ Requires: augeas >= 0.7.1 Requires: rsync Requires: /bin/egrep Requires: /sbin/ip -Requires: vconfig Group: System Environment/Libraries %description agent The Cloud.com agent is in charge of managing shared computing resources in @@ -451,18 +450,14 @@ fi %doc %{_docdir}/%{name}-%{version}/version-info %doc %{_docdir}/%{name}-%{version}/configure-info %doc README -%doc INSTALL %doc HACKING -%doc README.html %doc debian/copyright %files client-ui %defattr(0644,root,root,0755) %{_datadir}/%{name}/management/webapps/client/* %doc README -%doc INSTALL %doc HACKING -%doc README.html %doc debian/copyright %files server @@ -470,9 +465,7 @@ fi %{_javadir}/%{name}-server.jar %{_sysconfdir}/%{name}/server/* %doc README -%doc INSTALL %doc HACKING -%doc README.html %doc debian/copyright %if %{_premium} @@ -482,9 +475,7 @@ fi %{_libdir}/%{name}/agent/scripts/* %{_libdir}/%{name}/agent/vms/systemvm.zip %doc README -%doc INSTALL %doc HACKING -%doc README.html %doc debian/copyright %else @@ -494,23 +485,19 @@ fi %{_libdir}/%{name}/agent/scripts/installer/* %{_libdir}/%{name}/agent/scripts/network/domr/*.sh %{_libdir}/%{name}/agent/scripts/storage/*.sh -%{_libdir}/%{name}/agent/scripts/storage/zfs/* %{_libdir}/%{name}/agent/scripts/storage/qcow2/* %{_libdir}/%{name}/agent/scripts/storage/secondary/* %{_libdir}/%{name}/agent/scripts/util/* %{_libdir}/%{name}/agent/scripts/vm/*.sh %{_libdir}/%{name}/agent/scripts/vm/storage/nfs/* -%{_libdir}/%{name}/agent/scripts/vm/storage/iscsi/* %{_libdir}/%{name}/agent/scripts/vm/network/* %{_libdir}/%{name}/agent/scripts/vm/hypervisor/*.sh %{_libdir}/%{name}/agent/scripts/vm/hypervisor/kvm/* -%{_libdir}/%{name}/agent/scripts/vm/hypervisor/xen/* %{_libdir}/%{name}/agent/vms/systemvm.zip %{_libdir}/%{name}/agent/scripts/vm/hypervisor/xenserver/* +%{_libdir}/%{name}/agent/vms/systemvm-premium.zip %doc README -%doc INSTALL %doc HACKING -%doc README.html %doc debian/copyright %endif @@ -519,9 +506,7 @@ fi %defattr(-,root,root,-) %attr(755,root,root) %{_bindir}/%{name}-daemonize %doc README -%doc INSTALL %doc HACKING -%doc README.html %doc debian/copyright %files deps @@ -544,16 +529,13 @@ fi %{_javadir}/%{name}-xmlrpc-common-3.*.jar %{_javadir}/%{name}-xmlrpc-client-3.*.jar %doc README -%doc INSTALL %doc HACKING -%doc README.html %doc debian/copyright %files core %defattr(0644,root,root,0755) %{_javadir}/%{name}-core.jar %doc README -%doc INSTALL %doc HACKING %doc debian/copyright @@ -563,18 +545,14 @@ fi %attr(0755,root,root) %{_sbindir}/%{name}-vn %attr(0755,root,root) %{_initrddir}/%{name}-vnetd %doc README -%doc INSTALL %doc HACKING -%doc README.html %doc debian/copyright %files python %defattr(0644,root,root,0755) %{_prefix}/lib*/python*/site-packages/%{name}* %doc README -%doc INSTALL %doc HACKING -%doc README.html %doc debian/copyright %files setup @@ -594,9 +572,7 @@ fi %{_datadir}/%{name}/setup/postprocess-20to21.sql %{_datadir}/%{name}/setup/schema-20to21.sql %doc README -%doc INSTALL %doc HACKING -%doc README.html %doc debian/copyright %files client @@ -638,16 +614,13 @@ fi %dir %attr(770,root,%{name}) %{_localstatedir}/log/%{name}/management %dir %attr(770,root,%{name}) %{_localstatedir}/log/%{name}/agent %doc README -%doc INSTALL %doc HACKING -%doc README.html %doc debian/copyright %files agent-libs %defattr(0644,root,root,0755) %{_javadir}/%{name}-agent.jar %doc README -%doc INSTALL %doc HACKING %doc debian/copyright @@ -666,9 +639,7 @@ fi %attr(0755,root,root) %{_bindir}/%{name}-setup-agent %dir %attr(770,root,root) %{_localstatedir}/log/%{name}/agent %doc README -%doc INSTALL %doc HACKING -%doc README.html %doc debian/copyright %files console-proxy @@ -683,9 +654,7 @@ fi %attr(0755,root,root) %{_bindir}/%{name}-setup-console-proxy %dir %attr(770,root,root) %{_localstatedir}/log/%{name}/console-proxy %doc README -%doc INSTALL %doc HACKING -%doc README.html %doc debian/copyright %if %{_premium} @@ -698,18 +667,14 @@ fi %{_libdir}/%{name}/test/* %{_sysconfdir}/%{name}/test/* %doc README -%doc INSTALL %doc HACKING -%doc README.html %doc debian/copyright %files premium-deps %defattr(0644,root,root,0755) %{_javadir}/%{name}-premium/*.jar %doc README -%doc INSTALL %doc HACKING -%doc README.html %doc debian/copyright %files premium @@ -723,9 +688,7 @@ fi %{_datadir}/%{name}/setup/create-database-premium.sql %{_datadir}/%{name}/setup/create-schema-premium.sql %doc README -%doc INSTALL %doc HACKING -%doc README.html %doc debian/copyright %files usage @@ -738,9 +701,7 @@ fi %config(noreplace) %{_sysconfdir}/%{name}/usage/log4j-%{name}_usage.xml %config(noreplace) %attr(640,root,%{name}) %{_sysconfdir}/%{name}/usage/db.properties %doc README -%doc INSTALL %doc HACKING -%doc README.html %doc debian/copyright %endif diff --git a/console-proxy/libexec/console-proxy-runner.in b/console-proxy/libexec/console-proxy-runner.in index 4c01f7070d9..8ff9987b795 100755 --- a/console-proxy/libexec/console-proxy-runner.in +++ b/console-proxy/libexec/console-proxy-runner.in @@ -33,7 +33,7 @@ for x in private public ; do defaultroute=`ip route | grep ^default | cut -d ' ' -f 5` test -n "$defaultroute" echo "Using auto-discovered network device $defaultroute which is the default route" - SERVICEARGS="$SERVICEARGS $x.network.device="$defaultroute + SERVICEARGS="$SERVICEARGS -D$x.network.device="$defaultroute fi done @@ -52,7 +52,7 @@ function termagent() { trap termagent TERM while true ; do - java -Xms128M -Xmx384M -cp "$CLASSPATH" "$@" com.cloud.agent.AgentShell $SERVICEARGS & + java -Xms128M -Xmx384M -cp "$CLASSPATH" $SERVICEARGS "$@" com.cloud.agent.AgentShell & agentpid=$! echo "Console Proxy started. PID: $!" >&2 wait $agentpid diff --git a/core/.classpath b/core/.classpath index d5ea1df23fc..d6c04820681 100644 --- a/core/.classpath +++ b/core/.classpath @@ -1,43 +1,22 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/src/com/cloud/agent/api/BackupSnapshotCommand.java b/core/src/com/cloud/agent/api/BackupSnapshotCommand.java index ccf45d71115..edf68518eb2 100644 --- a/core/src/com/cloud/agent/api/BackupSnapshotCommand.java +++ b/core/src/com/cloud/agent/api/BackupSnapshotCommand.java @@ -30,7 +30,6 @@ public class BackupSnapshotCommand extends SnapshotCommand { private boolean isFirstSnapshotOfRootVolume; private boolean isVolumeInactive; private String firstBackupUuid; - private String vmName; protected BackupSnapshotCommand() { @@ -57,8 +56,7 @@ public class BackupSnapshotCommand extends SnapshotCommand { String prevBackupUuid, String firstBackupUuid, boolean isFirstSnapshotOfRootVolume, - boolean isVolumeInactive, - String vmName) + boolean isVolumeInactive) { super(primaryStoragePoolNameLabel, secondaryStoragePoolURL, snapshotUuid, snapshotName, dcId, accountId, volumeId); this.prevSnapshotUuid = prevSnapshotUuid; @@ -66,7 +64,6 @@ public class BackupSnapshotCommand extends SnapshotCommand { this.firstBackupUuid = firstBackupUuid; this.isFirstSnapshotOfRootVolume = isFirstSnapshotOfRootVolume; this.isVolumeInactive = isVolumeInactive; - this.vmName = vmName; } public String getPrevSnapshotUuid() { @@ -89,7 +86,4 @@ public class BackupSnapshotCommand extends SnapshotCommand { return isVolumeInactive; } - public String getVmName() { - return vmName; - } } \ No newline at end of file diff --git a/core/src/com/cloud/agent/api/storage/CreateCommand.java b/core/src/com/cloud/agent/api/storage/CreateCommand.java index 2c0ade671a9..b3ff5f6c312 100644 --- a/core/src/com/cloud/agent/api/storage/CreateCommand.java +++ b/core/src/com/cloud/agent/api/storage/CreateCommand.java @@ -29,7 +29,6 @@ public class CreateCommand extends Command { private StoragePoolTO pool; private DiskCharacteristicsTO diskCharacteristics; private String templateUrl; - private long size; protected CreateCommand() { super(); @@ -45,7 +44,7 @@ public class CreateCommand extends Command { * @param pool */ public CreateCommand(VolumeVO vol, VMInstanceVO vm, DiskCharacteristicsTO diskCharacteristics, String templateUrl, StoragePoolVO pool) { - this(vol, vm, diskCharacteristics, pool, 0); + this(vol, vm, diskCharacteristics, pool); this.templateUrl = templateUrl; } @@ -57,12 +56,11 @@ public class CreateCommand extends Command { * @param diskCharacteristics * @param pool */ - public CreateCommand(VolumeVO vol, VMInstanceVO vm, DiskCharacteristicsTO diskCharacteristics, StoragePoolVO pool, long size) { + public CreateCommand(VolumeVO vol, VMInstanceVO vm, DiskCharacteristicsTO diskCharacteristics, StoragePoolVO pool) { this.volId = vol.getId(); this.diskCharacteristics = diskCharacteristics; this.pool = new StoragePoolTO(pool); this.templateUrl = null; - this.size = size; } @Override @@ -85,8 +83,4 @@ public class CreateCommand extends Command { public long getVolumeId() { return volId; } - - public long getSize(){ - return this.size; - } } diff --git a/api/src/com/cloud/hypervisor/Hypervisor.java b/core/src/com/cloud/hypervisor/Hypervisor.java similarity index 100% rename from api/src/com/cloud/hypervisor/Hypervisor.java rename to core/src/com/cloud/hypervisor/Hypervisor.java diff --git a/core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java deleted file mode 100644 index 0df9c7df36c..00000000000 --- a/core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.cloud.hypervisor.vmware.resource; - -import java.util.Map; - -import javax.naming.ConfigurationException; - -import com.cloud.agent.IAgentControl; -import com.cloud.agent.api.Answer; -import com.cloud.agent.api.Command; -import com.cloud.agent.api.PingCommand; -import com.cloud.agent.api.StartupCommand; -import com.cloud.agent.api.storage.CopyVolumeAnswer; -import com.cloud.agent.api.storage.CopyVolumeCommand; -import com.cloud.agent.api.storage.CreateAnswer; -import com.cloud.agent.api.storage.CreateCommand; -import com.cloud.agent.api.storage.DestroyCommand; -import com.cloud.agent.api.storage.DownloadAnswer; -import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand; -import com.cloud.agent.api.storage.ShareAnswer; -import com.cloud.agent.api.storage.ShareCommand; -import com.cloud.host.Host.Type; -import com.cloud.resource.ServerResource; -import com.cloud.storage.resource.StoragePoolResource; - -public class VmwareResource implements StoragePoolResource, ServerResource { - - @Override - public DownloadAnswer execute(PrimaryStorageDownloadCommand cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Answer execute(DestroyCommand cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public ShareAnswer execute(ShareCommand cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public CopyVolumeAnswer execute(CopyVolumeCommand cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public CreateAnswer execute(CreateCommand cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public void disconnected() { - // TODO Auto-generated method stub - - } - - @Override - public Answer executeRequest(Command cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public IAgentControl getAgentControl() { - // TODO Auto-generated method stub - return null; - } - - @Override - public PingCommand getCurrentStatus(long id) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Type getType() { - // TODO Auto-generated method stub - return null; - } - - @Override - public StartupCommand[] initialize() { - // TODO Auto-generated method stub - return null; - } - - @Override - public void setAgentControl(IAgentControl agentControl) { - // TODO Auto-generated method stub - } - - @Override - public boolean configure(String name, Map 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; - } -} diff --git a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java index 1f5ca0f6827..06ad2291007 100644 --- a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java +++ b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java @@ -148,13 +148,13 @@ import com.cloud.exception.InternalErrorException; import com.cloud.host.Host.Type; import com.cloud.hypervisor.Hypervisor; import com.cloud.resource.ServerResource; -import com.cloud.storage.Storage.ImageFormat; -import com.cloud.storage.Storage.StoragePoolType; import com.cloud.storage.StorageLayer; import com.cloud.storage.StoragePoolVO; +import com.cloud.storage.VolumeVO; +import com.cloud.storage.Storage.ImageFormat; +import com.cloud.storage.Storage.StoragePoolType; import com.cloud.storage.Volume.StorageResourceType; import com.cloud.storage.Volume.VolumeType; -import com.cloud.storage.VolumeVO; import com.cloud.storage.resource.StoragePoolResource; import com.cloud.storage.template.TemplateInfo; import com.cloud.utils.NumbersUtil; @@ -171,7 +171,6 @@ import com.cloud.vm.State; import com.cloud.vm.VirtualMachineName; import com.trilead.ssh2.SCPClient; import com.xensource.xenapi.APIVersion; -import com.xensource.xenapi.Bond; import com.xensource.xenapi.Connection; import com.xensource.xenapi.Console; import com.xensource.xenapi.Host; @@ -184,10 +183,6 @@ import com.xensource.xenapi.Pool; import com.xensource.xenapi.SR; import com.xensource.xenapi.Session; 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.VDI; import com.xensource.xenapi.VIF; @@ -195,6 +190,9 @@ import com.xensource.xenapi.VLAN; import com.xensource.xenapi.VM; import com.xensource.xenapi.VMGuestMetrics; 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. @@ -2794,7 +2792,6 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR protected String startSystemVM(String vmName, String vlanId, Network nw0, List vols, String bootArgs, String guestMacAddr, String privateIp, String privateMacAddr, String publicMacAddr, int cmdPort, long ramSize) { - setupLinkLocalNetwork(); VM vm = null; List> mounts = null; Connection conn = getConnection(); @@ -3166,29 +3163,6 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR if (s_logger.isDebugEnabled()) { 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 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); } @@ -3546,6 +3520,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR } _host.privatePif = privateNic.pr.uuid; _host.privateNetwork = privateNic.nr.uuid; + _privateNetworkName = privateNic.nr.nameLabel; Nic guestNic = null; if (_guestNetworkName != null && !_guestNetworkName.equals(_privateNetworkName)) { @@ -3557,6 +3532,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR } else { guestNic = privateNic; } + _guestNetworkName = guestNic.nr.nameLabel; _host.guestNetwork = guestNic.nr.uuid; _host.guestPif = guestNic.pr.uuid; @@ -3572,6 +3548,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR } _host.publicPif = publicNic.pr.uuid; _host.publicNetwork = publicNic.nr.uuid; + _publicNetworkName = publicNic.nr.nameLabel; Nic storageNic1 = getLocalNetwork(conn, _storageNetworkName1); @@ -3679,35 +3656,6 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR } } - protected boolean transferManagementNetwork(Connection conn, Host host, PIF src, PIF.Record spr, PIF dest) throws XmlRpcException, XenAPIException { - dest.reconfigureIp(conn, spr.ipConfigurationMode, spr.IP, spr.netmask, spr.gateway, spr.DNS); - Host.managementReconfigure(conn, dest); - String hostUuid = null; - int count = 0; - while (count < 10) { - try { - Thread.sleep(10000); - hostUuid = host.getUuid(conn); - if (hostUuid != null) { - break; - } - } catch (XmlRpcException e) { - s_logger.debug("Waiting for host to come back: " + e.getMessage()); - } catch (XenAPIException e) { - s_logger.debug("Waiting for host to come back: " + e.getMessage()); - } catch (InterruptedException e) { - s_logger.debug("Gotta run"); - return false; - } - } - if (hostUuid == null) { - s_logger.warn("Unable to transfer the management network from " + spr.uuid); - return false; - } - - src.reconfigureIp(conn, IpConfigurationMode.NONE, null, null, null, null); - return true; - } @Override public StartupCommand[] initialize() throws IllegalArgumentException{ @@ -3720,6 +3668,8 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR return null; } + setupLinkLocalNetwork(); + destroyStoppedVm(); StartupRoutingCommand cmd = new StartupRoutingCommand(); fillHostInfo(cmd); @@ -4066,15 +4016,9 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR if (details == null) { details = new HashMap(); } - if (_privateNetworkName != null) { details.put("private.network.device", _privateNetworkName); - } - if (_publicNetworkName != null) { details.put("public.network.device", _publicNetworkName); - } - if (_guestNetworkName != null) { details.put("guest.network.device", _guestNetworkName); - } details.put("can_bridge_firewall", Boolean.toString(_canBridgeFirewall)); cmd.setHostDetails(details); cmd.setName(hr.nameLabel); @@ -4281,11 +4225,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR vdir.nameLabel = dskch.getName(); vdir.SR = poolSr; vdir.type = Types.VdiType.USER; - - if(cmd.getSize()!=0) - vdir.virtualSize = cmd.getSize(); - else - vdir.virtualSize = dskch.getSize(); + vdir.virtualSize = dskch.getSize(); vdi = VDI.create(conn, vdir); } diff --git a/core/src/com/cloud/network/ExteralIpAddressAllocator.java b/core/src/com/cloud/network/ExteralIpAddressAllocator.java index b9506b34885..c4b040da4dc 100644 --- a/core/src/com/cloud/network/ExteralIpAddressAllocator.java +++ b/core/src/com/cloud/network/ExteralIpAddressAllocator.java @@ -48,12 +48,12 @@ public class ExteralIpAddressAllocator implements IpAddrAllocator{ @Inject IPAddressDao _ipAddressDao = null; @Inject VlanDao _vlanDao; private boolean _isExternalIpAllocatorEnabled = false; - private String _externalIpAllocatorUrl = null; + private String _externalIpAllocatorUrl; @Override public IpAddr getPrivateIpAddress(String macAddr, long dcId, long podId) { - if (_externalIpAllocatorUrl == null || this._externalIpAllocatorUrl.equalsIgnoreCase("")) { + if (this._externalIpAllocatorUrl.equalsIgnoreCase("")) { return new IpAddr(); } String urlString = this._externalIpAllocatorUrl + "?command=getIpAddr&mac=" + macAddr + "&dc=" + dcId + "&pod=" + podId; @@ -102,12 +102,10 @@ public class ExteralIpAddressAllocator implements IpAddrAllocator{ @Override public boolean releasePrivateIpAddress(String ip, long dcId, long podId) { /*TODO: call API to release the ip address from external DHCP server*/ - if (_externalIpAllocatorUrl == null || this._externalIpAllocatorUrl.equalsIgnoreCase("")) { + String urlString = this._externalIpAllocatorUrl + "?command=releaseIpAddr&ip=" + ip + "&dc=" + dcId + "&pod=" + podId; + if (this._externalIpAllocatorUrl.equalsIgnoreCase("")) { return false; } - - String urlString = this._externalIpAllocatorUrl + "?command=releaseIpAddr&ip=" + ip + "&dc=" + dcId + "&pod=" + podId; - s_logger.debug("releaseIP:" + urlString); BufferedReader in = null; try { diff --git a/core/src/com/cloud/server/ManagementServer.java b/core/src/com/cloud/server/ManagementServer.java index a78e68ef140..150b99ae651 100644 --- a/core/src/com/cloud/server/ManagementServer.java +++ b/core/src/com/cloud/server/ManagementServer.java @@ -481,11 +481,10 @@ public interface ManagementServer { * @param name - name for the volume * @param zoneId - id of the zone to create this volume on * @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 */ - 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, long size) throws InvalidParameterValueException, InternalErrorException, ResourceAllocationException; + VolumeVO createVolume(long accountId, long userId, String name, long zoneId, long diskOfferingId, long startEventId) throws InternalErrorException; + long createVolumeAsync(long accountId, long userId, String name, long zoneId, long diskOfferingId) throws InvalidParameterValueException, InternalErrorException, ResourceAllocationException; /** * Finds the root volume of the VM @@ -644,15 +643,14 @@ public interface ManagementServer { * @param displayName user-supplied name to be shown in the UI or returned in the API * @param 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 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 * @throws InvalidParameterValueException if the parameter values are incorrect. * @throws ExecutionException * @throws StorageUnavailableException * @throws ConcurrentOperationException */ - UserVm deployVirtualMachine(long userId, long accountId, long dataCenterId, long serviceOfferingId, long templateId, Long diskOfferingId, String domain, String password, String displayName, String group, String userData, String [] groups, long startEventId, long size) throws ResourceAllocationException, InvalidParameterValueException, InternalErrorException, InsufficientStorageCapacityException, PermissionDeniedException, ExecutionException, StorageUnavailableException, ConcurrentOperationException; - 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; + UserVm deployVirtualMachine(long userId, long accountId, long dataCenterId, long serviceOfferingId, long templateId, Long diskOfferingId, String domain, String password, String displayName, String group, String userData, String [] groups, long startEventId) throws ResourceAllocationException, InvalidParameterValueException, InternalErrorException, InsufficientStorageCapacityException, PermissionDeniedException, ExecutionException, StorageUnavailableException, ConcurrentOperationException; + long deployVirtualMachineAsync(long userId, long accountId, long dataCenterId, long serviceOfferingId, long templateId, Long diskOfferingId, String domain, String password, String displayName, String group, String userData, String [] groups) throws InvalidParameterValueException, PermissionDeniedException; /** * Starts a Virtual Machine @@ -714,9 +712,8 @@ public interface ManagementServer { * Recovers a destroyed virtual machine. * @param vmId * @return true if recovered, false otherwise - * @throws InternalErrorException */ - boolean recoverVirtualMachine(long vmId) throws ResourceAllocationException, InternalErrorException; + boolean recoverVirtualMachine(long vmId) throws ResourceAllocationException; /** * Upgrade the virtual machine to a new service offering @@ -1769,12 +1766,6 @@ public interface ManagementServer { */ DiskOfferingVO findDiskOfferingById(long diskOffering); - /** - * Finds the obj associated with the private disk offering - * @return -- vo obj for private disk offering - */ - List 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. * @param templateId @@ -2000,7 +1991,7 @@ public interface ManagementServer { long updateLoadBalancerRuleAsync(long userId, long accountId, long loadBalancerId, String name, String description, String privatePort, String algorithm); void assignToLoadBalancer(long userId, long loadBalancerId, List instanceIds) throws NetworkRuleConflictException, InternalErrorException, PermissionDeniedException, InvalidParameterValueException; - long assignToLoadBalancerAsync(long userId, long loadBalancerId, List instanceIds); + long assignToLoadBalancerAsync(/*long userId, long loadBalancerId, List instanceIds, */Map params); boolean removeFromLoadBalancer(long userId, long loadBalancerId, List instanceIds) throws InvalidParameterValueException; long removeFromLoadBalancerAsync(long userId, long loadBalancerId, List instanceIds); @@ -2182,6 +2173,4 @@ public interface ManagementServer { boolean checkLocalStorageConfigVal(); boolean addConfig(String instance, String component, String category, String name, String value, String description); - - boolean validateCustomVolumeSizeRange(long size) throws InvalidParameterValueException; } diff --git a/core/src/com/cloud/storage/DiskOfferingVO.java b/core/src/com/cloud/storage/DiskOfferingVO.java index 5b972e817a0..e6f7d408072 100644 --- a/core/src/com/cloud/storage/DiskOfferingVO.java +++ b/core/src/com/cloud/storage/DiskOfferingVO.java @@ -155,11 +155,7 @@ public class DiskOfferingVO implements DiskOffering { public void setDisplayText(String displayText) { this.displayText = displayText; } - - public long getDiskSize(){ - return diskSize; - } - + public long getDiskSizeInBytes() { return diskSize * 1024 * 1024; } diff --git a/core/src/com/cloud/storage/StorageManager.java b/core/src/com/cloud/storage/StorageManager.java index 7b7ed9c1aef..0cb04e20eaa 100644 --- a/core/src/com/cloud/storage/StorageManager.java +++ b/core/src/com/cloud/storage/StorageManager.java @@ -34,7 +34,6 @@ import com.cloud.host.Host; import com.cloud.host.HostVO; import com.cloud.service.ServiceOfferingVO; import com.cloud.user.Account; -import com.cloud.uservm.UserVm; import com.cloud.utils.Pair; import com.cloud.utils.component.Manager; import com.cloud.utils.exception.ExecutionException; @@ -93,10 +92,9 @@ public interface StorageManager extends Manager { * @param offering service offering of the vm. * @param diskOffering disk offering of the vm. * @param avoids storage pools to avoid. - * @param size : size of the volume if defined * @return List of VolumeVO */ - List create(Account account, VMInstanceVO vm, VMTemplateVO template, DataCenterVO dc, HostPodVO pod, ServiceOfferingVO offering, DiskOfferingVO diskOffering, long size) throws StorageUnavailableException, ExecutionException; + List create(Account account, VMInstanceVO vm, VMTemplateVO template, DataCenterVO dc, HostPodVO pod, ServiceOfferingVO offering, DiskOfferingVO diskOffering) throws StorageUnavailableException, ExecutionException; /** * Create StoragePool based on uri @@ -158,7 +156,7 @@ public interface StorageManager extends Manager { public long createUserVM(Account account, VMInstanceVO vm, VMTemplateVO template, DataCenterVO dc, HostPodVO pod, ServiceOfferingVO offering, DiskOfferingVO diskOffering, - List avoids, long size); + List avoids); /** * This method sends the given command on all the hosts in the primary storage pool given until is succeeds on any one. @@ -170,7 +168,7 @@ public interface StorageManager extends Manager { * @return The answer for that command, could be success or failure. */ Answer sendToHostsOnStoragePool(Long poolId, Command cmd, String basicErrMsg); - Answer sendToHostsOnStoragePool(Long poolId, Command cmd, String basicErrMsg, int retriesPerHost, int pauseBeforeRetry, boolean shouldBeSnapshotCapable, Long vmId ); + Answer sendToHostsOnStoragePool(Long poolId, Command cmd, String basicErrMsg, int retriesPerHost, int pauseBeforeRetry, boolean shouldBeSnapshotCapable); /** @@ -197,10 +195,9 @@ public interface StorageManager extends Manager { * @param name * @param dc * @param diskOffering - * @param size * @return VolumeVO */ - VolumeVO createVolume(long accountId, long userId, String name, DataCenterVO dc, DiskOfferingVO diskOffering, long startEventId, long size); + VolumeVO createVolume(long accountId, long userId, String name, DataCenterVO dc, DiskOfferingVO diskOffering, long startEventId); /** * Marks the specified volume as destroyed in the management server database. The expunge thread will delete the volume from its storage pool. @@ -233,8 +230,6 @@ public interface StorageManager extends Manager { */ boolean volumeInactive(VolumeVO volume); - String getVmNameOnVolume(VolumeVO volume); - List> isStoredOn(VMInstanceVO vm); /** diff --git a/core/src/com/cloud/storage/dao/DiskOfferingDao.java b/core/src/com/cloud/storage/dao/DiskOfferingDao.java index 0cfe20e3aea..cbb7e8f21b0 100644 --- a/core/src/com/cloud/storage/dao/DiskOfferingDao.java +++ b/core/src/com/cloud/storage/dao/DiskOfferingDao.java @@ -24,7 +24,5 @@ import com.cloud.storage.DiskOfferingVO; import com.cloud.utils.db.GenericDao; public interface DiskOfferingDao extends GenericDao { - List listByDomainId(long domainId); - List findPrivateDiskOffering(); - + List listByDomainId(long domainId); } diff --git a/core/src/com/cloud/storage/dao/DiskOfferingDaoImpl.java b/core/src/com/cloud/storage/dao/DiskOfferingDaoImpl.java index 76811aa0eec..edc797e1541 100644 --- a/core/src/com/cloud/storage/dao/DiskOfferingDaoImpl.java +++ b/core/src/com/cloud/storage/dao/DiskOfferingDaoImpl.java @@ -38,7 +38,6 @@ public class DiskOfferingDaoImpl extends GenericDaoBase im private static final Logger s_logger = Logger.getLogger(DiskOfferingDaoImpl.class); private final SearchBuilder DomainIdSearch; - private final SearchBuilder PrivateDiskOfferingSearch; private final Attribute _typeAttr; protected DiskOfferingDaoImpl() { @@ -46,10 +45,6 @@ public class DiskOfferingDaoImpl extends GenericDaoBase im DomainIdSearch.and("domainId", DomainIdSearch.entity().getDomainId(), SearchCriteria.Op.EQ); DomainIdSearch.done(); - PrivateDiskOfferingSearch = createSearchBuilder(); - PrivateDiskOfferingSearch.and("diskSize", PrivateDiskOfferingSearch.entity().getDiskSize(), SearchCriteria.Op.EQ); - PrivateDiskOfferingSearch.done(); - _typeAttr = _allAttributes.get("type"); } @@ -61,13 +56,6 @@ public class DiskOfferingDaoImpl extends GenericDaoBase im return listActiveBy(sc); } - @Override - public List findPrivateDiskOffering() { - SearchCriteria sc = PrivateDiskOfferingSearch.create(); - sc.setParameters("diskSize", 0); - return listActiveBy(sc); - } - @Override public List searchAll(SearchCriteria sc, final Filter filter, final Boolean lock, final boolean cache) { sc.addAnd(_typeAttr, Op.EQ, Type.Disk); diff --git a/core/src/com/cloud/storage/dao/VMTemplateDaoImpl.java b/core/src/com/cloud/storage/dao/VMTemplateDaoImpl.java index a02d33bdb53..7e8c7a8c966 100644 --- a/core/src/com/cloud/storage/dao/VMTemplateDaoImpl.java +++ b/core/src/com/cloud/storage/dao/VMTemplateDaoImpl.java @@ -130,6 +130,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase implem public List listByAccountId(long accountId) { SearchCriteria sc = AccountIdSearch.create(); sc.setParameters("accountId", accountId); + sc.setParameters("publicTemplate", false); return listActiveBy(sc); } diff --git a/core/src/com/cloud/storage/dao/VMTemplateHostDao.java b/core/src/com/cloud/storage/dao/VMTemplateHostDao.java index 5a2b26cd5c2..4fd5b58053a 100644 --- a/core/src/com/cloud/storage/dao/VMTemplateHostDao.java +++ b/core/src/com/cloud/storage/dao/VMTemplateHostDao.java @@ -27,8 +27,6 @@ public interface VMTemplateHostDao extends GenericDao { List listByHostId(long id); List listByTemplateId(long templateId); - - List listByOnlyTemplateId(long templateId); VMTemplateHostVO findByHostTemplate(long hostId, long templateId); diff --git a/core/src/com/cloud/storage/dao/VMTemplateHostDaoImpl.java b/core/src/com/cloud/storage/dao/VMTemplateHostDaoImpl.java index 48f3d939624..b2becd0e141 100644 --- a/core/src/com/cloud/storage/dao/VMTemplateHostDaoImpl.java +++ b/core/src/com/cloud/storage/dao/VMTemplateHostDaoImpl.java @@ -144,13 +144,6 @@ public class VMTemplateHostDaoImpl extends GenericDaoBase listByOnlyTemplateId(long templateId) { - SearchCriteria sc = TemplateSearch.create(); - sc.setParameters("template_id", templateId); - return listBy(sc); } @Override diff --git a/core/src/com/cloud/user/UserContext.java b/core/src/com/cloud/user/UserContext.java index 36064b923b6..bb7c6a58a63 100644 --- a/core/src/com/cloud/user/UserContext.java +++ b/core/src/com/cloud/user/UserContext.java @@ -21,95 +21,132 @@ package com.cloud.user; import org.apache.log4j.Logger; import com.cloud.utils.ProcessUtil; - - + public class UserContext { private static final Logger s_logger = Logger.getLogger(UserContext.class); - - private static ThreadLocal s_currentContext = new ThreadLocal(); - - private Long userId; - private Long accountId; - private String sessionId; + + private static ThreadLocal s_currentContext = new ThreadLocal(); + + private Long userId; + private String accountName; + private Long accountId; + private Long domainId; + private String sessionId; + private Object accountObject; + + private boolean apiServer; + + private static UserContext s_nullContext = new UserContext(); + + public UserContext() { + } + + public UserContext(Long userId, Object accountObject, String accountName, Long accountId, Long domainId, String sessionId, boolean apiServer) { + this.userId = userId; + this.accountObject = accountObject; + this.accountId = accountId; + this.domainId = domainId; + this.sessionId = sessionId; + this.apiServer = apiServer; + } + + public Long getUserId() { + if (userId != null) { + return userId; + } + + if (!apiServer) { + s_logger.warn("Null user id in UserContext " + ProcessUtil.dumpStack()); + } + + return null; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public String getAccountName() { + return accountName; + } + + public void setAccountName(String accountName) { + this.accountName = accountName; + } - private boolean apiServer; - - private static UserContext s_nullContext = new UserContext(); - - public UserContext() { - } - - public UserContext(Long userId, Long accountId, String sessionId, boolean apiServer) { - this.userId = userId; - this.accountId = accountId; - this.sessionId = sessionId; - this.apiServer = apiServer; - } - - public long getUserId() { - if(userId != null) - return userId.longValue(); + public Long getAccountId() { + if (accountId != null) { + return accountId; + } + + if (!apiServer) { + s_logger.warn("Null account id in UserContext " + ProcessUtil.dumpStack()); + } - if(!apiServer) - s_logger.warn("Null user id in UserContext " + ProcessUtil.dumpStack()); - - return 0; + return null; + } + + public void setAccountId(Long accountId) { + this.accountId = accountId; + } + + public Long getDomainId() { + return domainId; + } + + public void setDomainId(Long domainId) { + this.domainId = domainId; + } + + public String getSessionId() { + return sessionId; + } + + public Object getAccountObject() { + return accountObject; + } + + public void setAccountObject(Object accountObject) { + this.accountObject = accountObject; + } + + public void setSessionKey(String sessionId) { + this.sessionId = sessionId; + } + + public boolean isApiServer() { + return apiServer; + } + + public void setApiServer(boolean apiServer) { + this.apiServer = apiServer; + } + + public static UserContext current() { + UserContext context = s_currentContext.get(); + if (context == null) { + return s_nullContext; + } + return context; + } + + public static void updateContext(Long userId, Object accountObject, String accountName, Long accountId, Long domainId, String sessionId) { + UserContext context = current(); + assert(context != null) : "Context should be already setup before you can call this one"; + + context.setUserId(userId); + context.setAccountObject(accountObject); + context.setAccountName(accountName); + context.setAccountId(accountId); + context.setDomainId(domainId); + context.setSessionKey(sessionId); } - - public void setUserId(Long userId) { - this.userId = userId; + + public static void registerContext(Long userId, Object accountObject, String accountName, Long accountId, Long domainId, String sessionId, boolean apiServer) { + s_currentContext.set(new UserContext(userId, accountObject, accountName, accountId, domainId, sessionId, apiServer)); } - - public long getAccountId() { - if(accountId != null) - return accountId.longValue(); - - if(!apiServer) - s_logger.warn("Null account id in UserContext " + ProcessUtil.dumpStack()); - return 0; - } - - public void setAccountId(Long accountId) { - this.accountId = accountId; - } - - public String getSessionId() { - return sessionId; - } - - public void setSessionKey(String sessionId) { - this.sessionId = sessionId; - } - - public boolean isApiServer() { - return apiServer; - } - - public void setApiServer(boolean apiServer) { - this.apiServer = apiServer; - } - - public static UserContext current() { - UserContext context = s_currentContext.get(); - if(context == null) - return s_nullContext; - return context; - } - - public static void updateContext(Long userId, Long accountId, String sessionId) { - UserContext context = current(); - assert(context != null) : "Context should be already setup before you can call this one"; - - context.setUserId(userId); - context.setAccountId(accountId); - context.setSessionKey(sessionId); - } - - public static void registerContext(Long userId, Long accountId, String sessionId, boolean apiServer) { - s_currentContext.set(new UserContext(userId, accountId, sessionId, apiServer)); - } - + public static void unregisterContext() { - s_currentContext.set(null); + s_currentContext.set(null); } } diff --git a/core/src/com/cloud/vm/UserVmVO.java b/core/src/com/cloud/vm/UserVmVO.java index 0943ff72f2b..fd4b9a69dd7 100755 --- a/core/src/com/cloud/vm/UserVmVO.java +++ b/core/src/com/cloud/vm/UserVmVO.java @@ -155,24 +155,6 @@ public class UserVmVO extends VMInstanceVO implements UserVm { 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, String name, long templateId, diff --git a/core/src/com/cloud/vm/VMInstanceVO.java b/core/src/com/cloud/vm/VMInstanceVO.java index 84c91116737..2e9296b136c 100644 --- a/core/src/com/cloud/vm/VMInstanceVO.java +++ b/core/src/com/cloud/vm/VMInstanceVO.java @@ -120,26 +120,7 @@ public class VMInstanceVO implements VirtualMachine { @Column(name="update_time", updatable=true) @Temporal(value=TemporalType.TIMESTAMP) - 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; - } - + Date updateTime; public VMInstanceVO(long id, String name, diff --git a/api/src/com/cloud/vm/VmCharacteristics.java b/core/src/com/cloud/vm/VmCharacteristics.java similarity index 56% rename from api/src/com/cloud/vm/VmCharacteristics.java rename to core/src/com/cloud/vm/VmCharacteristics.java index 6df26121c30..07e88329e21 100644 --- a/api/src/com/cloud/vm/VmCharacteristics.java +++ b/core/src/com/cloud/vm/VmCharacteristics.java @@ -1,7 +1,7 @@ /** * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. * - * This software is licensed under the GNU General Public License v3 or later. + * This software is licensed under the GNU General Public License v3 or later. * * It is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,18 +17,15 @@ */ package com.cloud.vm; -import java.util.Map; - -import com.cloud.hypervisor.Hypervisor; - public class VmCharacteristics { - int core; - int speed; // in mhz - long ram; // in bytes - Hypervisor.Type hypervisorType; VirtualMachine.Type type; + int cpus; // -1 means, take everything. + int speed; // In megahertz + long ram; // in bytes - Map params; + protected VmCharacteristics() { + + } public VmCharacteristics(VirtualMachine.Type type) { this.type = type; @@ -37,32 +34,4 @@ public class VmCharacteristics { public VirtualMachine.Type getType() { 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 params) { - this.core = core; - this.speed = speed; - this.ram = ram; - this.hypervisorType = type; - this.params = params; - } -} \ No newline at end of file +} diff --git a/core/test/com/cloud/vmware/TestVMWare.java b/core/test/com/cloud/vmware/TestVMWare.java deleted file mode 100644 index 1c7f4aa633b..00000000000 --- a/core/test/com/cloud/vmware/TestVMWare.java +++ /dev/null @@ -1,651 +0,0 @@ -package com.cloud.vmware; - -import java.io.File; -import java.rmi.RemoteException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.xml.DOMConfigurator; - -import com.cloud.utils.PropertiesUtil; -import com.vmware.apputils.AppUtil; -import com.vmware.vim.ArrayOfManagedObjectReference; -import com.vmware.vim.DatastoreInfo; -import com.vmware.vim.DynamicProperty; -import com.vmware.vim.InvalidProperty; -import com.vmware.vim.ManagedObjectReference; -import com.vmware.vim.ObjectContent; -import com.vmware.vim.ObjectSpec; -import com.vmware.vim.PropertyFilterSpec; -import com.vmware.vim.PropertySpec; -import com.vmware.vim.RuntimeFault; -import com.vmware.vim.SelectionSpec; -import com.vmware.vim.TraversalSpec; - -public class TestVMWare { - private static AppUtil cb; - - private static void setupLog4j() { - File file = PropertiesUtil.findConfigFile("log4j-cloud.xml"); - - if(file != null) { - System.out.println("Log4j configuration from : " + file.getAbsolutePath()); - DOMConfigurator.configureAndWatch(file.getAbsolutePath(), 10000); - } else { - System.out.println("Configure log4j with default properties"); - } - } - - private void getAndPrintInventoryContents() throws Exception { - TraversalSpec resourcePoolTraversalSpec = new TraversalSpec(); - resourcePoolTraversalSpec.setName("resourcePoolTraversalSpec"); - resourcePoolTraversalSpec.setType("ResourcePool"); - resourcePoolTraversalSpec.setPath("resourcePool"); - resourcePoolTraversalSpec.setSkip(new Boolean(false)); - resourcePoolTraversalSpec.setSelectSet( - new SelectionSpec [] { new SelectionSpec(null,null,"resourcePoolTraversalSpec") }); - - TraversalSpec computeResourceRpTraversalSpec = new TraversalSpec(); - computeResourceRpTraversalSpec.setName("computeResourceRpTraversalSpec"); - computeResourceRpTraversalSpec.setType("ComputeResource"); - computeResourceRpTraversalSpec.setPath("resourcePool"); - computeResourceRpTraversalSpec.setSkip(new Boolean(false)); - computeResourceRpTraversalSpec.setSelectSet( - new SelectionSpec [] { new SelectionSpec(null,null,"resourcePoolTraversalSpec") }); - - TraversalSpec computeResourceHostTraversalSpec = new TraversalSpec(); - computeResourceHostTraversalSpec.setName("computeResourceHostTraversalSpec"); - computeResourceHostTraversalSpec.setType("ComputeResource"); - computeResourceHostTraversalSpec.setPath("host"); - computeResourceHostTraversalSpec.setSkip(new Boolean(false)); - - TraversalSpec datacenterHostTraversalSpec = new TraversalSpec(); - datacenterHostTraversalSpec.setName("datacenterHostTraversalSpec"); - datacenterHostTraversalSpec.setType("Datacenter"); - datacenterHostTraversalSpec.setPath("hostFolder"); - datacenterHostTraversalSpec.setSkip(new Boolean(false)); - datacenterHostTraversalSpec.setSelectSet( - new SelectionSpec [] { new SelectionSpec(null,null,"folderTraversalSpec") }); - - TraversalSpec datacenterVmTraversalSpec = new TraversalSpec(); - datacenterVmTraversalSpec.setName("datacenterVmTraversalSpec"); - datacenterVmTraversalSpec.setType("Datacenter"); - datacenterVmTraversalSpec.setPath("vmFolder"); - datacenterVmTraversalSpec.setSkip(new Boolean(false)); - datacenterVmTraversalSpec.setSelectSet( - new SelectionSpec [] { new SelectionSpec(null,null,"folderTraversalSpec") }); - - TraversalSpec folderTraversalSpec = new TraversalSpec(); - folderTraversalSpec.setName("folderTraversalSpec"); - folderTraversalSpec.setType("Folder"); - folderTraversalSpec.setPath("childEntity"); - folderTraversalSpec.setSkip(new Boolean(false)); - folderTraversalSpec.setSelectSet( - new SelectionSpec [] { new SelectionSpec(null,null,"folderTraversalSpec"), - datacenterHostTraversalSpec, - datacenterVmTraversalSpec, - computeResourceRpTraversalSpec, - computeResourceHostTraversalSpec, - resourcePoolTraversalSpec }); - - PropertySpec[] propspecary = new PropertySpec[] { new PropertySpec() }; - propspecary[0].setAll(new Boolean(false)); - propspecary[0].setPathSet(new String[] { "name" }); - propspecary[0].setType("ManagedEntity"); - - PropertyFilterSpec spec = new PropertyFilterSpec(); - spec.setPropSet(propspecary); - spec.setObjectSet(new ObjectSpec[] { new ObjectSpec() }); - spec.getObjectSet(0).setObj(cb.getConnection().getRootFolder()); - spec.getObjectSet(0).setSkip(new Boolean(false)); - spec.getObjectSet(0).setSelectSet( - new SelectionSpec[] { folderTraversalSpec }); - - // Recursively get all ManagedEntity ManagedObjectReferences - // and the "name" property for all ManagedEntities retrieved - ObjectContent[] ocary = - cb.getConnection().getService().retrieveProperties( - cb.getConnection().getServiceContent().getPropertyCollector(), - new PropertyFilterSpec[] { spec } - ); - - // If we get contents back. print them out. - if (ocary != null) { - ObjectContent oc = null; - ManagedObjectReference mor = null; - DynamicProperty[] pcary = null; - DynamicProperty pc = null; - for (int oci = 0; oci < ocary.length; oci++) { - oc = ocary[oci]; - mor = oc.getObj(); - pcary = oc.getPropSet(); - - System.out.println("Object Type : " + mor.getType()); - System.out.println("Reference Value : " + mor.get_value()); - - if (pcary != null) { - for (int pci = 0; pci < pcary.length; pci++) { - pc = pcary[pci]; - System.out.println(" Property Name : " + pc.getName()); - if (pc != null) { - if (!pc.getVal().getClass().isArray()) { - System.out.println(" Property Value : " + pc.getVal()); - } - else { - Object[] ipcary = (Object[])pc.getVal(); - System.out.println("Val : " + pc.getVal()); - for (int ii = 0; ii < ipcary.length; ii++) { - Object oval = ipcary[ii]; - if (oval.getClass().getName().indexOf("ManagedObjectReference") >= 0) { - ManagedObjectReference imor = (ManagedObjectReference)oval; - - System.out.println("Inner Object Type : " + imor.getType()); - System.out.println("Inner Reference Value : " + imor.get_value()); - } - else { - System.out.println("Inner Property Value : " + oval); - } - } - } - } - } - } - } - } else { - System.out.println("No Managed Entities retrieved!"); - } - } - - private void listDataCenters() { - try { - ManagedObjectReference[] morDatacenters = getDataCenterMors(); - if(morDatacenters != null) { - for(ManagedObjectReference mor : morDatacenters) { - System.out.println("Datacenter : " + mor.get_value()); - - Map properites = new HashMap(); - properites.put("name", null); - properites.put("vmFolder", null); - properites.put("hostFolder", null); - - getProperites(mor, properites); - for(Map.Entry 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 listComputeResources = new ArrayList(); - for(ObjectContent oc : ocs) { - if(oc.getObj().getType().equalsIgnoreCase("ComputeResource")) - listComputeResources.add(oc.getObj()); - } - - List listHosts = new ArrayList(); - 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 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); - } - } -} diff --git a/debian/rules b/debian/rules index c99b62b85a7..7ab70329fd8 100755 --- a/debian/rules +++ b/debian/rules @@ -91,7 +91,7 @@ binary-common: dh_testdir dh_testroot dh_installchangelogs - dh_installdocs -A README INSTALL HACKING README.html + dh_installdocs -A README HACKING # dh_installexamples # dh_installmenu # dh_installdebconf diff --git a/python/lib/cloud_utils.py b/python/lib/cloud_utils.py index a8d6cfbd72f..d6ee34d9bfc 100644 --- a/python/lib/cloud_utils.py +++ b/python/lib/cloud_utils.py @@ -790,14 +790,13 @@ class SetupFirewall2(ConfigTask): def execute(self): - yield "Permitting traffic in the bridge interface, migration port and for VNC ports" + yield "Permitting traffic in the bridge interface and for VNC ports" if distro in (Fedora , CentOS): for rule in ( "-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 49152:49216 -j ACCEPT", ): args = rule.split() o = iptables(*args) @@ -814,7 +813,6 @@ class SetupFirewall2(ConfigTask): newtext.append(line) 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","49152:49216") stop_service("ufw") start_service("ufw") @@ -926,7 +924,7 @@ def setup_agent_config(configfile): zoneandpod = prompt_for_hostpods(x) if zoneandpod: confopts["zone"],confopts["pod"] = zoneandpod - stderr("You selected zone %s pod %s",confopts["zone"],confopts["pod"]) + stderr("You selected zone %s pod %s",e,confopts["zone"],confopts["pod"]) else: stderr("Skipped -- using the previous zone %s pod %s",confopts["zone"],confopts["pod"]) except (urllib2.URLError,urllib2.HTTPError),e: diff --git a/scripts/.project b/scripts/.project index 8d1ff9adbeb..6f05a336478 100644 --- a/scripts/.project +++ b/scripts/.project @@ -6,12 +6,12 @@ - org.python.pydev.PyDevBuilder + org.eclipse.jdt.core.javabuilder - org.python.pydev.pythonNature + org.eclipse.jdt.core.javanature diff --git a/scripts/.pydevproject b/scripts/.pydevproject deleted file mode 100644 index f8c0075c765..00000000000 --- a/scripts/.pydevproject +++ /dev/null @@ -1,7 +0,0 @@ - - - - -Default -python 2.6 - diff --git a/scripts/storage/qcow2/createtmplt.sh b/scripts/storage/qcow2/createtmplt.sh index 55efe952af5..cc235e0d7ac 100755 --- a/scripts/storage/qcow2/createtmplt.sh +++ b/scripts/storage/qcow2/createtmplt.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# $Id: createtmplt.sh 11542 2010-08-09 03:22:31Z edison $ $HeadURL: svn://svn.lab.vmops.com/repos/vmdev/java/scripts/storage/qcow2/createtmplt.sh $ +# $Id: createtmplt.sh 11474 2010-08-06 05:53:02Z edison $ $HeadURL: svn://svn.lab.vmops.com/repos/vmdev/java/scripts/storage/qcow2/createtmplt.sh $ # createtmplt.sh -- install a template usage() { @@ -142,11 +142,6 @@ then exit 3 fi -tmpltimg=$(uncompress $tmpltimg) -if [ $? -ne 0 ] -then - printf "failed to uncompress $tmpltimg\n" -fi create_from_file $tmpltfs $tmpltimg $tmpltname diff --git a/scripts/storage/qcow2/managesnapshot.sh b/scripts/storage/qcow2/managesnapshot.sh index 3c7692161d6..5890a360f4f 100755 --- a/scripts/storage/qcow2/managesnapshot.sh +++ b/scripts/storage/qcow2/managesnapshot.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# $Id: managesnapshot.sh 11542 2010-08-09 03:22:31Z edison $ $HeadURL: svn://svn.lab.vmops.com/repos/vmdev/java/scripts/storage/qcow2/managesnapshot.sh $ +# $Id: managesnapshot.sh 11474 2010-08-06 05:53:02Z edison $ $HeadURL: svn://svn.lab.vmops.com/repos/vmdev/java/scripts/storage/qcow2/managesnapshot.sh $ # managesnapshot.sh -- manage snapshots for a single disk (create, destroy, rollback) # @@ -34,19 +34,16 @@ create_snapshot() { } destroy_snapshot() { - local backupSnapDir=$1 + local disk=$1 local snapshotname=$2 local failed=0 - if [ -f $backupSnapDir/$snapshotname ] - then - rm -f $backupSnapDir/$snapshotname + qemu-img snapshot -d $snapshotname $disk - if [ $? -gt 0 ] - then - printf "***Failed to delete snapshot $snapshotname for path $backupSnapDir\n" >&2 - failed=1 - fi + if [ $? -gt 0 ] + then + printf "***Failed to delete snapshot $snapshotname for path $disk\n" >&2 + failed=1 fi return $failed diff --git a/scripts/vm/hypervisor/xenserver/launch_hb.sh b/scripts/vm/hypervisor/xenserver/launch_hb.sh index 849565e1e71..a16d3f4bcbc 100755 --- a/scripts/vm/hypervisor/xenserver/launch_hb.sh +++ b/scripts/vm/hypervisor/xenserver/launch_hb.sh @@ -26,5 +26,5 @@ for psid in `ps -ef | grep xenheartbeat | grep -v grep | awk '{print $2}'`; do kill $psid done -nohup /opt/xensource/bin/xenheartbeat.sh $1 $2 >/var/log/heartbeat.log 2>&1 & +nohup /opt/xensource/bin/heartbeat.sh $1 $2 >/var/log/heartbeat.log 2>&1 & echo "======> DONE <======" diff --git a/scripts/vm/hypervisor/xenserver/setupxenserver.sh b/scripts/vm/hypervisor/xenserver/setupxenserver.sh index 0a4b45f6173..e8831142415 100755 --- a/scripts/vm/hypervisor/xenserver/setupxenserver.sh +++ b/scripts/vm/hypervisor/xenserver/setupxenserver.sh @@ -23,10 +23,5 @@ iptables-save > /etc/sysconfig/iptables sed -i 's/127\.0\.0\.1/0\.0\.0\.0/' /opt/xensource/libexec/vncterm-wrapper 2>&1 sed -i 's/127\.0\.0\.1/0\.0\.0\.0/' /opt/xensource/libexec/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" diff --git a/scripts/vm/network/vnet/modifyvlan.sh b/scripts/vm/network/vnet/modifyvlan.sh index 19335523268..6806f244b95 100644 --- a/scripts/vm/network/vnet/modifyvlan.sh +++ b/scripts/vm/network/vnet/modifyvlan.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# $Id: modifyvlan.sh 11549 2010-08-09 20:55:51Z edison $ $HeadURL: svn://svn.lab.vmops.com/repos/vmdev/java/scripts/vm/network/vnet/modifyvlan.sh $ +# $Id: modifyvlan.sh 11388 2010-08-02 17:04:13Z edison $ $HeadURL: svn://svn.lab.vmops.com/repos/vmdev/java/scripts/vm/network/vnet/modifyvlan.sh $ # modifyvlan.sh -- adds and deletes VLANs from a Routing Server # # @@ -128,13 +128,6 @@ then exit 2 fi -# Vlan module is loaded? -lsmod|grep ^8021q >& /dev/null -if [ $? -gt 0 ] -then - modprobe 8021q >& /dev/null -fi - if [ "$op" == "add" ] then # Add the vlan diff --git a/server/src/com/cloud/api/ApiServer.java b/server/src/com/cloud/api/ApiServer.java index f8b4f06a734..6e9484c72af 100644 --- a/server/src/com/cloud/api/ApiServer.java +++ b/server/src/com/cloud/api/ApiServer.java @@ -25,11 +25,14 @@ import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InterruptedIOException; +import java.lang.reflect.Field; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; import java.net.URLEncoder; import java.security.SecureRandom; +import java.text.DateFormat; +import java.text.ParseException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -38,6 +41,7 @@ import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; +import java.util.StringTokenizer; import java.util.TimeZone; import java.util.concurrent.ExecutorService; import java.util.concurrent.LinkedBlockingQueue; @@ -74,6 +78,7 @@ import org.apache.http.protocol.ResponseDate; import org.apache.http.protocol.ResponseServer; import org.apache.log4j.Logger; +import com.cloud.api.BaseCmd.CommandType; import com.cloud.configuration.ConfigurationVO; import com.cloud.configuration.dao.ConfigurationDao; import com.cloud.domain.DomainVO; @@ -83,6 +88,7 @@ import com.cloud.user.Account; import com.cloud.user.User; import com.cloud.user.UserAccount; import com.cloud.user.UserContext; +import com.cloud.utils.DateUtil; import com.cloud.utils.Pair; import com.cloud.utils.PropertiesUtil; import com.cloud.utils.component.ComponentLocator; @@ -90,7 +96,7 @@ import com.cloud.utils.concurrency.NamedThreadFactory; import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.Transaction; import com.cloud.utils.encoding.Base64; - +import com.cloud.utils.exception.CloudRuntimeException; public class ApiServer implements HttpRequestHandler { private static final Logger s_logger = Logger.getLogger(ApiServer.class.getName()); @@ -110,7 +116,7 @@ public class ApiServer implements HttpRequestHandler { private static List s_resellerCommands = null; // AKA domain-admin private static List s_adminCommands = null; private static List s_readOnlyAdminCommands = null; - + private static ExecutorService _executor = new ThreadPoolExecutor(10, 150, 60, TimeUnit.SECONDS, new LinkedBlockingQueue(), new NamedThreadFactory("ApiServer")); static { @@ -233,7 +239,7 @@ public class ApiServer implements HttpRequestHandler { } try { // always trust commands from API port, user context will always be UID_SYSTEM/ACCOUNT_ID_SYSTEM - UserContext.registerContext(User.UID_SYSTEM, Account.ACCOUNT_ID_SYSTEM, null, true); + UserContext.registerContext(User.UID_SYSTEM, null, null, Account.ACCOUNT_ID_SYSTEM, null, null, true); String responseText = handleRequest(parameterMap, true, responseType); sb.append(" 200 " + ((responseText == null) ? 0 : responseText.length())); @@ -280,7 +286,7 @@ public class ApiServer implements HttpRequestHandler { } response = buildErrorResponse("invalid request, no command sent", responseType); } else { - Map paramMap = new HashMap(); + Map paramMap = new HashMap(); Set keys = params.keySet(); Iterator keysIter = keys.iterator(); while (keysIter.hasNext()) { @@ -288,7 +294,7 @@ public class ApiServer implements HttpRequestHandler { if ("command".equalsIgnoreCase(key)) { continue; } - Object[] value = (Object[])params.get(key); + String[] value = (String[])params.get(key); paramMap.put(key, value[0]); } String cmdClassName = _apiCommands.getProperty(command[0]); @@ -296,8 +302,43 @@ public class ApiServer implements HttpRequestHandler { Class cmdClass = Class.forName(cmdClassName); BaseCmd cmdObj = (BaseCmd)cmdClass.newInstance(); cmdObj.setManagementServer(_ms); + Map unpackedParams = cmdObj.unpackParams(paramMap, decode); + Field[] fields = cmdClass.getDeclaredFields(); + for (Field field : fields) { + Parameter parameterAnnotation = field.getAnnotation(Parameter.class); + if (parameterAnnotation == null) { + continue; + } + Object paramObj = unpackedParams.get(parameterAnnotation.name()); + if (paramObj == null) { + if (parameterAnnotation.required()) { + throw new ServerApiException(BaseCmd.PARAM_ERROR, "Unable to execute API command " + cmdObj.getName() + " due to missing parameter " + parameterAnnotation.name()); + } + continue; + } + + // marshall the parameter into the correct type and set the field value + try { + setFieldValue(field, cmdObj, paramObj, parameterAnnotation); + } catch (IllegalArgumentException argEx) { + if (s_logger.isDebugEnabled()) { + s_logger.debug("Unable to execute API command " + cmdObj.getName() + " due to invalid value " + paramObj + " for parameter " + parameterAnnotation.name()); + } + throw new ServerApiException(BaseCmd.PARAM_ERROR, "Unable to execute API command " + cmdObj.getName() + " due to invalid value " + paramObj + " for parameter " + parameterAnnotation.name()); + } catch (ParseException parseEx) { + if (s_logger.isDebugEnabled()) { + s_logger.debug("Invalid date parameter " + paramObj + " passed to command " + cmdObj.getName()); + } + throw new ServerApiException(BaseCmd.PARAM_ERROR, "Unable to parse date " + paramObj + " for command " + cmdObj.getName() + ", please pass dates in the format yyyy-MM-dd"); + } catch (CloudRuntimeException cloudEx) { + // FIXME: Better error message? This only happens if the API command is not executable, which typically means there was + // and IllegalAccessException setting one of the parameters. + throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Internal error executing API command " + cmdObj.getName()); + } + } + Map validatedParams = cmdObj.validateParams(paramMap, decode); - + List> resultValues = cmdObj.execute(validatedParams); response = cmdObj.buildResponse(resultValues, responseType); } else { @@ -400,14 +441,21 @@ public class ApiServer implements HttpRequestHandler { } if (account.getType() == Account.ACCOUNT_TYPE_NORMAL) { + UserContext.updateContext(user.getId(), account, account.getAccountName(), account.getId(), account.getDomainId(), null); + + /* requestParameters.put(BaseCmd.Properties.USER_ID.getName(), new String[] { user.getId().toString() }); requestParameters.put(BaseCmd.Properties.ACCOUNT.getName(), new String[] { account.getAccountName() }); requestParameters.put(BaseCmd.Properties.DOMAIN_ID.getName(), new String[] { account.getDomainId().toString() }); requestParameters.put(BaseCmd.Properties.ACCOUNT_OBJ.getName(), new Object[] { account }); + */ } else { + UserContext.updateContext(user.getId(), account, null, null, null, null); + /* requestParameters.put(BaseCmd.Properties.USER_ID.getName(), new String[] { user.getId().toString() }); requestParameters.put(BaseCmd.Properties.ACCOUNT_OBJ.getName(), new Object[] { account }); - } + */ + } if (!isCommandAvailable(account.getType(), commandName)) { return false; @@ -606,6 +654,64 @@ public class ApiServer implements HttpRequestHandler { return sb.toString(); } + @SuppressWarnings("unchecked") + private void setFieldValue(Field field, BaseCmd cmdObj, Object paramObj, Parameter annotation) throws IllegalArgumentException, ParseException { + try { + field.setAccessible(true); + CommandType fieldType = annotation.type(); + switch (fieldType) { + case BOOLEAN: + field.set(cmdObj, Boolean.valueOf(paramObj.toString())); + break; + case DATE: + DateFormat format = BaseCmd.INPUT_FORMAT; + synchronized (format) { + field.set(cmdObj, format.parse(paramObj.toString())); + } + break; + case FLOAT: + field.set(cmdObj, Float.valueOf(paramObj.toString())); + break; + case INTEGER: + field.set(cmdObj, Integer.valueOf(paramObj.toString())); + break; + case LIST: + List listParam = new ArrayList(); + StringTokenizer st = new StringTokenizer(paramObj.toString(), ","); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + CommandType listType = annotation.collectionType(); + switch (listType) { + case INTEGER: + listParam.add(Integer.valueOf(token)); + break; + case LONG: + listParam.add(Long.valueOf(token)); + break; + } + } + field.set(cmdObj, listParam); + break; + case LONG: + field.set(cmdObj, Long.valueOf(paramObj.toString())); + break; + case STRING: + field.set(cmdObj, paramObj.toString()); + break; + case TZDATE: + field.set(cmdObj, DateUtil.parseTZDateString(paramObj.toString())); + break; + case MAP: + default: + field.set(cmdObj, paramObj); + break; + } + } catch (IllegalAccessException ex) { + s_logger.error("Error initializing command " + cmdObj.getName() + ", field " + field.getName() + " is not accessible."); + throw new CloudRuntimeException("Internal error initializing parameters for command " + cmdObj.getName() + " [field " + field.getName() + " is not accessible]"); + } + } + // FIXME: the following two threads are copied from http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpServer.java // we have to cite a license if we are using this code directly, so we need to add the appropriate citation or modify the code to be very specific to our needs static class ListenerThread extends Thread { diff --git a/server/src/com/cloud/api/ApiServlet.java b/server/src/com/cloud/api/ApiServlet.java index d761286096b..06fdb775d22 100644 --- a/server/src/com/cloud/api/ApiServlet.java +++ b/server/src/com/cloud/api/ApiServlet.java @@ -154,16 +154,17 @@ public class ApiServlet extends HttpServlet { boolean isNew = ((session == null) ? true : session.isNew()); - Object accountObj = null; - String userId = null; - String account = null; - String domainId = null; - + // Initialize an empty context and we will update it after we have verified the request below, + // we no longer rely on web-session here, verifyRequest will populate user/account information + // if a API key exists + UserContext.registerContext(null, null, null, null, null, null, false); + String userId = null; + if (!isNew) { userId = (String)session.getAttribute(BaseCmd.Properties.USER_ID.getName()); - account = (String)session.getAttribute(BaseCmd.Properties.ACCOUNT.getName()); - domainId = (String)session.getAttribute(BaseCmd.Properties.DOMAIN_ID.getName()); - accountObj = session.getAttribute(BaseCmd.Properties.ACCOUNT_OBJ.getName()); + String account = (String)session.getAttribute(BaseCmd.Properties.ACCOUNT.getName()); + String domainId = (String)session.getAttribute(BaseCmd.Properties.DOMAIN_ID.getName()); + Object accountObj = session.getAttribute(BaseCmd.Properties.ACCOUNT_OBJ.getName()); String sessionKey = (String)session.getAttribute(BaseCmd.Properties.SESSION_KEY.getName()); String[] sessionKeyParam = (String[])params.get(BaseCmd.Properties.SESSION_KEY.getName()); if ((sessionKeyParam == null) || (sessionKey == null) || !sessionKey.equals(sessionKeyParam[0])) { @@ -178,26 +179,19 @@ public class ApiServlet extends HttpServlet { s_logger.info("missing command, ignoring request..."); resp.sendError(HttpServletResponse.SC_BAD_REQUEST, "no command specified"); return; - } + } + UserContext.updateContext(Long.valueOf(userId), accountObj, account, ((Account)accountObj).getId(), Long.valueOf(domainId), session.getId()); } else { - // Clear out the variables we retrieved from the session and invalidate the session. This ensures - // we won't allow a request across management server restarts if the userId was serialized to the + // Invalidate the session to ensure we won't allow a request across management server restarts if the userId was serialized to the // stored session - userId = null; - account = null; - accountObj = null; session.invalidate(); resp.sendError(HttpServletResponse.SC_UNAUTHORIZED, "unable to verify user credentials"); return; } } - // Initialize an empty context and we will update it after we have verified the request below, - // we no longer rely on web-session here, verifyRequest will populate user/account information - // if a API key exists - UserContext.registerContext(null, null, null, false); - if (_apiServer.verifyRequest(params, userId)) { + /* if (accountObj != null) { Account userAccount = (Account)accountObj; if (userAccount.getType() == Account.ACCOUNT_TYPE_NORMAL) { @@ -214,6 +208,7 @@ public class ApiServlet extends HttpServlet { // update user context info here so that we can take information if the request is authenticated // via api key mechenism updateUserContext(params, session != null ? session.getId() : null); + */ try { String response = _apiServer.handleRequest(params, false, responseType); writeResponse(resp, response != null ? response : "", false, responseType); @@ -237,7 +232,8 @@ public class ApiServlet extends HttpServlet { UserContext.unregisterContext(); } } - + + /* private void updateUserContext(Map requestParameters, String sessionId) { String userIdStr = (String)(requestParameters.get(BaseCmd.Properties.USER_ID.getName())[0]); Account accountObj = (Account)(requestParameters.get(BaseCmd.Properties.ACCOUNT_OBJ.getName())[0]); @@ -251,7 +247,8 @@ public class ApiServlet extends HttpServlet { accountId = accountObj.getId(); UserContext.updateContext(userId, accountId, sessionId); - } + } + */ // FIXME: rather than isError, we might was to pass in the status code to give more flexibility private void writeResponse(HttpServletResponse resp, String response, boolean isError, String responseType) { diff --git a/server/src/com/cloud/api/BaseCmd.java b/server/src/com/cloud/api/BaseCmd.java index 0698671be76..d54e75e24bf 100644 --- a/server/src/com/cloud/api/BaseCmd.java +++ b/server/src/com/cloud/api/BaseCmd.java @@ -21,7 +21,6 @@ package com.cloud.api; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.text.DateFormat; -import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; @@ -35,7 +34,6 @@ import com.cloud.async.AsyncJobVO; import com.cloud.serializer.SerializerHelper; import com.cloud.server.ManagementServer; import com.cloud.user.Account; -import com.cloud.utils.DateUtil; import com.cloud.utils.Pair; public abstract class BaseCmd { @@ -45,9 +43,13 @@ public abstract class BaseCmd { public static final String RESPONSE_TYPE_XML = "xml"; public static final String RESPONSE_TYPE_JSON = "json"; - private Map _params; +// private Map _params; private ManagementServer _ms = null; + public enum CommandType { + BOOLEAN, DATE, FLOAT, INTEGER, LIST, LONG, OBJECT, MAP, STRING, TZDATE + } + public static final short TYPE_STRING = 0; public static final short TYPE_INT = 1; public static final short TYPE_LONG = 2; @@ -100,7 +102,7 @@ public abstract class BaseCmd { public static final int STORAGE_RESOURCE_IN_USE = 580; - private static final DateFormat _format = new SimpleDateFormat("yyyy-MM-dd"); + public static final DateFormat INPUT_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); private static final DateFormat _outputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); public enum Properties { @@ -411,12 +413,15 @@ public abstract class BaseCmd { public abstract String getName(); public abstract List> getProperties(); + /* public Map getParams() { return _params; } public void setParams(Map params) { _params = params; } + */ + public ManagementServer getManagementServer() { return _ms; } @@ -435,12 +440,14 @@ public abstract class BaseCmd { return formattedString; } - public Map validateParams(Map params, boolean decode) { - List> properties = getProperties(); + public Map validateParams(Map params, boolean decode) { +// List> properties = getProperties(); // step 1 - all parameter names passed in will be converted to lowercase Map processedParams = lowercaseParams(params, decode); + return processedParams; + /* // step 2 - make sure all required params exist, and all existing params adhere to the appropriate data type Map validatedParams = new HashMap(); for (Pair propertyPair : properties) { @@ -524,91 +531,101 @@ public abstract class BaseCmd { } return validatedParams; + */ } - @SuppressWarnings("unchecked") - private Map lowercaseParams(Map params, boolean decode) { + private Map lowercaseParams(Map params, boolean decode) { Map lowercaseParams = new HashMap(); for (String key : params.keySet()) { - int arrayStartIndex = key.indexOf('['); - int arrayStartLastIndex = key.lastIndexOf('['); - if (arrayStartIndex != arrayStartLastIndex) { - throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup"); - } + lowercaseParams.put(key.toLowerCase(), params.get(key)); + } + return lowercaseParams; + } - if (arrayStartIndex > 0) { - int arrayEndIndex = key.indexOf(']'); - int arrayEndLastIndex = key.lastIndexOf(']'); - if ((arrayEndIndex < arrayStartIndex) || (arrayEndIndex != arrayEndLastIndex)) { - // malformed parameter - throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup"); - } + // FIXME: move this to a utils method so that maps can be unpacked and integer/long values can be appropriately cast + @SuppressWarnings("unchecked") + public Map unpackParams(Map params, boolean decode) { + Map lowercaseParams = new HashMap(); + for (String key : params.keySet()) { + int arrayStartIndex = key.indexOf('['); + int arrayStartLastIndex = key.lastIndexOf('['); + if (arrayStartIndex != arrayStartLastIndex) { + throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup"); + } - // Now that we have an array object, check for a field name in the case of a complex object - int fieldIndex = key.indexOf('.'); - String fieldName = null; - if (fieldIndex < arrayEndIndex) { - throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup"); - } else { - fieldName = key.substring(fieldIndex + 1); - } + if (arrayStartIndex > 0) { + int arrayEndIndex = key.indexOf(']'); + int arrayEndLastIndex = key.lastIndexOf(']'); + if ((arrayEndIndex < arrayStartIndex) || (arrayEndIndex != arrayEndLastIndex)) { + // malformed parameter + throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup"); + } - // parse the parameter name as the text before the first '[' character - String paramName = key.substring(0, arrayStartIndex); - paramName = paramName.toLowerCase(); + // Now that we have an array object, check for a field name in the case of a complex object + int fieldIndex = key.indexOf('.'); + String fieldName = null; + if (fieldIndex < arrayEndIndex) { + throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup"); + } else { + fieldName = key.substring(fieldIndex + 1); + } - Map mapArray = null; - Map mapValue = null; - String indexStr = key.substring(arrayStartIndex+1, arrayEndIndex); - int index = 0; - boolean parsedIndex = false; - try { - if (indexStr != null) { - index = Integer.parseInt(indexStr); - parsedIndex = true; - } - } catch (NumberFormatException nfe) { - s_logger.warn("Invalid parameter " + key + " received, unable to parse object array, returning an error."); - } + // parse the parameter name as the text before the first '[' character + String paramName = key.substring(0, arrayStartIndex); + paramName = paramName.toLowerCase(); - if (!parsedIndex) { - throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup"); - } + Map mapArray = null; + Map mapValue = null; + String indexStr = key.substring(arrayStartIndex+1, arrayEndIndex); + int index = 0; + boolean parsedIndex = false; + try { + if (indexStr != null) { + index = Integer.parseInt(indexStr); + parsedIndex = true; + } + } catch (NumberFormatException nfe) { + s_logger.warn("Invalid parameter " + key + " received, unable to parse object array, returning an error."); + } - Object value = lowercaseParams.get(paramName); - if (value == null) { - // for now, assume object array with sub fields - mapArray = new HashMap(); - mapValue = new HashMap(); - mapArray.put(Integer.valueOf(index), mapValue); - } else if (value instanceof Map) { - mapArray = (HashMap)value; - mapValue = mapArray.get(Integer.valueOf(index)); - if (mapValue == null) { - mapValue = new HashMap(); - mapArray.put(Integer.valueOf(index), mapValue); - } - } + if (!parsedIndex) { + throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup"); + } - // we are ready to store the value for a particular field into the map for this object, make sure the value is decoded if required - String valueStr = (String)params.get(key); - String decodedValue = null; - if (decode) { + Object value = lowercaseParams.get(paramName); + if (value == null) { + // for now, assume object array with sub fields + mapArray = new HashMap(); + mapValue = new HashMap(); + mapArray.put(Integer.valueOf(index), mapValue); + } else if (value instanceof Map) { + mapArray = (HashMap)value; + mapValue = mapArray.get(Integer.valueOf(index)); + if (mapValue == null) { + mapValue = new HashMap(); + mapArray.put(Integer.valueOf(index), mapValue); + } + } + + // we are ready to store the value for a particular field into the map for this object, make sure the value is decoded if required + String valueStr = (String)params.get(key); + String decodedValue = null; + if (decode) { try { - decodedValue = URLDecoder.decode(valueStr, "UTF-8"); + decodedValue = URLDecoder.decode(valueStr, "UTF-8"); } catch (UnsupportedEncodingException usex) { s_logger.warn(key + " could not be decoded, value = " + valueStr); throw new ServerApiException(PARAM_ERROR, key + " could not be decoded, received value " + valueStr); } } else { - decodedValue = valueStr; + decodedValue = valueStr; } - mapValue.put(fieldName, decodedValue); + mapValue.put(fieldName, decodedValue); - lowercaseParams.put(paramName, mapArray); - } else { + lowercaseParams.put(paramName, mapArray); + } else { lowercaseParams.put(key.toLowerCase(), params.get(key)); - } + } } return lowercaseParams; } diff --git a/server/src/com/cloud/api/BaseListCmd.java b/server/src/com/cloud/api/BaseListCmd.java new file mode 100644 index 00000000000..efc7441e973 --- /dev/null +++ b/server/src/com/cloud/api/BaseListCmd.java @@ -0,0 +1,34 @@ +package com.cloud.api; + + +public abstract class BaseListCmd extends BaseCmd { + ///////////////////////////////////////////////////// + /////////// BaseList API parameters ///////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="keyword", type=CommandType.STRING) + private String keyword; + + // FIXME: Need to be able to specify next/prev/first/last, so Integer might not be right + @Parameter(name="page", type=CommandType.INTEGER) + private Integer page; + + @Parameter(name="pagesize", type=CommandType.INTEGER) + private Integer pageSize; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getKeyword() { + return keyword; + } + + public Integer getPage() { + return page; + } + + public Integer getPageSize() { + return pageSize; + } +} diff --git a/server/src/com/cloud/api/Parameter.java b/server/src/com/cloud/api/Parameter.java new file mode 100644 index 00000000000..a1fe480f641 --- /dev/null +++ b/server/src/com/cloud/api/Parameter.java @@ -0,0 +1,37 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +package com.cloud.api; + +import static java.lang.annotation.ElementType.FIELD; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import com.cloud.api.BaseCmd.CommandType; + +@Retention(RetentionPolicy.RUNTIME) +@Target({FIELD}) +public @interface Parameter { + String name() default ""; + boolean required() default false; + CommandType type() default CommandType.OBJECT; + CommandType collectionType() default CommandType.OBJECT; +} + diff --git a/server/src/com/cloud/api/commands/AddConfigCmd.java b/server/src/com/cloud/api/commands/AddConfigCmd.java index 00ce03536ae..3ad28222484 100644 --- a/server/src/com/cloud/api/commands/AddConfigCmd.java +++ b/server/src/com/cloud/api/commands/AddConfigCmd.java @@ -25,8 +25,8 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; -import com.cloud.user.Account; import com.cloud.utils.Pair; public class AddConfigCmd extends BaseCmd { @@ -43,6 +43,63 @@ public class AddConfigCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.VALUE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.DESCRIPTION, Boolean.FALSE)); } + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="category", type=CommandType.STRING, required=true) + private String category; + + @Parameter(name="component", type=CommandType.STRING, required=true) + private String component; + + @Parameter(name="description", type=CommandType.STRING) + private String description; + + @Parameter(name="instance", type=CommandType.STRING, required=true) + private String instance; + + @Parameter(name="name", type=CommandType.STRING, required=true) + private String name; + + @Parameter(name="value", type=CommandType.STRING) + private String value; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getCategory() { + return category; + } + + public String getComponent() { + return component; + } + + public String getDescription() { + return description; + } + + public String getInstance() { + return instance; + } + + public String getConfigPropName() { + return name; + } + + public String getValue() { + return value; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/AddHostCmd.java b/server/src/com/cloud/api/commands/AddHostCmd.java index 76271fb5311..d14742b68b8 100644 --- a/server/src/com/cloud/api/commands/AddHostCmd.java +++ b/server/src/com/cloud/api/commands/AddHostCmd.java @@ -26,6 +26,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.dc.ClusterVO; import com.cloud.dc.HostPodVO; @@ -42,15 +43,78 @@ public class AddHostCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { - s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.POD_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.CLUSTER_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.CLUSTER_NAME, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.URL, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.USERNAME, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.PASSWORD, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.CLUSTER_NAME, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.PASSWORD, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.POD_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.URL, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.USERNAME, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="clusterid", type=CommandType.LONG) + private Long clusterId; + + @Parameter(name="clustername", type=CommandType.STRING) + private String clusterName; + + @Parameter(name="password", type=CommandType.STRING, required=true) + private String password; + + @Parameter(name="podid", type=CommandType.LONG) + private Long podId; + + @Parameter(name="url", type=CommandType.STRING, required=true) + private String url; + + @Parameter(name="username", type=CommandType.STRING, required=true) + private String username; + + @Parameter(name="zoneid", type=CommandType.LONG, required=true) + private Long zoneId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getClusterId() { + return clusterId; + } + + public String getClusterName() { + return clusterName; + } + + public String getPassword() { + return password; + } + + public Long getPodId() { + return podId; + } + + public String getUrl() { + return url; + } + + public String getUsername() { + return username; + } + + public Long getZoneId() { + return zoneId; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/AddSecondaryStorageCmd.java b/server/src/com/cloud/api/commands/AddSecondaryStorageCmd.java index 88209e03e1b..715354127ff 100644 --- a/server/src/com/cloud/api/commands/AddSecondaryStorageCmd.java +++ b/server/src/com/cloud/api/commands/AddSecondaryStorageCmd.java @@ -28,12 +28,12 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.host.Host; import com.cloud.host.HostStats; import com.cloud.host.HostVO; import com.cloud.offering.ServiceOffering; -import com.cloud.utils.NumbersUtil; import com.cloud.utils.Pair; import com.cloud.vm.UserVmVO; @@ -47,6 +47,34 @@ public class AddSecondaryStorageCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.URL, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="url", type=CommandType.STRING, required=true) + private String url; + + @Parameter(name="zoneid", type=CommandType.LONG) + private Long zoneId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getUrl() { + return url; + } + + public Long getZoneId() { + return zoneId; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/AssignPortForwardingServiceCmd.java b/server/src/com/cloud/api/commands/AssignPortForwardingServiceCmd.java index 2bd6d34f467..39994b1b8ae 100644 --- a/server/src/com/cloud/api/commands/AssignPortForwardingServiceCmd.java +++ b/server/src/com/cloud/api/commands/AssignPortForwardingServiceCmd.java @@ -18,14 +18,15 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.StringTokenizer; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.user.Account; import com.cloud.utils.Pair; @@ -46,6 +47,48 @@ public class AssignPortForwardingServiceCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.VIRTUAL_MACHINE_ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.STRING) + private Long id; + + @Parameter(name="ids", type=CommandType.LIST, collectionType=CommandType.LONG) + private List ids; + + @Parameter(name="publicip", type=CommandType.STRING, required=true) + private String publicIp; + + @Parameter(name="virtualmachineid", type=CommandType.LONG, required=true) + private Long virtualMachineId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + public List getIds() { + return ids; + } + + public String getPublicIp() { + return publicIp; + } + + public Long getVirtualMachineId() { + return virtualMachineId; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/AssignToLoadBalancerRuleCmd.java b/server/src/com/cloud/api/commands/AssignToLoadBalancerRuleCmd.java index 5d50a94632d..f3be7c69d35 100644 --- a/server/src/com/cloud/api/commands/AssignToLoadBalancerRuleCmd.java +++ b/server/src/com/cloud/api/commands/AssignToLoadBalancerRuleCmd.java @@ -18,17 +18,15 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.StringTokenizer; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; -import com.cloud.api.ServerApiException; -import com.cloud.network.LoadBalancerVO; -import com.cloud.user.Account; +import com.cloud.api.Parameter; import com.cloud.utils.Pair; public class AssignToLoadBalancerRuleCmd extends BaseCmd { @@ -36,7 +34,7 @@ public class AssignToLoadBalancerRuleCmd extends BaseCmd { private static final String s_name = "assigntoloadbalancerruleresponse"; private static final List> s_properties = new ArrayList>(); - + static { s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); @@ -46,17 +44,66 @@ public class AssignToLoadBalancerRuleCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.VIRTUAL_MACHINE_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.VIRTUAL_MACHINE_IDS, Boolean.FALSE)); } + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + @Parameter(name="virtualmachineid", type=CommandType.LONG, required=false) + private Long virtualMachineId; - public String getName() { - return s_name; - } - - public List> getProperties() { - return s_properties; - } - + @Parameter(name="virtualmachineids", type=CommandType.LIST, collectionType=CommandType.LONG, required=false) + private List virtualMachineIds; + + @Parameter(name="account", type=CommandType.STRING, required=false) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG, required=false) + private Long domainId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getLoadBalancerId() { + return id; + } + + public Long getVirtualMachineId() { + return virtualMachineId; + } + + public List getVirtualMachineIds() { + return virtualMachineIds; + } + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + public String getName() { + return s_name; + } + + public List> getProperties() { + return s_properties; + } + @Override - public List> execute(Map params) { + public List> execute(Map params) { + /* Long userId = (Long)params.get(BaseCmd.Properties.USER_ID.getName()); Account account = (Account)params.get(BaseCmd.Properties.ACCOUNT_OBJ.getName()); String accountName = (String)params.get(BaseCmd.Properties.ACCOUNT.getName()); @@ -103,9 +150,14 @@ public class AssignToLoadBalancerRuleCmd extends BaseCmd { } else if (!getManagementServer().isChildDomain(account.getDomainId(), loadBalancer.getDomainId())) { throw new ServerApiException(BaseCmd.PARAM_ERROR, "Invalid load balancer rule id (" + loadBalancer.getId() + ") given, unable to assign instances to load balancer rule."); } - } - - long jobId = getManagementServer().assignToLoadBalancerAsync(userId.longValue(), loadBalancerId.longValue(), instanceIdList); + } + */ + + Map paramMap = new HashMap(); + for (String key : params.keySet()) { + paramMap.put(key, (String)params.get(key)); + } + long jobId = getManagementServer().assignToLoadBalancerAsync(paramMap); if (jobId == 0) { s_logger.warn("Unable to schedule async-job for AssignToLoadBalancerRule comamnd"); diff --git a/server/src/com/cloud/api/commands/AssociateIPAddrCmd.java b/server/src/com/cloud/api/commands/AssociateIPAddrCmd.java index a4c06429d3a..b8737331d09 100644 --- a/server/src/com/cloud/api/commands/AssociateIPAddrCmd.java +++ b/server/src/com/cloud/api/commands/AssociateIPAddrCmd.java @@ -18,17 +18,18 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; -import com.cloud.dc.VlanVO; import com.cloud.dc.Vlan.VlanType; +import com.cloud.dc.VlanVO; import com.cloud.exception.InsufficientAddressCapacityException; import com.cloud.exception.InternalErrorException; import com.cloud.exception.InvalidParameterValueException; @@ -51,6 +52,41 @@ public class AssociateIPAddrCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="zoneid", type=CommandType.LONG, required=true) + private Long zoneId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + public Long getZoneId() { + return zoneId; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/AttachIsoCmd.java b/server/src/com/cloud/api/commands/AttachIsoCmd.java index 0cfd57b2e86..f622eac524a 100644 --- a/server/src/com/cloud/api/commands/AttachIsoCmd.java +++ b/server/src/com/cloud/api/commands/AttachIsoCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.storage.VMTemplateVO; import com.cloud.user.Account; @@ -44,6 +45,34 @@ public class AttachIsoCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + @Parameter(name="virtualmachineid", type=CommandType.LONG, required=true) + private Long virtualMachineId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + public Long getVirtualMachineId() { + return virtualMachineId; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/AttachVolumeCmd.java b/server/src/com/cloud/api/commands/AttachVolumeCmd.java index 53f0d5582bb..3879dde6f93 100644 --- a/server/src/com/cloud/api/commands/AttachVolumeCmd.java +++ b/server/src/com/cloud/api/commands/AttachVolumeCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.storage.VolumeVO; import com.cloud.user.Account; @@ -45,6 +46,41 @@ public class AttachVolumeCmd extends BaseCmd { } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="deviceid", type=CommandType.LONG) + private Long deviceId; + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + @Parameter(name="virtualmachineid", type=CommandType.LONG, required=true) + private Long virtualMachineId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getDeviceId() { + return deviceId; + } + + public Long getId() { + return id; + } + + public Long getVirtualMachineId() { + return virtualMachineId; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/AuthorizeNetworkGroupIngressCmd.java b/server/src/com/cloud/api/commands/AuthorizeNetworkGroupIngressCmd.java index 940105b54d7..1d8a850b2b5 100644 --- a/server/src/com/cloud/api/commands/AuthorizeNetworkGroupIngressCmd.java +++ b/server/src/com/cloud/api/commands/AuthorizeNetworkGroupIngressCmd.java @@ -28,6 +28,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.network.security.NetworkGroupVO; import com.cloud.user.Account; @@ -55,6 +56,93 @@ public class AuthorizeNetworkGroupIngressCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.USER_NETWORK_GROUP_LIST, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="protocol", type=CommandType.STRING) + private String protocol; + + @Parameter(name="startport", type=CommandType.INTEGER) + private Integer startPort; + + @Parameter(name="endport", type=CommandType.INTEGER) + private Integer endPort; + + @Parameter(name="icmptype", type=CommandType.INTEGER) + private Integer icmpType; + + @Parameter(name="icmpcode", type=CommandType.INTEGER) + private Integer icmpCode; + + @Parameter(name="networkgroupname", type=CommandType.STRING, required=true) + private String networkGroupName; + + @Parameter(name="cidrlist", type=CommandType.STRING) + private String cidrList; + + @Parameter(name="usernetworkgrouplist", type=CommandType.MAP) + private Map userNetworkGroupList; + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public String getCidrList() { + return cidrList; + } + + public Long getDomainId() { + return domainId; + } + + public Integer getEndPort() { + return endPort; + } + + public Integer getIcmpCode() { + return icmpCode; + } + + public Integer getIcmpType() { + return icmpType; + } + + public String getNetworkGroupName() { + return networkGroupName; + } + + public String getProtocol() { + if (protocol == null) { + return "all"; + } + return protocol; + } + + public Integer getStartPort() { + return startPort; + } + + public Map getUserNetworkGroupList() { + return userNetworkGroupList; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/CancelMaintenanceCmd.java b/server/src/com/cloud/api/commands/CancelMaintenanceCmd.java index 06c40619a4d..b1956359fd4 100644 --- a/server/src/com/cloud/api/commands/CancelMaintenanceCmd.java +++ b/server/src/com/cloud/api/commands/CancelMaintenanceCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.host.HostVO; import com.cloud.utils.Pair; @@ -39,6 +40,27 @@ public class CancelMaintenanceCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/CancelPrimaryStorageMaintenanceCmd.java b/server/src/com/cloud/api/commands/CancelPrimaryStorageMaintenanceCmd.java index 0472682b575..819b4c16772 100644 --- a/server/src/com/cloud/api/commands/CancelPrimaryStorageMaintenanceCmd.java +++ b/server/src/com/cloud/api/commands/CancelPrimaryStorageMaintenanceCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.exception.InvalidParameterValueException; import com.cloud.host.Status; @@ -44,6 +45,27 @@ public class CancelPrimaryStorageMaintenanceCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/CopyIsoCmd.java b/server/src/com/cloud/api/commands/CopyIsoCmd.java index 6b13d843e0d..553e03aa4a9 100644 --- a/server/src/com/cloud/api/commands/CopyIsoCmd.java +++ b/server/src/com/cloud/api/commands/CopyIsoCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.async.executor.CopyTemplateResultObject; import com.cloud.serializer.SerializerHelper; @@ -46,6 +47,41 @@ public class CopyIsoCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.DEST_ZONE_ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="destzoneid", type=CommandType.LONG, required=true) + private Long destZoneId; + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + @Parameter(name="sourcezoneid", type=CommandType.LONG, required=true) + private Long sourceZoneId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getDestinationZoneId() { + return destZoneId; + } + + public Long getId() { + return id; + } + + public Long getSourceZoneId() { + return sourceZoneId; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/CopyTemplateCmd.java b/server/src/com/cloud/api/commands/CopyTemplateCmd.java index 2ba53e15294..3b408cd2327 100644 --- a/server/src/com/cloud/api/commands/CopyTemplateCmd.java +++ b/server/src/com/cloud/api/commands/CopyTemplateCmd.java @@ -25,10 +25,9 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; -import com.cloud.async.AsyncJobResult; import com.cloud.async.executor.CopyTemplateResultObject; -import com.cloud.async.executor.CreatePrivateTemplateResultObject; import com.cloud.serializer.SerializerHelper; import com.cloud.storage.Storage; import com.cloud.storage.VMTemplateVO; @@ -48,6 +47,41 @@ public class CopyTemplateCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.DEST_ZONE_ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="destzoneid", type=CommandType.LONG, required=true) + private Long destZoneId; + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + @Parameter(name="sourcezoneid", type=CommandType.LONG, required=true) + private Long sourceZoneId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getDestinationZoneId() { + return destZoneId; + } + + public Long getId() { + return id; + } + + public Long getSourceZoneId() { + return sourceZoneId; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/CreateDiskOfferingCmd.java b/server/src/com/cloud/api/commands/CreateDiskOfferingCmd.java index a1e1099c079..745b7fcf2ce 100644 --- a/server/src/com/cloud/api/commands/CreateDiskOfferingCmd.java +++ b/server/src/com/cloud/api/commands/CreateDiskOfferingCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.domain.DomainVO; import com.cloud.exception.InvalidParameterValueException; @@ -48,6 +49,55 @@ public class CreateDiskOfferingCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.TAGS, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="disksize", type=CommandType.LONG, required=true) + private Long diskSize; + + @Parameter(name="displaytext", type=CommandType.STRING, required=true) + private String displayText; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="name", type=CommandType.STRING, required=true) + private String offeringName; + + @Parameter(name="tags", type=CommandType.STRING) + private String tags; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getDiskSize() { + return diskSize; + } + + public String getDisplayText() { + return displayText; + } + + public Long getDomainId() { + return domainId; + } + + public String getOfferingName() { + return offeringName; + } + + public String getTags() { + return tags; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/CreateDomainCmd.java b/server/src/com/cloud/api/commands/CreateDomainCmd.java index ff4cb1ccfd5..95dc099eff8 100644 --- a/server/src/com/cloud/api/commands/CreateDomainCmd.java +++ b/server/src/com/cloud/api/commands/CreateDomainCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.domain.DomainVO; import com.cloud.user.Account; @@ -42,6 +43,34 @@ public class CreateDomainCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.PARENT_DOMAIN_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="name", type=CommandType.STRING, required=true) + private String domainName; + + @Parameter(name="parentdomainid", type=CommandType.LONG) + private Long parentDomainId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getDomainName() { + return domainName; + } + + public Long getParentDomainId() { + return parentDomainId; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/CreateIPForwardingRuleCmd.java b/server/src/com/cloud/api/commands/CreateIPForwardingRuleCmd.java index 797029adec2..fbd5facb3c1 100644 --- a/server/src/com/cloud/api/commands/CreateIPForwardingRuleCmd.java +++ b/server/src/com/cloud/api/commands/CreateIPForwardingRuleCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.exception.NetworkRuleConflictException; import com.cloud.network.FirewallRuleVO; @@ -44,12 +45,61 @@ public class CreateIPForwardingRuleCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.IP_ADDRESS, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.PRIVATE_PORT, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.PROTOCOL, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.PUBLIC_PORT, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.PRIVATE_PORT, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.PROTOCOL, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.VIRTUAL_MACHINE_ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="ipaddress", type=CommandType.STRING, required=true) + private String ipAddress; + + @Parameter(name="privateport", type=CommandType.STRING, required=true) + private String privatePort; + + @Parameter(name="protocol", type=CommandType.STRING, required=true) + private String protocol; + + @Parameter(name="publicport", type=CommandType.STRING, required=true) + private String publicPort; + + @Parameter(name="virtualmachineid", type=CommandType.LONG, required=true) + private Long virtualMachineId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getIpAddress() { + return ipAddress; + } + + public String getPrivatePort() { + return privatePort; + } + + public String getProtocol() { + return protocol; + } + + public String getPublicPort() { + return publicPort; + } + + public Long getVirtualMachineId() { + return virtualMachineId; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/CreateLoadBalancerRuleCmd.java b/server/src/com/cloud/api/commands/CreateLoadBalancerRuleCmd.java index 5be0f45ae66..9ad2f2cb902 100644 --- a/server/src/com/cloud/api/commands/CreateLoadBalancerRuleCmd.java +++ b/server/src/com/cloud/api/commands/CreateLoadBalancerRuleCmd.java @@ -25,9 +25,10 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; -import com.cloud.dc.VlanVO; import com.cloud.dc.Vlan.VlanType; +import com.cloud.dc.VlanVO; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.PermissionDeniedException; import com.cloud.network.IPAddressVO; @@ -47,14 +48,71 @@ public class CreateLoadBalancerRuleCmd extends BaseCmd { static { s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); + + s_properties.add(new Pair(BaseCmd.Properties.ALGORITHM, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.DESCRIPTION, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.DESCRIPTION, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.PRIVATE_PORT, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.PUBLIC_IP, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.PUBLIC_PORT, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.PRIVATE_PORT, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.ALGORITHM, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="algorithm", type=CommandType.STRING, required=true) + private String algorithm; + + @Parameter(name="description", type=CommandType.STRING) + private String description; + + @Parameter(name="name", type=CommandType.STRING, required=true) + private String loadBalancerRuleName; + + @Parameter(name="privateport", type=CommandType.STRING, required=true) + private String privatePort; + + @Parameter(name="publicip", type=CommandType.STRING, required=true) + private String publicIp; + + @Parameter(name="publicport", type=CommandType.STRING, required=true) + private String publicPort; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAlgorithm() { + return algorithm; + } + + public String getDescription() { + return description; + } + + public String getLoadBalancerRuleName() { + return loadBalancerRuleName; + } + + public String getPrivatePort() { + return privatePort; + } + + public String getPublicIp() { + return publicIp; + } + + public String getPublicPort() { + return publicPort; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/CreateNetworkGroupCmd.java b/server/src/com/cloud/api/commands/CreateNetworkGroupCmd.java index 4b7712b64f8..f5e5cb5ca26 100644 --- a/server/src/com/cloud/api/commands/CreateNetworkGroupCmd.java +++ b/server/src/com/cloud/api/commands/CreateNetworkGroupCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.network.security.NetworkGroupVO; import com.cloud.user.Account; @@ -39,12 +40,55 @@ public class CreateNetworkGroupCmd extends BaseCmd { static { //s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.DESCRIPTION, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.DESCRIPTION, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="description", type=CommandType.STRING) + private String description; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="name", type=CommandType.STRING, required=true) + private String networkGroupName; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public String getDescription() { + return description; + } + + public Long getDomainId() { + return domainId; + } + + public String getNetworkGroupName() { + return networkGroupName; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/CreatePodCmd.java b/server/src/com/cloud/api/commands/CreatePodCmd.java index 2cf35e0acfb..ab9e2363069 100644 --- a/server/src/com/cloud/api/commands/CreatePodCmd.java +++ b/server/src/com/cloud/api/commands/CreatePodCmd.java @@ -25,10 +25,10 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.dc.DataCenterVO; import com.cloud.dc.HostPodVO; -import com.cloud.test.PodZoneConfig; import com.cloud.user.User; import com.cloud.utils.Pair; @@ -39,15 +39,72 @@ public class CreatePodCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { - s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.GATEWAY, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.CIDR, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.START_IP, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.END_IP, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.GATEWAY, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.START_IP, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="cidr", type=CommandType.STRING, required=true) + private String cidr; + + @Parameter(name="endip", type=CommandType.STRING) + private String endIp; + + @Parameter(name="gateway", type=CommandType.STRING, required=true) + private String gateway; + + @Parameter(name="name", type=CommandType.STRING, required=true) + private String podName; + + @Parameter(name="startip", type=CommandType.STRING, required=true) + private String startIp; + + @Parameter(name="zoneid", type=CommandType.LONG, required=true) + private Long zoneId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getCidr() { + return cidr; + } + + public String getEndIp() { + return endIp; + } + + public String getGateway() { + return gateway; + } + + public String getPodName() { + return podName; + } + + public String getStartIp() { + return startIp; + } + + public Long getZoneId() { + return zoneId; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/CreatePortForwardingServiceCmd.java b/server/src/com/cloud/api/commands/CreatePortForwardingServiceCmd.java index 285255f4d11..ee202d28ec8 100644 --- a/server/src/com/cloud/api/commands/CreatePortForwardingServiceCmd.java +++ b/server/src/com/cloud/api/commands/CreatePortForwardingServiceCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.network.SecurityGroupVO; import com.cloud.user.Account; @@ -38,13 +39,56 @@ public class CreatePortForwardingServiceCmd extends BaseCmd { static { //s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.DESCRIPTION, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.DESCRIPTION, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="description", type=CommandType.STRING) + private String description; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="name", type=CommandType.STRING, required=true) + private String portForwardingServiceName; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public String getDescription() { + return description; + } + + public Long getDomainId() { + return domainId; + } + + public String getPortForwardingServiceName() { + return portForwardingServiceName; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/CreatePortForwardingServiceRuleCmd.java b/server/src/com/cloud/api/commands/CreatePortForwardingServiceRuleCmd.java index f28221f8707..5a53d3b99fd 100644 --- a/server/src/com/cloud/api/commands/CreatePortForwardingServiceRuleCmd.java +++ b/server/src/com/cloud/api/commands/CreatePortForwardingServiceRuleCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.async.executor.CreateOrUpdateRuleResultObject; import com.cloud.network.SecurityGroupVO; @@ -40,13 +41,56 @@ public class CreatePortForwardingServiceRuleCmd extends BaseCmd { static { s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); + + s_properties.add(new Pair(BaseCmd.Properties.PORT_FORWARDING_SERVICE_ID, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.PRIVATE_PORT, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.PROTOCOL, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PUBLIC_PORT, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.PRIVATE_PORT, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.PROTOCOL, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.PORT_FORWARDING_SERVICE_ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="portforwardingserviceid", type=CommandType.LONG, required=true) + private Long portForwardingServiceId; + + @Parameter(name="privateport", type=CommandType.STRING, required=true) + private String privatePort; + + @Parameter(name="protocol", type=CommandType.STRING, required=true) + private String protocol; + + @Parameter(name="publicport", type=CommandType.STRING, required=true) + private String publicPort; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getPortForwardingServiceId() { + return portForwardingServiceId; + } + + public String getPrivatePort() { + return privatePort; + } + + public String getProtocol() { + return protocol; + } + + public String getPublicPort() { + return publicPort; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/CreateServiceOfferingCmd.java b/server/src/com/cloud/api/commands/CreateServiceOfferingCmd.java index 5d749cff451..9656ee9167e 100644 --- a/server/src/com/cloud/api/commands/CreateServiceOfferingCmd.java +++ b/server/src/com/cloud/api/commands/CreateServiceOfferingCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.offering.ServiceOffering.GuestIpType; import com.cloud.service.ServiceOfferingVO; @@ -37,18 +38,96 @@ public class CreateServiceOfferingCmd extends BaseCmd{ private static final List> s_properties = new ArrayList>(); static { + s_properties.add(new Pair(BaseCmd.Properties.CPU_NUMBER, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.CPU_SPEED, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.DISPLAY_TEXT, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.MEMORY, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.DISPLAY_TEXT, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.CPU_NUMBER, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.CPU_SPEED, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.MEMORY, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.OFFER_HA, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.STORAGE_TYPE, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.OFFER_HA, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.TAGS, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.USE_VIRTUAL_NETWORK, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.TAGS, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="cpunumber", type=CommandType.LONG, required=true) + private Long cpuNumber; + + @Parameter(name="cpuspeed", type=CommandType.LONG, required=true) + private Long cpuSpeed; + + @Parameter(name="displaytext", type=CommandType.STRING, required=true) + private String displayText; + + @Parameter(name="memory", type=CommandType.LONG, required=true) + private Long memory; + + @Parameter(name="name", type=CommandType.STRING, required=true) + private String serviceOfferingName; + + @Parameter(name="offerha", type=CommandType.BOOLEAN) + private Boolean offerHa; + + @Parameter(name="storagetype", type=CommandType.STRING) + private String storageType; + + @Parameter(name="tags", type=CommandType.STRING) + private String tags; + + @Parameter(name="usevirtualnetwork", type=CommandType.BOOLEAN) + private Boolean useVirtualNetwork; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getCpuNumber() { + return cpuNumber; + } + + public Long getCpuSpeed() { + return cpuSpeed; + } + + public String getDisplayText() { + return displayText; + } + + public Long getMemory() { + return memory; + } + + public String getServiceOfferingName() { + return serviceOfferingName; + } + + public Boolean getOfferHa() { + return offerHa; + } + + public String getStorageType() { + return storageType; + } + + public String getTags() { + return tags; + } + + public Boolean getUseVirtualNetwork() { + return useVirtualNetwork; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return _name; diff --git a/server/src/com/cloud/api/commands/CreateSnapshotCmd.java b/server/src/com/cloud/api/commands/CreateSnapshotCmd.java index 53b3efc9a22..36cee37902d 100644 --- a/server/src/com/cloud/api/commands/CreateSnapshotCmd.java +++ b/server/src/com/cloud/api/commands/CreateSnapshotCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.async.AsyncJobResult; import com.cloud.async.AsyncJobVO; @@ -32,7 +33,6 @@ import com.cloud.async.executor.CreateSnapshotResultObject; import com.cloud.exception.ResourceAllocationException; import com.cloud.serializer.SerializerHelper; import com.cloud.server.ManagementServer; -import com.cloud.storage.StoragePoolVO; import com.cloud.storage.VolumeVO; import com.cloud.utils.Pair; @@ -42,13 +42,49 @@ public class CreateSnapshotCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { - s_properties.add(new Pair(BaseCmd.Properties.VOLUME_ID, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.VOLUME_ID, Boolean.TRUE)); + + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="volumeid", type=CommandType.LONG, required=true) + private Long volumeId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + public Long getVolumeId() { + return volumeId; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/CreateSnapshotPolicyCmd.java b/server/src/com/cloud/api/commands/CreateSnapshotPolicyCmd.java index 88bb1896374..183e954266e 100644 --- a/server/src/com/cloud/api/commands/CreateSnapshotPolicyCmd.java +++ b/server/src/com/cloud/api/commands/CreateSnapshotPolicyCmd.java @@ -18,20 +18,20 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.exception.InvalidParameterValueException; import com.cloud.server.ManagementServer; import com.cloud.storage.SnapshotPolicyVO; import com.cloud.storage.StoragePoolVO; import com.cloud.storage.VolumeVO; -import com.cloud.user.Account; import com.cloud.utils.Pair; public class CreateSnapshotPolicyCmd extends BaseCmd { @@ -41,17 +41,81 @@ public class CreateSnapshotPolicyCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { - s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.INTERVAL_TYPE, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.MAX_SNAPS, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.SCHEDULE, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.TIMEZONE, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.VOLUME_ID, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.SCHEDULE, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.TIMEZONE, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.INTERVAL_TYPE, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.MAX_SNAPS, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="intervaltype", type=CommandType.STRING, required=true) + private String intervalType; + + @Parameter(name="maxsnaps", type=CommandType.INTEGER, required=true) + private Integer maxSnaps; + + @Parameter(name="schedule", type=CommandType.STRING, required=true) + private String schedule; + + @Parameter(name="timezone", type=CommandType.STRING, required=true) + private String timezone; + + @Parameter(name="volumeid", type=CommandType.LONG, required=true) + private Long volumeId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + public String getIntervalType() { + return intervalType; + } + + public Integer getMaxSnaps() { + return maxSnaps; + } + + public String getSchedule() { + return schedule; + } + + public String getTimezone() { + return timezone; + } + + public Long getVolumeId() { + return volumeId; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/CreateStoragePoolCmd.java b/server/src/com/cloud/api/commands/CreateStoragePoolCmd.java index d8515985b46..476bd0d456d 100644 --- a/server/src/com/cloud/api/commands/CreateStoragePoolCmd.java +++ b/server/src/com/cloud/api/commands/CreateStoragePoolCmd.java @@ -31,6 +31,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.dc.ClusterVO; import com.cloud.dc.DataCenterVO; @@ -47,15 +48,78 @@ public class CreateStoragePoolCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { - s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.URL, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.CLUSTER_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.DETAILS, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.POD_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.CLUSTER_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.TAGS, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.DETAILS, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.URL, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="clusterid", type=CommandType.LONG) + private Long clusterId; + + @Parameter(name="details", type=CommandType.MAP) + private Map details; + + @Parameter(name="name", type=CommandType.STRING, required=true) + private String storagePoolName; + + @Parameter(name="podid", type=CommandType.LONG) + private Long podId; + + @Parameter(name="tags", type=CommandType.STRING) + private String tags; + + @Parameter(name="url", type=CommandType.STRING, required=true) + private String url; + + @Parameter(name="zoneid", type=CommandType.LONG, required=true) + private Long zoneId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getClusterId() { + return clusterId; + } + + public Map getDetails() { + return details; + } + + public String getStoragePoolName() { + return storagePoolName; + } + + public Long getPodId() { + return podId; + } + + public String getTags() { + return tags; + } + + public String getUrl() { + return url; + } + + public Long getZoneId() { + return zoneId; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/CreateTemplateCmd.java b/server/src/com/cloud/api/commands/CreateTemplateCmd.java index fdc5dad6195..9b567b4f46d 100644 --- a/server/src/com/cloud/api/commands/CreateTemplateCmd.java +++ b/server/src/com/cloud/api/commands/CreateTemplateCmd.java @@ -25,9 +25,8 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; -import com.cloud.async.AsyncInstanceCreateStatus; -import com.cloud.async.AsyncJobResult; import com.cloud.async.executor.CreatePrivateTemplateResultObject; import com.cloud.serializer.SerializerHelper; import com.cloud.server.Criteria; @@ -43,20 +42,105 @@ public class CreateTemplateCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { + s_properties.add(new Pair(BaseCmd.Properties.BITS, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.DISPLAY_TEXT, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.IS_FEATURED, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.IS_PUBLIC, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.OS_TYPE_ID, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.PASSWORD_ENABLED, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.REQUIRES_HVM, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.SNAPSHOT_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.VOLUME_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.REQUIRES_HVM, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.BITS, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.PASSWORD_ENABLED, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.OS_TYPE_ID, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.IS_PUBLIC, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.IS_FEATURED, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.SNAPSHOT_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="bits", type=CommandType.INTEGER) + private Integer bits; + + @Parameter(name="displaytext", type=CommandType.STRING, required=true) + private String displayText; + + @Parameter(name="isfeatured", type=CommandType.BOOLEAN) + private Boolean featured; + + @Parameter(name="ispublic", type=CommandType.BOOLEAN) + private Boolean publicTemplate; + + @Parameter(name="name", type=CommandType.STRING, required=true) + private String templateName; + + @Parameter(name="ostypeid", type=CommandType.LONG, required=true) + private Long osTypeId; + + @Parameter(name="passwordenabled", type=CommandType.BOOLEAN) + private Boolean passwordEnabled; + + @Parameter(name="requireshvm", type=CommandType.BOOLEAN) + private Boolean requiresHvm; + + @Parameter(name="snapshotid", type=CommandType.LONG) + private Long snapshotId; + + @Parameter(name="volumeid", type=CommandType.LONG) + private Long volumeId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Integer getBits() { + return bits; + } + + public String getDisplayText() { + return displayText; + } + + public Boolean isFeatured() { + return featured; + } + + public Boolean isPublic() { + return publicTemplate; + } + + public String getTemplateName() { + return templateName; + } + + public Long getOsTypeId() { + return osTypeId; + } + + public Boolean isPasswordEnabled() { + return passwordEnabled; + } + + public Boolean getRequiresHvm() { + return requiresHvm; + } + + public Long getSnapshotId() { + return snapshotId; + } + + public Long getVolumeId() { + return volumeId; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } @@ -135,6 +219,14 @@ public class CreateTemplateCmd extends BaseCmd { c.addCriteria(Criteria.NAME, name); c.addCriteria(Criteria.CREATED_BY, Long.valueOf(volume.getAccountId())); List 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 (userId == null) { diff --git a/server/src/com/cloud/api/commands/CreateUserCmd.java b/server/src/com/cloud/api/commands/CreateUserCmd.java index d51237b963f..2eb047d2634 100644 --- a/server/src/com/cloud/api/commands/CreateUserCmd.java +++ b/server/src/com/cloud/api/commands/CreateUserCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.domain.DomainVO; import com.cloud.user.Account; @@ -39,17 +40,94 @@ public class CreateUserCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { - s_properties.add(new Pair(BaseCmd.Properties.USERNAME, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.PASSWORD, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.FIRSTNAME, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.LASTNAME, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.EMAIL, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_TYPE, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.EMAIL, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.FIRSTNAME, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.LASTNAME, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.PASSWORD, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.TIMEZONE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.USERNAME, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="accounttype", type=CommandType.LONG, required=true) + private Long accountType; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="email", type=CommandType.STRING, required=true) + private String email; + + @Parameter(name="firstname", type=CommandType.STRING, required=true) + private String firstname; + + @Parameter(name="lastname", type=CommandType.STRING, required=true) + private String lastname; + + @Parameter(name="password", type=CommandType.STRING, required=true) + private String password; + + @Parameter(name="timezone", type=CommandType.STRING) + private String timezone; + + @Parameter(name="username", type=CommandType.STRING, required=true) + private String username; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getAccountType() { + return accountType; + } + + public Long getDomainId() { + return domainId; + } + + public String getEmail() { + return email; + } + + public String getFirstname() { + return firstname; + } + + public String getLastname() { + return lastname; + } + + public String getPassword() { + return password; + } + + public String getTimezone() { + return timezone; + } + + public String getUsername() { + return username; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/CreateVlanIpRangeCmd.java b/server/src/com/cloud/api/commands/CreateVlanIpRangeCmd.java index bbf3b944db3..96cb4a862e7 100644 --- a/server/src/com/cloud/api/commands/CreateVlanIpRangeCmd.java +++ b/server/src/com/cloud/api/commands/CreateVlanIpRangeCmd.java @@ -18,19 +18,19 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.dc.HostPodVO; import com.cloud.dc.Vlan; -import com.cloud.dc.VlanVO; import com.cloud.dc.Vlan.VlanType; -import com.cloud.exception.InvalidParameterValueException; +import com.cloud.dc.VlanVO; import com.cloud.user.Account; import com.cloud.user.User; import com.cloud.utils.Pair; @@ -42,19 +42,104 @@ public class CreateVlanIpRangeCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { - s_properties.add(new Pair(BaseCmd.Properties.FOR_VIRTUAL_NETWORK, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.VLAN, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.GATEWAY, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.NETMASK, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.POD_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.START_IP, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.END_IP, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.FOR_VIRTUAL_NETWORK, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.GATEWAY, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.NETMASK, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.POD_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.START_IP, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.VLAN, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="endip", type=CommandType.STRING) + private String endIp; + + @Parameter(name="forvirtualnetwork", type=CommandType.BOOLEAN) + private Boolean forVirtualNetwork; + + @Parameter(name="gateway", type=CommandType.STRING, required=true) + private String gateway; + + @Parameter(name="netmask", type=CommandType.STRING, required=true) + private String netmask; + + @Parameter(name="podid", type=CommandType.LONG) + private Long podId; + + @Parameter(name="startip", type=CommandType.STRING, required=true) + private String startIp; + + @Parameter(name="vlan", type=CommandType.STRING) + private String vlan; + + @Parameter(name="zoneid", type=CommandType.LONG, required=true) + private Long zoneId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + public String getEndIp() { + return endIp; + } + + public Boolean isForVirtualNetwork() { + return forVirtualNetwork; + } + + public String getGateway() { + return gateway; + } + + public String getNetmask() { + return netmask; + } + + public Long getPodId() { + return podId; + } + + public String getStartIp() { + return startIp; + } + + public String getVlan() { + return vlan; + } + + public Long getZoneId() { + return zoneId; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/CreateVolumeCmd.java b/server/src/com/cloud/api/commands/CreateVolumeCmd.java index d9426d61852..25bec40d0df 100644 --- a/server/src/com/cloud/api/commands/CreateVolumeCmd.java +++ b/server/src/com/cloud/api/commands/CreateVolumeCmd.java @@ -25,11 +25,10 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.async.executor.VolumeOperationResultObject; -import com.cloud.exception.InvalidParameterValueException; import com.cloud.serializer.SerializerHelper; -import com.cloud.storage.DiskOfferingVO; import com.cloud.storage.Snapshot; import com.cloud.user.Account; import com.cloud.utils.Pair; @@ -42,15 +41,71 @@ public class CreateVolumeCmd extends BaseCmd { static { s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.DISK_OFFERING_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.DISK_OFFERING_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.SNAPSHOT_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.SIZE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="diskofferingid", type=CommandType.LONG) + private Long diskOfferingId; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="name", type=CommandType.STRING, required=true) + private String volumeName; + + @Parameter(name="snapshotid", type=CommandType.LONG) + private Long snapshotId; + + @Parameter(name="zoneid", type=CommandType.LONG) + private Long zoneId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDiskOfferingId() { + return diskOfferingId; + } + + public Long getDomainId() { + return domainId; + } + + public String getVolumeName() { + return volumeName; + } + + public Long getSnapshotId() { + return snapshotId; + } + + public Long getZoneId() { + return zoneId; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } @@ -73,7 +128,6 @@ public class CreateVolumeCmd extends BaseCmd { Long zoneId = (Long) params.get(BaseCmd.Properties.ZONE_ID.getName()); Long diskOfferingId = (Long) params.get(BaseCmd.Properties.DISK_OFFERING_ID.getName()); Long snapshotId = (Long)params.get(BaseCmd.Properties.SNAPSHOT_ID.getName()); - Long size = (Long)params.get(BaseCmd.Properties.SIZE.getName()); if (account == null) { // Admin API call @@ -113,45 +167,12 @@ public class CreateVolumeCmd extends BaseCmd { userId = Long.valueOf(Account.ACCOUNT_ID_SYSTEM); } - if(size==null){ - size = Long.valueOf(0); - } - boolean useSnapshot = false; - if (snapshotId == null) - { - if ((zoneId == null)) - { - throw new ServerApiException(BaseCmd.PARAM_ERROR, "Missing parameter,zoneid must be specified."); + 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(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 privateTemplateList = getManagementServer().findPrivateDiskOffering(); - diskOfferingId = privateTemplateList.get(0).getId(); //we use this id for creating volume - } - } - else - { + } else { useSnapshot = true; //Verify parameters Snapshot snapshotCheck = getManagementServer().findSnapshotById(snapshotId); @@ -176,7 +197,7 @@ public class CreateVolumeCmd extends BaseCmd { if (useSnapshot) { jobId = getManagementServer().createVolumeFromSnapshotAsync(userId, account.getId(), snapshotId, name); } else { - jobId = getManagementServer().createVolumeAsync(userId, account.getId(), name, zoneId, diskOfferingId, size); + jobId = getManagementServer().createVolumeAsync(userId, account.getId(), name, zoneId, diskOfferingId); } if (jobId == 0) { diff --git a/server/src/com/cloud/api/commands/CreateZoneCmd.java b/server/src/com/cloud/api/commands/CreateZoneCmd.java index fae7587bb62..dc094b56871 100644 --- a/server/src/com/cloud/api/commands/CreateZoneCmd.java +++ b/server/src/com/cloud/api/commands/CreateZoneCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.dc.DataCenterVO; import com.cloud.user.User; @@ -37,16 +38,80 @@ public class CreateZoneCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { - s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.DNS1, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.DNS2, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.GUEST_CIDR_ADDRESS, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.INTERNAL_DNS1, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.INTERNAL_DNS2, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.VNET, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.GUEST_CIDR_ADDRESS, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="dns1", type=CommandType.STRING, required=true) + private String dns1; + + @Parameter(name="dns2", type=CommandType.STRING) + private String dns2; + + @Parameter(name="guestcidraddress", type=CommandType.STRING, required=true) + private String guestCidrAddress; + + @Parameter(name="internaldns1", type=CommandType.STRING, required=true) + private String internalDns1; + + @Parameter(name="internaldns2", type=CommandType.STRING) + private String internalDns2; + + @Parameter(name="name", type=CommandType.STRING, required=true) + private String zoneName; + + @Parameter(name="vlan", type=CommandType.STRING) + private String vlan; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getDns1() { + return dns1; + } + + public String getDns2() { + return dns2; + } + + public String getGuestCidrAddress() { + return guestCidrAddress; + } + + public String getInternalDns1() { + return internalDns1; + } + + public String getInternalDns2() { + return internalDns2; + } + + public String getZoneName() { + return zoneName; + } + + public String getVlan() { + return vlan; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/DeleteDiskOfferingCmd.java b/server/src/com/cloud/api/commands/DeleteDiskOfferingCmd.java index aea19711107..b881358bb09 100644 --- a/server/src/com/cloud/api/commands/DeleteDiskOfferingCmd.java +++ b/server/src/com/cloud/api/commands/DeleteDiskOfferingCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.storage.DiskOfferingVO; import com.cloud.utils.Pair; @@ -39,6 +40,28 @@ public class DeleteDiskOfferingCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/DeleteDomainCmd.java b/server/src/com/cloud/api/commands/DeleteDomainCmd.java index 7ff5f1691e1..4f7b8ad4b32 100644 --- a/server/src/com/cloud/api/commands/DeleteDomainCmd.java +++ b/server/src/com/cloud/api/commands/DeleteDomainCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.domain.DomainVO; import com.cloud.user.Account; @@ -41,6 +42,34 @@ public class DeleteDomainCmd extends BaseCmd{ s_properties.add(new Pair(BaseCmd.Properties.CLEANUP, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + @Parameter(name="cleanup", type=CommandType.BOOLEAN) + private Boolean cleanup; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + public Boolean getCleanup() { + return cleanup; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/DeleteHostCmd.java b/server/src/com/cloud/api/commands/DeleteHostCmd.java index 47a66b93e9b..97d14a6f402 100644 --- a/server/src/com/cloud/api/commands/DeleteHostCmd.java +++ b/server/src/com/cloud/api/commands/DeleteHostCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.host.HostVO; import com.cloud.utils.Pair; @@ -39,6 +40,27 @@ public class DeleteHostCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/DeleteIPForwardingRuleCmd.java b/server/src/com/cloud/api/commands/DeleteIPForwardingRuleCmd.java index 9b9af0c6c82..d25f75c6828 100644 --- a/server/src/com/cloud/api/commands/DeleteIPForwardingRuleCmd.java +++ b/server/src/com/cloud/api/commands/DeleteIPForwardingRuleCmd.java @@ -18,22 +18,23 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - -import com.cloud.api.BaseCmd; -import com.cloud.api.ServerApiException; -import com.cloud.exception.InternalErrorException; -import com.cloud.exception.InvalidParameterValueException; -import com.cloud.exception.PermissionDeniedException; -import com.cloud.network.FirewallRuleVO; -import com.cloud.network.IPAddressVO; -import com.cloud.user.Account; -import com.cloud.user.User; -import com.cloud.utils.Pair; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + +import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; +import com.cloud.api.ServerApiException; +import com.cloud.exception.InternalErrorException; +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.exception.PermissionDeniedException; +import com.cloud.network.FirewallRuleVO; +import com.cloud.network.IPAddressVO; +import com.cloud.user.Account; +import com.cloud.user.User; +import com.cloud.utils.Pair; public class DeleteIPForwardingRuleCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DeleteIPForwardingRuleCmd.class.getName()); @@ -47,6 +48,27 @@ public class DeleteIPForwardingRuleCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/DeleteIsoCmd.java b/server/src/com/cloud/api/commands/DeleteIsoCmd.java index de376b2be5a..28319c9c801 100644 --- a/server/src/com/cloud/api/commands/DeleteIsoCmd.java +++ b/server/src/com/cloud/api/commands/DeleteIsoCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.storage.VMTemplateVO; import com.cloud.user.Account; @@ -42,6 +43,34 @@ public class DeleteIsoCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + @Parameter(name="zoneid", type=CommandType.LONG) + private Long zoneId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + public Long getZoneId() { + return zoneId; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/DeleteLoadBalancerRuleCmd.java b/server/src/com/cloud/api/commands/DeleteLoadBalancerRuleCmd.java index 3330d3d9278..c01493f76df 100644 --- a/server/src/com/cloud/api/commands/DeleteLoadBalancerRuleCmd.java +++ b/server/src/com/cloud/api/commands/DeleteLoadBalancerRuleCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.network.LoadBalancerVO; import com.cloud.user.Account; @@ -44,6 +45,41 @@ public class DeleteLoadBalancerRuleCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getId() { + return id; + } + + public Long getDomainId() { + return domainId; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/DeleteNetworkGroupCmd.java b/server/src/com/cloud/api/commands/DeleteNetworkGroupCmd.java index 9d7be7dd7f1..e96f7ae883f 100644 --- a/server/src/com/cloud/api/commands/DeleteNetworkGroupCmd.java +++ b/server/src/com/cloud/api/commands/DeleteNetworkGroupCmd.java @@ -7,6 +7,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.exception.PermissionDeniedException; import com.cloud.exception.ResourceInUseException; @@ -28,6 +29,41 @@ public class DeleteNetworkGroupCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="name", type=CommandType.STRING, required=true) + private String networkGroupName; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + public String getNetworkGroupName() { + return networkGroupName; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/DeletePodCmd.java b/server/src/com/cloud/api/commands/DeletePodCmd.java index 92e5d8939b1..56c188eba2b 100644 --- a/server/src/com/cloud/api/commands/DeletePodCmd.java +++ b/server/src/com/cloud/api/commands/DeletePodCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.dc.HostPodVO; import com.cloud.user.User; @@ -41,6 +42,27 @@ public class DeletePodCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/DeletePoolCmd.java b/server/src/com/cloud/api/commands/DeletePoolCmd.java index 16e5fdd0c40..f32b1147d79 100644 --- a/server/src/com/cloud/api/commands/DeletePoolCmd.java +++ b/server/src/com/cloud/api/commands/DeletePoolCmd.java @@ -7,9 +7,10 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; -import com.cloud.storage.StoragePoolVO; import com.cloud.storage.Storage.StoragePoolType; +import com.cloud.storage.StoragePoolVO; import com.cloud.utils.Pair; public class DeletePoolCmd extends BaseCmd { @@ -22,6 +23,27 @@ public class DeletePoolCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/DeletePortForwardingServiceCmd.java b/server/src/com/cloud/api/commands/DeletePortForwardingServiceCmd.java index 72d92be15d5..47d5fcf5898 100644 --- a/server/src/com/cloud/api/commands/DeletePortForwardingServiceCmd.java +++ b/server/src/com/cloud/api/commands/DeletePortForwardingServiceCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.network.SecurityGroupVO; import com.cloud.user.Account; @@ -43,6 +44,27 @@ public class DeletePortForwardingServiceCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/DeletePortForwardingServiceRuleCmd.java b/server/src/com/cloud/api/commands/DeletePortForwardingServiceRuleCmd.java index 40e0edc1e14..8fc542e0ce2 100644 --- a/server/src/com/cloud/api/commands/DeletePortForwardingServiceRuleCmd.java +++ b/server/src/com/cloud/api/commands/DeletePortForwardingServiceRuleCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.exception.PermissionDeniedException; import com.cloud.user.Account; @@ -42,6 +43,27 @@ public class DeletePortForwardingServiceRuleCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/DeleteServiceOfferingCmd.java b/server/src/com/cloud/api/commands/DeleteServiceOfferingCmd.java index e6ae7815444..72cfb3c5f05 100644 --- a/server/src/com/cloud/api/commands/DeleteServiceOfferingCmd.java +++ b/server/src/com/cloud/api/commands/DeleteServiceOfferingCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.service.ServiceOfferingVO; import com.cloud.user.User; @@ -40,6 +41,27 @@ public class DeleteServiceOfferingCmd extends BaseCmd{ s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/DeleteSnapshotCmd.java b/server/src/com/cloud/api/commands/DeleteSnapshotCmd.java index bee684954e6..45311960079 100644 --- a/server/src/com/cloud/api/commands/DeleteSnapshotCmd.java +++ b/server/src/com/cloud/api/commands/DeleteSnapshotCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.storage.Snapshot; import com.cloud.user.Account; @@ -36,14 +37,50 @@ public class DeleteSnapshotCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); } - public String getName() { + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + public Long getId() { + return id; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/DeleteSnapshotPoliciesCmd.java b/server/src/com/cloud/api/commands/DeleteSnapshotPoliciesCmd.java index fe526255bc0..5bcbd1fb0f8 100644 --- a/server/src/com/cloud/api/commands/DeleteSnapshotPoliciesCmd.java +++ b/server/src/com/cloud/api/commands/DeleteSnapshotPoliciesCmd.java @@ -26,12 +26,12 @@ import java.util.StringTokenizer; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.exception.InvalidParameterValueException; import com.cloud.server.ManagementServer; import com.cloud.storage.SnapshotPolicyVO; import com.cloud.storage.VolumeVO; -import com.cloud.user.Account; import com.cloud.utils.Pair; public class DeleteSnapshotPoliciesCmd extends BaseCmd { @@ -41,14 +41,57 @@ public class DeleteSnapshotPoliciesCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { - s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.IDS, Boolean.FALSE)); + + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="id", type=CommandType.LONG) + private Long id; + + @Parameter(name="ids", type=CommandType.LIST, collectionType=CommandType.LONG) + private List ids; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + public Long getId() { + return id; + } + + public List getIds() { + return ids; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/DeleteTemplateCmd.java b/server/src/com/cloud/api/commands/DeleteTemplateCmd.java index 386f1442b54..b1196c8c490 100644 --- a/server/src/com/cloud/api/commands/DeleteTemplateCmd.java +++ b/server/src/com/cloud/api/commands/DeleteTemplateCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.storage.VMTemplateVO; import com.cloud.user.Account; @@ -42,6 +43,34 @@ public class DeleteTemplateCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + @Parameter(name="zoneid", type=CommandType.LONG) + private Long zoneId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + public Long getZoneId() { + return zoneId; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/DeleteUserCmd.java b/server/src/com/cloud/api/commands/DeleteUserCmd.java index 279feff61ea..0740cae89f4 100644 --- a/server/src/com/cloud/api/commands/DeleteUserCmd.java +++ b/server/src/com/cloud/api/commands/DeleteUserCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.user.Account; import com.cloud.user.User; @@ -39,6 +40,27 @@ public class DeleteUserCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public static String getStaticName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/DeleteVlanIpRangeCmd.java b/server/src/com/cloud/api/commands/DeleteVlanIpRangeCmd.java index 65ddaf49894..4d4425f5d66 100644 --- a/server/src/com/cloud/api/commands/DeleteVlanIpRangeCmd.java +++ b/server/src/com/cloud/api/commands/DeleteVlanIpRangeCmd.java @@ -18,16 +18,15 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.StringTokenizer; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; -import com.cloud.dc.VlanVO; import com.cloud.exception.InvalidParameterValueException; import com.cloud.user.User; import com.cloud.utils.Pair; @@ -43,6 +42,27 @@ public class DeleteVlanIpRangeCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/DeleteVolumeCmd.java b/server/src/com/cloud/api/commands/DeleteVolumeCmd.java index 601162eb510..f57fcf78203 100644 --- a/server/src/com/cloud/api/commands/DeleteVolumeCmd.java +++ b/server/src/com/cloud/api/commands/DeleteVolumeCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.storage.VolumeVO; import com.cloud.user.Account; @@ -40,6 +41,27 @@ public class DeleteVolumeCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/DeleteZoneCmd.java b/server/src/com/cloud/api/commands/DeleteZoneCmd.java index 23f1314c7fd..d28dee505fd 100644 --- a/server/src/com/cloud/api/commands/DeleteZoneCmd.java +++ b/server/src/com/cloud/api/commands/DeleteZoneCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.dc.DataCenterVO; import com.cloud.user.User; @@ -41,6 +42,27 @@ public class DeleteZoneCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/DeployVMCmd.java b/server/src/com/cloud/api/commands/DeployVMCmd.java index 63c4b9aa47f..195aaf15229 100644 --- a/server/src/com/cloud/api/commands/DeployVMCmd.java +++ b/server/src/com/cloud/api/commands/DeployVMCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.async.executor.DeployVMResultObject; import com.cloud.dc.DataCenterVO; @@ -44,21 +45,105 @@ public class DeployVMCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { - s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.SERVICE_OFFERING_ID, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.DISK_OFFERING_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.TEMPLATE_ID, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.DISPLAY_NAME, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.GROUP, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.USER_DATA, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.DISK_OFFERING_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.DISPLAY_NAME, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.GROUP, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.NETWORK_GROUP_LIST, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.SIZE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.SERVICE_OFFERING_ID, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.TEMPLATE_ID, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.USER_DATA, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.TRUE)); + + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="diskofferingid", type=CommandType.LONG) + private Long diskOfferingId; + + @Parameter(name="displayname", type=CommandType.STRING) + private String displayName; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="group", type=CommandType.STRING) + private String group; + + @Parameter(name="networkgrouplist", type=CommandType.LIST, collectionType=CommandType.STRING) + private List networkGroupList; + + @Parameter(name="serviceofferingid", type=CommandType.LONG, required=true) + private Long serviceOfferingId; + + @Parameter(name="templateid", type=CommandType.LONG, required=true) + private Long templateId; + + @Parameter(name="userdata", type=CommandType.STRING) + private String userData; + + @Parameter(name="zoneid", type=CommandType.LONG, required=true) + private Long zoneId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDiskOfferingId() { + return diskOfferingId; + } + + public String getDisplayName() { + return displayName; + } + + public Long getDomainId() { + return domainId; + } + + public String getGroup() { + return group; + } + + public List getNetworkGroupList() { + return networkGroupList; + } + + public Long getServiceOfferingId() { + return serviceOfferingId; + } + + public Long getTemplateId() { + return templateId; + } + + public String getUserData() { + return userData; + } + + public Long getZoneId() { + return zoneId; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; @@ -87,13 +172,10 @@ public class DeployVMCmd extends BaseCmd { String group = (String)params.get(BaseCmd.Properties.GROUP.getName()); String userData = (String) params.get(BaseCmd.Properties.USER_DATA.getName()); String networkGroupList = (String)params.get(BaseCmd.Properties.NETWORK_GROUP_LIST.getName()); - Long size = (Long)params.get(BaseCmd.Properties.SIZE.getName()); + String password = null; Long accountId = null; - - if(size == null) - size = Long.valueOf(0); - + VMTemplateVO template = getManagementServer().findTemplateById(templateId); if (template == null) { throw new ServerApiException(BaseCmd.VM_INVALID_PARAM_ERROR, "Unable to find template with id " + templateId); @@ -171,7 +253,7 @@ public class DeployVMCmd extends BaseCmd { long jobId = mgr.deployVirtualMachineAsync(userId.longValue(), accountId.longValue(), zoneId.longValue(), serviceOfferingId.longValue(), templateId.longValue(), diskOfferingId, - null, password, displayName, group, userData, groups,size); + null, password, displayName, group, userData, groups); long vmId = 0; if (jobId == 0) { diff --git a/server/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java b/server/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java index 31ec1ec5590..1fb444af877 100644 --- a/server/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java +++ b/server/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.utils.Pair; import com.cloud.vm.ConsoleProxyVO; @@ -39,6 +40,27 @@ public class DestroyConsoleProxyCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/DestroyVMCmd.java b/server/src/com/cloud/api/commands/DestroyVMCmd.java index 7cd4414b9d5..2e286ab06bb 100644 --- a/server/src/com/cloud/api/commands/DestroyVMCmd.java +++ b/server/src/com/cloud/api/commands/DestroyVMCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.user.Account; import com.cloud.utils.Pair; @@ -42,6 +43,27 @@ public class DestroyVMCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/DetachIsoCmd.java b/server/src/com/cloud/api/commands/DetachIsoCmd.java index 0b443a98a4f..132ebfe4549 100644 --- a/server/src/com/cloud/api/commands/DetachIsoCmd.java +++ b/server/src/com/cloud/api/commands/DetachIsoCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.user.Account; import com.cloud.utils.Pair; @@ -42,6 +43,27 @@ public class DetachIsoCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="virtualmachineid", type=CommandType.LONG, required=true) + private Long virtualMachineId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getVirtualMachineId() { + return virtualMachineId; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/DetachVolumeCmd.java b/server/src/com/cloud/api/commands/DetachVolumeCmd.java index d8f69b965d4..b5627ee8abc 100644 --- a/server/src/com/cloud/api/commands/DetachVolumeCmd.java +++ b/server/src/com/cloud/api/commands/DetachVolumeCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.storage.VolumeVO; import com.cloud.user.Account; @@ -40,6 +41,27 @@ public class DetachVolumeCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/DisableAccountCmd.java b/server/src/com/cloud/api/commands/DisableAccountCmd.java index 8b3b63478eb..0c9c5917e3d 100644 --- a/server/src/com/cloud/api/commands/DisableAccountCmd.java +++ b/server/src/com/cloud/api/commands/DisableAccountCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.user.Account; import com.cloud.utils.Pair; @@ -40,6 +41,34 @@ public class DisableAccountCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/DisableUserCmd.java b/server/src/com/cloud/api/commands/DisableUserCmd.java index b16c360c1c5..2d5ab371e12 100644 --- a/server/src/com/cloud/api/commands/DisableUserCmd.java +++ b/server/src/com/cloud/api/commands/DisableUserCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.user.Account; import com.cloud.user.User; @@ -40,6 +41,27 @@ public class DisableUserCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/DisassociateIPAddrCmd.java b/server/src/com/cloud/api/commands/DisassociateIPAddrCmd.java index 678f8f73068..50fb9e55b1b 100644 --- a/server/src/com/cloud/api/commands/DisassociateIPAddrCmd.java +++ b/server/src/com/cloud/api/commands/DisassociateIPAddrCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.exception.PermissionDeniedException; import com.cloud.user.Account; @@ -42,6 +43,27 @@ public class DisassociateIPAddrCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="ipaddress", type=CommandType.STRING, required=true) + private String ipAddress; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getIpAddress() { + return ipAddress; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/EnableAccountCmd.java b/server/src/com/cloud/api/commands/EnableAccountCmd.java index 2d718e2f35f..fa35b18f47f 100644 --- a/server/src/com/cloud/api/commands/EnableAccountCmd.java +++ b/server/src/com/cloud/api/commands/EnableAccountCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.user.Account; import com.cloud.utils.Pair; @@ -41,6 +42,34 @@ public class EnableAccountCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/EnableUserCmd.java b/server/src/com/cloud/api/commands/EnableUserCmd.java index c2b607f908e..5ca6fe256e6 100644 --- a/server/src/com/cloud/api/commands/EnableUserCmd.java +++ b/server/src/com/cloud/api/commands/EnableUserCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.user.Account; import com.cloud.user.User; @@ -41,6 +42,27 @@ public class EnableUserCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/GetCloudIdentifierCmd.java b/server/src/com/cloud/api/commands/GetCloudIdentifierCmd.java index a917a050ab6..37f0be9275e 100644 --- a/server/src/com/cloud/api/commands/GetCloudIdentifierCmd.java +++ b/server/src/com/cloud/api/commands/GetCloudIdentifierCmd.java @@ -37,6 +37,24 @@ public class GetCloudIdentifierCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + // none -- a no argument API command + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + // none -- a no argument API command + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/ListAccountsCmd.java b/server/src/com/cloud/api/commands/ListAccountsCmd.java index 46d6dc0cb17..89ed0af27d2 100644 --- a/server/src/com/cloud/api/commands/ListAccountsCmd.java +++ b/server/src/com/cloud/api/commands/ListAccountsCmd.java @@ -26,6 +26,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.configuration.ResourceCount.ResourceType; import com.cloud.domain.DomainVO; @@ -43,19 +44,82 @@ public class ListAccountsCmd extends BaseCmd{ private static final List> s_properties = new ArrayList>(); static { + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_TYPE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.IS_CLEANUP_REQUIRED, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_TYPE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.STATE, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.IS_CLEANUP_REQUIRED, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); + + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="accounttype", type=CommandType.LONG) + private Long accountType; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="id", type=CommandType.LONG) + private Long id; + + @Parameter(name="iscleanuprequired", type=CommandType.BOOLEAN) + private Boolean cleanupRequired; + + @Parameter(name="name", type=CommandType.STRING) + private String searchName; + + @Parameter(name="state", type=CommandType.STRING) + private String state; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getAccountType() { + return accountType; + } + + public Long getDomainId() { + return domainId; + } + + public Long getId() { + return id; + } + + public Boolean isCleanupRequired() { + return cleanupRequired; + } + + public String getSearchName() { + return searchName; + } + + public String getState() { + return state; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/ListAlertsCmd.java b/server/src/com/cloud/api/commands/ListAlertsCmd.java index fb72fa06012..4fb5bcd0352 100644 --- a/server/src/com/cloud/api/commands/ListAlertsCmd.java +++ b/server/src/com/cloud/api/commands/ListAlertsCmd.java @@ -18,86 +18,109 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.alert.AlertVO; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.server.Criteria; import com.cloud.utils.Pair; -public class ListAlertsCmd extends BaseCmd{ - - public static final Logger s_logger = Logger.getLogger(ListAlertsCmd.class.getName()); - - private static final String s_name = "listalertsresponse"; - private static final List> s_properties = new ArrayList>(); - - public String getName() { - return s_name; - } - public List> getProperties() { - return s_properties; - } - - static { - s_properties.add(new Pair(BaseCmd.Properties.TYPE, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); - } - - - @Override - public List> execute(Map params) { - String alertType = (String)params.get(BaseCmd.Properties.TYPE.getName()); - String keyword = (String)params.get(BaseCmd.Properties.KEYWORD.getName()); - Integer page = (Integer)params.get(BaseCmd.Properties.PAGE.getName()); - Integer pageSize = (Integer)params.get(BaseCmd.Properties.PAGESIZE.getName()); - - Long startIndex = Long.valueOf(0); - int pageSizeNum = 50; - if (pageSize != null) { - pageSizeNum = pageSize.intValue(); - } - if (page != null) { - int pageNum = page.intValue(); - if (pageNum > 0) { - startIndex = Long.valueOf(pageSizeNum * (pageNum-1)); - } - } - - Criteria c = new Criteria ("lastSent", Boolean.FALSE, startIndex, Long.valueOf(pageSizeNum)); - c.addCriteria(Criteria.KEYWORD, keyword); - - if (keyword == null) - c.addCriteria(Criteria.TYPE, alertType); - - List alerts = getManagementServer().searchForAlerts(c); - - if (alerts == null ) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "unable to find alerts"); - } - - List> alertsTags = new ArrayList>(); - Object[] aTag = new Object[alerts.size()]; - int i=0; - - for (AlertVO alert : alerts) { - List> alertData = new ArrayList>(); - alertData.add(new Pair(BaseCmd.Properties.TYPE.getName(), alert.getType())); - alertData.add(new Pair(BaseCmd.Properties.DESCRIPTION.getName(), alert.getSubject())); - alertData.add(new Pair(BaseCmd.Properties.SENT.getName(), alert.getLastSent())); - aTag[i++] = alertData; - } - - Pair alertTag = new Pair("alert", aTag); - alertsTags.add(alertTag); - return alertsTags; - - } -} + +public class ListAlertsCmd extends BaseCmd { + + public static final Logger s_logger = Logger.getLogger(ListAlertsCmd.class.getName()); + + private static final String s_name = "listalertsresponse"; + private static final List> s_properties = new ArrayList>(); + + static { + s_properties.add(new Pair(BaseCmd.Properties.TYPE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); + } + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="type", type=CommandType.STRING) + private String type; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getType() { + return type; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + public String getName() { + return s_name; + } + + public List> getProperties() { + return s_properties; + } + + @Override + public List> execute(Map params) { + String alertType = (String) params.get(BaseCmd.Properties.TYPE.getName()); + String keyword = (String) params.get(BaseCmd.Properties.KEYWORD.getName()); + Integer page = (Integer) params.get(BaseCmd.Properties.PAGE.getName()); + Integer pageSize = (Integer) params.get(BaseCmd.Properties.PAGESIZE.getName()); + + Long startIndex = Long.valueOf(0); + int pageSizeNum = 50; + if (pageSize != null) { + pageSizeNum = pageSize.intValue(); + } + if (page != null) { + int pageNum = page.intValue(); + if (pageNum > 0) { + startIndex = Long.valueOf(pageSizeNum * (pageNum - 1)); + } + } + + Criteria c = new Criteria("lastSent", Boolean.FALSE, startIndex, Long.valueOf(pageSizeNum)); + c.addCriteria(Criteria.KEYWORD, keyword); + + if (keyword == null) + c.addCriteria(Criteria.TYPE, alertType); + + List alerts = getManagementServer().searchForAlerts(c); + + if (alerts == null) { + throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "unable to find alerts"); + } + + List> alertsTags = new ArrayList>(); + Object[] aTag = new Object[alerts.size()]; + int i = 0; + + for (AlertVO alert : alerts) { + List> alertData = new ArrayList>(); + alertData.add(new Pair(BaseCmd.Properties.TYPE.getName(), alert.getType())); + alertData.add(new Pair(BaseCmd.Properties.DESCRIPTION.getName(), alert.getSubject())); + alertData.add(new Pair(BaseCmd.Properties.SENT.getName(), alert.getLastSent())); + aTag[i++] = alertData; + } + + Pair alertTag = new Pair("alert", aTag); + alertsTags.add(alertTag); + return alertsTags; + + } +} diff --git a/server/src/com/cloud/api/commands/ListAsyncJobsCmd.java b/server/src/com/cloud/api/commands/ListAsyncJobsCmd.java index 19aaf959383..2a7563dfee4 100644 --- a/server/src/com/cloud/api/commands/ListAsyncJobsCmd.java +++ b/server/src/com/cloud/api/commands/ListAsyncJobsCmd.java @@ -25,6 +25,7 @@ import java.util.List; import java.util.Map; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.async.AsyncJobVO; import com.cloud.server.Criteria; @@ -38,12 +39,48 @@ public class ListAsyncJobsCmd extends BaseCmd { static { s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.START_TZDATE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="startdate", type=CommandType.TZDATE) + private Date startDate; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + public Date getStartDate() { + return startDate; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/ListCapacityCmd.java b/server/src/com/cloud/api/commands/ListCapacityCmd.java index 59f4fd9904a..08659ee7b3c 100644 --- a/server/src/com/cloud/api/commands/ListCapacityCmd.java +++ b/server/src/com/cloud/api/commands/ListCapacityCmd.java @@ -18,23 +18,24 @@ package com.cloud.api.commands; -import java.text.DecimalFormat; -import java.util.ArrayList; -import java.util.HashMap; +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.HashMap; import java.util.HashSet; -import java.util.List; -import java.util.Map; +import java.util.List; +import java.util.Map; import java.util.Set; -import java.util.StringTokenizer; - -import org.apache.log4j.Logger; - +import java.util.StringTokenizer; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.capacity.CapacityVO; import com.cloud.server.Criteria; -import com.cloud.storage.StoragePoolVO; import com.cloud.storage.Storage.StoragePoolType; +import com.cloud.storage.StoragePoolVO; import com.cloud.utils.Pair; public class ListCapacityCmd extends BaseCmd{ @@ -45,6 +46,57 @@ public class ListCapacityCmd extends BaseCmd{ private static final String s_name = "listcapacityresponse"; private static final List> s_properties = new ArrayList>(); + static { + s_properties.add(new Pair(BaseCmd.Properties.HOST_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.POD_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.TYPE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.FALSE)); + + s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); + } + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="hostid", type=CommandType.LONG) + private Long hostId; + + @Parameter(name="podid", type=CommandType.LONG) + private Long podId; + + @Parameter(name="type", type=CommandType.STRING) + private String type; + + @Parameter(name="zoneid", type=CommandType.LONG) + private Long zoneId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getHostId() { + return hostId; + } + + public Long getPodId() { + return podId; + } + + public String getType() { + return type; + } + + public Long getZoneId() { + return zoneId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } @@ -52,15 +104,6 @@ public class ListCapacityCmd extends BaseCmd{ return s_properties; } - static { - s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.POD_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.HOST_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.TYPE, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); - } - public List> execute(Map params) { Long zoneId = (Long)params.get(BaseCmd.Properties.ZONE_ID.getName()); Long podId = (Long)params.get(BaseCmd.Properties.POD_ID.getName()); diff --git a/server/src/com/cloud/api/commands/ListCfgsByCmd.java b/server/src/com/cloud/api/commands/ListCfgsByCmd.java index ae27b6e92f9..e42f6eba497 100644 --- a/server/src/com/cloud/api/commands/ListCfgsByCmd.java +++ b/server/src/com/cloud/api/commands/ListCfgsByCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.configuration.ConfigurationVO; import com.cloud.server.Criteria; @@ -39,11 +40,40 @@ public class ListCfgsByCmd extends BaseCmd { static { s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.CATEGORY, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="category", type=CommandType.STRING) + private String category; + + @Parameter(name="name", type=CommandType.STRING) + private String configName; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getCategory() { + return category; + } + + public String getConfigName() { + return configName; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/ListClustersCmd.java b/server/src/com/cloud/api/commands/ListClustersCmd.java index c08eaebfe93..4c5ca1efdd6 100644 --- a/server/src/com/cloud/api/commands/ListClustersCmd.java +++ b/server/src/com/cloud/api/commands/ListClustersCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.dc.ClusterVO; import com.cloud.dc.DataCenterVO; @@ -43,10 +44,52 @@ public class ListClustersCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.POD_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); + + s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG) + private Long id; + + @Parameter(name="name", type=CommandType.STRING) + private String clusterName; + + @Parameter(name="podid", type=CommandType.LONG) + private Long podId; + + @Parameter(name="zoneid", type=CommandType.LONG) + private Long zoneId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + public String getClusterName() { + return clusterName; + } + + public Long getPodId() { + return podId; + } + + public Long getZoneId() { + return zoneId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/ListDiskOfferingsCmd.java b/server/src/com/cloud/api/commands/ListDiskOfferingsCmd.java index f549d6286c1..c3c3363bc84 100644 --- a/server/src/com/cloud/api/commands/ListDiskOfferingsCmd.java +++ b/server/src/com/cloud/api/commands/ListDiskOfferingsCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.server.Criteria; import com.cloud.storage.DiskOfferingVO; import com.cloud.utils.Pair; @@ -37,14 +38,51 @@ public class ListDiskOfferingsCmd extends BaseCmd { static { s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="id", type=CommandType.LONG) + private Long id; + + @Parameter(name="name", type=CommandType.STRING) + private String diskOfferingName; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getDomainId() { + return domainId; + } + + public Long getId() { + return id; + } + + public String getDiskOfferingName() { + return diskOfferingName; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/ListDomainChildrenCmd.java b/server/src/com/cloud/api/commands/ListDomainChildrenCmd.java index 3e3150f56b4..ed13b7d3567 100644 --- a/server/src/com/cloud/api/commands/ListDomainChildrenCmd.java +++ b/server/src/com/cloud/api/commands/ListDomainChildrenCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.domain.DomainVO; import com.cloud.server.Criteria; @@ -39,14 +40,51 @@ public class ListDomainChildrenCmd extends BaseCmd { static { s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); + + s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.IS_RECURSIVE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.IS_RECURSIVE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG) + private Long id; + + @Parameter(name="isrecursive", type=CommandType.BOOLEAN) + private Boolean recursive; + + @Parameter(name="name", type=CommandType.STRING) + private String domainName; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + public Boolean isRecursive() { + return recursive; + } + + public String getDomainName() { + return domainName; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/ListDomainsCmd.java b/server/src/com/cloud/api/commands/ListDomainsCmd.java index 42c0576fb9c..4a45f8a65ab 100644 --- a/server/src/com/cloud/api/commands/ListDomainsCmd.java +++ b/server/src/com/cloud/api/commands/ListDomainsCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.domain.DomainVO; import com.cloud.server.Criteria; @@ -39,14 +40,51 @@ public class ListDomainsCmd extends BaseCmd { static { s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.FALSE)); + + s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_LEVEL, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG) + private Long id; + + @Parameter(name="level", type=CommandType.INTEGER) + private Integer level; + + @Parameter(name="name", type=CommandType.STRING) + private String domainName; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + public Integer getLevel() { + return level; + } + + public String getDomainName() { + return domainName; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/ListEventsCmd.java b/server/src/com/cloud/api/commands/ListEventsCmd.java index 7cefef97c4a..089aca5577a 100644 --- a/server/src/com/cloud/api/commands/ListEventsCmd.java +++ b/server/src/com/cloud/api/commands/ListEventsCmd.java @@ -18,14 +18,15 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.domain.DomainVO; import com.cloud.event.EventVO; @@ -41,21 +42,84 @@ public class ListEventsCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.TYPE, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.LEVEL, Boolean.FALSE)); -// s_properties.add(new Pair(BaseCmd.Properties.DESCRIPTION, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.START_DATE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.DURATION, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.END_DATE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ENTRY_TIME, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.DURATION, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.LEVEL, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.START_DATE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.TYPE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="duration", type=CommandType.INTEGER) + private Integer duration; + + @Parameter(name="enddate", type=CommandType.DATE) + private Date endDate; + + @Parameter(name="entrytime", type=CommandType.INTEGER) + private Integer entryTime; + + @Parameter(name="startdate", type=CommandType.DATE) + private Date startDate; + + @Parameter(name="type", type=CommandType.STRING) + private String type; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + public Integer getDuration() { + return duration; + } + + public Date getEndDate() { + return endDate; + } + + public Integer getEntryTime() { + return entryTime; + } + + public Date getStartDate() { + return startDate; + } + + public String getType() { + return type; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/ListGuestOsCategoriesCmd.java b/server/src/com/cloud/api/commands/ListGuestOsCategoriesCmd.java index a50bfbd70be..c0c48cb9c04 100644 --- a/server/src/com/cloud/api/commands/ListGuestOsCategoriesCmd.java +++ b/server/src/com/cloud/api/commands/ListGuestOsCategoriesCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.server.Criteria; import com.cloud.storage.GuestOSCategoryVO; @@ -42,6 +43,27 @@ public class ListGuestOsCategoriesCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG) + private Long id; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/ListGuestOsCmd.java b/server/src/com/cloud/api/commands/ListGuestOsCmd.java index 23185193a98..3037eaf78c2 100644 --- a/server/src/com/cloud/api/commands/ListGuestOsCmd.java +++ b/server/src/com/cloud/api/commands/ListGuestOsCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.server.Criteria; import com.cloud.storage.GuestOSVO; @@ -42,6 +43,35 @@ public class ListGuestOsCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); } + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG) + private Long id; + + @Parameter(name="oscategoryid", type=CommandType.LONG) + private Long osCategoryId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + public Long getOsCategoryId() { + return osCategoryId; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/ListHostsCmd.java b/server/src/com/cloud/api/commands/ListHostsCmd.java index 5416d88d630..18e343cd1e6 100644 --- a/server/src/com/cloud/api/commands/ListHostsCmd.java +++ b/server/src/com/cloud/api/commands/ListHostsCmd.java @@ -27,6 +27,7 @@ import java.util.Set; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.dc.ClusterVO; import com.cloud.host.Host; @@ -46,18 +47,82 @@ public class ListHostsCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { + s_properties.add(new Pair(BaseCmd.Properties.CLUSTER_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.POD_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.CLUSTER_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.TYPE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.STATE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.TYPE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.STATE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="clusterid", type=CommandType.LONG) + private Long clusterId; + + @Parameter(name="id", type=CommandType.LONG) + private Long id; + + @Parameter(name="name", type=CommandType.STRING) + private String hostName; + + @Parameter(name="podid", type=CommandType.LONG) + private Long podId; + + @Parameter(name="state", type=CommandType.STRING) + private String state; + + @Parameter(name="type", type=CommandType.STRING) + private String type; + + @Parameter(name="zoneid", type=CommandType.LONG) + private Long zoneId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getClusterId() { + return clusterId; + } + + public Long getId() { + return id; + } + + public String getHostName() { + return hostName; + } + + public Long getPodId() { + return podId; + } + + public String getState() { + return state; + } + + public String getType() { + return type; + } + + public Long getZoneId() { + return zoneId; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/ListIsosCmd.java b/server/src/com/cloud/api/commands/ListIsosCmd.java index 939525a1a3a..9ee0a7f4159 100644 --- a/server/src/com/cloud/api/commands/ListIsosCmd.java +++ b/server/src/com/cloud/api/commands/ListIsosCmd.java @@ -26,6 +26,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.async.AsyncJobVO; import com.cloud.dc.DataCenterVO; @@ -33,8 +34,8 @@ import com.cloud.domain.DomainVO; import com.cloud.host.HostVO; import com.cloud.storage.GuestOS; import com.cloud.storage.VMTemplateHostVO; -import com.cloud.storage.VMTemplateVO; import com.cloud.storage.VMTemplateStorageResourceAssoc.Status; +import com.cloud.storage.VMTemplateVO; import com.cloud.storage.dao.VMTemplateDao.TemplateFilter; import com.cloud.user.Account; import com.cloud.utils.Pair; @@ -47,21 +48,98 @@ public class ListIsosCmd extends BaseCmd { static { s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.BOOTABLE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.IS_PUBLIC, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.IS_READY, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ISO_FILTER, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.IS_PUBLIC, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.IS_READY, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ISO_FILTER, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.BOOTABLE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.FALSE)); + + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="bootable", type=CommandType.BOOLEAN) + private Boolean bootable; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="id", type=CommandType.LONG) + private Long id; + + @Parameter(name="ispublic", type=CommandType.BOOLEAN) + private Boolean publicIso; + + @Parameter(name="isready", type=CommandType.BOOLEAN) + private Boolean ready; + + @Parameter(name="isofilter", type=CommandType.STRING) + private String isoFilter; + + @Parameter(name="name", type=CommandType.STRING) + private String isoName; + + @Parameter(name="zoneid", type=CommandType.LONG) + private Long zoneId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Boolean isBootable() { + return bootable; + } + + public Long getDomainId() { + return domainId; + } + + public Long getId() { + return id; + } + + public Boolean isPublic() { + return publicIso; + } + + public Boolean isReady() { + return ready; + } + + public String getIsoFilter() { + return isoFilter; + } + + public String getIsoName() { + return isoName; + } + + public Long getZoneId() { + return zoneId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/ListLoadBalancerRuleInstancesCmd.java b/server/src/com/cloud/api/commands/ListLoadBalancerRuleInstancesCmd.java index 3bc40f0827d..a2e4db3f942 100644 --- a/server/src/com/cloud/api/commands/ListLoadBalancerRuleInstancesCmd.java +++ b/server/src/com/cloud/api/commands/ListLoadBalancerRuleInstancesCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.network.LoadBalancerVO; import com.cloud.user.Account; @@ -39,10 +40,39 @@ public class ListLoadBalancerRuleInstancesCmd extends BaseCmd { static { s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); + + s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.APPLIED, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="applied", type=CommandType.BOOLEAN) + private Boolean applied; + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Boolean isApplied() { + return applied; + } + + public Long getId() { + return id; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/ListLoadBalancerRulesCmd.java b/server/src/com/cloud/api/commands/ListLoadBalancerRulesCmd.java index 499ec7060ee..9bb1ce8d027 100644 --- a/server/src/com/cloud/api/commands/ListLoadBalancerRulesCmd.java +++ b/server/src/com/cloud/api/commands/ListLoadBalancerRulesCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.domain.DomainVO; import com.cloud.network.IPAddressVO; @@ -41,17 +42,74 @@ public class ListLoadBalancerRulesCmd extends BaseCmd { static { s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PUBLIC_IP, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.VIRTUAL_MACHINE_ID, Boolean.FALSE)); + + s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="id", type=CommandType.LONG) + private Long id; + + @Parameter(name="name", type=CommandType.STRING) + private String loadBalancerRuleName; + + @Parameter(name="publicip", type=CommandType.STRING) + private String publicIp; + + @Parameter(name="virtualmachineid", type=CommandType.LONG) + private Long virtualMachineId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + public Long getId() { + return id; + } + + public String getLoadBalancerRuleName() { + return loadBalancerRuleName; + } + + public String getPublicIp() { + return publicIp; + } + + public Long getVirtualMachineId() { + return virtualMachineId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/ListNetworkGroupsCmd.java b/server/src/com/cloud/api/commands/ListNetworkGroupsCmd.java index f1668d98e8f..fd1f31ae114 100644 --- a/server/src/com/cloud/api/commands/ListNetworkGroupsCmd.java +++ b/server/src/com/cloud/api/commands/ListNetworkGroupsCmd.java @@ -7,6 +7,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.async.executor.IngressRuleResultObject; import com.cloud.async.executor.NetworkGroupResultObject; @@ -24,15 +25,58 @@ public class ListNetworkGroupsCmd extends BaseCmd { static { s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.NETWORK_GROUP_NAME, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.VIRTUAL_MACHINE_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="networkgroupname", type=CommandType.STRING) + private String networkGroupName; + + @Parameter(name="virtualmachineid", type=CommandType.LONG) + private Long virtualMachineId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + public String getNetworkGroupName() { + return networkGroupName; + } + + public Long getVirtualMachineId() { + return virtualMachineId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/ListPodsByCmd.java b/server/src/com/cloud/api/commands/ListPodsByCmd.java index 2abcfd7906c..ed9d21804e1 100644 --- a/server/src/com/cloud/api/commands/ListPodsByCmd.java +++ b/server/src/com/cloud/api/commands/ListPodsByCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.dc.HostPodVO; import com.cloud.server.Criteria; @@ -44,6 +45,40 @@ public class ListPodsByCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG) + private Long id; + + @Parameter(name="name", type=CommandType.STRING) + private String podName; + + @Parameter(name="zoneid", type=CommandType.LONG) + private Long zoneId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + public String getPodName() { + return podName; + } + + public Long getZoneId() { + return zoneId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/ListPortForwardingRulesCmd.java b/server/src/com/cloud/api/commands/ListPortForwardingRulesCmd.java index 68aa5407757..9c5db89b419 100644 --- a/server/src/com/cloud/api/commands/ListPortForwardingRulesCmd.java +++ b/server/src/com/cloud/api/commands/ListPortForwardingRulesCmd.java @@ -26,6 +26,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.network.FirewallRuleVO; import com.cloud.network.IPAddressVO; @@ -45,6 +46,26 @@ public class ListPortForwardingRulesCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.IP_ADDRESS, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="ipaddress", type=CommandType.STRING, required=true) + private String ipAddress; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getIpAddress() { + return ipAddress; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/ListPortForwardingServiceRulesCmd.java b/server/src/com/cloud/api/commands/ListPortForwardingServiceRulesCmd.java index 3addbf14a22..9b855f075df 100644 --- a/server/src/com/cloud/api/commands/ListPortForwardingServiceRulesCmd.java +++ b/server/src/com/cloud/api/commands/ListPortForwardingServiceRulesCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.async.AsyncJobVO; import com.cloud.network.NetworkRuleConfigVO; @@ -41,12 +42,54 @@ public class ListPortForwardingServiceRulesCmd extends BaseCmd { static { s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PORT_FORWARDING_SERVICE_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="id", type=CommandType.LONG) + private Long id; + + @Parameter(name="portforwardingserviceid", type=CommandType.LONG) + private Long portForwardingServiceId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + public Long getId() { + return id; + } + + public Long getPortForwardingServiceId() { + return portForwardingServiceId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/ListPortForwardingServicesByVmCmd.java b/server/src/com/cloud/api/commands/ListPortForwardingServicesByVmCmd.java index 05829dfde47..a1e8bfa1a17 100644 --- a/server/src/com/cloud/api/commands/ListPortForwardingServicesByVmCmd.java +++ b/server/src/com/cloud/api/commands/ListPortForwardingServicesByVmCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.network.SecurityGroupVO; import com.cloud.server.Criteria; @@ -39,14 +40,56 @@ public class ListPortForwardingServicesByVmCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.IP_ADDRESS, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.VIRTUAL_MACHINE_ID, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.IP_ADDRESS, Boolean.FALSE)); + + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="ipaddress", type=CommandType.STRING) + private String ipAddress; + + @Parameter(name="virtualmachineid", type=CommandType.LONG) + private Long virtualMachineId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + public String getIpAddress() { + return ipAddress; + } + + public Long getVirtualMachineId() { + return virtualMachineId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/ListPortForwardingServicesCmd.java b/server/src/com/cloud/api/commands/ListPortForwardingServicesCmd.java index 931a51a9942..8a209061093 100644 --- a/server/src/com/cloud/api/commands/ListPortForwardingServicesCmd.java +++ b/server/src/com/cloud/api/commands/ListPortForwardingServicesCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.domain.DomainVO; import com.cloud.network.SecurityGroupVO; @@ -40,15 +41,58 @@ public class ListPortForwardingServicesCmd extends BaseCmd { static { s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); + + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="id", type=CommandType.LONG) + private Long id; + + @Parameter(name="name", type=CommandType.STRING) + private String portForwardingServiceName; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + public Long getId() { + return id; + } + + public String getPortForwardingServiceName() { + return portForwardingServiceName; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/ListPreallocatedLunsCmd.java b/server/src/com/cloud/api/commands/ListPreallocatedLunsCmd.java index 5badeba93f5..34c56e62ebc 100644 --- a/server/src/com/cloud/api/commands/ListPreallocatedLunsCmd.java +++ b/server/src/com/cloud/api/commands/ListPreallocatedLunsCmd.java @@ -25,11 +25,9 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; -import com.cloud.dc.ClusterVO; import com.cloud.server.Criteria; -import com.cloud.storage.StoragePoolVO; -import com.cloud.storage.StorageStats; import com.cloud.storage.preallocatedlun.PreallocatedLunVO; import com.cloud.utils.Pair; @@ -42,10 +40,37 @@ public class ListPreallocatedLunsCmd extends BaseCmd { static { s_properties.add(new Pair(BaseCmd.Properties.TARGET_IQN, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.SCOPE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="scope", type=CommandType.STRING) + private String scope; + + @Parameter(name="targetiqn", type=CommandType.STRING) + private String targetIqn; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getScope() { + return scope; + } + + public String getTargetIqn() { + return targetIqn; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/ListPublicIpAddressesCmd.java b/server/src/com/cloud/api/commands/ListPublicIpAddressesCmd.java index 99c310d6048..b12fd25b6aa 100644 --- a/server/src/com/cloud/api/commands/ListPublicIpAddressesCmd.java +++ b/server/src/com/cloud/api/commands/ListPublicIpAddressesCmd.java @@ -18,16 +18,17 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; -import com.cloud.dc.VlanVO; import com.cloud.dc.Vlan.VlanType; +import com.cloud.dc.VlanVO; import com.cloud.domain.DomainVO; import com.cloud.network.IPAddressVO; import com.cloud.server.Criteria; @@ -42,18 +43,80 @@ public class ListPublicIpAddressesCmd extends BaseCmd { static { s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ALLOCATED_ONLY, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ALLOCATED_ONLY, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.FOR_VIRTUAL_NETWORK, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.IP_ADDRESS, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.VLAN_DB_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.VLAN_DB_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.IP_ADDRESS, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); + + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.FOR_VIRTUAL_NETWORK, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="allocatedonly", type=CommandType.BOOLEAN) + private Boolean allocatedOnly; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="forvirtualnetwork", type=CommandType.BOOLEAN) + private Boolean forVirtualNetwork; + + @Parameter(name="ipaddress", type=CommandType.STRING) + private String ipAddress; + + @Parameter(name="vlanid", type=CommandType.LONG) + private Long vlanId; + + @Parameter(name="zoneid", type=CommandType.LONG) + private Long zoneId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Boolean isAllocatedOnly() { + return allocatedOnly; + } + + public Long getDomainId() { + return domainId; + } + + public Boolean isForVirtualNetwork() { + return forVirtualNetwork; + } + + public String getIpAddress() { + return ipAddress; + } + + public Long getVlanId() { + return vlanId; + } + + public Long getZoneId() { + return zoneId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java b/server/src/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java index f3a11ab6037..843da134a6a 100644 --- a/server/src/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java +++ b/server/src/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java @@ -18,11 +18,12 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.storage.SnapshotScheduleVO; import com.cloud.storage.VolumeVO; @@ -39,6 +40,32 @@ public class ListRecurringSnapshotScheduleCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="snapshotpolicyid", type=CommandType.LONG) + private Long snapshotPolicyId; + + @Parameter(name="volumeid", type=CommandType.LONG, required=true) + private Long volumeId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getSnapshotPolicyId() { + return snapshotPolicyId; + } + + public Long getVolumeId() { + return volumeId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/ListResourceLimitsCmd.java b/server/src/com/cloud/api/commands/ListResourceLimitsCmd.java index 9136339ea86..d537c77a344 100644 --- a/server/src/com/cloud/api/commands/ListResourceLimitsCmd.java +++ b/server/src/com/cloud/api/commands/ListResourceLimitsCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.configuration.ResourceCount.ResourceType; import com.cloud.configuration.ResourceLimitVO; @@ -40,15 +41,56 @@ public class ListResourceLimitsCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { - s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.RESOURCE_TYPE, Boolean.FALSE)); + + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="id", type=CommandType.LONG) + private Long id; + + @Parameter(name="resourcetype", type=CommandType.INTEGER) + private Integer resourceType; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + public Long getId() { + return id; + } + + public Integer getResourceType() { + return resourceType; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/ListRoutersCmd.java b/server/src/com/cloud/api/commands/ListRoutersCmd.java index 56bd2b7ba9f..406b85c963e 100644 --- a/server/src/com/cloud/api/commands/ListRoutersCmd.java +++ b/server/src/com/cloud/api/commands/ListRoutersCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.async.AsyncJobVO; import com.cloud.domain.DomainVO; @@ -40,19 +41,81 @@ public class ListRoutersCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.HOST_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.POD_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.STATE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.POD_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.HOST_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.STATE, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="hostid", type=CommandType.LONG) + private Long hostId; + + @Parameter(name="name", type=CommandType.STRING) + private String routerName; + + @Parameter(name="podid", type=CommandType.LONG) + private Long podId; + + @Parameter(name="state", type=CommandType.STRING) + private String state; + + @Parameter(name="zoneid", type=CommandType.LONG) + private Long zoneId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + public Long getHostId() { + return hostId; + } + + public String getRouterName() { + return routerName; + } + + public Long getPodId() { + return podId; + } + + public String getState() { + return state; + } + + public Long getZoneId() { + return zoneId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/ListServiceOfferingsCmd.java b/server/src/com/cloud/api/commands/ListServiceOfferingsCmd.java index 8a690c60809..0e89e9a5187 100644 --- a/server/src/com/cloud/api/commands/ListServiceOfferingsCmd.java +++ b/server/src/com/cloud/api/commands/ListServiceOfferingsCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.offering.ServiceOffering.GuestIpType; import com.cloud.server.Criteria; @@ -43,12 +44,46 @@ public class ListServiceOfferingsCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.VIRTUAL_MACHINE_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG) + private Long id; + + @Parameter(name="name", type=CommandType.STRING) + private String serviceOfferingName; + + @Parameter(name="virtualmachineid", type=CommandType.LONG) + private Long virtualMachineId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + public String getServiceOfferingName() { + return serviceOfferingName; + } + + public Long getVirtualMachineId() { + return virtualMachineId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/ListSnapshotPoliciesCmd.java b/server/src/com/cloud/api/commands/ListSnapshotPoliciesCmd.java index f52e57fc7e0..5ecb57e1e86 100644 --- a/server/src/com/cloud/api/commands/ListSnapshotPoliciesCmd.java +++ b/server/src/com/cloud/api/commands/ListSnapshotPoliciesCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.storage.SnapshotPolicyVO; import com.cloud.storage.VolumeVO; @@ -43,6 +44,39 @@ public class ListSnapshotPoliciesCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.VOLUME_ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="volumeid", type=CommandType.LONG, required=true) + private Long volumeId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + public Long getVolumeId() { + return volumeId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/ListSnapshotsCmd.java b/server/src/com/cloud/api/commands/ListSnapshotsCmd.java index a71e5b7b36c..8773eeed488 100644 --- a/server/src/com/cloud/api/commands/ListSnapshotsCmd.java +++ b/server/src/com/cloud/api/commands/ListSnapshotsCmd.java @@ -25,14 +25,15 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.async.AsyncJobVO; import com.cloud.exception.InvalidParameterValueException; import com.cloud.server.Criteria; import com.cloud.storage.Snapshot; +import com.cloud.storage.Snapshot.SnapshotType; import com.cloud.storage.SnapshotVO; import com.cloud.storage.VolumeVO; -import com.cloud.storage.Snapshot.SnapshotType; import com.cloud.user.Account; import com.cloud.utils.Pair; @@ -43,19 +44,81 @@ public class ListSnapshotsCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.INTERVAL_TYPE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.SNAPSHOT_TYPE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.VOLUME_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.INTERVAL_TYPE, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.SNAPSHOT_TYPE, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); + + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="id", type=CommandType.LONG) + private Long id; + + @Parameter(name="intervalType", type=CommandType.STRING) + private String intervalType; + + @Parameter(name="name", type=CommandType.STRING) + private String snapshotName; + + @Parameter(name="snapshottype", type=CommandType.STRING) + private String snapshotType; + + @Parameter(name="volumeid", type=CommandType.LONG) + private Long volumeId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + public Long getId() { + return id; + } + + public String getIntervalType() { + return intervalType; + } + + public String getSnapshotName() { + return snapshotName; + } + + public String getSnapshotType() { + return snapshotType; + } + + public Long getVolumeId() { + return volumeId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/ListStoragePoolsAndHostsCmd.java b/server/src/com/cloud/api/commands/ListStoragePoolsAndHostsCmd.java index 3cbd24399bf..7f474325f26 100644 --- a/server/src/com/cloud/api/commands/ListStoragePoolsAndHostsCmd.java +++ b/server/src/com/cloud/api/commands/ListStoragePoolsAndHostsCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.host.Host; import com.cloud.server.ManagementServer; import com.cloud.utils.Pair; @@ -38,15 +39,76 @@ public class ListStoragePoolsAndHostsCmd extends BaseCmd{ private static final ListHostsCmd storageHostsCmd = new ListHostsCmd(); static { + s_properties.add(new Pair(BaseCmd.Properties.IP_ADDRESS, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.PATH, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.POD_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.STATE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.TYPE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.IP_ADDRESS, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.PATH, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.POD_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.TYPE, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.STATE, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="ipaddress", type=CommandType.STRING) + private String ipAddress; + + @Parameter(name="name", type=CommandType.STRING) + private String storagePoolName; + + @Parameter(name="path", type=CommandType.STRING) + private String path; + + @Parameter(name="podid", type=CommandType.LONG) + private Long podId; + + @Parameter(name="state", type=CommandType.STRING) + private String state; + + @Parameter(name="type", type=CommandType.STRING) + private String type; + + @Parameter(name="zoneid", type=CommandType.LONG) + private Long zoneId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getIpAddress() { + return ipAddress; + } + + public String getStoragePoolName() { + return storagePoolName; + } + + public String getPath() { + return path; + } + + public Long getPodId() { + return podId; + } + + public String getState() { + return state; + } + + public String getType() { + return type; + } + + public Long getZoneId() { + return zoneId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; @@ -78,7 +140,7 @@ public class ListStoragePoolsAndHostsCmd extends BaseCmd{ } @Override - public Map validateParams(Map params, boolean decode) { + public Map validateParams(Map params, boolean decode) { Map result = storagePoolsCmd.validateParams(params, decode); result.putAll(storageHostsCmd.validateParams(params, decode)); return result; diff --git a/server/src/com/cloud/api/commands/ListStoragePoolsCmd.java b/server/src/com/cloud/api/commands/ListStoragePoolsCmd.java index 4bb8488a8e1..abb5848c2f5 100644 --- a/server/src/com/cloud/api/commands/ListStoragePoolsCmd.java +++ b/server/src/com/cloud/api/commands/ListStoragePoolsCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.dc.ClusterVO; import com.cloud.server.Criteria; @@ -42,17 +43,72 @@ public class ListStoragePoolsCmd extends BaseCmd{ private static final List> s_properties = new ArrayList>(); static { + s_properties.add(new Pair(BaseCmd.Properties.CLUSTER_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.IP_ADDRESS, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.PATH, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.POD_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.CLUSTER_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.IP_ADDRESS, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.PATH, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="clusterid", type=CommandType.LONG) + private Long clusterId; + + @Parameter(name="ipaddress", type=CommandType.STRING) + private String ipAddress; + + @Parameter(name="name", type=CommandType.STRING) + private String storagePoolName; + + @Parameter(name="path", type=CommandType.STRING) + private String path; + + @Parameter(name="podid", type=CommandType.LONG) + private Long podId; + + @Parameter(name="zoneid", type=CommandType.LONG) + private Long zoneId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getClusterId() { + return clusterId; + } + + public String getIpAddress() { + return ipAddress; + } + + public String getStoragePoolName() { + return storagePoolName; + } + + public String getPath() { + return path; + } + + public Long getPodId() { + return podId; + } + + public Long getZoneId() { + return zoneId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; @@ -63,7 +119,6 @@ public class ListStoragePoolsCmd extends BaseCmd{ return s_properties; } - @SuppressWarnings("unchecked") @Override public List> execute(Map params) { String name = (String)params.get(BaseCmd.Properties.NAME.getName()); diff --git a/server/src/com/cloud/api/commands/ListSystemVMsCmd.java b/server/src/com/cloud/api/commands/ListSystemVMsCmd.java index f67a741f30f..4ae4939639c 100644 --- a/server/src/com/cloud/api/commands/ListSystemVMsCmd.java +++ b/server/src/com/cloud/api/commands/ListSystemVMsCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.async.AsyncJobVO; import com.cloud.server.Criteria; import com.cloud.utils.Pair; @@ -38,18 +39,80 @@ public class ListSystemVMsCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { + s_properties.add(new Pair(BaseCmd.Properties.HOST_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.POD_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.HOST_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.STATE, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.STATE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.SYSTEM_VM_TYPE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.SYSTEM_VM_TYPE, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="hostid", type=CommandType.LONG) + private Long hostId; + + @Parameter(name="id", type=CommandType.LONG) + private Long id; + + @Parameter(name="name", type=CommandType.STRING) + private String systemVmName; + + @Parameter(name="podid", type=CommandType.LONG) + private Long podId; + + @Parameter(name="state", type=CommandType.STRING) + private String state; + + @Parameter(name="systemvmtype", type=CommandType.STRING) + private String systemVmType; + + @Parameter(name="zoneid", type=CommandType.LONG) + private Long zoneId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getHostId() { + return hostId; + } + + public Long getId() { + return id; + } + + public String getSystemVmName() { + return systemVmName; + } + + public Long getPodId() { + return podId; + } + + public String getState() { + return state; + } + + public String getSystemVmType() { + return systemVmType; + } + + public Long getZoneId() { + return zoneId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/ListTemplateOrIsoPermissionsCmd.java b/server/src/com/cloud/api/commands/ListTemplateOrIsoPermissionsCmd.java index 438236efa00..73185fd8d52 100644 --- a/server/src/com/cloud/api/commands/ListTemplateOrIsoPermissionsCmd.java +++ b/server/src/com/cloud/api/commands/ListTemplateOrIsoPermissionsCmd.java @@ -7,6 +7,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.domain.DomainVO; import com.cloud.storage.VMTemplateVO; @@ -25,6 +26,39 @@ public class ListTemplateOrIsoPermissionsCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + public Long getId() { + return id; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/ListTemplatePermissionsCmd.java b/server/src/com/cloud/api/commands/ListTemplatePermissionsCmd.java index a3cfcd47e57..8525fc31d88 100644 --- a/server/src/com/cloud/api/commands/ListTemplatePermissionsCmd.java +++ b/server/src/com/cloud/api/commands/ListTemplatePermissionsCmd.java @@ -18,19 +18,10 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - -import com.cloud.api.BaseCmd; -import com.cloud.api.ServerApiException; -import com.cloud.domain.DomainVO; -import com.cloud.storage.VMTemplateVO; +import org.apache.log4j.Logger; + import com.cloud.storage.Storage.ImageFormat; -import com.cloud.user.Account; -import com.cloud.utils.Pair; +import com.cloud.storage.VMTemplateVO; public class ListTemplatePermissionsCmd extends ListTemplateOrIsoPermissionsCmd { protected String getResponseName() { diff --git a/server/src/com/cloud/api/commands/ListTemplatesCmd.java b/server/src/com/cloud/api/commands/ListTemplatesCmd.java index a3067e05fc9..be511abea1c 100644 --- a/server/src/com/cloud/api/commands/ListTemplatesCmd.java +++ b/server/src/com/cloud/api/commands/ListTemplatesCmd.java @@ -25,14 +25,15 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.async.AsyncJobVO; import com.cloud.dc.DataCenterVO; import com.cloud.host.HostVO; import com.cloud.storage.GuestOS; import com.cloud.storage.VMTemplateHostVO; -import com.cloud.storage.VMTemplateVO; import com.cloud.storage.VMTemplateStorageResourceAssoc.Status; +import com.cloud.storage.VMTemplateVO; import com.cloud.storage.dao.VMTemplateDao.TemplateFilter; import com.cloud.storage.template.TemplateConstants; import com.cloud.user.Account; @@ -45,7 +46,6 @@ public class ListTemplatesCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.FALSE)); @@ -53,13 +53,68 @@ public class ListTemplatesCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.IS_PUBLIC, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.IS_READY, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.TEMPLATE_FILTER, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.FALSE)); + + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.FALSE)); - } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + @Parameter(name="name", type=CommandType.STRING) + private String templateName; + + @Parameter(name="templatefilter", type=CommandType.STRING, required=true) + private String templateFilter; + + @Parameter(name="zoneid", type=CommandType.LONG) + private Long zoneId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + public Long getId() { + return id; + } + + public String getTemplateName() { + return templateName; + } + + public String getTemplateFilter() { + return templateFilter; + } + + public Long getZoneId() { + return zoneId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; @@ -76,8 +131,6 @@ public class ListTemplatesCmd extends BaseCmd { Long domainId = (Long)params.get(BaseCmd.Properties.DOMAIN_ID.getName()); Long id = (Long) params.get(BaseCmd.Properties.ID.getName()); String name = (String) params.get(BaseCmd.Properties.NAME.getName()); - Boolean isPublic = (Boolean) params.get(BaseCmd.Properties.IS_PUBLIC.getName()); - Boolean isReady = (Boolean) params.get(BaseCmd.Properties.IS_READY.getName()); String templateFilterString = (String) params.get(BaseCmd.Properties.TEMPLATE_FILTER.getName()); String keyword = (String)params.get(BaseCmd.Properties.KEYWORD.getName()); Integer page = (Integer)params.get(BaseCmd.Properties.PAGE.getName()); @@ -161,14 +214,10 @@ public class ListTemplatesCmd extends BaseCmd { templateData.add(new Pair(BaseCmd.Properties.DISPLAY_TEXT.getName(), template.getDisplayText())); templateData.add(new Pair(BaseCmd.Properties.IS_PUBLIC.getName(), Boolean.valueOf(template.isPublicTemplate()).toString())); templateData.add(new Pair(BaseCmd.Properties.CREATED.getName(), getDateString(templateHostRef.getCreated()))); - if(template.getRemoved() != null){ - templateData.add(new Pair(BaseCmd.Properties.REMOVED.getName(), getDateString(template.getRemoved()))); - } templateData.add(new Pair(BaseCmd.Properties.IS_READY.getName(), Boolean.valueOf(templateHostRef.getDownloadState()==Status.DOWNLOADED).toString())); templateData.add(new Pair(BaseCmd.Properties.IS_FEATURED.getName(), Boolean.valueOf(template.isFeatured()).toString())); templateData.add(new Pair(BaseCmd.Properties.PASSWORD_ENABLED.getName(), Boolean.valueOf(template.getEnablePassword()).toString())); templateData.add(new Pair(BaseCmd.Properties.CROSS_ZONES.getName(), Boolean.valueOf(template.isCrossZones()).toString())); - templateData.add(new Pair(BaseCmd.Properties.FORMAT.getName(), template.getFormat())); GuestOS os = getManagementServer().findGuestOSById(template.getGuestOSId()); if (os != null) { diff --git a/server/src/com/cloud/api/commands/ListUsersCmd.java b/server/src/com/cloud/api/commands/ListUsersCmd.java index 559b3831712..d88964f2647 100644 --- a/server/src/com/cloud/api/commands/ListUsersCmd.java +++ b/server/src/com/cloud/api/commands/ListUsersCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.domain.DomainVO; import com.cloud.server.Criteria; @@ -39,18 +40,73 @@ public class ListUsersCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_TYPE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.STATE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.USERNAME, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_TYPE, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.STATE, Boolean.FALSE)); + + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="accounttype", type=CommandType.LONG) + private Long accountType; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="id", type=CommandType.LONG) + private Long id; + + @Parameter(name="state", type=CommandType.STRING) + private String state; + + @Parameter(name="username", type=CommandType.STRING) + private String username; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getAccountType() { + return accountType; + } + + public Long getDomainId() { + return domainId; + } + + public Long getId() { + return id; + } + + public String getState() { + return state; + } + + public String getUsername() { + return username; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/ListVMsCmd.java b/server/src/com/cloud/api/commands/ListVMsCmd.java index 1f87433f8fa..2f902018c7d 100644 --- a/server/src/com/cloud/api/commands/ListVMsCmd.java +++ b/server/src/com/cloud/api/commands/ListVMsCmd.java @@ -27,6 +27,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.async.AsyncJobVO; import com.cloud.domain.DomainVO; @@ -46,20 +47,89 @@ public class ListVMsCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { - s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.STATE, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.POD_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.HOST_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.HOST_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.POD_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.STATE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.FALSE)); + + s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="hostid", type=CommandType.LONG) + private Long hostId; + + @Parameter(name="id", type=CommandType.LONG) + private Long id; + + @Parameter(name="name", type=CommandType.STRING) + private String instanceName; + + @Parameter(name="podid", type=CommandType.LONG) + private Long podId; + + @Parameter(name="state", type=CommandType.STRING) + private String state; + + @Parameter(name="zoneid", type=CommandType.LONG) + private Long zoneId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + public Long getHostId() { + return hostId; + } + + public Long getId() { + return id; + } + + public String getInstanceName() { + return instanceName; + } + + public Long getPodId() { + return podId; + } + + public String getState() { + return state; + } + + public Long getZoneId() { + return zoneId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/ListVlanIpRangesCmd.java b/server/src/com/cloud/api/commands/ListVlanIpRangesCmd.java index 69b6dc311d8..7a43118b74d 100644 --- a/server/src/com/cloud/api/commands/ListVlanIpRangesCmd.java +++ b/server/src/com/cloud/api/commands/ListVlanIpRangesCmd.java @@ -18,20 +18,20 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.dc.HostPodVO; -import com.cloud.dc.VlanVO; import com.cloud.dc.Vlan.VlanType; +import com.cloud.dc.VlanVO; import com.cloud.server.Criteria; import com.cloud.user.Account; -import com.cloud.user.AccountVO; import com.cloud.utils.Pair; public class ListVlanIpRangesCmd extends BaseCmd { @@ -41,18 +41,72 @@ public class ListVlanIpRangesCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { - s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.VLAN, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.POD_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.POD_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.VLAN, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + @Parameter(name="podid", type=CommandType.LONG) + private Long podId; + + @Parameter(name="vlan", type=CommandType.STRING) + private String vlan; + + @Parameter(name="zoneid", type=CommandType.LONG) + private Long zoneId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + public Long getId() { + return id; + } + + public Long getPodId() { + return podId; + } + + public String getVlan() { + return vlan; + } + + public Long getZoneId() { + return zoneId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } @@ -68,7 +122,6 @@ public class ListVlanIpRangesCmd extends BaseCmd { String accountName = (String) params.get(BaseCmd.Properties.ACCOUNT.getName()); Long domainId = (Long) params.get(BaseCmd.Properties.DOMAIN_ID.getName()); Long podId = (Long) params.get(BaseCmd.Properties.POD_ID.getName()); - String name = (String) params.get(BaseCmd.Properties.NAME.getName()); String keyword = (String)params.get(BaseCmd.Properties.KEYWORD.getName()); Integer page = (Integer)params.get(BaseCmd.Properties.PAGE.getName()); Integer pageSize = (Integer)params.get(BaseCmd.Properties.PAGESIZE.getName()); diff --git a/server/src/com/cloud/api/commands/ListVolumesCmd.java b/server/src/com/cloud/api/commands/ListVolumesCmd.java index ca414103ec1..eb70306b43c 100644 --- a/server/src/com/cloud/api/commands/ListVolumesCmd.java +++ b/server/src/com/cloud/api/commands/ListVolumesCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.async.AsyncJobVO; import com.cloud.domain.DomainVO; @@ -43,20 +44,97 @@ public class ListVolumesCmd extends BaseCmd{ static { s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.TYPE, Boolean.FALSE)); + + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.HOST_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.POD_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.TYPE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.VIRTUAL_MACHINE_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.POD_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.VIRTUAL_MACHINE_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.HOST_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="hostid", type=CommandType.LONG) + private Long hostId; + + @Parameter(name="id", type=CommandType.LONG) + private Long id; + + @Parameter(name="name", type=CommandType.STRING) + private String volumeName; + + @Parameter(name="podid", type=CommandType.LONG) + private Long podId; + + @Parameter(name="type", type=CommandType.STRING) + private String type; + + @Parameter(name="virtualmachineid", type=CommandType.LONG) + private Long virtualMachineId; + + @Parameter(name="zoneid", type=CommandType.LONG) + private Long zoneId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + public Long getHostId() { + return hostId; + } + + public Long getId() { + return id; + } + + public String getVolumeName() { + return volumeName; + } + + public Long getPodId() { + return podId; + } + + public String getType() { + return type; + } + + public Long getVirtualMachineId() { + return virtualMachineId; + } + + public Long getZoneId() { + return zoneId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/ListZonesByCmd.java b/server/src/com/cloud/api/commands/ListZonesByCmd.java index e15687ea88d..bf6b2868153 100644 --- a/server/src/com/cloud/api/commands/ListZonesByCmd.java +++ b/server/src/com/cloud/api/commands/ListZonesByCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.dc.DataCenterVO; import com.cloud.user.Account; @@ -38,11 +39,29 @@ public class ListZonesByCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.AVAILABLE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="available", type=CommandType.BOOLEAN) + private Boolean available; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Boolean isAvailable() { + return available; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/LockAccountCmd.java b/server/src/com/cloud/api/commands/LockAccountCmd.java index 397ec3d8eca..dc6e2bb76cb 100644 --- a/server/src/com/cloud/api/commands/LockAccountCmd.java +++ b/server/src/com/cloud/api/commands/LockAccountCmd.java @@ -17,16 +17,17 @@ */ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - -import com.cloud.api.BaseCmd; -import com.cloud.api.ServerApiException; -import com.cloud.user.Account; -import com.cloud.utils.Pair; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + +import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; +import com.cloud.api.ServerApiException; +import com.cloud.user.Account; +import com.cloud.utils.Pair; public class LockAccountCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(LockAccountCmd.class.getName()); @@ -40,6 +41,32 @@ public class LockAccountCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING, required=true) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG, required=true) + private Long domainId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/LockUserCmd.java b/server/src/com/cloud/api/commands/LockUserCmd.java index 5f17436c53d..fde82869a47 100644 --- a/server/src/com/cloud/api/commands/LockUserCmd.java +++ b/server/src/com/cloud/api/commands/LockUserCmd.java @@ -17,17 +17,18 @@ */ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - -import com.cloud.api.BaseCmd; -import com.cloud.api.ServerApiException; -import com.cloud.user.Account; -import com.cloud.user.User; -import com.cloud.utils.Pair; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + +import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; +import com.cloud.api.ServerApiException; +import com.cloud.user.Account; +import com.cloud.user.User; +import com.cloud.utils.Pair; public class LockUserCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(LockUserCmd.class.getName()); @@ -36,10 +37,29 @@ public class LockUserCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { - s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/PrepareForMaintenanceCmd.java b/server/src/com/cloud/api/commands/PrepareForMaintenanceCmd.java index 951997b54a1..5c4ffcbb908 100644 --- a/server/src/com/cloud/api/commands/PrepareForMaintenanceCmd.java +++ b/server/src/com/cloud/api/commands/PrepareForMaintenanceCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.exception.InvalidParameterValueException; import com.cloud.host.HostVO; @@ -40,6 +41,25 @@ public class PrepareForMaintenanceCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/PreparePrimaryStorageForMaintenanceCmd.java b/server/src/com/cloud/api/commands/PreparePrimaryStorageForMaintenanceCmd.java index cfd3d013553..f506eba3f82 100644 --- a/server/src/com/cloud/api/commands/PreparePrimaryStorageForMaintenanceCmd.java +++ b/server/src/com/cloud/api/commands/PreparePrimaryStorageForMaintenanceCmd.java @@ -25,12 +25,11 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.exception.InvalidParameterValueException; -import com.cloud.host.HostVO; import com.cloud.host.Status; import com.cloud.storage.StoragePoolVO; -import com.cloud.user.Account; import com.cloud.utils.Pair; public class PreparePrimaryStorageForMaintenanceCmd extends BaseCmd { @@ -45,6 +44,25 @@ public class PreparePrimaryStorageForMaintenanceCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } @@ -60,8 +78,6 @@ public class PreparePrimaryStorageForMaintenanceCmd extends BaseCmd { @Override public List> execute(Map params) { Long storagePoolId = (Long)params.get(BaseCmd.Properties.ID.getName()); - Long userId = (Long)params.get(BaseCmd.Properties.USER_ID.getName()); - Account account = (Account)params.get(BaseCmd.Properties.ACCOUNT_OBJ.getName()); //verify input parameters StoragePoolVO storagePool = getManagementServer().findPoolById(storagePoolId); diff --git a/server/src/com/cloud/api/commands/QueryAsyncJobResultCmd.java b/server/src/com/cloud/api/commands/QueryAsyncJobResultCmd.java index 898ba29aece..d897536585e 100644 --- a/server/src/com/cloud/api/commands/QueryAsyncJobResultCmd.java +++ b/server/src/com/cloud/api/commands/QueryAsyncJobResultCmd.java @@ -18,14 +18,15 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.async.AsyncJobResult; import com.cloud.async.executor.IngressRuleResultObject; @@ -44,6 +45,25 @@ public class QueryAsyncJobResultCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.JOB_ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/RebootRouterCmd.java b/server/src/com/cloud/api/commands/RebootRouterCmd.java index bc672ef4434..c3885b1fd30 100644 --- a/server/src/com/cloud/api/commands/RebootRouterCmd.java +++ b/server/src/com/cloud/api/commands/RebootRouterCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.user.Account; import com.cloud.utils.Pair; @@ -41,6 +42,25 @@ public class RebootRouterCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/RebootSystemVmCmd.java b/server/src/com/cloud/api/commands/RebootSystemVmCmd.java index 0632dd6b028..f5baa46cc42 100644 --- a/server/src/com/cloud/api/commands/RebootSystemVmCmd.java +++ b/server/src/com/cloud/api/commands/RebootSystemVmCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.utils.Pair; import com.cloud.vm.VMInstanceVO; @@ -39,6 +40,25 @@ public class RebootSystemVmCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/RebootVMCmd.java b/server/src/com/cloud/api/commands/RebootVMCmd.java index 37595f62d2b..8550c16bceb 100644 --- a/server/src/com/cloud/api/commands/RebootVMCmd.java +++ b/server/src/com/cloud/api/commands/RebootVMCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.user.Account; import com.cloud.utils.Pair; @@ -41,6 +42,25 @@ public class RebootVMCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/ReconnectHostCmd.java b/server/src/com/cloud/api/commands/ReconnectHostCmd.java index 69a07793c34..506350ff5be 100644 --- a/server/src/com/cloud/api/commands/ReconnectHostCmd.java +++ b/server/src/com/cloud/api/commands/ReconnectHostCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.host.HostVO; import com.cloud.utils.Pair; @@ -39,6 +40,25 @@ public class ReconnectHostCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/RecoverVMCmd.java b/server/src/com/cloud/api/commands/RecoverVMCmd.java index 92ba3fed2c4..3a6d8d4d419 100644 --- a/server/src/com/cloud/api/commands/RecoverVMCmd.java +++ b/server/src/com/cloud/api/commands/RecoverVMCmd.java @@ -18,15 +18,15 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; -import com.cloud.exception.InternalErrorException; import com.cloud.exception.ResourceAllocationException; import com.cloud.user.Account; import com.cloud.utils.Pair; @@ -43,6 +43,25 @@ public class RecoverVMCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } @@ -81,8 +100,6 @@ public class RecoverVMCmd extends BaseCmd { return returnValues; } catch (ResourceAllocationException ex) { 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()); - } + } } } diff --git a/server/src/com/cloud/api/commands/RegisterCmd.java b/server/src/com/cloud/api/commands/RegisterCmd.java index 02c5bb8ce00..f290ba2eabc 100644 --- a/server/src/com/cloud/api/commands/RegisterCmd.java +++ b/server/src/com/cloud/api/commands/RegisterCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.user.User; import com.cloud.utils.Pair; @@ -39,6 +40,25 @@ public class RegisterCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/RegisterIsoCmd.java b/server/src/com/cloud/api/commands/RegisterIsoCmd.java index 076b729a34a..cdd60384665 100644 --- a/server/src/com/cloud/api/commands/RegisterIsoCmd.java +++ b/server/src/com/cloud/api/commands/RegisterIsoCmd.java @@ -25,13 +25,14 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.dc.DataCenterVO; -import com.cloud.storage.VMTemplateHostVO; -import com.cloud.storage.VMTemplateVO; import com.cloud.storage.Storage.FileSystem; import com.cloud.storage.Storage.ImageFormat; +import com.cloud.storage.VMTemplateHostVO; import com.cloud.storage.VMTemplateStorageResourceAssoc.Status; +import com.cloud.storage.VMTemplateVO; import com.cloud.user.Account; import com.cloud.utils.Pair; @@ -42,18 +43,88 @@ public class RegisterIsoCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { + s_properties.add(new Pair(BaseCmd.Properties.BOOTABLE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.DISPLAY_TEXT, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.IS_FEATURED, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.IS_PUBLIC, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.DISPLAY_TEXT, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.OS_TYPE_ID, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.URL, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.IS_PUBLIC, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.IS_FEATURED, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.OS_TYPE_ID, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.BOOTABLE, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.TRUE)); + } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="bootable", type=CommandType.BOOLEAN) + private Boolean bootable; + + @Parameter(name="displaytext", type=CommandType.STRING, required=true) + private String displayText; + + @Parameter(name="isfeatured", type=CommandType.BOOLEAN) + private Boolean featured; + + @Parameter(name="ispublic", type=CommandType.BOOLEAN) + private Boolean publicIso; + + @Parameter(name="name", type=CommandType.STRING, required=true) + private String isoName; + + @Parameter(name="ostypeid", type=CommandType.LONG, required=true) + private Long osTypeId; + + @Parameter(name="url", type=CommandType.STRING, required=true) + private String url; + + @Parameter(name="zoneid", type=CommandType.LONG, required=true) + private Long zoneId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Boolean isBootable() { + return bootable; + } + + public String getDisplayText() { + return displayText; + } + + public Boolean isFeatured() { + return featured; + } + + public Boolean isPublic() { + return publicIso; + } + + public String getIsoName() { + return isoName; + } + + public Long getOsTypeId() { + return osTypeId; + } + + public String getUrl() { + return url; + } + + public Long getZoneId() { + return zoneId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/RegisterTemplateCmd.java b/server/src/com/cloud/api/commands/RegisterTemplateCmd.java index a7ed60f51a3..887f7b92927 100644 --- a/server/src/com/cloud/api/commands/RegisterTemplateCmd.java +++ b/server/src/com/cloud/api/commands/RegisterTemplateCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.dc.DataCenterVO; import com.cloud.exception.InvalidParameterValueException; @@ -43,23 +44,111 @@ public class RegisterTemplateCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { - s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.DISPLAY_TEXT, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.URL, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.BITS, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.PASSWORD_ENABLED, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.REQUIRES_HVM, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.BITS, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.DISPLAY_TEXT, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.FORMAT, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.IS_FEATURED, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.IS_PUBLIC, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.IS_FEATURED, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.OS_TYPE_ID, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.PASSWORD_ENABLED, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.REQUIRES_HVM, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.URL, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.FORMAT, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.OS_TYPE_ID, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.TRUE)); - - } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="bits", type=CommandType.INTEGER) + private Integer bits; + + @Parameter(name="displaytext", type=CommandType.STRING, required=true) + private String displayText; + + @Parameter(name="format", type=CommandType.STRING, required=true) + private String format; + + @Parameter(name="isfeatured", type=CommandType.BOOLEAN) + private Boolean featured; + + @Parameter(name="ispublic", type=CommandType.BOOLEAN) + private Boolean publicTemplate; + + @Parameter(name="name", type=CommandType.STRING, required=true) + private String templateName; + + @Parameter(name="ostypeid", type=CommandType.LONG, required=true) + private Long osTypeId; + + @Parameter(name="passwordenabled", type=CommandType.BOOLEAN) + private Boolean passwordEnabled; + + @Parameter(name="requireshvm", type=CommandType.BOOLEAN) + private Boolean requiresHvm; + + @Parameter(name="url", type=CommandType.STRING, required=true) + private String url; + + @Parameter(name="zoneid", type=CommandType.LONG, required=true) + private Long zoneId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Integer getBits() { + return bits; + } + + public String getDisplayText() { + return displayText; + } + + public String getFormat() { + return format; + } + + public Boolean isFeatured() { + return featured; + } + + public Boolean isPublic() { + return publicTemplate; + } + + public String getTemplateName() { + return templateName; + } + + public Long getOsTypeId() { + return osTypeId; + } + + public Boolean isPasswordEnabled() { + return passwordEnabled; + } + + public Boolean getRequiresHvm() { + return requiresHvm; + } + + public String getUrl() { + return url; + } + + public Long getZoneId() { + return zoneId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; @@ -180,8 +269,7 @@ public class RegisterTemplateCmd extends BaseCmd { listForEmbeddedObject.add(new Pair(BaseCmd.Properties.ID.getName(), template.getId().toString())); listForEmbeddedObject.add(new Pair(BaseCmd.Properties.NAME.getName(), template.getName())); listForEmbeddedObject.add(new Pair(BaseCmd.Properties.DISPLAY_TEXT.getName(), template.getDisplayText())); - listForEmbeddedObject.add(new Pair(BaseCmd.Properties.IS_PUBLIC.getName(), Boolean.valueOf(template.isPublicTemplate()).toString())); - listForEmbeddedObject.add(new Pair(BaseCmd.Properties.CROSS_ZONES.getName(), Boolean.valueOf(template.isCrossZones()).toString())); + listForEmbeddedObject.add(new Pair(BaseCmd.Properties.IS_PUBLIC.getName(), Boolean.valueOf(template.isPublicTemplate()).toString())); if (templateHostRef != null) { listForEmbeddedObject.add(new Pair(BaseCmd.Properties.CREATED.getName(), getDateString(templateHostRef.getCreated()))); diff --git a/server/src/com/cloud/api/commands/RemoveFromLoadBalancerRuleCmd.java b/server/src/com/cloud/api/commands/RemoveFromLoadBalancerRuleCmd.java index b2fb11392dc..770ee2b86de 100644 --- a/server/src/com/cloud/api/commands/RemoveFromLoadBalancerRuleCmd.java +++ b/server/src/com/cloud/api/commands/RemoveFromLoadBalancerRuleCmd.java @@ -18,14 +18,15 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.StringTokenizer; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.network.LoadBalancerVO; import com.cloud.user.Account; @@ -40,13 +41,45 @@ public class RemoveFromLoadBalancerRuleCmd extends BaseCmd { static { s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); - //s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.VIRTUAL_MACHINE_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.VIRTUAL_MACHINE_IDS, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + @Parameter(name="virtualmachineid", type=CommandType.LONG) + private Long virtualMachineId; + + @Parameter(name="virtualmachineids", type=CommandType.LIST, collectionType=CommandType.LONG) + private List virtualMachineIds; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + public Long getVirtualMachineId() { + return virtualMachineId; + } + + public List getVirtualMachineIds() { + return virtualMachineIds; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/RemovePortForwardingServiceCmd.java b/server/src/com/cloud/api/commands/RemovePortForwardingServiceCmd.java index 0f3929afd14..d5444d13337 100644 --- a/server/src/com/cloud/api/commands/RemovePortForwardingServiceCmd.java +++ b/server/src/com/cloud/api/commands/RemovePortForwardingServiceCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.network.SecurityGroupVO; import com.cloud.user.Account; @@ -41,10 +42,44 @@ public class RemovePortForwardingServiceCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.PUBLIC_IP, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.VIRTUAL_MACHINE_ID, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + @Parameter(name="publicip", type=CommandType.STRING, required=true) + private String publicIp; + + @Parameter(name="virtualmachineid", type=CommandType.LONG, required=true) + private Long virtualMachineId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + public String getPublicIp() { + return publicIp; + } + + public Long getVirtualMachineId() { + return virtualMachineId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/ResetVMPasswordCmd.java b/server/src/com/cloud/api/commands/ResetVMPasswordCmd.java index 8e458e59904..eec58c2ae25 100644 --- a/server/src/com/cloud/api/commands/ResetVMPasswordCmd.java +++ b/server/src/com/cloud/api/commands/ResetVMPasswordCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.storage.VMTemplateVO; import com.cloud.user.Account; @@ -43,6 +44,25 @@ public class ResetVMPasswordCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/RevokeNetworkGroupIngressCmd.java b/server/src/com/cloud/api/commands/RevokeNetworkGroupIngressCmd.java index adbd67b5188..75598ca3855 100644 --- a/server/src/com/cloud/api/commands/RevokeNetworkGroupIngressCmd.java +++ b/server/src/com/cloud/api/commands/RevokeNetworkGroupIngressCmd.java @@ -10,6 +10,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.network.security.NetworkGroupVO; import com.cloud.user.Account; @@ -23,21 +24,104 @@ public class RevokeNetworkGroupIngressCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.START_PORT, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.END_PORT, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ICMP_TYPE, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ICMP_CODE, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.PROTOCOL, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.NETWORK_GROUP_NAME, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); + + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.CIDR_LIST, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.END_PORT, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ICMP_CODE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ICMP_TYPE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.NETWORK_GROUP_NAME, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.PROTOCOL, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.START_PORT, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.USER_NETWORK_GROUP_LIST, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="cidrlist", type=CommandType.STRING) + private String cidrList; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="endport", type=CommandType.INTEGER) + private Integer endPort; + + @Parameter(name="icmpcode", type=CommandType.INTEGER) + private Integer icmpCode; + + @Parameter(name="icmptype", type=CommandType.INTEGER) + private Integer icmpType; + + @Parameter(name="networkgroupname", type=CommandType.STRING, required=true) + private String networkGroupName; + + @Parameter(name="protocol", type=CommandType.STRING) + private String protocol; + + @Parameter(name="startport", type=CommandType.INTEGER) + private Integer startPort; + + @Parameter(name="usernetworkgrouplist", type=CommandType.MAP) + private Map userNetworkGroupList; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public String getCidrList() { + return cidrList; + } + + public Long getDomainId() { + return domainId; + } + + public Integer getEndPort() { + return endPort; + } + + public Integer getIcmpCode() { + return icmpCode; + } + + public Integer getIcmpType() { + return icmpType; + } + + public String getNetworkGroupName() { + return networkGroupName; + } + + public String getProtocol() { + return protocol; + } + + public Integer getStartPort() { + return startPort; + } + + public Map getUserNetworkGroupList() { + return userNetworkGroupList; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/StartRouterCmd.java b/server/src/com/cloud/api/commands/StartRouterCmd.java index 2f395cc04d8..3de0549af41 100644 --- a/server/src/com/cloud/api/commands/StartRouterCmd.java +++ b/server/src/com/cloud/api/commands/StartRouterCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.user.Account; import com.cloud.utils.Pair; @@ -41,6 +42,25 @@ public class StartRouterCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/StartSystemVMCmd.java b/server/src/com/cloud/api/commands/StartSystemVMCmd.java index 13313b4cc1b..debb6403918 100644 --- a/server/src/com/cloud/api/commands/StartSystemVMCmd.java +++ b/server/src/com/cloud/api/commands/StartSystemVMCmd.java @@ -18,16 +18,16 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.utils.Pair; -import com.cloud.vm.ConsoleProxyVO; import com.cloud.vm.VMInstanceVO; public class StartSystemVMCmd extends BaseCmd { @@ -40,6 +40,25 @@ public class StartSystemVMCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/StartVMCmd.java b/server/src/com/cloud/api/commands/StartVMCmd.java index 33a97a78280..5546295e25e 100644 --- a/server/src/com/cloud/api/commands/StartVMCmd.java +++ b/server/src/com/cloud/api/commands/StartVMCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.user.Account; import com.cloud.utils.Pair; @@ -43,6 +44,25 @@ public class StartVMCmd extends BaseCmd { } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/StopRouterCmd.java b/server/src/com/cloud/api/commands/StopRouterCmd.java index 24020e67bca..3b9328fb8b8 100644 --- a/server/src/com/cloud/api/commands/StopRouterCmd.java +++ b/server/src/com/cloud/api/commands/StopRouterCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.user.Account; import com.cloud.utils.Pair; @@ -41,6 +42,25 @@ public class StopRouterCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/StopSystemVmCmd.java b/server/src/com/cloud/api/commands/StopSystemVmCmd.java index 93b7a963002..6788be63f51 100644 --- a/server/src/com/cloud/api/commands/StopSystemVmCmd.java +++ b/server/src/com/cloud/api/commands/StopSystemVmCmd.java @@ -18,16 +18,16 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.utils.Pair; -import com.cloud.vm.ConsoleProxyVO; import com.cloud.vm.VMInstanceVO; public class StopSystemVmCmd extends BaseCmd { @@ -39,7 +39,26 @@ public class StopSystemVmCmd extends BaseCmd { static { s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); } - + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/StopVMCmd.java b/server/src/com/cloud/api/commands/StopVMCmd.java index 254c510da83..5760d8da9ad 100644 --- a/server/src/com/cloud/api/commands/StopVMCmd.java +++ b/server/src/com/cloud/api/commands/StopVMCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.user.Account; import com.cloud.utils.Pair; @@ -42,6 +43,25 @@ public class StopVMCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/UpdateAccountCmd.java b/server/src/com/cloud/api/commands/UpdateAccountCmd.java index 8960475be0a..0a39a5db108 100644 --- a/server/src/com/cloud/api/commands/UpdateAccountCmd.java +++ b/server/src/com/cloud/api/commands/UpdateAccountCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.user.Account; import com.cloud.utils.Pair; @@ -38,9 +39,43 @@ public class UpdateAccountCmd extends BaseCmd{ s_properties.add(new Pair(BaseCmd.Properties.NEW_NAME, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING, required=true) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG, required=true) + private Long domainId; + + @Parameter(name="newname", type=CommandType.STRING, required=true) + private String newName; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + public String getNewName() { + return newName; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/UpdateCfgCmd.java b/server/src/com/cloud/api/commands/UpdateCfgCmd.java index 93d90079adc..84f9afb0344 100644 --- a/server/src/com/cloud/api/commands/UpdateCfgCmd.java +++ b/server/src/com/cloud/api/commands/UpdateCfgCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.user.User; import com.cloud.utils.Pair; @@ -38,9 +39,36 @@ public class UpdateCfgCmd extends BaseCmd { static { s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.VALUE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="name", type=CommandType.STRING, required=true) + private String cfgName; + + @Parameter(name="value", type=CommandType.STRING) + private String value; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getCfgName() { + return cfgName; + } + + public String getValue() { + return value; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/UpdateDiskOfferingCmd.java b/server/src/com/cloud/api/commands/UpdateDiskOfferingCmd.java index dcd983a3149..01ffa45d14f 100644 --- a/server/src/com/cloud/api/commands/UpdateDiskOfferingCmd.java +++ b/server/src/com/cloud/api/commands/UpdateDiskOfferingCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.storage.DiskOfferingVO; import com.cloud.user.User; @@ -36,13 +37,54 @@ public class UpdateDiskOfferingCmd extends BaseCmd{ private static final List> s_properties = new ArrayList>(); static { + s_properties.add(new Pair(BaseCmd.Properties.DISPLAY_TEXT, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.DISPLAY_TEXT, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.TAGS, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.TAGS, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="displaytext", type=CommandType.STRING) + private String displayText; + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + @Parameter(name="name", type=CommandType.STRING) + private String diskOfferingName; + + @Parameter(name="tags", type=CommandType.STRING) + private String tags; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getDisplayText() { + return displayText; + } + + public Long getId() { + return id; + } + + public String getDiskOfferingName() { + return diskOfferingName; + } + + public String getTags() { + return tags; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; @@ -59,7 +101,6 @@ public class UpdateDiskOfferingCmd extends BaseCmd{ String displayText = (String)params.get(BaseCmd.Properties.DISPLAY_TEXT.getName()); Long userId = (Long)params.get(BaseCmd.Properties.USER_ID.getName()); String tags = (String)params.get(BaseCmd.Properties.TAGS.getName()); - Boolean editSOResult = false; if (userId == null) { userId = Long.valueOf(User.UID_SYSTEM); diff --git a/server/src/com/cloud/api/commands/UpdateDomainCmd.java b/server/src/com/cloud/api/commands/UpdateDomainCmd.java index 05c6d7ae063..dc3ceba3f53 100644 --- a/server/src/com/cloud/api/commands/UpdateDomainCmd.java +++ b/server/src/com/cloud/api/commands/UpdateDomainCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.domain.DomainVO; import com.cloud.user.Account; @@ -41,6 +42,32 @@ public class UpdateDomainCmd extends BaseCmd{ s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + @Parameter(name="name", type=CommandType.STRING) + private String domainName; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + public String getDomainName() { + return domainName; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/UpdateHostCmd.java b/server/src/com/cloud/api/commands/UpdateHostCmd.java index 0ef0426986b..1dfe8fe02b6 100644 --- a/server/src/com/cloud/api/commands/UpdateHostCmd.java +++ b/server/src/com/cloud/api/commands/UpdateHostCmd.java @@ -27,6 +27,7 @@ import java.util.Set; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.async.executor.HostResultObject; import com.cloud.host.Host; @@ -36,11 +37,9 @@ import com.cloud.host.Status; import com.cloud.host.Status.Event; import com.cloud.offering.ServiceOffering; import com.cloud.storage.GuestOSCategoryVO; -import com.cloud.utils.NumbersUtil; import com.cloud.utils.Pair; import com.cloud.utils.fsm.StateMachine; import com.cloud.vm.UserVmVO; -//import com.cloud.vm.HostStats; public class UpdateHostCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(UpdateHostCmd.class.getName()); @@ -52,6 +51,32 @@ public class UpdateHostCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.OS_CATEGORY_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + @Parameter(name="oscategoryid", type=CommandType.LONG) + private Long osCategoryId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + public Long getOsCategoryId() { + return osCategoryId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/UpdateIPForwardingRuleCmd.java b/server/src/com/cloud/api/commands/UpdateIPForwardingRuleCmd.java index 41f5cd55069..0a0502447dd 100644 --- a/server/src/com/cloud/api/commands/UpdateIPForwardingRuleCmd.java +++ b/server/src/com/cloud/api/commands/UpdateIPForwardingRuleCmd.java @@ -7,6 +7,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.network.IPAddressVO; import com.cloud.server.Criteria; @@ -25,14 +26,69 @@ public class UpdateIPForwardingRuleCmd extends BaseCmd { static { s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.PUBLIC_IP, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.PRIVATE_IP, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.PUBLIC_PORT, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.PRIVATE_PORT, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.PROTOCOL, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.PUBLIC_IP, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.PUBLIC_PORT, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.VIRTUAL_MACHINE_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="privateip", type=CommandType.STRING) + private String privateIp; + + @Parameter(name="privateport", type=CommandType.STRING, required=true) + private String privatePort; + + @Parameter(name="protocol", type=CommandType.STRING, required=true) + private String protocol; + + @Parameter(name="publicip", type=CommandType.STRING, required=true) + private String publicIp; + + @Parameter(name="publicport", type=CommandType.STRING, required=true) + private String publicPort; + + @Parameter(name="virtualmachineid", type=CommandType.LONG) + private Long virtualMachineId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getPrivateIp() { + return privateIp; + } + + public String getPrivatePort() { + return privatePort; + } + + public String getProtocol() { + return protocol; + } + + public String getPublicIp() { + return publicIp; + } + + public String getPublicPort() { + return publicPort; + } + + public Long getVirtualMachineId() { + return virtualMachineId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/UpdateIsoCmd.java b/server/src/com/cloud/api/commands/UpdateIsoCmd.java index 887e593cd77..098cc4e667e 100644 --- a/server/src/com/cloud/api/commands/UpdateIsoCmd.java +++ b/server/src/com/cloud/api/commands/UpdateIsoCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.storage.Storage; import com.cloud.storage.VMTemplateVO; @@ -38,14 +39,62 @@ public class UpdateIsoCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { + s_properties.add(new Pair(BaseCmd.Properties.BOOTABLE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.DISPLAY_TEXT, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.DISPLAY_TEXT, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.OS_TYPE_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.BOOTABLE, Boolean.FALSE)); + + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="bootable", type=CommandType.BOOLEAN) + private Boolean bootable; + + @Parameter(name="displaytext", type=CommandType.STRING) + private String displayText; + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + @Parameter(name="name", type=CommandType.STRING) + private String isoName; + + @Parameter(name="ostypeid", type=CommandType.LONG) + private Long osTypeId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Boolean isBootable() { + return bootable; + } + + public String getDisplayText() { + return displayText; + } + + public Long getId() { + return id; + } + + public String isoName() { + return isoName; + } + + public Long getOsTypeId() { + return osTypeId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/UpdateLoadBalancerRuleCmd.java b/server/src/com/cloud/api/commands/UpdateLoadBalancerRuleCmd.java index 586d28d4fa6..360e7c1fa74 100644 --- a/server/src/com/cloud/api/commands/UpdateLoadBalancerRuleCmd.java +++ b/server/src/com/cloud/api/commands/UpdateLoadBalancerRuleCmd.java @@ -7,6 +7,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.network.LoadBalancerVO; import com.cloud.user.Account; @@ -21,13 +22,61 @@ public class UpdateLoadBalancerRuleCmd extends BaseCmd { static { s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.DESCRIPTION, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.PRIVATE_PORT, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ALGORITHM, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.DESCRIPTION, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.PRIVATE_PORT, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="algorithm", type=CommandType.STRING) + private String algorithm; + + @Parameter(name="description", type=CommandType.STRING) + private String description; + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + @Parameter(name="name", type=CommandType.STRING) + private String loadBalancerName; + + @Parameter(name="privateport", type=CommandType.STRING) + private String privatePort; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAlgorithm() { + return algorithm; + } + + public String getDescription() { + return description; + } + + public Long getId() { + return id; + } + + public String getLoadBalancerName() { + return loadBalancerName; + } + + public String getPrivatePort() { + return privatePort; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/UpdatePodCmd.java b/server/src/com/cloud/api/commands/UpdatePodCmd.java index 5b6a8263e25..7ded253c9de 100644 --- a/server/src/com/cloud/api/commands/UpdatePodCmd.java +++ b/server/src/com/cloud/api/commands/UpdatePodCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.dc.DataCenterVO; import com.cloud.dc.HostPodVO; @@ -38,15 +39,70 @@ public class UpdatePodCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { + s_properties.add(new Pair(BaseCmd.Properties.CIDR, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.END_IP, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.GATEWAY, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.GATEWAY, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.CIDR, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.START_IP, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.END_IP, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="cidr", type=CommandType.STRING) + private String cidr; + + @Parameter(name="endip", type=CommandType.STRING) + private String endIp; + + @Parameter(name="gateway", type=CommandType.STRING) + private String gateway; + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + @Parameter(name="name", type=CommandType.STRING) + private String podName; + + @Parameter(name="startip", type=CommandType.STRING) + private String startIp; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getCidr() { + return cidr; + } + + public String getEndIp() { + return endIp; + } + + public String getGateway() { + return gateway; + } + + public Long getId() { + return id; + } + + public String getPodName() { + return podName; + } + + public String getStartIp() { + return startIp; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/UpdateResourceLimitCmd.java b/server/src/com/cloud/api/commands/UpdateResourceLimitCmd.java index 55fc1c1be1c..a89cf26b5b5 100644 --- a/server/src/com/cloud/api/commands/UpdateResourceLimitCmd.java +++ b/server/src/com/cloud/api/commands/UpdateResourceLimitCmd.java @@ -25,9 +25,10 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; -import com.cloud.configuration.ResourceLimitVO; import com.cloud.configuration.ResourceCount.ResourceType; +import com.cloud.configuration.ResourceLimitVO; import com.cloud.domain.DomainVO; import com.cloud.exception.InvalidParameterValueException; import com.cloud.server.Criteria; @@ -42,12 +43,53 @@ public class UpdateResourceLimitCmd extends BaseCmd { static { s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); + + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.RESOURCE_TYPE, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.MAX, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.RESOURCE_TYPE, Boolean.TRUE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="account", type=CommandType.STRING) + private String accountName; + + @Parameter(name="domainid", type=CommandType.LONG) + private Long domainId; + + @Parameter(name="max", type=CommandType.LONG) + private Long max; + + @Parameter(name="resourcetype", type=CommandType.INTEGER, required=true) + private Integer resourceType; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + public Long getMax() { + return max; + } + + public Integer getResourceType() { + return resourceType; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/UpdateServiceOfferingCmd.java b/server/src/com/cloud/api/commands/UpdateServiceOfferingCmd.java index 0b4d46ef420..f9807c136fe 100644 --- a/server/src/com/cloud/api/commands/UpdateServiceOfferingCmd.java +++ b/server/src/com/cloud/api/commands/UpdateServiceOfferingCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.offering.ServiceOffering.GuestIpType; import com.cloud.service.ServiceOfferingVO; @@ -37,15 +38,70 @@ public class UpdateServiceOfferingCmd extends BaseCmd{ private static final List> s_properties = new ArrayList>(); static { + s_properties.add(new Pair(BaseCmd.Properties.DISPLAY_TEXT, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.DISPLAY_TEXT, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.OFFER_HA, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.TAGS, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.USE_VIRTUAL_NETWORK, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.TAGS, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="displaytext", type=CommandType.STRING) + private String displayText; + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + @Parameter(name="name", type=CommandType.STRING) + private String serviceOfferingName; + + @Parameter(name="offerha", type=CommandType.BOOLEAN) + private Boolean offerHa; + + @Parameter(name="tags", type=CommandType.STRING) + private String tags; + + @Parameter(name="usevirtualnetwork", type=CommandType.BOOLEAN) + private Boolean useVirtualNetwork; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getDisplayText() { + return displayText; + } + + public Long getId() { + return id; + } + + public String getServiceOfferingName() { + return serviceOfferingName; + } + + public Boolean getOfferHa() { + return offerHa; + } + + public String getTags() { + return tags; + } + + public Boolean getUseVirtualNetwork() { + return useVirtualNetwork; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/UpdateStoragePoolCmd.java b/server/src/com/cloud/api/commands/UpdateStoragePoolCmd.java index 13cfc64f111..9a5f49fcf98 100644 --- a/server/src/com/cloud/api/commands/UpdateStoragePoolCmd.java +++ b/server/src/com/cloud/api/commands/UpdateStoragePoolCmd.java @@ -18,19 +18,14 @@ package com.cloud.api.commands; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.UnknownHostException; import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.dc.ClusterVO; import com.cloud.storage.StoragePoolVO; @@ -48,6 +43,32 @@ public class UpdateStoragePoolCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.TAGS, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + @Parameter(name="tags", type=CommandType.STRING) + private String tags; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + public String getTags() { + return tags; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/UpdateTemplateCmd.java b/server/src/com/cloud/api/commands/UpdateTemplateCmd.java index 752a43f8a14..b8fc35dbf5f 100644 --- a/server/src/com/cloud/api/commands/UpdateTemplateCmd.java +++ b/server/src/com/cloud/api/commands/UpdateTemplateCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.storage.VMTemplateVO; import com.cloud.user.Account; @@ -37,14 +38,69 @@ public class UpdateTemplateCmd extends BaseCmd { static { s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.DISPLAY_TEXT, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.FORMAT, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.OS_TYPE_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.PASSWORD_ENABLED, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="displaytext", type=CommandType.STRING) + private String displayText; + + @Parameter(name="format", type=CommandType.STRING) + private String format; + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + @Parameter(name="name", type=CommandType.STRING) + private String templateName; + + @Parameter(name="ostypeid", type=CommandType.LONG) + private Long osTypeId; + + @Parameter(name="passwordenabled", type=CommandType.BOOLEAN) + private Boolean passwordEnabled; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getDisplayText() { + return displayText; + } + + public String getFormat() { + return format; + } + + public Long getId() { + return id; + } + + public String getTemplateName() { + return templateName; + } + + public Long getOsTypeId() { + return osTypeId; + } + + public Boolean isPasswordEnabled() { + return passwordEnabled; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; @@ -106,7 +162,6 @@ public class UpdateTemplateCmd extends BaseCmd { templateData.add(new Pair(BaseCmd.Properties.FORMAT.getName(), updatedTemplate.getFormat())); templateData.add(new Pair(BaseCmd.Properties.OS_TYPE_ID.getName(), updatedTemplate.getGuestOSId())); templateData.add(new Pair(BaseCmd.Properties.PASSWORD_ENABLED.getName(), updatedTemplate.getEnablePassword())); - templateData.add(new Pair(BaseCmd.Properties.CROSS_ZONES.getName(), Boolean.valueOf(updatedTemplate.isCrossZones()).toString())); return templateData; } else { throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "internal error updating template"); diff --git a/server/src/com/cloud/api/commands/UpdateTemplateOrIsoPermissionsCmd.java b/server/src/com/cloud/api/commands/UpdateTemplateOrIsoPermissionsCmd.java index 78eff95987c..4e8d5b3d13e 100644 --- a/server/src/com/cloud/api/commands/UpdateTemplateOrIsoPermissionsCmd.java +++ b/server/src/com/cloud/api/commands/UpdateTemplateOrIsoPermissionsCmd.java @@ -8,6 +8,7 @@ import java.util.StringTokenizer; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.PermissionDeniedException; @@ -23,13 +24,61 @@ public abstract class UpdateTemplateOrIsoPermissionsCmd extends BaseCmd { static { s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.IS_PUBLIC, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.IS_FEATURED, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_NAMES, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.IS_FEATURED, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.IS_PUBLIC, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.OP, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="accounts", type=CommandType.LIST, collectionType=CommandType.STRING) + private List accountNames; + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + @Parameter(name="isfeatured", type=CommandType.BOOLEAN) + private Boolean featured; + + @Parameter(name="ispublic", type=CommandType.BOOLEAN) + private Boolean isPublic; + + @Parameter(name="op", type=CommandType.STRING) + private String operation; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public List getAccountNames() { + return accountNames; + } + + public Long getId() { + return id; + } + + public Boolean isFeatured() { + return featured; + } + + public Boolean isPublic() { + return isPublic; + } + + public String getOperation() { + return operation; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; @@ -82,12 +131,6 @@ 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)) { throw new ServerApiException(BaseCmd.PARAM_ERROR, "unable to update permissions for " + getMediaType() + " with id " + id); } diff --git a/server/src/com/cloud/api/commands/UpdateUserCmd.java b/server/src/com/cloud/api/commands/UpdateUserCmd.java index adf75e5afe1..1dff585fc19 100644 --- a/server/src/com/cloud/api/commands/UpdateUserCmd.java +++ b/server/src/com/cloud/api/commands/UpdateUserCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.exception.InvalidParameterValueException; import com.cloud.user.Account; @@ -38,17 +39,92 @@ public class UpdateUserCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { - s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.USERNAME, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.PASSWORD, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.FIRSTNAME, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.LASTNAME, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.EMAIL, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.TIMEZONE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.API_KEY, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.EMAIL, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.FIRSTNAME, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.LASTNAME, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.PASSWORD, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.SECRET_KEY, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.TIMEZONE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.USERNAME, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="apikey", type=CommandType.STRING) + private String apiKey; + + @Parameter(name="email", type=CommandType.STRING) + private String email; + + @Parameter(name="firstname", type=CommandType.STRING) + private String firstname; + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + @Parameter(name="lastname", type=CommandType.STRING) + private String lastname; + + @Parameter(name="password", type=CommandType.STRING) + private String password; + + @Parameter(name="secretkey", type=CommandType.STRING) + private String secretKey; + + @Parameter(name="timezone", type=CommandType.STRING) + private String timezone; + + @Parameter(name="username", type=CommandType.STRING) + private String username; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getApiKey() { + return apiKey; + } + + public String getEmail() { + return email; + } + + public String getFirstname() { + return firstname; + } + + public Long getId() { + return id; + } + + public String getLastname() { + return lastname; + } + + public String getPassword() { + return password; + } + + public String getSecretKey() { + return secretKey; + } + + public String getTimezone() { + return timezone; + } + + public String getUsername() { + return username; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/api/commands/UpdateVMCmd.java b/server/src/com/cloud/api/commands/UpdateVMCmd.java index 3f31927911b..254e1df6b13 100644 --- a/server/src/com/cloud/api/commands/UpdateVMCmd.java +++ b/server/src/com/cloud/api/commands/UpdateVMCmd.java @@ -18,13 +18,14 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.user.Account; import com.cloud.utils.Pair; @@ -36,14 +37,55 @@ public class UpdateVMCmd extends BaseCmd{ private static final List> s_properties = new ArrayList>(); static { + s_properties.add(new Pair(BaseCmd.Properties.DISPLAY_NAME, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.GROUP, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.HA_ENABLE, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.GROUP, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.DISPLAY_NAME, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.HA_ENABLE, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="displayname", type=CommandType.STRING) + private String displayName; + + @Parameter(name="group", type=CommandType.STRING) + private String group; + + @Parameter(name="haenable", type=CommandType.BOOLEAN) + private Boolean haEnable; + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getDisplayName() { + return displayName; + } + + public String getGroup() { + return group; + } + + public Boolean getHaEnable() { + return haEnable; + } + + public Long getId() { + return id; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/UpdateZoneCmd.java b/server/src/com/cloud/api/commands/UpdateZoneCmd.java index 609ce62f135..3861daf069e 100644 --- a/server/src/com/cloud/api/commands/UpdateZoneCmd.java +++ b/server/src/com/cloud/api/commands/UpdateZoneCmd.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.dc.DataCenterVO; import com.cloud.user.User; @@ -37,17 +38,86 @@ public class UpdateZoneCmd extends BaseCmd { private static final List> s_properties = new ArrayList>(); static { - s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.DNS1, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.DNS2, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.GUEST_CIDR_ADDRESS, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.INTERNAL_DNS1, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.INTERNAL_DNS2, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.VNET, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.GUEST_CIDR_ADDRESS, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="dns1", type=CommandType.STRING) + private String dns1; + + @Parameter(name="dns2", type=CommandType.STRING) + private String dns2; + + @Parameter(name="guestcidraddress", type=CommandType.STRING) + private String guestCidrAddress; + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + @Parameter(name="internaldns1", type=CommandType.STRING) + private String internalDns1; + + @Parameter(name="internaldns2", type=CommandType.STRING) + private String internalDns2; + + @Parameter(name="name", type=CommandType.STRING) + private String zoneName; + + @Parameter(name="vnet", type=CommandType.STRING) + private String vnet; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getDns1() { + return dns1; + } + + public String getDns2() { + return dns2; + } + + public String getGuestCidrAddress() { + return guestCidrAddress; + } + + public Long getId() { + return id; + } + + public String getInternalDns1() { + return internalDns1; + } + + public String getInternalDns2() { + return internalDns2; + } + + public String getZoneName() { + return zoneName; + } + + public String getVnet() { + return vnet; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getName() { return s_name; diff --git a/server/src/com/cloud/api/commands/UpgradeVMCmd.java b/server/src/com/cloud/api/commands/UpgradeVMCmd.java index b1a5d6ee643..cf6c153ae79 100644 --- a/server/src/com/cloud/api/commands/UpgradeVMCmd.java +++ b/server/src/com/cloud/api/commands/UpgradeVMCmd.java @@ -18,16 +18,16 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + import com.cloud.api.BaseCmd; +import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.exception.InvalidParameterValueException; -import com.cloud.service.ServiceOfferingVO; import com.cloud.user.Account; import com.cloud.user.User; import com.cloud.utils.Pair; @@ -41,10 +41,37 @@ public class UpgradeVMCmd extends BaseCmd { static { s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.SERVICE_OFFERING_ID, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); } + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name="id", type=CommandType.LONG, required=true) + private Long id; + + @Parameter(name="serviceofferingid", type=CommandType.LONG, required=true) + private Long serviceOfferingId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + public Long getServiceOfferingId() { + return serviceOfferingId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + public String getName() { return s_name; } diff --git a/server/src/com/cloud/async/executor/AssignToLoadBalancerExecutor.java b/server/src/com/cloud/async/executor/AssignToLoadBalancerExecutor.java index dd9bff55619..88309abbfa2 100644 --- a/server/src/com/cloud/async/executor/AssignToLoadBalancerExecutor.java +++ b/server/src/com/cloud/async/executor/AssignToLoadBalancerExecutor.java @@ -18,6 +18,9 @@ package com.cloud.async.executor; +import java.lang.reflect.Type; +import java.util.Map; + import org.apache.log4j.Logger; import com.cloud.async.AsyncJobManager; @@ -25,6 +28,7 @@ import com.cloud.async.AsyncJobVO; import com.cloud.async.BaseAsyncJobExecutor; import com.cloud.serializer.GsonHelper; import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; public class AssignToLoadBalancerExecutor extends BaseAsyncJobExecutor { public static final Logger s_logger = Logger.getLogger(AssignToLoadBalancerExecutor.class.getName()); @@ -35,7 +39,12 @@ public class AssignToLoadBalancerExecutor extends BaseAsyncJobExecutor { Gson gson = GsonHelper.getBuilder().create(); AsyncJobManager asyncMgr = getAsyncJobMgr(); AsyncJobVO job = getJob(); - + Type mapType = new TypeToken>() {}.getType(); + + Map params = gson.fromJson(job.getCmdInfo(), mapType); + for (Object paramObj : params.values()) { + s_logger.error("%%% %%% deserialized param: " + paramObj); + } LoadBalancerParam param = gson.fromJson(job.getCmdInfo(), LoadBalancerParam.class); asyncMgr.syncAsyncJobExecution(job.getId(), "Router", param.getDomainRouterId()); diff --git a/server/src/com/cloud/async/executor/CreatePrivateTemplateExecutor.java b/server/src/com/cloud/async/executor/CreatePrivateTemplateExecutor.java index 32fda8b7ac9..2a44c5e6650 100644 --- a/server/src/com/cloud/async/executor/CreatePrivateTemplateExecutor.java +++ b/server/src/com/cloud/async/executor/CreatePrivateTemplateExecutor.java @@ -188,7 +188,6 @@ public class CreatePrivateTemplateExecutor extends VolumeOperationExecutor { resultObject.setCreated(templateHostRef.getCreated()); resultObject.setReady(templateHostRef != null && templateHostRef.getDownloadState() == Status.DOWNLOADED); resultObject.setPasswordEnabled(template.getEnablePassword()); - resultObject.setCrossZones(template.isCrossZones()); ManagementServer managerServer = getAsyncJobMgr().getExecutorContext().getManagementServer(); GuestOS os = managerServer.findGuestOSById(template.getGuestOSId()); if (os != null) { diff --git a/server/src/com/cloud/async/executor/CreatePrivateTemplateResultObject.java b/server/src/com/cloud/async/executor/CreatePrivateTemplateResultObject.java index beee9b6c247..c18ef4d3180 100644 --- a/server/src/com/cloud/async/executor/CreatePrivateTemplateResultObject.java +++ b/server/src/com/cloud/async/executor/CreatePrivateTemplateResultObject.java @@ -52,9 +52,6 @@ public class CreatePrivateTemplateResultObject { @Param(name="passwordenabled") private boolean passwordEnabled; - @Param(name="crossZones") - private boolean crossZones; - @Param(name="ostypeid") private Long osTypeId; @@ -200,14 +197,6 @@ public class CreatePrivateTemplateResultObject { this.passwordEnabled = passwordEnabled; } - public boolean isCrossZones() { - return crossZones; - } - - public void setCrossZones(boolean crossZones) { - this.crossZones = crossZones; - } - public long getDomainId() { return domainId; } diff --git a/server/src/com/cloud/async/executor/DeployVMExecutor.java b/server/src/com/cloud/async/executor/DeployVMExecutor.java index 23fcc8c7493..b0da90c7b32 100644 --- a/server/src/com/cloud/async/executor/DeployVMExecutor.java +++ b/server/src/com/cloud/async/executor/DeployVMExecutor.java @@ -60,7 +60,7 @@ public class DeployVMExecutor extends VMOperationExecutor { param.getUserId(), param.getAccountId(), param.getDataCenterId(), param.getServiceOfferingId(), param.getTemplateId(), param.getDiskOfferingId(), param.getDomain(), - param.getPassword(), param.getDisplayName(), param.getGroup(), param.getUserData(), param.getNetworkGroup(), param.getEventId(), param.getSize()); + param.getPassword(), param.getDisplayName(), param.getGroup(), param.getUserData(), param.getNetworkGroup(), param.getEventId()); asyncMgr.completeAsyncJob(getJob().getId(), AsyncJobResult.STATUS_SUCCEEDED, 0, composeResultObject(param.getUserId(), vm, param)); diff --git a/server/src/com/cloud/async/executor/DeployVMParam.java b/server/src/com/cloud/async/executor/DeployVMParam.java index 4727b51142c..d857b5eaab3 100644 --- a/server/src/com/cloud/async/executor/DeployVMParam.java +++ b/server/src/com/cloud/async/executor/DeployVMParam.java @@ -31,7 +31,6 @@ public class DeployVMParam extends VMOperationParam { private String userData; private long domainId; private String [] networkGroups; - private long size; public DeployVMParam() { } @@ -59,7 +58,7 @@ public class DeployVMParam extends VMOperationParam { long serviceOfferingId, long templateId, Long diskOfferingId, String domain, String password, String displayName, String group, String userData, - String [] networkGroups, long eventId, long size) { + String [] networkGroups, long eventId) { setUserId(userId); setAccountId(accountId); @@ -74,12 +73,7 @@ public class DeployVMParam extends VMOperationParam { this.userData = userData; this.setNetworkGroups(networkGroups); this.eventId = eventId; - this.size = size; - } - - public long getSize(){ - return size; - } + } public long getDataCenterId() { return dataCenterId; diff --git a/server/src/com/cloud/async/executor/VolumeOperationExecutor.java b/server/src/com/cloud/async/executor/VolumeOperationExecutor.java index 9f32126c568..10f6b1c0dbc 100644 --- a/server/src/com/cloud/async/executor/VolumeOperationExecutor.java +++ b/server/src/com/cloud/async/executor/VolumeOperationExecutor.java @@ -62,7 +62,7 @@ public class VolumeOperationExecutor extends BaseAsyncJobExecutor { if (op == VolumeOp.Create) { eventType = EventTypes.EVENT_VOLUME_CREATE; failureDescription = "Failed to create volume"; - volume = asyncMgr.getExecutorContext().getManagementServer().createVolume(param.getUserId(), param.getAccountId(), param.getName(), param.getZoneId(), param.getDiskOfferingId(), param.getEventId(), param.getSize()); + volume = asyncMgr.getExecutorContext().getManagementServer().createVolume(param.getUserId(), param.getAccountId(), param.getName(), param.getZoneId(), param.getDiskOfferingId(), param.getEventId()); if (volume.getStatus() == AsyncInstanceCreateStatus.Corrupted) { asyncMgr.completeAsyncJob(getJob().getId(), AsyncJobResult.STATUS_FAILED, BaseCmd.INTERNAL_ERROR, "Failed to create volume."); } else { diff --git a/server/src/com/cloud/async/executor/VolumeOperationParam.java b/server/src/com/cloud/async/executor/VolumeOperationParam.java index 4ee39e087a0..86c10aa53ed 100644 --- a/server/src/com/cloud/async/executor/VolumeOperationParam.java +++ b/server/src/com/cloud/async/executor/VolumeOperationParam.java @@ -31,8 +31,7 @@ public class VolumeOperationParam { private long zoneId; private String name; private long diskOfferingId; - private long size; - + // Used for Attach and Detach private long vmId; @@ -125,11 +124,4 @@ public class VolumeOperationParam { return deviceId; } - public long getSize(){ - return size; - } - - public void setSize(long size){ - this.size = size; - } } diff --git a/server/src/com/cloud/configuration/ConfigurationManager.java b/server/src/com/cloud/configuration/ConfigurationManager.java index 2acf9ee9e27..b9fc95ba032 100644 --- a/server/src/com/cloud/configuration/ConfigurationManager.java +++ b/server/src/com/cloud/configuration/ConfigurationManager.java @@ -96,7 +96,6 @@ public interface ConfigurationManager extends Manager { * @param description * @param numGibibytes * @param mirrored - * @param size * @return ID */ DiskOfferingVO createDiskOffering(long domainId, String name, String description, int numGibibytes, String tags); diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index 52a7b58dfc3..f5efe1c0438 100644 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -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); } - private String validateConfigurationValue(String name, String value) throws InvalidParameterValueException { + private String validateConfigurationValue(String name, String value) { if (value == null) { return null; } @@ -170,18 +170,11 @@ public class ConfigurationManagerImpl implements ConfigurationManager { } if(type.equals(String.class)) { - if (range.equals("privateip")) - { - try { - if (!NetUtils.isSiteLocalAddress(value)) { - 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"); + if (range.equals("privateip")) { + if (!NetUtils.isSiteLocalAddress(value)) { + s_logger.error("privateip range " + value + + " is not a site local address for configuration variable " + name); + return "Please enter a site local IP address."; } } else if (range.equals("netmask")) { if (!NetUtils.isValidNetmask(value)) { diff --git a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java index 3cfbc1dacaf..c0bb446a6e3 100644 --- a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java +++ b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java @@ -985,7 +985,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, final AccountVO account = _accountDao.findById(Account.ACCOUNT_ID_SYSTEM); try { - List vols = _storageMgr.create(account, proxy, _template, dc, pod, _serviceOffering, null,0); + List vols = _storageMgr.create(account, proxy, _template, dc, pod, _serviceOffering, null); if (vols == null) { s_logger.error("Unable to alloc storage for console proxy"); return null; @@ -1383,9 +1383,10 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, if (s_logger.isTraceEnabled()) 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"); - 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"); return; diff --git a/server/src/com/cloud/hypervisor/vmware/discoverer/VmwareServerDiscoverer.java b/server/src/com/cloud/hypervisor/vmware/discoverer/VmwareServerDiscoverer.java deleted file mode 100644 index a7f186a19e0..00000000000 --- a/server/src/com/cloud/hypervisor/vmware/discoverer/VmwareServerDiscoverer.java +++ /dev/null @@ -1,40 +0,0 @@ -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> find(long dcId, Long podId, Long clusterId, URI url, - String username, String password) throws DiscoveryException { - - // ??? - return null; - } - - @Override - public void postDiscovery(List hosts, long msId) { - //do nothing - } - - @Override - public boolean configure(String name, Map params) throws ConfigurationException { - super.configure(name, params); - - // TODO - return true; - } -} - diff --git a/server/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java b/server/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java index ecdf216f5df..d5ae622d890 100644 --- a/server/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java +++ b/server/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java @@ -214,17 +214,17 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L details.put(HostInfo.HOST_OS_KERNEL_VERSION, hostKernelVer); details.put(HostInfo.HYPERVISOR_VERSION, xenVersion); - if (!params.containsKey("public.network.device") && _publicNic != null) { + if (!params.containsKey("public.network.device")) { params.put("public.network.device", _publicNic); details.put("public.network.device", _publicNic); } - if (!params.containsKey("guest.network.device") && _guestNic != null) { + if (!params.containsKey("guest.network.device")) { params.put("guest.network.device", _guestNic); details.put("guest.network.device", _guestNic); } - if (!params.containsKey("private.network.device") && _privateNic != null) { + if (!params.containsKey("private.network.device")) { params.put("private.network.device", _privateNic); details.put("private.network.device", _privateNic); } diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java index a37b3376cb6..9a49c93c977 100755 --- a/server/src/com/cloud/network/NetworkManagerImpl.java +++ b/server/src/com/cloud/network/NetworkManagerImpl.java @@ -97,7 +97,6 @@ import com.cloud.ha.HighAvailabilityManager; import com.cloud.host.Host; import com.cloud.host.HostVO; import com.cloud.host.dao.HostDao; -import com.cloud.hypervisor.Hypervisor; import com.cloud.network.dao.FirewallRulesDao; import com.cloud.network.dao.IPAddressDao; import com.cloud.network.dao.LoadBalancerDao; @@ -433,7 +432,7 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager txn.commit(); - List vols = _storageMgr.create(account, router, rtrTemplate, dc, pod, _offering, null,0); + List vols = _storageMgr.create(account, router, rtrTemplate, dc, pod, _offering, null); if (vols == null){ _ipAddressDao.unassignIpAddress(guestIp); _routerDao.delete(router.getId()); @@ -606,7 +605,7 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager router.setLastHostId(pod.second()); router = _routerDao.persist(router); - List vols = _storageMgr.create(account, router, template, dc, pod.first(), _offering, null,0); + List vols = _storageMgr.create(account, router, template, dc, pod.first(), _offering, null); if(vols != null) { found = true; break; @@ -2050,7 +2049,7 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager final HashSet avoid = new HashSet(); final HostVO fromHost = _hostDao.findById(router.getHostId()); - if (fromHost.getHypervisorType() != Hypervisor.Type.KVM && fromHost.getClusterId() == null) { + if (fromHost.getClusterId() == null) { s_logger.debug("The host is not in a cluster"); return null; } diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java b/server/src/com/cloud/server/ConfigurationServerImpl.java index b07169a1a62..ba45f291447 100644 --- a/server/src/com/cloud/server/ConfigurationServerImpl.java +++ b/server/src/com/cloud/server/ConfigurationServerImpl.java @@ -145,8 +145,7 @@ public class ConfigurationServerImpl implements ConfigurationServer { _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, "Large", "Large Disk, 100 GB", 100, null); - _configMgr.createDiskOffering(DomainVO.ROOT_DOMAIN, "Private", "Private Disk", 0, null); - + //Add default manual snapshot policy SnapshotPolicyVO snapPolicy = new SnapshotPolicyVO(0L, "00", "GMT", (short)4, 0); _snapPolicyDao.persist(snapPolicy); diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java index 6f8312c6534..3a87d379d15 100755 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@ -38,6 +38,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.StringTokenizer; import java.util.TimeZone; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; @@ -58,6 +59,7 @@ import com.cloud.alert.AlertManager; import com.cloud.alert.AlertVO; import com.cloud.alert.dao.AlertDao; import com.cloud.api.BaseCmd; +import com.cloud.api.ServerApiException; import com.cloud.api.commands.AssociateIPAddrCmd; import com.cloud.api.commands.AuthorizeNetworkGroupIngressCmd; import com.cloud.api.commands.CancelMaintenanceCmd; @@ -101,15 +103,15 @@ import com.cloud.async.executor.SecurityGroupParam; import com.cloud.async.executor.UpdateLoadBalancerParam; import com.cloud.async.executor.UpgradeVMParam; import com.cloud.async.executor.VMOperationParam; -import com.cloud.async.executor.VolumeOperationParam; import com.cloud.async.executor.VMOperationParam.VmOp; +import com.cloud.async.executor.VolumeOperationParam; import com.cloud.async.executor.VolumeOperationParam.VolumeOp; import com.cloud.capacity.CapacityVO; import com.cloud.capacity.dao.CapacityDao; import com.cloud.configuration.ConfigurationManager; import com.cloud.configuration.ConfigurationVO; -import com.cloud.configuration.ResourceLimitVO; import com.cloud.configuration.ResourceCount.ResourceType; +import com.cloud.configuration.ResourceLimitVO; import com.cloud.configuration.dao.ConfigurationDao; import com.cloud.configuration.dao.ResourceLimitDao; import com.cloud.consoleproxy.ConsoleProxyManager; @@ -119,8 +121,8 @@ import com.cloud.dc.DataCenterIpAddressVO; import com.cloud.dc.DataCenterVO; import com.cloud.dc.HostPodVO; import com.cloud.dc.PodVlanMapVO; -import com.cloud.dc.VlanVO; import com.cloud.dc.Vlan.VlanType; +import com.cloud.dc.VlanVO; import com.cloud.dc.dao.AccountVlanMapDao; import com.cloud.dc.dao.ClusterDao; import com.cloud.dc.dao.DataCenterDao; @@ -186,22 +188,22 @@ import com.cloud.storage.GuestOSCategoryVO; import com.cloud.storage.GuestOSVO; import com.cloud.storage.LaunchPermissionVO; import com.cloud.storage.Snapshot; +import com.cloud.storage.Snapshot.SnapshotType; import com.cloud.storage.SnapshotPolicyVO; import com.cloud.storage.SnapshotScheduleVO; import com.cloud.storage.SnapshotVO; import com.cloud.storage.Storage; +import com.cloud.storage.Storage.FileSystem; +import com.cloud.storage.Storage.ImageFormat; import com.cloud.storage.StorageManager; import com.cloud.storage.StoragePoolVO; import com.cloud.storage.StorageStats; import com.cloud.storage.VMTemplateHostVO; import com.cloud.storage.VMTemplateStorageResourceAssoc; import com.cloud.storage.VMTemplateVO; +import com.cloud.storage.Volume.VolumeType; import com.cloud.storage.VolumeStats; import com.cloud.storage.VolumeVO; -import com.cloud.storage.Snapshot.SnapshotType; -import com.cloud.storage.Storage.FileSystem; -import com.cloud.storage.Storage.ImageFormat; -import com.cloud.storage.Volume.VolumeType; import com.cloud.storage.dao.DiskOfferingDao; import com.cloud.storage.dao.DiskTemplateDao; import com.cloud.storage.dao.GuestOSCategoryDao; @@ -211,9 +213,9 @@ import com.cloud.storage.dao.SnapshotDao; import com.cloud.storage.dao.SnapshotPolicyDao; import com.cloud.storage.dao.StoragePoolDao; import com.cloud.storage.dao.VMTemplateDao; +import com.cloud.storage.dao.VMTemplateDao.TemplateFilter; import com.cloud.storage.dao.VMTemplateHostDao; import com.cloud.storage.dao.VolumeDao; -import com.cloud.storage.dao.VMTemplateDao.TemplateFilter; import com.cloud.storage.preallocatedlun.PreallocatedLunVO; import com.cloud.storage.preallocatedlun.dao.PreallocatedLunDao; import com.cloud.storage.secondary.SecondaryStorageVmManager; @@ -235,12 +237,12 @@ import com.cloud.user.dao.UserDao; import com.cloud.user.dao.UserStatisticsDao; import com.cloud.uservm.UserVm; import com.cloud.utils.DateUtil; +import com.cloud.utils.DateUtil.IntervalType; import com.cloud.utils.EnumUtils; import com.cloud.utils.NumbersUtil; import com.cloud.utils.Pair; import com.cloud.utils.PasswordGenerator; import com.cloud.utils.StringUtils; -import com.cloud.utils.DateUtil.IntervalType; import com.cloud.utils.component.Adapters; import com.cloud.utils.component.ComponentLocator; import com.cloud.utils.concurrency.NamedThreadFactory; @@ -920,7 +922,9 @@ public class ManagementServerImpl implements ManagementServer { if (!_vmMgr.destroyVirtualMachine(userId, vm.getId())) { s_logger.error("Unable to destroy vm: " + vm.getId()); accountCleanupNeeded = true; - } + } else { + //_vmMgr.releaseGuestIpAddress(vm); FIXME FIXME bug 5561 + } } // Mark the account's volumes as destroyed @@ -1447,20 +1451,19 @@ public class ManagementServerImpl implements ManagementServer { List ipAddrsList = new ArrayList(); for (VlanVO vlan : vlansForAccount){ ipAddrsList.addAll(_publicIpAddressDao.assignAcccountSpecificIps(accountId, account.getDomainId().longValue(), vlan.getId(), false)); - + long size = ipAddrsList.size(); _accountMgr.incrementResourceCount(accountId, ResourceType.public_ip, size); s_logger.debug("Assigning new ip addresses " +ipAddrsList); } if(ipAddrsList.isEmpty()) return; - - // Associate the IP's to DomR - boolean success = true; - String params = "\nsourceNat=" + false + "\ndcId=" + zoneId; - ArrayList dummyipAddrList = new ArrayList(); - success = _networkMgr.associateIP(router,ipAddrsList, true); - String errorMsg = "Unable to assign public IP address pool"; + + String params = "\nsourceNat=" + false + "\ndcId=" + zoneId; + + // Associate the IP's to DomR + boolean success = _networkMgr.associateIP(router,ipAddrsList, true); + String errorMsg = "Unable to assign public IP address pool"; if (!success) { s_logger.debug(errorMsg); for(String ip : ipAddrsList){ @@ -1653,12 +1656,7 @@ public class ManagementServerImpl implements ManagementServer { if (!vlan.getVlanType().equals(VlanType.VirtualNetwork)) { 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(); boolean success = _networkMgr.releasePublicIpAddress(userId, publicIPAddress); if (success) @@ -1729,11 +1727,11 @@ public class ManagementServerImpl implements ManagementServer { } @Override - public VolumeVO createVolume(long userId, long accountId, String name, long zoneId, long diskOfferingId, long startEventId, long size) throws InternalErrorException { + public VolumeVO createVolume(long userId, long accountId, String name, long zoneId, long diskOfferingId, long startEventId) throws InternalErrorException { saveStartedEvent(userId, accountId, EventTypes.EVENT_VOLUME_CREATE, "Creating volume", startEventId); DataCenterVO zone = _dcDao.findById(zoneId); DiskOfferingVO diskOffering = _diskOfferingDao.findById(diskOfferingId); - VolumeVO createdVolume = _storageMgr.createVolume(accountId, userId, name, zone, diskOffering, startEventId,size); + VolumeVO createdVolume = _storageMgr.createVolume(accountId, userId, name, zone, diskOffering, startEventId); if (createdVolume != null) return createdVolume; @@ -1742,7 +1740,7 @@ public class ManagementServerImpl implements ManagementServer { } @Override - public long createVolumeAsync(long userId, long accountId, String name, long zoneId, long diskOfferingId, long size) throws InvalidParameterValueException, InternalErrorException, ResourceAllocationException { + public long createVolumeAsync(long userId, long accountId, String name, long zoneId, long diskOfferingId) throws InvalidParameterValueException, InternalErrorException, ResourceAllocationException { // Check that the account is valid AccountVO account = _accountDao.findById(accountId); if (account == null) { @@ -1797,8 +1795,7 @@ public class ManagementServerImpl implements ManagementServer { param.setZoneId(zoneId); param.setDiskOfferingId(diskOfferingId); param.setEventId(eventId); - param.setSize(size); - + Gson gson = GsonHelper.getBuilder().create(); AsyncJobVO job = new AsyncJobVO(); @@ -2191,7 +2188,7 @@ public class ManagementServerImpl implements ManagementServer { @Override 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, long size) throws ResourceAllocationException, InvalidParameterValueException, InternalErrorException, + String domain, String password, String displayName, String group, String userData, String [] networkGroups, long startEventId) throws ResourceAllocationException, InvalidParameterValueException, InternalErrorException, InsufficientStorageCapacityException, PermissionDeniedException, ExecutionException, StorageUnavailableException, ConcurrentOperationException { saveStartedEvent(userId, accountId, EventTypes.EVENT_VM_CREATE, "Deploying Vm", startEventId); @@ -2275,7 +2272,7 @@ public class ManagementServerImpl implements ManagementServer { ArrayList a = new ArrayList(avoids.values()); if (_directAttachNetworkExternalIpAllocator) { try { - created = _vmMgr.createDirectlyAttachedVMExternal(vmId, userId, account, dc, offering, template, diskOffering, displayName, group, userData, a, networkGroupVOs, startEventId, size); + created = _vmMgr.createDirectlyAttachedVMExternal(vmId, userId, account, dc, offering, template, diskOffering, displayName, group, userData, a, networkGroupVOs, startEventId); } catch (ResourceAllocationException rae) { throw rae; } @@ -2296,13 +2293,13 @@ public class ManagementServerImpl implements ManagementServer { } try { - created = _vmMgr.createVirtualMachine(vmId, userId, account, dc, offering, template, diskOffering, displayName, group, userData, a, startEventId, size); + created = _vmMgr.createVirtualMachine(vmId, userId, account, dc, offering, template, diskOffering, displayName, group, userData, a, startEventId); } catch (ResourceAllocationException rae) { throw rae; } } else { try { - created = _vmMgr.createDirectlyAttachedVM(vmId, userId, account, dc, offering, template, diskOffering, displayName, group, userData, a, networkGroupVOs, startEventId, size); + created = _vmMgr.createDirectlyAttachedVM(vmId, userId, account, dc, offering, template, diskOffering, displayName, group, userData, a, networkGroupVOs, startEventId); } catch (ResourceAllocationException rae) { throw rae; } @@ -2403,7 +2400,7 @@ public class ManagementServerImpl implements ManagementServer { _userVmDao.update(started.getId(), started); started = _userVmDao.findById(started.getId()); } - String params = "\nsourceNat=" + false + "\ndcId=" + dc.getId(); + try { associateIpAddressListToAccount(userId, accountId, dc.getId(),null); } catch (InsufficientAddressCapacityException e) { @@ -2421,7 +2418,7 @@ public class ManagementServerImpl implements ManagementServer { @Override 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, long size) throws InvalidParameterValueException, PermissionDeniedException { + Long diskOfferingId, String domain, String password, String displayName, String group, String userData, String [] networkGroups) throws InvalidParameterValueException, PermissionDeniedException { AccountVO account = _accountDao.findById(accountId); if (account == null) { @@ -2515,7 +2512,7 @@ public class ManagementServerImpl implements ManagementServer { long eventId = saveScheduledEvent(userId, accountId, EventTypes.EVENT_VM_CREATE, "deploying Vm"); DeployVMParam param = new DeployVMParam(userId, accountId, dataCenterId, serviceOfferingId, templateId, diskOfferingId, domain, password, - displayName, group, userData, networkGroups, eventId, size); + displayName, group, userData, networkGroups, eventId); Gson gson = GsonHelper.getBuilder().create(); AsyncJobVO job = new AsyncJobVO(); @@ -2626,7 +2623,7 @@ public class ManagementServerImpl implements ManagementServer { } @Override - public boolean recoverVirtualMachine(long vmId) throws ResourceAllocationException, InternalErrorException { + public boolean recoverVirtualMachine(long vmId) throws ResourceAllocationException { return _vmMgr.recoverVirtualMachine(vmId); } @@ -3383,58 +3380,55 @@ public class ManagementServerImpl implements ManagementServer { } } - if (userVm != null) { - Pair privateIpPort = mappedPublicPorts.get(publicPort); - if (privateIpPort != null) { - if (privateIpPort.first().equals(userVm.getGuestIpAddress()) && privateIpPort.second().equals(privatePort)) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("skipping the creating of firewall rule " + ipAddress + ":" + publicPort + " to " + userVm.getGuestIpAddress() + ":" + privatePort + "; rule already exists."); - } - return null; // already mapped - } else { - throw new NetworkRuleConflictException("An existing port forwarding service rule for " + ipAddress + ":" + publicPort - + " already exists, found while trying to create mapping to " + userVm.getGuestIpAddress() + ":" + privatePort + ((securityGroupId == null) ? "." : " from port forwarding service " - + securityGroupId.toString() + ".")); + Pair privateIpPort = mappedPublicPorts.get(publicPort); + if (privateIpPort != null) { + if (privateIpPort.first().equals(userVm.getGuestIpAddress()) && privateIpPort.second().equals(privatePort)) { + if (s_logger.isDebugEnabled()) { + s_logger.debug("skipping the creating of firewall rule " + ipAddress + ":" + publicPort + " to " + userVm.getGuestIpAddress() + ":" + privatePort + "; rule already exists."); } - } - - FirewallRuleVO newFwRule = new FirewallRuleVO(); - newFwRule.setEnabled(true); - newFwRule.setForwarding(true); - newFwRule.setPrivatePort(privatePort); - newFwRule.setProtocol(protocol); - newFwRule.setPublicPort(publicPort); - newFwRule.setPublicIpAddress(ipAddress); - newFwRule.setPrivateIpAddress(userVm.getGuestIpAddress()); - newFwRule.setGroupId(securityGroupId); - - // In 1.0 the rules were always persisted when a user created a rule. When the rules get sent down - // the stopOnError parameter is set to false, so the agent will apply all rules that it can. That - // behavior is preserved here by persisting the rule before sending it to the agent. - _firewallRulesDao.persist(newFwRule); - - boolean success = _networkMgr.updateFirewallRule(newFwRule, null, null); - - // Save and create the event - String description; - String ruleName = "ip forwarding"; - String level = EventVO.LEVEL_INFO; - Account account = _accountDao.findById(userVm.getAccountId()); - - if (success == true) { - description = "created new " + ruleName + " rule [" + newFwRule.getPublicIpAddress() + ":" + newFwRule.getPublicPort() + "]->[" - + newFwRule.getPrivateIpAddress() + ":" + newFwRule.getPrivatePort() + "]" + " " + newFwRule.getProtocol(); + return null; // already mapped } else { - level = EventVO.LEVEL_ERROR; - description = "failed to create new " + ruleName + " rule [" + newFwRule.getPublicIpAddress() + ":" + newFwRule.getPublicPort() + "]->[" - + newFwRule.getPrivateIpAddress() + ":" + newFwRule.getPrivatePort() + "]" + " " + newFwRule.getProtocol(); + throw new NetworkRuleConflictException("An existing port forwarding service rule for " + ipAddress + ":" + publicPort + + " already exists, found while trying to create mapping to " + userVm.getGuestIpAddress() + ":" + privatePort + ((securityGroupId == null) ? "." : " from port forwarding service " + + securityGroupId.toString() + ".")); } - - saveEvent(Long.valueOf(userId), account.getId(), level, EventTypes.EVENT_NET_RULE_ADD, description); - - return newFwRule; } - return null; + + FirewallRuleVO newFwRule = new FirewallRuleVO(); + newFwRule.setEnabled(true); + newFwRule.setForwarding(true); + newFwRule.setPrivatePort(privatePort); + newFwRule.setProtocol(protocol); + newFwRule.setPublicPort(publicPort); + newFwRule.setPublicIpAddress(ipAddress); + newFwRule.setPrivateIpAddress(userVm.getGuestIpAddress()); + newFwRule.setGroupId(securityGroupId); + + // In 1.0 the rules were always persisted when a user created a rule. When the rules get sent down + // the stopOnError parameter is set to false, so the agent will apply all rules that it can. That + // behavior is preserved here by persisting the rule before sending it to the agent. + _firewallRulesDao.persist(newFwRule); + + boolean success = _networkMgr.updateFirewallRule(newFwRule, null, null); + + // Save and create the event + String description; + String ruleName = "ip forwarding"; + String level = EventVO.LEVEL_INFO; + Account account = _accountDao.findById(userVm.getAccountId()); + + if (success == true) { + description = "created new " + ruleName + " rule [" + newFwRule.getPublicIpAddress() + ":" + newFwRule.getPublicPort() + "]->[" + + newFwRule.getPrivateIpAddress() + ":" + newFwRule.getPrivatePort() + "]" + " " + newFwRule.getProtocol(); + } else { + level = EventVO.LEVEL_ERROR; + description = "failed to create new " + ruleName + " rule [" + newFwRule.getPublicIpAddress() + ":" + newFwRule.getPublicPort() + "]->[" + + newFwRule.getPrivateIpAddress() + ":" + newFwRule.getPrivatePort() + "]" + " " + newFwRule.getProtocol(); + } + + saveEvent(Long.valueOf(userId), account.getId(), level, EventTypes.EVENT_NET_RULE_ADD, description); + + return newFwRule; } @DB @@ -4234,14 +4228,6 @@ public class ManagementServerImpl implements ManagementServer { template = _templateDao.findById(templateId); if (template == null) { 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); } } @@ -4281,7 +4267,7 @@ public class ManagementServerImpl implements ManagementServer { return _templateHostDao.listByHostTemplate(secondaryStorageHost.getId(), templateId); } } else { - return _templateHostDao.listByOnlyTemplateId(templateId); + return _templateHostDao.listByTemplateId(templateId); } } @@ -4775,6 +4761,20 @@ public class ManagementServerImpl implements ManagementServer { VMTemplateVO template = _templateDao.createForUpdate(id); 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); } @@ -6657,11 +6657,6 @@ public class ManagementServerImpl implements ManagementServer { return _diskOfferingDao.findById(diskOfferingId); } - @Override - public List findPrivateDiskOffering() { - return _diskOfferingDao.findPrivateDiskOffering(); - } - @Override @DB public boolean updateTemplatePermissions(long templateId, String operation, Boolean isPublic, Boolean isFeatured, List accountNames) throws InvalidParameterValueException, @@ -6815,7 +6810,7 @@ public class ManagementServerImpl implements ManagementServer { @Override public DiskOfferingVO createDiskOffering(long domainId, String name, String description, int numGibibytes, String tags) throws InvalidParameterValueException { - if (numGibibytes!=0 && numGibibytes < 1) { + if (numGibibytes < 1) { throw new InvalidParameterValueException("Please specify a disk size of at least 1 Gb."); } else if (numGibibytes > _maxVolumeSizeInGb) { throw new InvalidParameterValueException("The maximum size for a disk is " + _maxVolumeSizeInGb + " Gb."); @@ -7367,9 +7362,42 @@ public class ManagementServerImpl implements ManagementServer { } @Override @DB - public long assignToLoadBalancerAsync(long userId, long loadBalancerId, List instanceIds) { + public long assignToLoadBalancerAsync(/*long userId, long loadBalancerId, List instanceIds, */Map params) { LoadBalancerVO loadBalancer = null; try { + // unpack the params + String accountName = params.get(BaseCmd.Properties.ACCOUNT.getName()); + String domainIdStr = params.get(BaseCmd.Properties.DOMAIN_ID.getName()); + String loadBalancerIdStr = params.get(BaseCmd.Properties.ID.getName()); + String instanceIdStr = params.get(BaseCmd.Properties.VIRTUAL_MACHINE_ID.getName()); + String instanceIdList = params.get(BaseCmd.Properties.VIRTUAL_MACHINE_IDS.getName()); + + Long domainId = null; + if (domainIdStr != null) { + domainId = Long.valueOf(domainIdStr); + } + + Long loadBalancerId = null; + if (loadBalancerIdStr != null) { + loadBalancerId = Long.valueOf(loadBalancerIdStr); + } + + List instanceIds = new ArrayList(); + if (instanceIdList != null) { + StringTokenizer st = new StringTokenizer(instanceIdList, ","); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + try { + Long nextInstanceId = Long.parseLong(token); + instanceIds.add(nextInstanceId); + } catch (NumberFormatException nfe) { + throw new ServerApiException(BaseCmd.PARAM_ERROR, "The virtual machine id " + token + " is not a valid parameter."); + } + } + } else if (instanceIdStr != null) { + instanceIds.add(Long.valueOf(instanceIdStr)); + } + loadBalancer = _loadBalancerDao.acquire(loadBalancerId); // if unable to lock the load balancer, throw an exception @@ -7379,6 +7407,7 @@ public class ManagementServerImpl implements ManagementServer { IPAddressVO ipAddress = _publicIpAddressDao.findById(loadBalancer.getIpAddress()); DomainRouterVO router = _routerDao.findBy(loadBalancer.getAccountId(), ipAddress.getDataCenterId()); + params.put("domainrouterid", Long.valueOf(router.getId()).toString()); List mappedVMs = _loadBalancerVMMapDao.listByLoadBalancerId(loadBalancerId); for (LoadBalancerVMMapVO mappedVM : mappedVMs) { @@ -7399,14 +7428,15 @@ public class ManagementServerImpl implements ManagementServer { _loadBalancerVMMapDao.persist(loadBalancerMapping); } - LoadBalancerParam param = new LoadBalancerParam(userId, router.getId(), loadBalancerId, instanceIds); +// LoadBalancerParam param = new LoadBalancerParam(userId, router.getId(), loadBalancerId, instanceIds); Gson gson = GsonHelper.getBuilder().create(); AsyncJobVO job = new AsyncJobVO(); job.setUserId(UserContext.current().getUserId()); job.setAccountId(loadBalancer.getAccountId()); job.setCmd("AssignToLoadBalancer"); - job.setCmdInfo(gson.toJson(param)); +// job.setCmdInfo(gson.toJson(param)); + job.setCmdInfo(gson.toJson(params)); return _asyncMgr.submitAsyncJob(job, true); } finally { if (loadBalancer != null) { @@ -7759,10 +7789,7 @@ public class ManagementServerImpl implements ManagementServer { return; } - Transaction txn = null; try { - txn = Transaction.open(Transaction.CLOUD_DB); - List accounts = _accountDao.findCleanups(); s_logger.info("Found " + accounts.size() + " accounts to cleanup"); for (AccountVO account : accounts) { @@ -7776,9 +7803,6 @@ public class ManagementServerImpl implements ManagementServer { } catch (Exception e) { s_logger.error("Exception ", e); } finally { - if(txn != null) - txn.close(); - lock.unlock(); } } catch (Exception e) { @@ -8533,16 +8557,5 @@ public class ManagementServerImpl implements ManagementServer { 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; - } } diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java index a25e42c3f0c..312f2c02d2c 100644 --- a/server/src/com/cloud/storage/StorageManagerImpl.java +++ b/server/src/com/cloud/storage/StorageManagerImpl.java @@ -41,12 +41,10 @@ import org.apache.log4j.Logger; import com.cloud.agent.AgentManager; import com.cloud.agent.api.Answer; -import com.cloud.agent.api.BackupSnapshotCommand; import com.cloud.agent.api.Command; import com.cloud.agent.api.CreateVolumeFromSnapshotAnswer; import com.cloud.agent.api.CreateVolumeFromSnapshotCommand; import com.cloud.agent.api.DeleteStoragePoolCommand; -import com.cloud.agent.api.ManageSnapshotCommand; import com.cloud.agent.api.ModifyStoragePoolAnswer; import com.cloud.agent.api.ModifyStoragePoolCommand; import com.cloud.agent.api.storage.CopyVolumeAnswer; @@ -205,7 +203,7 @@ public class StorageManagerImpl implements StorageManager { private int _totalRetries; private int _pauseInterval; private final boolean _shouldBeSnapshotCapable = true; - private Hypervisor.Type _hypervisorType; + private String _hypervisorType; @Override public boolean share(VMInstanceVO vm, List vols, HostVO host, boolean cancelPreviousShare) { @@ -268,7 +266,7 @@ public class StorageManagerImpl implements StorageManager { } else { offering = _offeringDao.findById(vol.getDiskOfferingId()); } - VolumeVO created = createVolume(create, vm, template, dc, pod, host.getClusterId(), offering, diskOffering, new ArrayList(),0); + VolumeVO created = createVolume(create, vm, template, dc, pod, host.getClusterId(), offering, diskOffering, new ArrayList()); if (created == null) { break; } @@ -673,7 +671,7 @@ public class StorageManagerImpl implements StorageManager { basicErrMsg, _totalRetries, _pauseInterval, - _shouldBeSnapshotCapable, null); + _shouldBeSnapshotCapable); if (answer != null && answer.getResult()) { vdiUUID = answer.getVdi(); } @@ -686,7 +684,7 @@ public class StorageManagerImpl implements StorageManager { @DB protected VolumeVO createVolume(VolumeVO volume, VMInstanceVO vm, VMTemplateVO template, DataCenterVO dc, HostPodVO pod, Long clusterId, - ServiceOfferingVO offering, DiskOfferingVO diskOffering, List avoids, long size) { + ServiceOfferingVO offering, DiskOfferingVO diskOffering, List avoids) { StoragePoolVO pool = null; final HashSet avoidPools = new HashSet(avoids); @@ -743,7 +741,7 @@ public class StorageManagerImpl implements StorageManager { } cmd = new CreateCommand(volume, vm, dskCh, tmpltStoredOn.getLocalDownloadPath(), pool); } else { - cmd = new CreateCommand(volume, vm, dskCh, pool, size); + cmd = new CreateCommand(volume, vm, dskCh, pool); } Answer answer = sendToPool(pool, cmd); @@ -780,21 +778,21 @@ public class StorageManagerImpl implements StorageManager { } @Override - public List create(Account account, VMInstanceVO vm, VMTemplateVO template, DataCenterVO dc, HostPodVO pod, ServiceOfferingVO offering, DiskOfferingVO diskOffering, long size) throws StorageUnavailableException, ExecutionException { + public List create(Account account, VMInstanceVO vm, VMTemplateVO template, DataCenterVO dc, HostPodVO pod, ServiceOfferingVO offering, DiskOfferingVO diskOffering) throws StorageUnavailableException, ExecutionException { List avoids = new ArrayList(); - return create(account, vm, template, dc, pod, offering, diskOffering, avoids, size); + return create(account, vm, template, dc, pod, offering, diskOffering, avoids); } @DB protected List create(Account account, VMInstanceVO vm, VMTemplateVO template, DataCenterVO dc, HostPodVO pod, - ServiceOfferingVO offering, DiskOfferingVO diskOffering, List avoids, long size) { + ServiceOfferingVO offering, DiskOfferingVO diskOffering, List avoids) { ArrayList vols = new ArrayList(2); VolumeVO dataVol = null; VolumeVO rootVol = null; Transaction txn = Transaction.currentTxn(); txn.start(); if (Storage.ImageFormat.ISO == template.getFormat()) { - rootVol = new VolumeVO(VolumeType.ROOT, vm.getId(), vm.getInstanceName() + "-ROOT", dc.getId(), pod.getId(), account.getId(), account.getDomainId(),(size>0)? size : diskOffering.getDiskSizeInBytes()); + rootVol = new VolumeVO(VolumeType.ROOT, vm.getId(), vm.getInstanceName() + "-ROOT", dc.getId(), pod.getId(), account.getId(), account.getDomainId(), diskOffering.getDiskSizeInBytes()); rootVol.setDiskOfferingId(diskOffering.getId()); rootVol.setDeviceId(0l); rootVol = _volsDao.persist(rootVol); @@ -806,7 +804,7 @@ public class StorageManagerImpl implements StorageManager { rootVol = _volsDao.persist(rootVol); if (diskOffering != null && diskOffering.getDiskSizeInBytes() > 0) { - dataVol = new VolumeVO(VolumeType.DATADISK, vm.getId(), vm.getInstanceName() + "-DATA", dc.getId(), pod.getId(), account.getId(), account.getDomainId(), (size>0)? size : diskOffering.getDiskSizeInBytes()); + dataVol = new VolumeVO(VolumeType.DATADISK, vm.getId(), vm.getInstanceName() + "-DATA", dc.getId(), pod.getId(), account.getId(), account.getDomainId(), diskOffering.getDiskSizeInBytes()); dataVol.setDiskOfferingId(diskOffering.getId()); dataVol.setDeviceId(1l); dataVol = _volsDao.persist(dataVol); @@ -817,7 +815,7 @@ public class StorageManagerImpl implements StorageManager { VolumeVO dataCreated = null; VolumeVO rootCreated = null; try { - rootCreated = createVolume(rootVol, vm, template, dc, pod, null, offering, diskOffering, avoids,size); + rootCreated = createVolume(rootVol, vm, template, dc, pod, null, offering, diskOffering, avoids); if (rootCreated == null) { throw new CloudRuntimeException("Unable to create " + rootVol); } @@ -826,7 +824,7 @@ public class StorageManagerImpl implements StorageManager { if (dataVol != null) { StoragePoolVO pool = _storagePoolDao.findById(rootCreated.getPoolId()); - dataCreated = createVolume(dataVol, vm, template, dc, pod, pool.getClusterId(), offering, diskOffering, avoids,size); + dataCreated = createVolume(dataVol, vm, template, dc, pod, pool.getClusterId(), offering, diskOffering, avoids); if (dataCreated == null) { throw new CloudRuntimeException("Unable to create " + dataVol); } @@ -847,8 +845,8 @@ public class StorageManagerImpl implements StorageManager { @Override public long createUserVM(Account account, VMInstanceVO vm, VMTemplateVO template, DataCenterVO dc, HostPodVO pod, ServiceOfferingVO offering, DiskOfferingVO diskOffering, - List avoids, long size) { - List volumes = create(account, vm, template, dc, pod, offering, diskOffering, avoids, size); + List avoids) { + List volumes = create(account, vm, template, dc, pod, offering, diskOffering, avoids); for (VolumeVO v : volumes) { long volumeId = v.getId(); @@ -868,22 +866,13 @@ public class StorageManagerImpl implements StorageManager { return volumes.get(0).getPoolId(); } - public Long chooseHostForStoragePool(StoragePoolVO poolVO, List avoidHosts, boolean sendToVmResidesOn, Long vmId) { - if (sendToVmResidesOn) { - if (vmId != null) { - VMInstanceVO vmInstance = _vmInstanceDao.findById(vmId); - if (vmInstance != null) { - return vmInstance.getHostId(); - } - } - return null; - } + public StoragePoolHostVO chooseHostForStoragePool(StoragePoolVO poolVO, List avoidHosts) { List poolHosts = _poolHostDao.listByHostStatus(poolVO.getId(), Status.Up); Collections.shuffle(poolHosts); if (poolHosts != null && poolHosts.size() > 0) { for (StoragePoolHostVO sphvo : poolHosts) { if (!avoidHosts.contains(sphvo.getHostId())) { - return sphvo.getHostId(); + return sphvo; } } } @@ -993,10 +982,8 @@ public class StorageManagerImpl implements StorageManager { _totalRetries = NumbersUtil.parseInt(configDao.getValue("total.retries"), 4); _pauseInterval = 2*NumbersUtil.parseInt(configDao.getValue("ping.interval"), 60); - String hypervisoType = configDao.getValue("hypervisor.type"); - if (hypervisoType.equalsIgnoreCase("KVM")) { - _hypervisorType = Hypervisor.Type.KVM; - } + _hypervisorType = configDao.getValue("hypervisor.type"); + _agentMgr.registerForHostEvents(new StoragePoolMonitor(this, _hostDao, _storagePoolDao), true, false, true); String storageCleanupEnabled = configs.get("storage.cleanup.enabled"); @@ -1077,19 +1064,6 @@ public class StorageManagerImpl implements StorageManager { 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) { String isoPath = null; @@ -1188,7 +1162,7 @@ public class StorageManagerImpl implements StorageManager { } } if (hypervisorType == null) { - if (_hypervisorType == Hypervisor.Type.KVM) { + if (_hypervisorType.equalsIgnoreCase("KVM")) { hypervisorType = Hypervisor.Type.KVM; } else { s_logger.debug("Couldn't find a host to serve in the server pool"); @@ -1270,7 +1244,7 @@ public class StorageManagerImpl implements StorageManager { // perhaps do this on demand, or perhaps mount on a couple of hosts per // pod List allHosts = _hostDao.listBy(Host.Type.Routing, clusterId, podId, zoneId); - if (allHosts.isEmpty() && _hypervisorType != Hypervisor.Type.KVM) { + if (allHosts.isEmpty() && !_hypervisorType.equalsIgnoreCase("KVM")) { throw new ResourceAllocationException("No host exists to associate a storage pool with"); } long poolId = _storagePoolDao.getNextInSequence(Long.class, "id"); @@ -1284,7 +1258,7 @@ public class StorageManagerImpl implements StorageManager { pool.setClusterId(clusterId); pool.setStatus(Status.Up); pool = _storagePoolDao.persist(pool, details); - if (_hypervisorType == Hypervisor.Type.KVM && allHosts.isEmpty()) { + if (_hypervisorType.equalsIgnoreCase("KVM") && allHosts.isEmpty()) { return pool; } s_logger.debug("In createPool Adding the pool to each of the hosts"); @@ -1503,7 +1477,7 @@ public class StorageManagerImpl implements StorageManager { @Override @DB - public VolumeVO createVolume(long accountId, long userId, String userSpecifiedName, DataCenterVO dc, DiskOfferingVO diskOffering, long startEventId, long size) + public VolumeVO createVolume(long accountId, long userId, String userSpecifiedName, DataCenterVO dc, DiskOfferingVO diskOffering, long startEventId) { String volumeName = ""; VolumeVO createdVolume = null; @@ -1546,7 +1520,7 @@ public class StorageManagerImpl implements StorageManager { Pair pod = 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, size)) != null) { + if ((createdVolume = createVolume(volume, null, null, dc, pod.first(), null, null, diskOffering, poolsToAvoid)) != null) { break; } else { podsToAvoid.add(pod.first().getId()); @@ -1669,21 +1643,18 @@ public class StorageManagerImpl implements StorageManager { @Override public Answer sendToHostsOnStoragePool(Long poolId, Command cmd, String basicErrMsg) { - return sendToHostsOnStoragePool(poolId, cmd, basicErrMsg, 1, 0, false, null); + return sendToHostsOnStoragePool(poolId, cmd, basicErrMsg, 1, 0, false); } @Override - public Answer sendToHostsOnStoragePool(Long poolId, Command cmd, String basicErrMsg, int totalRetries, int pauseBeforeRetry, boolean shouldBeSnapshotCapable, - Long vmId) { + public Answer sendToHostsOnStoragePool(Long poolId, Command cmd, String basicErrMsg, int totalRetries, int pauseBeforeRetry, boolean shouldBeSnapshotCapable) { Answer answer = null; Long hostId = null; StoragePoolVO storagePool = _storagePoolDao.findById(poolId); List hostsToAvoid = new ArrayList(); - + StoragePoolHostVO storagePoolHost; int tryCount = 0; - boolean sendToVmHost = sendToVmResidesOn(cmd); - - if (chooseHostForStoragePool(storagePool, hostsToAvoid, sendToVmHost, vmId) == null) { + if (chooseHostForStoragePool(storagePool, hostsToAvoid) == null) { // Don't just fail. The host could be reconnecting. // wait for some time for it to get connected // Wait for 3*ping.interval, since the code attempts a manual @@ -1695,9 +1666,10 @@ public class StorageManagerImpl implements StorageManager { // continue. } } - while ((hostId = chooseHostForStoragePool(storagePool, hostsToAvoid, sendToVmHost, vmId)) != null && tryCount++ < totalRetries) { + while ((storagePoolHost = chooseHostForStoragePool(storagePool, hostsToAvoid)) != null && tryCount++ < totalRetries) { String errMsg = basicErrMsg + " on host: " + hostId + " try: " + tryCount + ", reason: "; try { + hostId = storagePoolHost.getHostId(); HostVO hostVO = _hostDao.findById(hostId); if (shouldBeSnapshotCapable) { if (hostVO == null ) { @@ -2175,14 +2147,4 @@ public class StorageManagerImpl implements StorageManager { return true; } - - private boolean sendToVmResidesOn(Command cmd) { - if ((_hypervisorType == Hypervisor.Type.KVM) && - ((cmd instanceof ManageSnapshotCommand) || - (cmd instanceof BackupSnapshotCommand))) { - return true; - } else { - return false; - } - } } diff --git a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java index 815ead3bc0f..dadef9db822 100644 --- a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java +++ b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java @@ -784,7 +784,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V final AccountVO account = _accountDao.findById(Account.ACCOUNT_ID_SYSTEM); try { - List vols = _storageMgr.create(account, secStorageVm, _template, dc, pod, _serviceOffering, null,0); + List vols = _storageMgr.create(account, secStorageVm, _template, dc, pod, _serviceOffering, null); if( vols == null ){ s_logger.error("Unable to alloc storage for secondary storage vm"); return null; diff --git a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java index a372e17b6e8..ec5e9f63963 100644 --- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java +++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java @@ -86,7 +86,6 @@ import com.cloud.user.AccountManager; import com.cloud.user.AccountVO; import com.cloud.user.dao.AccountDao; import com.cloud.user.dao.UserDao; -import com.cloud.uservm.UserVm; import com.cloud.utils.DateUtil; import com.cloud.utils.NumbersUtil; import com.cloud.utils.component.ComponentLocator; @@ -135,7 +134,6 @@ public class SnapshotManagerImpl implements SnapshotManager { protected SearchBuilder PolicySnapshotSearch; protected SearchBuilder PoliciesForSnapSearch; - private String _hypervisorType; private final boolean _shouldBeSnapshotCapable = true; // all methods here should be snapshot capable. @Override @DB @@ -346,12 +344,9 @@ public class SnapshotManagerImpl implements SnapshotManager { txn.commit(); // Send a ManageSnapshotCommand to the agent - String vmName = _storageMgr.getVmNameOnVolume(volume); - - ManageSnapshotCommand cmd = new ManageSnapshotCommand(ManageSnapshotCommand.CREATE_SNAPSHOT, id, volume.getPath(), snapshotName, vmName); + ManageSnapshotCommand cmd = new ManageSnapshotCommand(ManageSnapshotCommand.CREATE_SNAPSHOT, id, volume.getPath(), snapshotName, _vmDao.findById(volume.getInstanceId()).getInstanceName()); String basicErrMsg = "Failed to create snapshot for volume: " + volume.getId(); - ManageSnapshotAnswer answer = (ManageSnapshotAnswer) _storageMgr.sendToHostsOnStoragePool(volume.getPoolId(), cmd, basicErrMsg, _totalRetries, _pauseInterval, - _shouldBeSnapshotCapable, volume.getInstanceId()); + ManageSnapshotAnswer answer = (ManageSnapshotAnswer) _storageMgr.sendToHostsOnStoragePool(volume.getPoolId(), cmd, basicErrMsg, _totalRetries, _pauseInterval, _shouldBeSnapshotCapable); txn = Transaction.currentTxn(); txn.start(); @@ -526,7 +521,6 @@ public class SnapshotManagerImpl implements SnapshotManager { } String firstBackupUuid = volume.getFirstSnapshotBackupUuid(); boolean isVolumeInactive = _storageMgr.volumeInactive(volume); - String vmName = _storageMgr.getVmNameOnVolume(volume); BackupSnapshotCommand backupSnapshotCommand = new BackupSnapshotCommand(primaryStoragePoolNameLabel, secondaryStoragePoolUrl, @@ -539,8 +533,7 @@ public class SnapshotManagerImpl implements SnapshotManager { prevBackupUuid, firstBackupUuid, isFirstSnapshotOfRootVolume, - isVolumeInactive, - vmName); + isVolumeInactive); String backedUpSnapshotUuid = null; // By default, assume failed. @@ -551,8 +544,7 @@ public class SnapshotManagerImpl implements SnapshotManager { basicErrMsg, _totalRetries, _pauseInterval, - _shouldBeSnapshotCapable, - volume.getInstanceId()); + _shouldBeSnapshotCapable); if (answer != null && answer.getResult()) { backedUpSnapshotUuid = answer.getBackupSnapshotName(); if (backedUpSnapshotUuid != null) { @@ -742,8 +734,7 @@ public class SnapshotManagerImpl implements SnapshotManager { basicErrMsg, _totalRetries, _pauseInterval, - _shouldBeSnapshotCapable, - volume.getInstanceId()); + _shouldBeSnapshotCapable); } return answer; @@ -902,7 +893,7 @@ public class SnapshotManagerImpl implements SnapshotManager { details, _totalRetries, _pauseInterval, - _shouldBeSnapshotCapable, volume.getInstanceId()); + _shouldBeSnapshotCapable); if ((answer != null) && answer.getResult()) { // This is not the last snapshot. @@ -1029,7 +1020,7 @@ public class SnapshotManagerImpl implements SnapshotManager { Long poolId = volume.getPoolId(); if (poolId != null) { // 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, volume.getInstanceId()); + answer = _storageMgr.sendToHostsOnStoragePool(poolId, cmd, basicErrMsg, 1, _pauseInterval, _shouldBeSnapshotCapable); } 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"); @@ -1239,7 +1230,7 @@ public class SnapshotManagerImpl implements SnapshotManager { snapshot.getName(), backupOfNextSnapshot); String basicErrMsg = "Failed to destroy snapshot id: " + snapshotId + " for volume id: " + volumeId; - Answer answer = _storageMgr.sendToHostsOnStoragePool(volume.getPoolId(), cmd, basicErrMsg, _totalRetries, _pauseInterval, _shouldBeSnapshotCapable, volume.getInstanceId()); + Answer answer = _storageMgr.sendToHostsOnStoragePool(volume.getPoolId(), cmd, basicErrMsg, _totalRetries, _pauseInterval, _shouldBeSnapshotCapable); if ((answer != null) && answer.getResult()) { success = true; @@ -1296,8 +1287,6 @@ public class SnapshotManagerImpl implements SnapshotManager { 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.DAILY.setMax(NumbersUtil.parseInt(configDao.getValue("snapshot.max.daily"), DAILYMAX)); DateUtil.IntervalType.WEEKLY.setMax(NumbersUtil.parseInt(configDao.getValue("snapshot.max.weekly"), WEEKLYMAX)); @@ -1340,7 +1329,5 @@ public class SnapshotManagerImpl implements SnapshotManager { public boolean stop() { return true; } - - } diff --git a/server/src/com/cloud/vm/UserVmManager.java b/server/src/com/cloud/vm/UserVmManager.java index 4c2a3e98e3d..b56d6a7273a 100644 --- a/server/src/com/cloud/vm/UserVmManager.java +++ b/server/src/com/cloud/vm/UserVmManager.java @@ -29,14 +29,12 @@ import com.cloud.async.executor.StopVMExecutor; import com.cloud.async.executor.VMOperationParam; import com.cloud.dc.DataCenterVO; import com.cloud.exception.ConcurrentOperationException; -import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.InsufficientStorageCapacityException; import com.cloud.exception.InternalErrorException; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.StorageUnavailableException; import com.cloud.network.security.NetworkGroupVO; -import com.cloud.offerings.NetworkOfferingVO; import com.cloud.service.ServiceOfferingVO; import com.cloud.storage.DiskOfferingVO; import com.cloud.storage.SnapshotVO; @@ -54,8 +52,7 @@ import com.cloud.vm.VirtualMachine.Event; * */ public interface UserVmManager extends Manager, VirtualMachineManager { - - 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; /** @@ -80,11 +77,11 @@ public interface UserVmManager extends Manager, VirtualMachineManager * @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. */ - UserVmVO createVirtualMachine(Long vmId, long userId, AccountVO account, DataCenterVO dc, ServiceOfferingVO offering, VMTemplateVO template, DiskOfferingVO diskOffering, String displayName, String group, String userData, List avoids, long startEventId, long size) 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 avoids, long startEventId) 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 a, List networkGroupVO, long startEventId, long size) 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 a, List 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 a, List 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 a, List networkGroupVO, long startEventId) throws InternalErrorException, ResourceAllocationException; /** * Destroys one virtual machine @@ -184,7 +181,7 @@ public interface UserVmManager extends Manager, VirtualMachineManager boolean rebootVirtualMachine(long userId, long vmId); OperationResponse executeRebootVM(RebootVMExecutor executor, VMOperationParam param); - boolean recoverVirtualMachine(long vmId) throws ResourceAllocationException, InternalErrorException; + boolean recoverVirtualMachine(long vmId) throws ResourceAllocationException; VMTemplateVO createPrivateTemplateRecord(Long userId, long vmId, String name, String description, long guestOsId, Boolean requiresHvm, Integer bits, Boolean passwordEnabled, boolean isPublic, boolean featured) throws InvalidParameterValueException; diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index 89ae3351502..b4876bc7566 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -82,8 +82,8 @@ import com.cloud.configuration.dao.ConfigurationDao; import com.cloud.configuration.dao.ResourceLimitDao; import com.cloud.dc.DataCenterVO; import com.cloud.dc.HostPodVO; -import com.cloud.dc.Vlan.VlanType; import com.cloud.dc.VlanVO; +import com.cloud.dc.Vlan.VlanType; import com.cloud.dc.dao.DataCenterDao; import com.cloud.dc.dao.HostPodDao; import com.cloud.dc.dao.VlanDao; @@ -94,7 +94,6 @@ import com.cloud.event.EventVO; import com.cloud.event.dao.EventDao; import com.cloud.exception.AgentUnavailableException; import com.cloud.exception.ConcurrentOperationException; -import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.InternalErrorException; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.OperationTimedoutException; @@ -122,25 +121,24 @@ import com.cloud.network.security.NetworkGroupManager; import com.cloud.network.security.NetworkGroupVO; import com.cloud.offering.ServiceOffering; import com.cloud.offering.ServiceOffering.GuestIpType; -import com.cloud.offerings.NetworkOfferingVO; import com.cloud.service.ServiceOfferingVO; import com.cloud.service.dao.ServiceOfferingDao; import com.cloud.storage.DiskOfferingVO; import com.cloud.storage.GuestOSVO; import com.cloud.storage.Snapshot; -import com.cloud.storage.Snapshot.SnapshotType; import com.cloud.storage.SnapshotVO; import com.cloud.storage.Storage; -import com.cloud.storage.Storage.ImageFormat; import com.cloud.storage.StorageManager; import com.cloud.storage.StoragePoolVO; import com.cloud.storage.VMTemplateHostVO; -import com.cloud.storage.VMTemplateStorageResourceAssoc.Status; import com.cloud.storage.VMTemplateVO; -import com.cloud.storage.VirtualMachineTemplate.BootloaderType; import com.cloud.storage.Volume; -import com.cloud.storage.Volume.VolumeType; 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.VirtualMachineTemplate.BootloaderType; +import com.cloud.storage.Volume.VolumeType; import com.cloud.storage.dao.DiskOfferingDao; import com.cloud.storage.dao.DiskTemplateDao; import com.cloud.storage.dao.GuestOSCategoryDao; @@ -1201,180 +1199,11 @@ public class UserVmManagerImpl implements UserVmManager { } userVm.setGuestIpAddress(null); - _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 pod = null; - long poolid = 0; - Set podsToAvoid = new HashSet(); - - 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; + //_vmDao.update(userVm.getId(), userVm); FIXME need an updateIf } @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 avoids, long startEventId, long size) 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 avoids, long startEventId) throws InternalErrorException, ResourceAllocationException { long accountId = account.getId(); long dataCenterId = dc.getId(); long serviceOfferingId = offering.getId(); @@ -1471,7 +1300,7 @@ public class UserVmManagerImpl implements UserVmManager { throw rae; } - poolid = _storageMgr.createUserVM(account, vm, template, dc, pod.first(), offering, diskOffering, avoids,size); + poolid = _storageMgr.createUserVM(account, vm, template, dc, pod.first(), offering, diskOffering, avoids); if ( poolid != 0) { break; } @@ -1697,9 +1526,8 @@ public class UserVmManagerImpl implements UserVmManager { } @Override @DB - public boolean recoverVirtualMachine(long vmId) throws ResourceAllocationException, InternalErrorException { + public boolean recoverVirtualMachine(long vmId) throws ResourceAllocationException { UserVmVO vm = _vmDao.findById(vmId); - if (vm == null || vm.getRemoved() != null) { if (s_logger.isDebugEnabled()) { s_logger.debug("Unable to find vm or vm is removed: " + vmId); @@ -1730,10 +1558,6 @@ public class UserVmManagerImpl implements UserVmManager { 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 if (_accountMgr.resourceLimitExceeded(account, ResourceType.user_vm)) { ResourceAllocationException rae = new ResourceAllocationException("Maximum number of virtual machines for account: " + account.getAccountName() + " has been exceeded."); @@ -2558,7 +2382,7 @@ public class UserVmManagerImpl implements UserVmManager { @DB @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 a, List networkGroups, long startEventId, long size) 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 a, List networkGroups, long startEventId) throws InternalErrorException, ResourceAllocationException { long accountId = account.getId(); long dataCenterId = dc.getId(); @@ -2685,7 +2509,7 @@ public class UserVmManagerImpl implements UserVmManager { vm = _vmDao.findById(vmId); try { - poolId = _storageMgr.createUserVM(account, vm, template, dc, pod.first(), offering, diskOffering, a,size); + poolId = _storageMgr.createUserVM(account, vm, template, dc, pod.first(), offering, diskOffering, a); } catch (CloudRuntimeException e) { _vmDao.delete(vmId); _ipAddressDao.unassignIpAddress(guestIp); @@ -2758,7 +2582,7 @@ public class UserVmManagerImpl implements UserVmManager { @DB @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 a, List networkGroups, long startEventId, long size) 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 a, List networkGroups, long startEventId) throws InternalErrorException, ResourceAllocationException { long accountId = account.getId(); long dataCenterId = dc.getId(); long serviceOfferingId = offering.getId(); @@ -2844,7 +2668,7 @@ public class UserVmManagerImpl implements UserVmManager { vm = _vmDao.findById(vmId); try { - poolId = _storageMgr.createUserVM(account, vm, template, dc, pod.first(), offering, diskOffering,a,size); + poolId = _storageMgr.createUserVM(account, vm, template, dc, pod.first(), offering, diskOffering, a); } catch (CloudRuntimeException e) { _vmDao.delete(vmId); _accountMgr.decrementResourceCount(account.getId(), ResourceType.user_vm); diff --git a/setup/.project b/setup/.project index 66073caf5cd..2ab02813e01 100644 --- a/setup/.project +++ b/setup/.project @@ -5,7 +5,13 @@ + + org.eclipse.jdt.core.javabuilder + + + + org.eclipse.jdt.core.javanature diff --git a/ui/content/tab_accounts.html b/ui/content/tab_accounts.html index 5a63bb419c5..91857da6f63 100644 --- a/ui/content/tab_accounts.html +++ b/ui/content/tab_accounts.html @@ -1,5 +1,3 @@ - -