Merged master to vmsync

This commit is contained in:
Alex Huang 2013-05-13 17:33:53 -07:00
commit d4039743d2
1654 changed files with 73020 additions and 23517 deletions

6
.gitignore vendored
View File

@ -18,10 +18,7 @@
build/replace.properties
build/build.number
bin/
cloudstack-proprietary/
premium/
.lock-wscript
artifacts/
.waf-*
waf-*
target/
@ -37,7 +34,7 @@ cloud-*.tar.bz2
*.egg-info/
*.prefs
build.number
api.log.*.gz
*.log.*.gz
cloud.log.*.*
unittest
deps/cloud.userlibraries
@ -59,6 +56,7 @@ tools/cli/build/
*.iso
*.tar.gz
*.tgz
.*
target-eclipse
awsapi/modules/*
!.gitignore

385
CHANGES
View File

@ -1,7 +1,387 @@
Apache CloudStack (Incubating) CHANGES
Apache CloudStack CHANGES
======================================
Full release notes for each release are located in the project's documentation website: http://cloudstack.apache.org/docs
Full release notes for each release are located in the project's documentation website:
http://cloudstack.apache.org/docs
Version 4.2.0
------------------------
In progress
Version 4.1.0
------------------------
This is the second major release of CloudStack from within the Apache Software Foundation, and the
first major release as a Top-Level Project (TLP).
Build Tool Changes:
* The project now uses Maven 3 exclusively to build.
New Features:
* CLOUDSTACK-101: OVS support in KVM
* CLOUDSTACK-132: Mash up marvin into an interactive auto-completing API shell for CloudStack
* CLOUDSTACK-241: AWS Style Regions
* CLOUDSTACK-297: Reset SSH Key to access VM (similar to reset password)
* CLOUDSTACK-299: Egress firewall rules for guest network
* CLOUDSTACK-306: Support SRX & F5 inline mode
* CLOUDSTACK-618: API request throttling to avoid malicious attacks on MS per account through frequent API request.
* CLOUDSTACK-637: AutoScale
* CLOUDSTACK-644: Resize volumes feature
* CLOUDSTACK-706: Persistent Networks without running a VM
* CLOUDSTACK-726: Implement L3 Router functionality in Nicira Nvp Plugin
* CLOUDSTACK-780: Additional VMX Settings
* CLOUDSTACK-926: ApiDiscoverService: Implement a plugin mechanism that exposes the list of APIs through a discovery service on the management server
Bug Fixes:
* CLOUDSTACK-1600 Typo in dpkg-buildpackage command
* CLOUDSTACK-1574 updateResourceCount API is failed saying to specify valida resource type even after parsing the valid resource type
* CLOUDSTACK-1562 Replace the short-cut solution of supportting @DB with the formal one
* CLOUDSTACK-1541 NPE while deleting snapshot :Unexpected exception while executing org.apache.cloudstack.api.command.user.snapshot.DeleteSnapshotCmd
* CLOUDSTACK-1521 Redundant router: Services are not stopped when switch to BACKUP state
* CLOUDSTACK-1509 Failed to implement network elements and resources while provisioning for persistent network(createVlanIpRange to an account]
* CLOUDSTACK-1496 List API Performance: listAccounts failing with OOME for high values of pagesize (>1000 )
* CLOUDSTACK-1487 cloudstack-setup-agent fails to set private.network.device on KVM host add
* CLOUDSTACK-1485 Add Baremetal Provider back to 4.1 branch
* CLOUDSTACK-1484 "API Throttling : api.throttling.enabled, Global setting missing"
* CLOUDSTACK-1473 deleteDomain is failing with NPE
* CLOUDSTACK-1470 unhandled exception executing api command: deployVirtualMachine
* CLOUDSTACK-1469 kvm agent: agent service fails to start up
* CLOUDSTACK-1465 List Zones returns null under create instance when logged is as user
* CLOUDSTACK-1449 listAccounts and listProjectAccounts API lists all the users not account-specific users for each account returned
* CLOUDSTACK-1447 [UI]Persistent Status is not displayed for VPC Tiers
* CLOUDSTACK-1436 4.1 management server fails to start from RPM build artifacts
* CLOUDSTACK-1429 single account is unable to use same vnet across multiple physical networks
* CLOUDSTACK-1425 unhandled exception executing api command: migrateVirtualMachine & recoverVirtualMachine
* CLOUDSTACK-1420 Ensure trademarks are properly attributed in publican brand.
* CLOUDSTACK-1419 Apache-ify and apply trademark logos in the UI
* CLOUDSTACK-1418 "As regular user , we are not allowed to deploy VM on a shared network."
* CLOUDSTACK-1417 "When invalid values are passed to createNetwork() , error message does not indicate the parameter name that has invalid values."
* CLOUDSTACK-1414 Redundant router: BACKUP switch cancelled due to lock timeout after a glitch in network
* CLOUDSTACK-1403 Storage and console-proxy related error
* CLOUDSTACK-1402 listRouters API response doesn't return linklocal IP and public IP details
* CLOUDSTACK-1399 Unhandled exception executing api command: stopVirtualMachine
* CLOUDSTACK-1397 Static Nat configuration is failing with NPE
* CLOUDSTACK-1391 EventBus is not getting injected after javelin merge
* CLOUDSTACK-1383 Deploying basic zone on 4.1 fails in NPE
* CLOUDSTACK-1382 "vm deploy fails with Error ""cannot find DeployPlannerSelector for vm"""
* CLOUDSTACK-1375 deploydb failing with acs master
* CLOUDSTACK-1369 "Ipv6 - In dual Stack network , guest VM does not have the Ipv6 address of the router programmed in /etc/resolv.conf for DNS resolution."
* CLOUDSTACK-1367 NPE noticed in logs while AgentMonitor is monitoring the host ping interval
* CLOUDSTACK-1357 "Autoscale: Provisioned VMs from Netscaler not being added to lb vserver, provserver fails with provserver_err_asynctaskpoll"
* CLOUDSTACK-1350 Management server Stop and start causes previously downloaded ISOs and templates to redownload & reinstall
* CLOUDSTACK-1347 "Not able to delete network. Error - ""Unable to insert queue item into database, DB is full?"""
* CLOUDSTACK-1346 "Check to see if external devices are used in the network, is hardcoded for specific devices"
* CLOUDSTACK-1345 BigSwitch plugin introduces 'VNS' isolation in UI without backend implementation
* CLOUDSTACK-1344 Typo in use.external.dns setting description
* CLOUDSTACK-1343 Porting Baremetal related UI changes to ACS
* CLOUDSTACK-1341 URL for the KEYs file is wrong in the installation guide
* CLOUDSTACK-1339 ASF 4.1: Management server becomes unresponsive
* CLOUDSTACK-1338 Deploy VM failed using ISO
* CLOUDSTACK-1334 vmware.root.disk.controller doesn't work.
* CLOUDSTACK-1332 IPV6 - Router and guest Vms should be able to use an IPV6 address for external DNS entry.
* CLOUDSTACK-1331 Upgrade fails for a 2.2.14 Zone having multiple guest networks using network_tags and Public Vlan
* CLOUDSTACK-1330 ec2-run-instances - When -n option is used to deploy multiple Vms API returns error even though few of the Vms have been deployed successfully.
* CLOUDSTACK-1320 Routers naming convention is changed to hostname
* CLOUDSTACK-1319 createCustomerVpnGateway response gives TypeError: json.createvpncustomergatewayresponse is undefined
* CLOUDSTACK-1315 [F5-SRX-InlineMode] Network implement failed with Run time Exception during network upgrade from VR to SRX-F5
* CLOUDSTACK-1313 Working with Volumes Section Is Missing
* CLOUDSTACK-1312 "Fix rolling upgrades from 4.0 to 4.1 in 4.1 release, fix db schemas to be same as 4.0"
* CLOUDSTACK-1307 Noticed NPE when we put host in maintenance mode in clustered management setup
* CLOUDSTACK-1303 Ipv6 - java.lang.NullPointerException when executing listnetworks() and deployVirtualMachine() after extending the Ipv4 range of a dual stack network.
* CLOUDSTACK-1300 section in wrong order in installation guide
* CLOUDSTACK-1299 Errors in 4.5.5 section of installation guide
* CLOUDSTACK-1295 NPE in usage parsers due to missing @Component inject
* CLOUDSTACK-1289 [F5-SRX-InlineMode] Usage stats are not generated for Juniper SRX Firewall in inlinemode
* CLOUDSTACK-1288 [F5-SRX-InlineMode] classCastException during network restart with cleanup option true
* CLOUDSTACK-1277 ApiResponseHelper.createUserVmResponse failed to populate password field set from UserVm object
* CLOUDSTACK-1272 Autoscale: createAutoScaleVmProfile fails due to unable to retrieve Service Offering id
* CLOUDSTACK-1267 KVM's cloudstack-agent service doesn't log (log4j)
* CLOUDSTACK-1265 logrotate dnsmasq configuration is wrong
* CLOUDSTACK-1262 "Failed to Prepare Secondary Storage in VMware,"
* CLOUDSTACK-1251 Baremetal zone doesn't need primary/secondary storage in UI wizard
* CLOUDSTACK-1243 Failed to cleanup account :java.lang.NullPointerException
* CLOUDSTACK-1242 [F5-SRX-InlineMode] Failed to create LB rule with F5-SRX inlinemode deployement
* CLOUDSTACK-1241 Network apply rules logic is broken
* CLOUDSTACK-1237 "Register Template fails with ""Cannot find template adapter for XenServer"""
* CLOUDSTACK-1234 Unable to start KVM agent with 4.1 build
* CLOUDSTACK-1233 Veewee configuration files are inappropriately identified as ASLv2 licensed files
* CLOUDSTACK-1232 "Ipv6 - Guest Vms are not able to get Ipaddress when executing dhclient command when using ""/96"" network."
* CLOUDSTACK-1226 Error while running Cloudstack-setup-databases
* CLOUDSTACK-1223 Exception while starting jetty server: org.springframework.beans.factory.BeanCreationException Error creating bean with name 'apiServer':
* CLOUDSTACK-1222 API rate limit configs: removed double quote in upgrade script
* CLOUDSTACK-1220 Ipv6 - Better error message when deploy Vm fails to get a free Ip address.
* CLOUDSTACK-1219 Ipv6 - Provide better error messages when deploying a Vm with Ip an address that is outside the network's ip range / if the ip address already is assigned to another Vm.
* CLOUDSTACK-1216 UUID is null for admin and failed to register user key with 4.1
* CLOUDSTACK-1210 Make all pluggable services return list of api cmd classes
* CLOUDSTACK-1206 Failure in Copy of System templates
* CLOUDSTACK-1205 Ipv6 - Ubuntu 12.10 guest Vms looses default route (after it expiration time ~ 30 mts) when ipv6.autoconfig parameters are disabled except for net.ipv6.conf.lo.autoconf which is enabled.
* CLOUDSTACK-1204 Fail to create advance zone due to fail to add host
* CLOUDSTACK-1201 "Failed to create ssh key for user ""cloud"" /var/lib/cloud/management/.ssh/id_rsa and failed to start management server"
* CLOUDSTACK-1190 Make APIChecker interface throw a single sensible exception
* CLOUDSTACK-1181 mvn deploy db failing with NPE
* CLOUDSTACK-1176 Issue with snapshots(create/list)
* CLOUDSTACK-1174 Snapshots related SQL error
* CLOUDSTACK-1173 ConsoleProxyResource instantiation exception
* CLOUDSTACK-1168 Create firewall rule broken
* CLOUDSTACK-1163 Failed with NPE while creating firewall rule
* CLOUDSTACK-1161 Differences between 4.1 and master in ongoing-config-of-external-firewalls-lb.xml
* CLOUDSTACK-1154 Account/Users related API failed due to RegionService inject exception
* CLOUDSTACK-1153 "Ipv6 - Vm deployment fails with ""n must be positive"" error."
* CLOUDSTACK-1152 Missing tag in host-add.xml
* CLOUDSTACK-1141 "Ipv6 - After network restart (and reboot router) , we do not see the existing vms dnsentries not being programmed in the router."
* CLOUDSTACK-1138 "Providing invalid values for gateway, netmask etc in the zoneWizard blocks the VLAN container to load , throwing an error"
* CLOUDSTACK-1123 ListStoragePools API broken by refactor
* CLOUDSTACK-1113 "Ipv6 - Not able to deploy a new VM in this network because of ""Unable to allocate Unique Ipv6 address"""
* CLOUDSTACK-1112 "Errors in ""Prepare the System VM Template"""
* CLOUDSTACK-1111 Ipv6 - listRouters() does not return guestipaddress/
* CLOUDSTACK-1109 "Ipv6 - Unable to expunge User Vms that are ""Destroyed""."
* CLOUDSTACK-1108 Ipv6 - Not able to restart Networks.
* CLOUDSTACK-1107 Ipv6 - Unable to extend Ip range for a Ipv6 network using craeteVlanIpRange() command - Error code 530 returned.
* CLOUDSTACK-1105 "IpV6 - listVirtualMachines() does not return netmask ,gateway,ipaddress."
* CLOUDSTACK-1104 Ipv6 - listVlanIpRanges() returns error 530.
* CLOUDSTACK-1103 "IpV6 - listNetwork() command does not retrun gateway,netmask,cidr"
* CLOUDSTACK-1095 Ipv6 - dhclient command needs to be run manually on the Vms to get the Ipv6 address.
* CLOUDSTACK-1088 EnableStaticNat error will clear the data in database
* CLOUDSTACK-1087 Update the Developer Guide for ASFCS 4.1 Release
* CLOUDSTACK-1083 listUsageRecords api: removed project results in NPE
* CLOUDSTACK-1082 UI doesn't throw any error message when trying to delete ip range from a network that is in use
* CLOUDSTACK-1079 Deploying AWSAPI with mvn -pl :cloud-awsapi jetty:run fails
* CLOUDSTACK-1070 javelin: NPE on executing registerIso API
* CLOUDSTACK-1064 A type error occurs when trying to add account/register template....
* CLOUDSTACK-1063 "SG Enabled Advanced Zone - ""Add Guest Networks"" - When user tries to add a guest Network with scope as ""Account"" , he should NOT be presented with ""Offering for shared security group enabled"""
* CLOUDSTACK-1057 regression of changeServiceForVirtualMachine API - fails to find service offering by serviceOfferingId parameter
* CLOUDSTACK-1056 S3 secondary storage fails to upload systemvm template due to KVMHA directory
* CLOUDSTACK-1055 "The overlay still exists when the ""Recurring Snapshots"" dialog is canceled by pressing esc key."
* CLOUDSTACK-1051 API dispatcher unable to find objectVO corresponding to DeleteTemplatecmd
* CLOUDSTACK-1050 No Documentation on Adding a Load Balancer Rule
* CLOUDSTACK-1037 "Make cloudmonkey awesome-er: Online help docs and api discovery, better colored output, parameter value autocompletion"
* CLOUDSTACK-1029 Enter the token to specified project is malfunctioned
* CLOUDSTACK-1027 """Update SSL certificate"" button should properly reflect it's functionality"
* CLOUDSTACK-1024 Regression: Unable to add Xenserver host with latest build
* CLOUDSTACK-1021 the vlan is not creat to right nic. when i creat multi guest network.
* CLOUDSTACK-1016 Not able to deploy VM.
* CLOUDSTACK-1014 Merge ManagementServer and ManagementServerExt
* CLOUDSTACK-1013 running cloudstack overwrites default public/private ssh keys
* CLOUDSTACK-1011 KVM host getting disconnected in cluster environment
* CLOUDSTACK-1010 Host count and Secondary storage count always shows 1 in UI
* CLOUDSTACK-1002 Not able to start VM.
* CLOUDSTACK-995 Not able to add the KVM host.
* CLOUDSTACK-993 """admin"" user is not getting created when management server is started."
* CLOUDSTACK-987 Sections missing in Working With Snapshots
* CLOUDSTACK-985 Different MAC address for RvR caused issue in short term network outrage
* CLOUDSTACK-978 TypeError: instance.displayname is undefined while adding VM's to the LB rule.
* CLOUDSTACK-968 marvin: vlan should be an attribute of the physical_network and not the zone
* CLOUDSTACK-959 Missing sub-sections in document section System Service Offerings
* CLOUDSTACK-938 s2s VPN trouble
* CLOUDSTACK-928 [Simulator] Latency for Agent Commands - change unit of wait from seconds to milliseconds
* CLOUDSTACK-863 Non-printable characters (ASCII control character) such as %00 or %0025 are getting stored in raw/non encoded form in the database.
* CLOUDSTACK-819 Create Account/User API logging password in access logs
* CLOUDSTACK-799 [Load Test] Check router statistics falls behind in gathering stats by more than 2 times the set value
* CLOUDSTACK-798 Move usage related cmd classes from cloud-server to cloud-api
* CLOUDSTACK-736 Integration smoke tests: Fix check for vm name for the deployvm smoke test
* CLOUDSTACK-734 api_refactoring: CreateAccountCmd fails to send response due to NPE in service layer
* CLOUDSTACK-725 UI: Error when the Egress rules tab is selected for a network
* CLOUDSTACK-721 Bytes sent/received in user statistics is empty (CloudStack 4.0)
* CLOUDSTACK-720 Fail to load a png image when accessing the web console
* CLOUDSTACK-717 cloudmonkey fails to parse/print response
* CLOUDSTACK-693 Adding a VPC virtual router to a NiciraNVP enabled network fails
* CLOUDSTACK-691 A warning dialog box shows after reloading the welcome page
* CLOUDSTACK-689 RVR: Stop pending flag is not cleared when user start the disconnected router from another host
* CLOUDSTACK-683 Image Is Missing in the Accessing VM Section
* CLOUDSTACK-660 Network Traffic Labels are not functional in Marvin
* CLOUDSTACK-648 The normal users could change their own login password
* CLOUDSTACK-639 API Refactoring: Adapters for ACL
* CLOUDSTACK-617 Unable to edit a Sub domain
* CLOUDSTACK-614 "ListTemplates API is not returning ""Enable SSH Key"" attribute for any given template"
* CLOUDSTACK-606 Starting VM fails with 'ConcurrentOperationException' in a clustered MS scenario
* CLOUDSTACK-605 Host physical CPU is incorrectly calculated for Vmware hosts
* CLOUDSTACK-599 DhcpEntryCommand fails on Router VM on CS4.0 and vSphere5 with Advanced Network Zone
* CLOUDSTACK-596 DeployVM command takes a lot of time to return job id
* CLOUDSTACK-584 "typos in ""Apache_CloudStack-4.0.0-incubating-CloudStack_Nicira_NVP_Guide-en-US"""
* CLOUDSTACK-573 "NPE at ""com.cloud.network.NetworkManagerImpl.networkOfferingIsConfiguredForExternalNetworking(NetworkManagerImpl.java:4345)"" when create network from the network offering having NULL provider for the service"
* CLOUDSTACK-572 SG Enabled Advanced Zone - Not able to deploy a VM in an account specific shared network.
* CLOUDSTACK-560 Usage server doesn't work in 4.0.0 due to missing db changes
* CLOUDSTACK-556 Erratic window behavior in Quick View tooltip
* CLOUDSTACK-553 "SRX - When adding SRX device make ""Public Network"" - default to ""untrusted"" and ""Private Network"" - default to ""trusted"" as un-editable fields."
* CLOUDSTACK-552 ]Quick view details for a volume displays scroll bar in place of name of the volume when the name of the volume has more no of characters
* CLOUDSTACK-539 Cropped Text in UI under Quick View
* CLOUDSTACK-536 remove citrix cloudpatform from 4.0 build - CloudStack is ASF project
* CLOUDSTACK-527 List API performance optimization by using DB views and removing UUID conversion.
* CLOUDSTACK-522 Log requests in cloudmonkey's log file
* CLOUDSTACK-520 Dependency jar names mismatch with install-non-oss.sh
* CLOUDSTACK-518 API refactoring -- change @Parameter annotation and remove the @IdentityMapper annotation
* CLOUDSTACK-514 Marvin and Cloudmonkey don't work when an API target uses https or an alternate path
* CLOUDSTACK-510 Add button not visible when adding public IPs to physical network
* CLOUDSTACK-508 CLVM copies template to primary storage unnecessarily
* CLOUDSTACK-507 fix api docs for listSSHKeyPairs
* CLOUDSTACK-504 Duplicate guest password scripts in codebase
* CLOUDSTACK-501 Apidocs and marvin does not know how to handle Autoscaling docs
* CLOUDSTACK-500 Passwd-server iptables rules are dropped on domr on fresh start or on reboot
* CLOUDSTACK-499 cloudmonkey CLI can't accept complex parameters
* CLOUDSTACK-493 2.2.x-3.0 DB upgrade support for Advance SG enabled networks
* CLOUDSTACK-481 Installation Guide Doc Error
* CLOUDSTACK-467 Developer's Guide points to cloud.com for API reference
* CLOUDSTACK-465 French language file quotes are dropping javascript syntax errors
* CLOUDSTACK-464 "Regression in AWSAPI docs, entire sections removed"
* CLOUDSTACK-462 A few corrections to make to the 4.0.0 installation guide
* CLOUDSTACK-459 [Optional Public IP assignment for EIP with Basic Zone] Associate IP Checkbox in Create Network Offering Dialog is Displayed When Elastic LB is Selected
* CLOUDSTACK-456 License tag in SPEC isn't what RPM is expecting
* CLOUDSTACK-448 SSVM bootstrap failure on XenServer hosts with E3 CPU
* CLOUDSTACK-446 "Host going to alert state, if you are adding already added host"
* CLOUDSTACK-441 Running mgmt server using jetty fails to start api server
* CLOUDSTACK-435 Vmware network labels are ignored when creating a Zone using basic networking
* CLOUDSTACK-427 Change hardcoded step number references to dynamic links
* CLOUDSTACK-424 Updated userdata not propagating to the VR.
* CLOUDSTACK-417 Handle password server securely to run on port 8080 on VR
* CLOUDSTACK-416 XCP 1.6beta2 (61002c) - can't add a host
* CLOUDSTACK-404 Update docs on the usage of cloud-setup-databases
* CLOUDSTACK-398 Install Guide: Section 11.17.3 (Using VPN with Mac OSX): Not complete?
* CLOUDSTACK-397 Install Guide: Section 11.1 (Guest Traffic): Diagram is the wrong diagram
* CLOUDSTACK-390 Install Guide: Section 4.5.7 (Prepare the System VM Template): Links go to cloud.com
* CLOUDSTACK-378 mavenize marvin on master
* CLOUDSTACK-377 provide deployment config access to marvin's testcase
* CLOUDSTACK-373 "static NAT and Firewall is not working on external firewall device SRX, it needs to be implemented"
* CLOUDSTACK-369 ASF 4.0 - unable to support XenServer 6.1 host
* CLOUDSTACK-364 Docs point to download.cloud.com for AWS API script
* CLOUDSTACK-361 Wrong creation of guest networks on a KVM host in Multiple Physical Networks with guest traffic
* CLOUDSTACK-359 PropagateResourceEventCommand failes in cluster configuration
* CLOUDSTACK-357 "ISOs can be deleted while still attached to a running VM, and they subsequently cannot be detached from a running VM"
* CLOUDSTACK-355 "Fix ""count"" in a bunch of API commands"
* CLOUDSTACK-348 deleteNetwork does not clean up network resource count correctly
* CLOUDSTACK-347 listNetworks API: return vlan information only when the caller is ROOT admin
* CLOUDSTACK-346 Cannot add Vmware cluster with class loader conflict exception
* CLOUDSTACK-335 KVM VPC load balancer not working
* CLOUDSTACK-333 When Datacenter name in VCenter has spaces Primary Storage (VMFS) discovery will fail
* CLOUDSTACK-332 """count"" property in list* API response should be equal to how many entries in database, not how many objects in API response"
* CLOUDSTACK-318 Adding XenServer Host Fails - 6.0.2 fails with 4.0.0
* CLOUDSTACK-304 Add synchronization for createSnapshot command per host basis
* CLOUDSTACK-293 "We do awful, hacky things in our spec file for client"
* CLOUDSTACK-290 3.0.0 template also needed for 2.2.14 to 3.0.5 direct upgrade.
* CLOUDSTACK-284 listVirtualMachines does not return deleted machines when zone is specified
* CLOUDSTACK-279 deleteProject fails when executed by the regular user (works fine for root/domain admin)
* CLOUDSTACK-274 Two error codes mapped to same value in API
* CLOUDSTACK-271 updatePhysicalNetwork dies with an NPE when the vlan range is empty
* CLOUDSTACK-256 "vpn:As an admin user , not able to delete VPN user which is present in a regular user's network."
* CLOUDSTACK-250 Incorrect description of maintenance mode in admin guide
* CLOUDSTACK-249 Add host id to failed VM deploy alerts
* CLOUDSTACK-235 Network rate can be set in 2 places. Clarify docs on how this works.
* CLOUDSTACK-232 Zone infrastructure chart -- disable resource total display
* CLOUDSTACK-228 UI provides an option to reconnect a disconnected host - ServerApiException is thrown on an attempt
* CLOUDSTACK-227 ReconnectHostCmd: NullPointerException: Unable to get host Information for XenServer 6.0.2 host - on intentionally changing the traffic labels on the physical network
* CLOUDSTACK-226 UpdatePhysicalNetworkcommand failed due to java.sql.BatchUpdateException ; Tried to extend the existing Guest VLAN Range of one physical network into the Guest VLAN range of the other physical network
* CLOUDSTACK-225 API Docs: Request params repeated with different descriptions
* CLOUDSTACK-222 Admin UI prompts to restart Management server with cancel edit operation
* CLOUDSTACK-178 Expose name parameter of VM in list Vm view.
* CLOUDSTACK-130 Clarify docs on tags parameter in API reference
* CLOUDSTACK-119 Move Agent-Simulator in to the hypervisor plugin model
* CLOUDSTACK-118 "Status of host resorce stuck in ""ErrorInMaintenance"""
* CLOUDSTACK-95 IP address allocation not working when a user tries to allocate IP addresses in a Project.
* CLOUDSTACK-70 Improve Network Restart Behaviour for Basic Zone: Restarting Network Fails
* CLOUDSTACK-46 Remnants of mycloud remain
Security Fixes:
* CVE-2012-4501: Apache CloudStack configuration vulnerability
Version 4.0.2
------------------------
This is a maintenance release for the Apache CloudStack 4.0.x series, with no new features.
Issues fixed in this release:
* CLOUDSTACK-354: Display of storage statistics is wrong.
* CLOUDSTACK-397: Install Guide: Section 11.1 (Guest Traffic): Diagram is the wrong diagram
* CLOUDSTACK-398: Install Guide: Section 11.17.3 (Using VPN with Mac OSX): Not complete?
* CLOUDSTACK-462: A few corrections to make to the 4.0.0 installation guide
* CLOUDSTACK-524: http proxy used by ssvm (secstorage.proxy) NOT working
* CLOUDSTACK-587: MEMORY_CONSTRAINT_VIOLATIONMemory limits must satisfy:
* CLOUDSTACK-803: HA gets triggered even when the host investigator is unable to determine the state of the host
* CLOUDSTACK-810: Make DirectAgent thread pool size configurable
* CLOUDSTACK-976: unable to start cloudstack (error: "java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Base64.encodeBase64URLSafeString([B)Ljava/lang/String;")
* CLOUDSTACK-988: HV version must be updated in hypervisor_version column of host table
* CLOUDSTACK-990: Documentation issue with libvirtd.conf tcp_port configuration
* CLOUDSTACK-1088: EnableStaticNat error will clear the data in database
* CLOUDSTACK-1106: Missing documentation for cloud-setup-databases
* CLOUDSTACK-1110: Documentation missing "Management Server Load Balancing"
* CLOUDSTACK-1112: Errors in "Prepare the System VM Template"
* CLOUDSTACK-1137: Force reconnect of a disconnected state complains about the state of the host.
* CLOUDSTACK-1150: Documentation for libvirt on Ubuntu 12.04
* CLOUDSTACK-1151: vmware systemVm template upgrade is missing in 4.0 upgrade
* CLOUDSTACK-1211: Network operations are Blocked for the Read-only file system of Virtual Router
* CLOUDSTACK-1265: logrotate dnsmasq configuration is wrong
* CLOUDSTACK-1291: duplicate arguments in commands.xml prevents cloudapis.py to run to completion
* CLOUDSTACK-1298: typo in deb package setup
* CLOUDSTACK-1299: Errors in 4.5.5 section of installation guide
* CLOUDSTACK-1300: section in wrong order in installation guide
* CLOUDSTACK-1341: URL for the KEYs file is wrong in the installation guide
* CLOUDSTACK-1419: Apache-ify and apply trademark logos in the UI
* CLOUDSTACK-1420: Ensure trademarks are properly attributed in publican brand.
* CLOUDSTACK-1589: Ubuntu 4.0 packages depend on non-existent chkconfig
* CLOUDSTACK-1629: Need to move location or conflict with antlr
* CLOUDSTACK-1642: Add support CentOS 6.4
* CLOUDSTACK-1648: Unable to add KVM host
* CLOUDSTACK-1652: /etc/hosts error in virtual router when deploy instance with the name same to previous instances
* CLOUDSTACK-1666: KVM VPC NetworkUsage doesnot work
* CLOUDSTACK-1668: IP conflict in VPC tier
* CLOUDSTACK-1761: Available local storage disk capacity incorrectly reported in KVM to manager.
* CLOUDSTACK-1845: KVM - storage migration often fails
* CLOUDSTACK-1846: KVM - storage pools can silently fail to be unregistered, leading to failure to register later
* CLOUDSTACK-2003: Deleting domain while deleted account is cleaning up leaves VMs expunging forever due to 'Failed to update resource count'
* CLOUDSTACK-2090: Upgrade from version 4.0.1 to version 4.0.2 triggers the 4.0.0 to 4.0.1.
* CLOUDSTACK-2091: Error in API documentation for 4.0.x.
Version 4.0.1-incubating
------------------------
This is a bugfix release for Apache CloudStack 4.0.0-incubating, with no new features.
Security Fixes:
* CVE-2012-5616: Local Information Disclosure Vulnerability (See CLOUDSTACK-505)
Bugs fixed in this release:
* CLOUDSTACK-359: PropagateResourceEventCommand fails in cluster configuration
* CLOUDSTACK-374: When running cloud-setup-databases, it auto chooses the highest priority nic (lowest number ie: eth0)
* CLOUDSTACK-389: Install Guide: Section 4.5.5 (Prepare NFS Shares): Confusing statement about iSCSI
* CLOUDSTACK-395: Primary Storage and Secondary Storage sections missing sub-sections
* CLOUDSTACK-411: Add another step during kvm agent installation on Ubuntu machine
* CLOUDSTACK-415: restartNetwork call causes VM to be unreachable when Nicira based SDN is used.
* CLOUDSTACK-422: XSL files missing license header.
* CLOUDSTACK-426: SetVPCStaticNatRules unimplemented for KVM.
* CLOUDSTACK-448: SSVM bootstrap failure on XenServer hosts with E3 CPU.
* CLOUDSTACK-465: French language file quotes are dropping javascript syntax errors.
* CLOUDSTACK-473: API Doc for uploadCustomCertificate doesn't explain how to use the optional parameters well.
* CLOUDSTACK-480: Installation Documentation error: Section 4.5.5.2 needs to mention nfs-kernel-server.
* CLOUDSTACK-481: Installation Guide Doc Error
* CLOUDSTACK-498: Missing dependency in RPM of KVM Agent.
* CLOUDSTACK-502: VPC router needs to resolve its hostname.
* CLOUDSTACK-505: cloudstack logs the private key in plaintext.
* CLOUDSTACK-507: fix api docs for listSSHKeyPairs.
* CLOUDSTACK-515: NVP installation.
* CLOUDSTACK-536: remove citrix cloudpatform from 4.0 build - CloudStack is ASF project.
* CLOUDSTACK-560: Usage server doesn't work in 4.0.0 due to missing db changes.
* CLOUDSTACK-580: Packages are named with 4.0 with 4.0.1 build.
* CLOUDSTACK-591: Wrong vnet in iptables on KVM hypervisors after VM reboot.
* CLOUDSTACK-595: Recreate root volume scenarios doesn't work in VMware
* CLOUDSTACK-603: Upgrade from 4.0 to 4.0.1 is not enabled.
* CLOUDSTACK-605: Host physical CPU is incorrectly calculated for VMware host
* CLOUDSTACK-622: In the add primary storage dialog in the ui the RBD fields don't disappear when changing from RBD to another protocol.
* CLOUDSTACK-683: Image is missing in the Accessing VM Section
* CLOUDSTACK-685: CloudStack 4.0 Network Usage is ZERO
* CLOUDSTACK-938: s2s VPN trouble
* CLOUDSTACK-961: Installation docs don't detail dependencies for building RPMs
* CLOUDSTACK-995: Not able to add the KVM host
Version 4.0.0-incubating
------------------------
@ -34,4 +414,3 @@ New Features:
Security Fixes:
* CVE-2012-4501: Apache CloudStack configuration vulnerability

View File

@ -1,7 +0,0 @@
Apache CloudStack is an effort undergoing incubation at The Apache Software Foundation (ASF),
sponsored by the Apache Incubator. Incubation is required of all newly accepted
projects until a further review indicates that the infrastructure, communications, and
decision making process have stabilized in a manner consistent with other successful ASF
projects. While incubation status is not necessarily a reflection of the completeness or
stability of the code, it does indicate that the project has yet to be fully endorsed by
the ASF.

View File

@ -1,8 +1,8 @@
Apache CloudStack (Incubating) Version 4.0.0
Apache CloudStack Version 4.2.0
# About Apache CloudStack (Incubating)
# About Apache CloudStack
Apache CloudStack (Incubating) is software designed to deploy
Apache CloudStack is software designed to deploy
and manage large networks of virtual machines, as a highly
available, highly scalable Infrastructure as a Service (IaaS)
cloud computing platform. CloudStack is used by a number of

View File

@ -78,7 +78,7 @@ domr.scripts.dir=scripts/network/domr/kvm
# a sensible default will be selected based on the network.bridge.type but can
# be overridden here.
# native = com.cloud.hypervisor.kvm.resource.BridgeVifDriver
# openvswitch = com.cloud.hypervisor.kvm.resource.OvsBridgeDriver
# openvswitch = com.cloud.hypervisor.kvm.resource.OvsVifDriver
#libvirt.vif.driver=com.cloud.hypervisor.kvm.resource.BridgeVifDriver
# set the hypervisor type, values are: kvm, lxc

View File

@ -38,12 +38,10 @@ import java.util.UUID;
import javax.naming.ConfigurationException;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.apache.log4j.xml.DOMConfigurator;
import com.cloud.agent.Agent.ExitStatus;
@ -373,6 +371,7 @@ public class AgentShell implements IAgentShell {
throw new ConfigurationException("Unable to find the guid");
}
_guid = UUID.randomUUID().toString();
_properties.setProperty("guid", _guid);
}
return true;

View File

@ -235,14 +235,14 @@ public class ConsoleProxyResource extends ServerResourceBase implements
if (_eth1ip != null) {
params.put("private.network.device", "eth1");
} else {
s_logger.warn("WARNING: eth1ip parameter is not found!");
s_logger.info("eth1ip parameter has not been configured, assuming that we are not inside a system vm");
}
String eth2ip = (String) params.get("eth2ip");
if (eth2ip != null) {
params.put("public.network.device", "eth2");
} else {
s_logger.warn("WARNING: eth2ip parameter is not found!");
s_logger.info("eth2ip parameter is not found, assuming that we are not inside a system vm");
}
super.configure(name, params);

View File

@ -1,31 +1,26 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.vm;
import com.cloud.storage.Storage;
/**
* VirtualDisk describes the disks that are plugged into
* the virtual machine.
*
*/
public class VirtualDisk {
public Storage.ImageFormat format;
public String url;
public boolean bootable;
public long size;
}
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.agent.api.storage;
import com.cloud.agent.api.Answer;
public class CreateVolumeOVAAnswer extends Answer {
public CreateVolumeOVAAnswer(CreateVolumeOVACommand cmd, boolean result, String details) {
super(cmd, result, details);
}
}

View File

@ -0,0 +1,60 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.agent.api.storage;
import com.cloud.agent.api.Command;
import com.cloud.agent.api.to.StorageFilerTO;
import com.cloud.storage.StoragePool;
public class CreateVolumeOVACommand extends Command {
String secUrl;
String volPath;
String volName;
StorageFilerTO pool;
public CreateVolumeOVACommand() {
}
public CreateVolumeOVACommand(String secUrl, String volPath, String volName, StoragePool pool, int wait) {
this.secUrl = secUrl;
this.volPath = volPath;
this.volName = volName;
this.pool = new StorageFilerTO(pool);
setWait(wait);
}
@Override
public boolean executeInSequence() {
return true;
}
public String getVolPath() {
return this.volPath;
}
public String getVolName() {
return this.volName;
}
public String getSecondaryStorageUrl() {
return this.secUrl;
}
public StorageFilerTO getPool() {
return pool;
}
}

View File

@ -0,0 +1,26 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.agent.api.storage;
import com.cloud.agent.api.Answer;
public class PrepareOVAPackingAnswer extends Answer {
public PrepareOVAPackingAnswer(PrepareOVAPackingCommand cmd, boolean result, String details) {
super(cmd, result, details);
}
}

View File

@ -0,0 +1,48 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.agent.api.storage;
import com.cloud.agent.api.Command;
public class PrepareOVAPackingCommand extends Command {
private String templatePath;
private String secUrl;
public PrepareOVAPackingCommand() {
}
public PrepareOVAPackingCommand(String secUrl, String templatePath) {
this.secUrl = secUrl;
this.templatePath = templatePath;
}
@Override
public boolean executeInSequence() {
return true;
}
public String getTemplatePath() {
return this.templatePath;
}
public String getSecondaryStorageUrl() {
return this.secUrl;
}
}

View File

@ -23,6 +23,7 @@ import org.apache.cloudstack.api.InternalIdentity;
import com.cloud.network.rules.FirewallRule;
import com.cloud.network.rules.FirewallRule.State;
import com.cloud.network.rules.FirewallRule.TrafficType;
import com.cloud.utils.net.NetUtils;
/**
@ -109,6 +110,11 @@ public class FirewallRuleTO implements InternalIdentity {
this(rule.getId(),srcVlanTag, srcIp, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(), revokeState, alreadyAdded, purpose,rule.getSourceCidrList(),rule.getIcmpType(),rule.getIcmpCode());
}
public FirewallRuleTO(FirewallRule rule, String guestVlanTag, FirewallRule.TrafficType trafficType) {
this(rule.getId(), guestVlanTag, null, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(), rule.getState()==State.Revoke, rule.getState()==State.Active, rule.getPurpose(), rule.getSourceCidrList(), rule.getIcmpType(), rule.getIcmpCode());
this.trafficType = trafficType;
}
public FirewallRule.TrafficType getTrafficType(){
return trafficType;
}

View File

@ -1,197 +0,0 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.api.commands;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.log4j.Logger;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.network.Network;
import com.cloud.user.UserContext;
//@APICommand(description="Creates a private network", responseObject=NetworkResponse.class)
public class CreatePrivateNetworkCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(CreatePrivateNetworkCmd.class.getName());
private static final String s_name = "createnetworkresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="the name of the network")
private String name;
@Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, required=true, description="the display text of the network")
private String displayText;
@Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.UUID, entityType = PhysicalNetworkResponse.class,
required=true, description="the Physical Network ID the network belongs to")
private Long physicalNetworkId;
@Parameter(name=ApiConstants.GATEWAY, type=CommandType.STRING, required=true, description="the gateway of the network")
private String gateway;
@Parameter(name=ApiConstants.NETMASK, type=CommandType.STRING, required=true, description="the netmask of the network")
private String netmask;
@Parameter(name=ApiConstants.START_IP, type=CommandType.STRING, required=true, description="the beginning IP address in the network IP range")
private String startIp;
@Parameter(name=ApiConstants.END_IP, type=CommandType.STRING, description="the ending IP address in the network IP" +
" range. If not specified, will be defaulted to startIP")
private String endIp;
@Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, required=true, description="the ID or VID of the network")
private String vlan;
@Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="account who will own the network")
private String accountName;
@Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType = ProjectResponse.class,
description="an optional project for the ssh key")
private Long projectId;
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType = DomainResponse.class,
description="domain ID of the account owning a network")
private Long domainId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public String getGateway() {
return gateway;
}
public String getVlan() {
return vlan;
}
public String getAccountName() {
return accountName;
}
public Long getDomainId() {
return domainId;
}
public String getNetmask() {
return netmask;
}
public String getStartIp() {
return startIp;
}
public String getNetworkName() {
return name;
}
public String getDisplayText() {
return displayText;
}
public Long getProjectId() {
return projectId;
}
public long getPhysicalNetworkId() {
return physicalNetworkId;
}
public String getEndIp() {
return endIp;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public void create() throws ResourceAllocationException {
Network result = null;
try {
result = _networkService.createPrivateNetwork(getNetworkName(), getDisplayText(), getPhysicalNetworkId(), getVlan(),
getStartIp(), getEndIp(), getGateway(), getNetmask(), getEntityOwnerId(), null);
} catch (InsufficientCapacityException ex){
s_logger.info(ex);
s_logger.trace(ex);
throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
} catch (ConcurrentOperationException ex) {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
}
if (result != null) {
this.setEntityId(result.getId());
this.setEntityUuid(result.getUuid());
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a Private network");
}
}
@Override
public void execute() throws InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException{
Network result = _networkService.getNetwork(getEntityId());
if (result != null) {
NetworkResponse response = _responseGenerator.createNetworkResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create private network");
}
}
@Override
public long getEntityOwnerId() {
Long accountId = finalyzeAccountId(accountName, domainId, projectId, true);
if (accountId == null) {
return UserContext.current().getCaller().getId();
}
return accountId;
}
@Override
public String getEventType() {
return EventTypes.EVENT_NETWORK_CREATE;
}
@Override
public String getEventDescription() {
return "creating private network";
}
}

View File

@ -32,6 +32,39 @@ public interface AsyncJob extends Identity, InternalIdentity {
String getDispatcher();
int getPendingSignals();
public enum Type {
None,
VirtualMachine,
DomainRouter,
Volume,
ConsoleProxy,
Snapshot,
Template,
Iso,
SystemVm,
Host,
StoragePool,
IpAddress,
SecurityGroup,
PhysicalNetwork,
TrafficType,
PhysicalNetworkServiceProvider,
FirewallRule,
Account,
User,
PrivateGateway,
StaticRoute,
Counter,
Condition,
AutoScalePolicy,
AutoScaleVmProfile,
AutoScaleVmGroup,
GlobalLoadBalancerRule,
LoadBalancerRule,
AffinityGroup,
InternalLbVm,
DedicatedGuestVlanRange
}
long getUserId();

View File

@ -20,6 +20,11 @@ import java.util.List;
import javax.naming.NamingException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.exception.ResourceAllocationException;
import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd;
import org.apache.cloudstack.api.command.admin.ldap.LDAPConfigCmd;
import org.apache.cloudstack.api.command.admin.ldap.LDAPRemoveCmd;
@ -35,7 +40,9 @@ import org.apache.cloudstack.api.command.admin.offering.UpdateServiceOfferingCmd
import org.apache.cloudstack.api.command.admin.pod.DeletePodCmd;
import org.apache.cloudstack.api.command.admin.pod.UpdatePodCmd;
import org.apache.cloudstack.api.command.admin.vlan.CreateVlanIpRangeCmd;
import org.apache.cloudstack.api.command.admin.vlan.DedicatePublicIpRangeCmd;
import org.apache.cloudstack.api.command.admin.vlan.DeleteVlanIpRangeCmd;
import org.apache.cloudstack.api.command.admin.vlan.ReleasePublicIpRangeCmd;
import org.apache.cloudstack.api.command.admin.zone.CreateZoneCmd;
import org.apache.cloudstack.api.command.admin.zone.DeleteZoneCmd;
import org.apache.cloudstack.api.command.admin.zone.UpdateZoneCmd;
@ -44,10 +51,6 @@ import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd;
import com.cloud.dc.DataCenter;
import com.cloud.dc.Pod;
import com.cloud.dc.Vlan;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Networks.TrafficType;
import com.cloud.offering.DiskOffering;
import com.cloud.offering.NetworkOffering;
@ -63,7 +66,7 @@ public interface ConfigurationService {
* - the command wrapping name and value parameters
* @return updated configuration object if successful
*/
Configuration updateConfiguration(UpdateCfgCmd cmd);
Configuration updateConfiguration(UpdateCfgCmd cmd) throws InvalidParameterValueException;
/**
* Create a service offering through the API
@ -234,6 +237,10 @@ public interface ConfigurationService {
boolean deleteVlanIpRange(DeleteVlanIpRangeCmd cmd);
Vlan dedicatePublicIpRange(DedicatePublicIpRangeCmd cmd) throws ResourceAllocationException;
boolean releasePublicIpRange(ReleasePublicIpRangeCmd cmd);
NetworkOffering createNetworkOffering(CreateNetworkOfferingCmd cmd);
NetworkOffering updateNetworkOffering(UpdateNetworkOfferingCmd cmd);
@ -244,7 +251,7 @@ public interface ConfigurationService {
NetworkOffering getNetworkOffering(long id);
Integer getNetworkOfferingNetworkRate(long networkOfferingId);
Integer getNetworkOfferingNetworkRate(long networkOfferingId, Long dataCenterId);
Account getVlanAccount(long vlanId);
@ -256,7 +263,7 @@ public interface ConfigurationService {
Long getDefaultPageSize();
Integer getServiceOfferingNetworkRate(long serviceOfferingId);
Integer getServiceOfferingNetworkRate(long serviceOfferingId, Long dataCenterId);
DiskOffering getDiskOffering(long diskOfferingId);

View File

@ -16,6 +16,9 @@
// under the License.
package com.cloud.event;
import java.util.HashMap;
import java.util.Map;
import com.cloud.configuration.Configuration;
import com.cloud.dc.DataCenter;
import com.cloud.dc.Pod;
@ -23,8 +26,18 @@ import com.cloud.dc.StorageNetworkIpRange;
import com.cloud.dc.Vlan;
import com.cloud.domain.Domain;
import com.cloud.host.Host;
import com.cloud.network.*;
import com.cloud.network.as.*;
import com.cloud.network.GuestVlan;
import com.cloud.network.Network;
import com.cloud.network.PhysicalNetwork;
import com.cloud.network.PhysicalNetworkServiceProvider;
import com.cloud.network.PhysicalNetworkTrafficType;
import com.cloud.network.PublicIpAddress;
import com.cloud.network.RemoteAccessVpn;
import com.cloud.network.as.AutoScaleCounter;
import com.cloud.network.as.AutoScalePolicy;
import com.cloud.network.as.AutoScaleVmGroup;
import com.cloud.network.as.AutoScaleVmProfile;
import com.cloud.network.as.Condition;
import com.cloud.network.router.VirtualRouter;
import com.cloud.network.rules.LoadBalancer;
import com.cloud.network.rules.StaticNat;
@ -43,9 +56,6 @@ import com.cloud.user.Account;
import com.cloud.user.User;
import com.cloud.vm.VirtualMachine;
import java.util.HashMap;
import java.util.Map;
public class EventTypes {
//map of Event and corresponding entity for which Event is applicable
@ -226,6 +236,8 @@ public class EventTypes {
// VLANs/IP ranges
public static final String EVENT_VLAN_IP_RANGE_CREATE = "VLAN.IP.RANGE.CREATE";
public static final String EVENT_VLAN_IP_RANGE_DELETE = "VLAN.IP.RANGE.DELETE";
public static final String EVENT_VLAN_IP_RANGE_DEDICATE = "VLAN.IP.RANGE.DEDICATE";
public static final String EVENT_VLAN_IP_RANGE_RELEASE = "VLAN.IP.RANGE.RELEASE";
public static final String EVENT_STORAGE_IP_RANGE_CREATE = "STORAGE.IP.RANGE.CREATE";
public static final String EVENT_STORAGE_IP_RANGE_DELETE = "STORAGE.IP.RANGE.DELETE";
@ -348,7 +360,7 @@ public class EventTypes {
// tag related events
public static final String EVENT_TAGS_CREATE = "CREATE_TAGS";
public static final String EVENT_TAGS_DELETE = "DELETE_TAGS";
// vm snapshot events
public static final String EVENT_VM_SNAPSHOT_CREATE = "VMSNAPSHOT.CREATE";
public static final String EVENT_VM_SNAPSHOT_DELETE = "VMSNAPSHOT.DELETE";
@ -382,6 +394,20 @@ public class EventTypes {
public static final String EVENT_BAREMETAL_PXE_SERVER_ADD = "PHYSICAL.PXE.ADD";
public static final String EVENT_BAREMETAL_PXE_SERVER_DELETE = "PHYSICAL.PXE.DELETE";
public static final String EVENT_AFFINITY_GROUP_CREATE = "AG.CREATE";
public static final String EVENT_AFFINITY_GROUP_DELETE = "AG.DELETE";
public static final String EVENT_AFFINITY_GROUP_ASSIGN = "AG.ASSIGN";
public static final String EVENT_AFFINITY_GROUP_REMOVE = "AG.REMOVE";
public static final String EVENT_VM_AFFINITY_GROUP_UPDATE = "VM.AG.UPDATE";
public static final String EVENT_INTERNAL_LB_VM_START = "INTERNALLBVM.START";
public static final String EVENT_INTERNAL_LB_VM_STOP = "INTERNALLBVM.STOP";
// Dedicated guest vlan range
public static final String EVENT_GUEST_VLAN_RANGE_DEDICATE = "GUESTVLANRANGE.DEDICATE";
public static final String EVENT_DEDICATED_GUEST_VLAN_RANGE_RELEASE = "GUESTVLANRANGE.RELEASE";
static {
// TODO: need a way to force author adding event types to declare the entity details as well, with out braking
@ -539,6 +565,8 @@ public class EventTypes {
// VLANs/IP ranges
entityEventDetails.put(EVENT_VLAN_IP_RANGE_CREATE, Vlan.class.getName());
entityEventDetails.put(EVENT_VLAN_IP_RANGE_DELETE,Vlan.class.getName());
entityEventDetails.put(EVENT_VLAN_IP_RANGE_DEDICATE, Vlan.class.getName());
entityEventDetails.put(EVENT_VLAN_IP_RANGE_RELEASE,Vlan.class.getName());
entityEventDetails.put(EVENT_STORAGE_IP_RANGE_CREATE, StorageNetworkIpRange.class.getName());
entityEventDetails.put(EVENT_STORAGE_IP_RANGE_DELETE, StorageNetworkIpRange.class.getName());
@ -680,6 +708,9 @@ public class EventTypes {
entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_UPDATE, AutoScaleVmGroup.class.getName());
entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_ENABLE, AutoScaleVmGroup.class.getName());
entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_DISABLE, AutoScaleVmGroup.class.getName());
entityEventDetails.put(EVENT_GUEST_VLAN_RANGE_DEDICATE, GuestVlan.class.getName());
entityEventDetails.put(EVENT_DEDICATED_GUEST_VLAN_RANGE_RELEASE, GuestVlan.class.getName());
}
public static String getEntityForEvent (String eventName) {

View File

@ -0,0 +1,34 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.exception;
import com.cloud.utils.SerialVersionUID;
import com.cloud.utils.exception.CloudRuntimeException;
public class AffinityConflictException extends CloudRuntimeException {
private static final long serialVersionUID = SerialVersionUID.AffinityConflictException;
public AffinityConflictException(String message) {
super(message);
}
public AffinityConflictException(String message, Throwable th) {
super(message, th);
}
}

View File

@ -52,4 +52,6 @@ public interface HypervisorCapabilities extends Identity, InternalIdentity{
*/
Integer getMaxHostsPerCluster();
boolean isStorageMotionSupported();
}

View File

@ -16,6 +16,8 @@
// under the License.
package com.cloud.hypervisor;
import java.util.List;
import com.cloud.agent.api.Command;
import com.cloud.agent.api.to.NicTO;
import com.cloud.agent.api.to.VirtualMachineTO;
@ -57,4 +59,11 @@ public interface HypervisorGuru extends Adapter {
* @return
*/
NicTO toNicTO(NicProfile profile);
/**
* Give hypervisor guru opportunity to decide if certain command needs to be done after expunge VM from DB
* @param vm
* @return a list of Commands
*/
List<Command> finalizeExpunge(VirtualMachine vm);
}

View File

@ -0,0 +1,31 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.network;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
public interface GuestVlan extends InternalIdentity, Identity {
public long getId();
public long getAccountId();
public String getGuestVlanRange();
public long getPhysicalNetworkId();
}

View File

@ -78,16 +78,10 @@ public interface IpAddress extends ControlledEntity, Identity, InternalIdentity
boolean getSystem();
/**
* @return
*/
Long getVpcId();
/**
* @param vpcId
*/
void setVpcId(Long vpcId);
String getVmIp();
void setVmIp(String vmIp);
Long getNetworkId();
}

View File

@ -19,29 +19,17 @@ package com.cloud.network;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
import com.cloud.network.Networks.BroadcastDomainType;
import com.cloud.network.Networks.Mode;
import com.cloud.network.Networks.TrafficType;
import com.cloud.network.Networks.BroadcastDomainType;
import com.cloud.network.Networks.Mode;
import com.cloud.network.Networks.TrafficType;
import com.cloud.utils.fsm.StateMachine2;
import com.cloud.utils.fsm.StateObject;
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
/**
* owned by an account.
*/
@ -63,7 +51,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
Capability.MultipleIps, Capability.TrafficStatistics, Capability.SupportedTrafficDirection, Capability.SupportedEgressProtocols);
public static final Service Lb = new Service("Lb", Capability.SupportedLBAlgorithms, Capability.SupportedLBIsolation,
Capability.SupportedProtocols, Capability.TrafficStatistics, Capability.LoadBalancingSupportedIps,
Capability.SupportedStickinessMethods, Capability.ElasticLb);
Capability.SupportedStickinessMethods, Capability.ElasticLb, Capability.LbSchemes);
public static final Service UserData = new Service("UserData");
public static final Service SourceNat = new Service("SourceNat", Capability.SupportedSourceNatTypes, Capability.RedundantRouter);
public static final Service StaticNat = new Service("StaticNat", Capability.ElasticIp);
@ -137,6 +125,8 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
public static final Provider None = new Provider("None", false);
// NiciraNvp is not an "External" provider, otherwise we get in trouble with NetworkServiceImpl.providersConfiguredForExternalNetworking
public static final Provider NiciraNvp = new Provider("NiciraNvp", false);
public static final Provider InternalLbVm = new Provider("InternalLbVm", false);
public static final Provider CiscoVnmc = new Provider("CiscoVnmc", true);
private String name;
private boolean isExternal;
@ -182,12 +172,14 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
public static final Capability AllowDnsSuffixModification = new Capability("AllowDnsSuffixModification");
public static final Capability RedundantRouter = new Capability("RedundantRouter");
public static final Capability ElasticIp = new Capability("ElasticIp");
public static final Capability AssociatePublicIP = new Capability("AssociatePublicIP");
public static final Capability ElasticLb = new Capability("ElasticLb");
public static final Capability AutoScaleCounters = new Capability("AutoScaleCounters");
public static final Capability InlineMode = new Capability("InlineMode");
public static final Capability SupportedTrafficDirection = new Capability("SupportedTrafficDirection");
public static final Capability SupportedEgressProtocols = new Capability("SupportedEgressProtocols");
public static final Capability HealthCheckPolicy = new Capability("HealthCheckPolicy");
public static final Capability LbSchemes = new Capability("LbSchemes");
private String name;

View File

@ -33,6 +33,7 @@ import com.cloud.network.Networks.TrafficType;
import com.cloud.network.element.NetworkElement;
import com.cloud.network.element.UserDataServiceProvider;
import com.cloud.offering.NetworkOffering;
import com.cloud.offering.NetworkOffering.Detail;
import com.cloud.user.Account;
import com.cloud.vm.Nic;
import com.cloud.vm.NicProfile;
@ -181,7 +182,7 @@ public interface NetworkModel {
/**
* @return
*/
String getDefaultNetworkDomain();
String getDefaultNetworkDomain(long zoneId);
/**
* @param ntwkOffId
@ -263,4 +264,12 @@ public interface NetworkModel {
boolean isProviderEnabledInZone(long zoneId, String provider);
Nic getPlaceholderNicForRouter(Network network, Long podId);
IpAddress getPublicIpAddress(String ipAddress, long zoneId);
List<String> getUsedIpsInNetwork(Network network);
Map<Detail, String> getNtwkOffDetails(long offId);
Networks.IsolationType[] listNetworkIsolationMethods();
}

View File

@ -18,6 +18,8 @@ package com.cloud.network;
import java.util.List;
import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;
import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd;
@ -29,6 +31,7 @@ import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.GuestVlan;
import com.cloud.network.Network.Service;
import com.cloud.network.Networks.TrafficType;
import com.cloud.user.Account;
@ -46,7 +49,7 @@ public interface NetworkService {
List<? extends Network> getIsolatedNetworksOwnedByAccountInZone(long zoneId, Account owner);
IpAddress allocateIP(Account ipOwner, boolean isSystem, long zoneId) throws ResourceAllocationException,
IpAddress allocateIP(Account ipOwner, long zoneId, Long networkId) throws ResourceAllocationException,
InsufficientAddressCapacityException, ConcurrentOperationException;
boolean releaseIpAddress(long ipAddressId) throws InsufficientAddressCapacityException;
@ -79,7 +82,7 @@ public interface NetworkService {
Long startIndex, Long pageSize, String name);
PhysicalNetwork updatePhysicalNetwork(Long id, String networkSpeed, List<String> tags,
String newVnetRangeString, String state);
String newVnetRangeString, String state, String removeVlan);
boolean deletePhysicalNetwork(Long id);
@ -114,6 +117,12 @@ public interface NetworkService {
boolean deletePhysicalNetworkTrafficType(Long id);
GuestVlan dedicateGuestVlanRange(DedicateGuestVlanRangeCmd cmd);
Pair<List<? extends GuestVlan>, Integer> listDedicatedGuestVlanRanges(ListDedicatedGuestVlanRangesCmd cmd);
boolean releaseDedicatedGuestVlanRange(Long dedicatedGuestVlanRangeId);
Pair<List<? extends PhysicalNetworkTrafficType>, Integer> listTrafficTypes(Long physicalNetworkId);
@ -138,6 +147,7 @@ public interface NetworkService {
ResourceAllocationException, ResourceUnavailableException, ConcurrentOperationException;
/**
*
* @param networkName
* @param displayText
* @param physicalNetworkId
@ -148,17 +158,18 @@ public interface NetworkService {
* @param netmask
* @param networkOwnerId
* @param vpcId TODO
* @param sourceNat
* @return
* @throws InsufficientCapacityException
* @throws ConcurrentOperationException
* @throws ResourceAllocationException
*/
Network createPrivateNetwork(String networkName, String displayText, long physicalNetworkId, String vlan,
String startIp, String endIP, String gateway, String netmask, long networkOwnerId, Long vpcId)
String startIp, String endIP, String gateway, String netmask, long networkOwnerId, Long vpcId, Boolean sourceNat)
throws ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException;
/* Requests an IP address for the guest nic */
String allocateSecondaryGuestIP(Account account, long zoneId, Long nicId,
NicSecondaryIp allocateSecondaryGuestIP(Account account, long zoneId, Long nicId,
Long networkId, String ipaddress) throws InsufficientAddressCapacityException;
boolean releaseSecondaryIpFromNic(long ipAddressId);

View File

@ -18,6 +18,7 @@ package com.cloud.network;
import java.util.List;
import com.cloud.utils.Pair;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
@ -59,7 +60,9 @@ public interface PhysicalNetwork extends Identity, InternalIdentity {
Long getDomainId();
String getVnet();
List<Pair<Integer,Integer>> getVnet();
String getVnetString();
String getSpeed();

View File

@ -30,7 +30,4 @@ public interface PublicIpAddress extends ControlledEntity, IpAddress, Vlan, Inte
public String getNetmask();
public String getGateway();
@Override
public String getVlanTag();
}

View File

@ -63,5 +63,7 @@ public interface VirtualNetworkApplianceService {
VirtualRouter startRouter(long id) throws ResourceUnavailableException, InsufficientCapacityException, ConcurrentOperationException;
VirtualRouter destroyRouter(long routerId, Account caller, Long callerUserId) throws ResourceUnavailableException, ConcurrentOperationException;
VirtualRouter findRouter(long routerId);
}

View File

@ -23,7 +23,8 @@ public interface VirtualRouterProvider extends InternalIdentity, Identity {
public enum VirtualRouterProviderType {
VirtualRouter,
ElasticLoadBalancerVm,
VPCVirtualRouter
VPCVirtualRouter,
InternalLbVm
}
public VirtualRouterProviderType getType();

View File

@ -28,7 +28,11 @@ import com.cloud.utils.component.Adapter;
public interface IpDeployer extends Adapter{
/**
* Apply ip addresses to this network
* Modify ip addresses on this network
* Depending on the State of the ip addresses the element should take
* appropriate action.
* If state is Releasing the ip address should be de-allocated
* If state is Allocating or Allocated the ip address should be provisioned
* @param network
* @param ipAddress
* @return

View File

@ -25,111 +25,83 @@ import com.cloud.network.as.Condition;
import com.cloud.network.as.Counter;
import com.cloud.network.rules.FirewallRule;
import com.cloud.network.rules.LoadBalancer;
import com.cloud.network.rules.LoadBalancerContainer.Scheme;
import com.cloud.utils.Pair;
import com.cloud.utils.net.Ip;
public class LoadBalancingRule implements FirewallRule, LoadBalancer {
public class LoadBalancingRule {
private LoadBalancer lb;
private Ip sourceIp;
private List<LbDestination> destinations;
private List<LbStickinessPolicy> stickinessPolicies;
private LbAutoScaleVmGroup autoScaleVmGroup;
private List<LbHealthCheckPolicy> healthCheckPolicies;
public LoadBalancingRule(LoadBalancer lb, List<LbDestination> destinations,
List<LbStickinessPolicy> stickinessPolicies, List<LbHealthCheckPolicy> healthCheckPolicies) {
List<LbStickinessPolicy> stickinessPolicies, List<LbHealthCheckPolicy> healthCheckPolicies, Ip sourceIp) {
this.lb = lb;
this.destinations = destinations;
this.stickinessPolicies = stickinessPolicies;
this.healthCheckPolicies = healthCheckPolicies;
this.sourceIp = sourceIp;
}
@Override
public long getId() {
return lb.getId();
}
@Override
public long getAccountId() {
return lb.getAccountId();
}
@Override
public long getDomainId() {
return lb.getDomainId();
}
@Override
public String getName() {
return lb.getName();
}
@Override
public String getDescription() {
return lb.getDescription();
}
@Override
public int getDefaultPortStart() {
return lb.getDefaultPortStart();
}
@Override
public int getDefaultPortEnd() {
return lb.getDefaultPortEnd();
}
@Override
public String getAlgorithm() {
return lb.getAlgorithm();
}
@Override
public String getUuid() {
return lb.getUuid();
}
@Override
public String getXid() {
return lb.getXid();
}
@Override
public Long getSourceIpAddressId() {
return lb.getSourceIpAddressId();
}
@Override
public Integer getSourcePortStart() {
return lb.getSourcePortStart();
}
@Override
public Integer getSourcePortEnd() {
return lb.getSourcePortEnd();
}
@Override
public String getProtocol() {
return lb.getProtocol();
}
@Override
public Purpose getPurpose() {
return Purpose.LoadBalancing;
public FirewallRule.Purpose getPurpose() {
return FirewallRule.Purpose.LoadBalancing;
}
@Override
public State getState() {
public FirewallRule.State getState() {
return lb.getState();
}
@Override
public long getNetworkId() {
return lb.getNetworkId();
}
public LoadBalancer getLb() {
return lb;
}
public void setDestinations(List<LbDestination> destinations) {
this.destinations = destinations;
@ -287,36 +259,6 @@ public class LoadBalancingRule implements FirewallRule, LoadBalancer {
}
}
@Override
public Integer getIcmpCode() {
return null;
}
@Override
public Integer getIcmpType() {
return null;
}
@Override
public List<String> getSourceCidrList() {
return null;
}
@Override
public Long getRelated() {
return null;
}
@Override
public TrafficType getTrafficType() {
return null;
}
@Override
public FirewallRuleType getType() {
return FirewallRuleType.User;
}
public LbAutoScaleVmGroup getAutoScaleVmGroup() {
return autoScaleVmGroup;
}
@ -473,4 +415,11 @@ public class LoadBalancingRule implements FirewallRule, LoadBalancer {
}
}
public Ip getSourceIp() {
return sourceIp;
}
public Scheme getScheme() {
return lb.getScheme();
}
}

View File

@ -17,10 +17,10 @@
package com.cloud.network.lb;
import java.util.List;
import java.util.Map;
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLBHealthCheckPolicyCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLBStickinessPolicyCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLoadBalancerRuleCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.ListLBHealthCheckPoliciesCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.ListLBStickinessPoliciesCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.ListLoadBalancerRuleInstancesCmd;
@ -30,12 +30,13 @@ import org.apache.cloudstack.api.command.user.loadbalancer.UpdateLoadBalancerRul
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.lb.LoadBalancingRule.LbStickinessPolicy;
import com.cloud.network.rules.HealthCheckPolicy;
import com.cloud.network.rules.LoadBalancer;
import com.cloud.network.rules.LoadBalancerContainer.Scheme;
import com.cloud.network.rules.StickinessPolicy;
import com.cloud.uservm.UserVm;
import com.cloud.utils.Pair;
import com.cloud.utils.net.Ip;
public interface LoadBalancingRulesService {
@ -49,7 +50,9 @@ public interface LoadBalancingRulesService {
* @return the newly created LoadBalancerVO if successful, null otherwise
* @throws InsufficientAddressCapacityException
*/
LoadBalancer createLoadBalancerRule(CreateLoadBalancerRuleCmd lb, boolean openFirewall) throws NetworkRuleConflictException, InsufficientAddressCapacityException;
LoadBalancer createPublicLoadBalancerRule(String xId, String name, String description,
int srcPortStart, int srcPortEnd, int defPortStart, int defPortEnd, Long ipAddrId, String protocol, String algorithm,
long networkId, long lbOwnerId, boolean openFirewall) throws NetworkRuleConflictException, InsufficientAddressCapacityException;
LoadBalancer updateLoadBalancerRule(UpdateLoadBalancerRuleCmd cmd);
@ -134,8 +137,9 @@ public interface LoadBalancingRulesService {
List<? extends HealthCheckPolicy> searchForLBHealthCheckPolicies(ListLBHealthCheckPoliciesCmd cmd);
List<LoadBalancingRule> listByNetworkId(long networkId);
LoadBalancer findById(long LoadBalancer);
public void updateLBHealthChecks() throws ResourceUnavailableException;
public void updateLBHealthChecks(Scheme scheme) throws ResourceUnavailableException;
Map<Ip, UserVm> getLbInstances(long lbId);
}

View File

@ -23,7 +23,7 @@ import com.cloud.vm.VirtualMachine;
*/
public interface VirtualRouter extends VirtualMachine {
public enum Role {
VIRTUAL_ROUTER, LB
VIRTUAL_ROUTER, LB, INTERNAL_LB_VM
}
Role getRole();
boolean getIsRedundantRouter();

View File

@ -19,16 +19,10 @@ package com.cloud.network.rules;
/**
* Definition for a LoadBalancer
*/
public interface LoadBalancer extends FirewallRule {
String getName();
String getDescription();
public interface LoadBalancer extends FirewallRule, LoadBalancerContainer {
int getDefaultPortStart();
int getDefaultPortEnd();
String getAlgorithm();
}

View File

@ -14,17 +14,20 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.storage;
package com.cloud.network.rules;
public interface SecondaryStorage {
public interface LoadBalancerContainer {
String getBackupPath();
String getTemplatePath();
String getIsoPath();
public enum Scheme {
Public, Internal;
}
void createTemplate();
String getName();
String getDescription();
void destroyTemplate();
String getAlgorithm();
Scheme getScheme();
}

View File

@ -67,7 +67,7 @@ public interface RulesService {
boolean applyPortForwardingRules(long ipAdddressId, Account caller) throws ResourceUnavailableException;
boolean enableStaticNat(long ipAddressId, long vmId, long networkId, boolean isSystemVm, String vmGuestIp) throws NetworkRuleConflictException, ResourceUnavailableException;
boolean enableStaticNat(long ipAddressId, long vmId, long networkId, String vmGuestIp) throws NetworkRuleConflictException, ResourceUnavailableException;
PortForwardingRule getPortForwardigRule(long ruleId);

View File

@ -31,6 +31,8 @@ public interface SecurityGroupRules extends InternalIdentity {
Long getRuleId();
String getRuleUuid();
int getStartPort();
int getEndPort();

View File

@ -44,5 +44,6 @@ public interface PrivateIp {
String getMacAddress();
long getNetworkId();
boolean getSourceNat();
}

View File

@ -77,4 +77,8 @@ public interface VpcGateway extends Identity, ControlledEntity, InternalIdentity
* @return
*/
State getState();
/**
* @return
*/
boolean getSourceNat();
}

View File

@ -26,6 +26,7 @@ public interface VpcOffering extends InternalIdentity, Identity {
}
public static final String defaultVPCOfferingName = "Default VPC offering";
public static final String defaultVPCNSOfferingName = "Default VPC offering with Netscaler";
/**
*

View File

@ -163,6 +163,7 @@ public interface VpcService {
/**
* Persists VPC private gateway in the Database.
*
*
* @param vpcId TODO
* @param physicalNetworkId
* @param vlan
@ -170,13 +171,14 @@ public interface VpcService {
* @param gateway
* @param netmask
* @param gatewayOwnerId
* @param isSourceNat
* @return
* @throws InsufficientCapacityException
* @throws ConcurrentOperationException
* @throws ResourceAllocationException
*/
public PrivateGateway createVpcPrivateGateway(long vpcId, Long physicalNetworkId, String vlan, String ipAddress,
String gateway, String netmask, long gatewayOwnerId) throws ResourceAllocationException,
String gateway, String netmask, long gatewayOwnerId, Boolean isSourceNat) throws ResourceAllocationException,
ConcurrentOperationException, InsufficientCapacityException;
/**

View File

@ -16,6 +16,8 @@
// under the License.
package com.cloud.offering;
import java.util.Map;
import org.apache.cloudstack.acl.InfrastructureEntity;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
@ -38,6 +40,11 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
Disabled,
Enabled
}
public enum Detail {
InternalLbProvider,
PublicLbProvider
}
public final static String SystemPublicNetwork = "System-Public-Network";
public final static String SystemControlNetwork = "System-Control-Network";
@ -46,6 +53,7 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
public final static String SystemPrivateGatewayNetworkOffering = "System-Private-Gateway-Network-Offering";
public final static String DefaultSharedNetworkOfferingWithSGService = "DefaultSharedNetworkOfferingWithSGService";
public final static String QuickCloudNoServices = "QuickCloudNoServices";
public final static String DefaultIsolatedNetworkOfferingWithSourceNatService = "DefaultIsolatedNetworkOfferingWithSourceNatService";
public final static String OvsIsolatedNetworkOfferingWithSourceNatService = "OvsIsolatedNetworkOfferingWithSourceNatService";
public final static String DefaultSharedNetworkOffering = "DefaultSharedNetworkOffering";
@ -106,6 +114,8 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
boolean getElasticIp();
boolean getAssociatePublicIP();
boolean getElasticLb();
boolean getSpecifyIpRanges();
@ -113,5 +123,9 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
boolean isInline();
boolean getIsPersistent();
boolean getInternalLb();
boolean getPublicLb();
}

View File

@ -30,6 +30,7 @@ public interface ServiceOffering extends InfrastructureEntity, InternalIdentity,
public static final String ssvmDefaultOffUniqueName = "Cloud.com-SecondaryStorage";
public static final String routerDefaultOffUniqueName = "Cloud.Com-SoftwareRouter";
public static final String elbVmDefaultOffUniqueName = "Cloud.Com-ElasticLBVm";
public static final String internalLbVmDefaultOffUniqueName = "Cloud.Com-InternalLBVm";
public enum StorageType {
local,

View File

@ -17,6 +17,7 @@
package com.cloud.region.ha;
import com.cloud.network.rules.LoadBalancer;
import org.apache.cloudstack.api.command.user.region.ha.gslb.*;
import java.util.List;
@ -44,4 +45,6 @@ public interface GlobalLoadBalancingRulesService {
List<GlobalLoadBalancerRule> listGlobalLoadBalancerRule(ListGlobalLoadBalancerRuleCmd listGslbCmd);
List<LoadBalancer> listSiteLoadBalancers(long gslbRuleId);
}

View File

@ -75,9 +75,11 @@ import com.cloud.network.IpAddress;
import com.cloud.org.Cluster;
import com.cloud.storage.GuestOS;
import com.cloud.storage.GuestOsCategory;
import com.cloud.storage.StoragePool;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.SSHKeyPair;
import com.cloud.utils.Pair;
import com.cloud.utils.Ternary;
import com.cloud.vm.InstanceGroup;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachine.Type;
@ -123,7 +125,7 @@ public interface ManagementService {
/**
* Searches for servers by the specified search criteria Can search by: "name", "type", "state", "dataCenterId",
* "podId"
*
*
* @param cmd
* @return List of Hosts
*/
@ -388,10 +390,21 @@ public interface ManagementService {
* @param Long
* vmId
* Id of The VM to migrate
* @return Pair<List<? extends Host>, List<? extends Host>> List of all Hosts in VM's cluster and list of Hosts with
* enough capacity
* @return Ternary<List<? extends Host>, List<? extends Host>, Map<Host, Boolean>> List of all Hosts to which a VM
* can be migrated, list of Hosts with enough capacity and hosts requiring storage motion for migration.
*/
Pair<Pair<List<? extends Host>, Integer>, List<? extends Host>> listHostsForMigrationOfVM(Long vmId, Long startIndex, Long pageSize);
Ternary<Pair<List<? extends Host>, Integer>, List<? extends Host>, Map<Host, Boolean>> listHostsForMigrationOfVM(
Long vmId, Long startIndex, Long pageSize);
/**
* List storage pools for live migrating of a volume. The API returns list of all pools in the cluster to which the
* volume can be migrated. Current pool is not included in the list.
*
* @param Long volumeId
* @return Pair<List<? extends StoragePool>, List<? extends StoragePool>> List of storage pools in cluster and list
* of pools with enough capacity.
*/
Pair<List<? extends StoragePool>, List<? extends StoragePool>> listStoragePoolsForMigrationOfVolume(Long volumeId);
String[] listEventTypes();

View File

@ -19,8 +19,6 @@ package com.cloud.storage;
import java.net.URI;
import java.util.Map;
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
import com.cloud.exception.DiscoveryException;
import com.cloud.utils.component.Adapter;
@ -29,7 +27,7 @@ import com.cloud.utils.component.Adapter;
*/
public interface StoragePoolDiscoverer extends Adapter {
Map<StoragePoolVO, Map<String, String>> find(long dcId, Long podId, URI uri, Map<String, String> details) throws DiscoveryException;
Map<StoragePoolVO, Map<String, String>> find(long dcId, Long podId, URI uri, Map<String, String> details, String username, String password) throws DiscoveryException;
Map<? extends StoragePool, Map<String, String>> find(long dcId, Long podId, URI uri, Map<String, String> details) throws DiscoveryException;
Map<? extends StoragePool, Map<String, String>> find(long dcId, Long podId, URI uri, Map<String, String> details, String username, String password) throws DiscoveryException;
}

View File

@ -16,12 +16,12 @@
// under the License.
package com.cloud.storage.snapshot;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
import java.util.Date;
public interface SnapshotSchedule {
long getId();
String getUuid();
public interface SnapshotSchedule extends InternalIdentity, Identity {
Long getVolumeId();
@ -38,10 +38,9 @@ public interface SnapshotSchedule {
Long getAsyncJobId();
void setAsyncJobId(long asyncJobId);
void setAsyncJobId(Long asyncJobId);
Long getSnapshotId();
void setSnapshotId(Long snapshotId);
}

View File

@ -22,6 +22,7 @@ import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
public interface Account extends ControlledEntity, InternalIdentity, Identity {
public enum Type {
Normal,
@ -64,4 +65,7 @@ public interface Account extends ControlledEntity, InternalIdentity, Identity {
public Long getDefaultZoneId();
public String getUuid();
boolean isDefault();
}

View File

@ -72,5 +72,7 @@ public interface User extends OwnedBy, InternalIdentity {
String getRegistrationToken();
boolean isRegistered();
boolean isDefault();
}

View File

@ -139,7 +139,7 @@ public class DiskProfile {
this.hyperType = hyperType;
}
public HypervisorType getHypersorType() {
public HypervisorType getHypervisorType() {
return this.hyperType;
}

View File

@ -21,14 +21,24 @@ import java.util.Map;
import javax.naming.InsufficientResourcesException;
import org.apache.cloudstack.api.BaseCmd.HTTPMethod;
import org.apache.cloudstack.api.command.admin.vm.AssignVMCmd;
import org.apache.cloudstack.api.command.admin.vm.RecoverVMCmd;
import org.apache.cloudstack.api.command.user.vm.*;
import org.apache.cloudstack.api.command.user.vm.AddNicToVMCmd;
import org.apache.cloudstack.api.command.user.vm.DeployVMCmd;
import org.apache.cloudstack.api.command.user.vm.DestroyVMCmd;
import org.apache.cloudstack.api.command.user.vm.RebootVMCmd;
import org.apache.cloudstack.api.command.user.vm.RemoveNicFromVMCmd;
import org.apache.cloudstack.api.command.user.vm.ResetVMPasswordCmd;
import org.apache.cloudstack.api.command.user.vm.ResetVMSSHKeyCmd;
import org.apache.cloudstack.api.command.user.vm.RestoreVMCmd;
import org.apache.cloudstack.api.command.user.vm.ScaleVMCmd;
import org.apache.cloudstack.api.command.user.vm.StartVMCmd;
import org.apache.cloudstack.api.command.user.vm.UpdateDefaultNicForVMCmd;
import org.apache.cloudstack.api.command.user.vm.UpdateVMCmd;
import org.apache.cloudstack.api.command.user.vm.UpgradeVMCmd;
import org.apache.cloudstack.api.command.user.vmgroup.CreateVMGroupCmd;
import org.apache.cloudstack.api.command.user.vmgroup.DeleteVMGroupCmd;
import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd;
import org.apache.cloudstack.api.command.user.volume.DetachVolumeCmd;
import com.cloud.dc.DataCenter;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
@ -42,7 +52,6 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.network.Network.IpAddresses;
import com.cloud.offering.ServiceOffering;
import com.cloud.storage.StoragePool;
import com.cloud.storage.Volume;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;
import com.cloud.uservm.UserVm;
@ -104,14 +113,14 @@ public interface UserVmService {
* @return the vm object if successful, null otherwise
*/
UserVm addNicToVirtualMachine(AddNicToVMCmd cmd);
/**
* Removes a NIC on the given network from the virtual machine
* @param cmd the command object that defines the vm and the given network
* @return the vm object if successful, null otherwise
*/
UserVm removeNicFromVirtualMachine(RemoveNicFromVMCmd cmd);
/**
* Updates default Nic to the given network for given virtual machine
* @param cmd the command object that defines the vm and the given network
@ -123,7 +132,8 @@ public interface UserVmService {
/**
* Creates a Basic Zone User VM in the database and returns the VM to the caller.
* Creates a Basic Zone User VM in the database and returns the VM to the
* caller.
*
* @param zone
* - availability zone for the virtual machine
@ -132,61 +142,69 @@ public interface UserVmService {
* @param template
* - the template for the virtual machine
* @param securityGroupIdList
* - comma separated list of security groups id that going to be applied to the virtual machine
* - comma separated list of security groups id that going to be
* applied to the virtual machine
* @param hostName
* - host name for the virtual machine
* @param displayName
* - an optional user generated name for the virtual machine
* @param diskOfferingId
* - the ID of the disk offering for the virtual machine. If the template is of ISO format, the
* diskOfferingId is
* for the root disk volume. Otherwise this parameter is used to indicate the offering for the data disk
* volume.
* If the templateId parameter passed is from a Template object, the diskOfferingId refers to a DATA Disk
* Volume
* created. If the templateId parameter passed is from an ISO object, the diskOfferingId refers to a ROOT
* Disk
* Volume created
* - the ID of the disk offering for the virtual machine. If the
* template is of ISO format, the diskOfferingId is for the root
* disk volume. Otherwise this parameter is used to indicate the
* offering for the data disk volume. If the templateId parameter
* passed is from a Template object, the diskOfferingId refers to
* a DATA Disk Volume created. If the templateId parameter passed
* is from an ISO object, the diskOfferingId refers to a ROOT
* Disk Volume created
* @param diskSize
* - the arbitrary size for the DATADISK volume. Mutually exclusive with diskOfferingId
* - the arbitrary size for the DATADISK volume. Mutually
* exclusive with diskOfferingId
* @param group
* - an optional group for the virtual machine
* @param hypervisor
* - the hypervisor on which to deploy the virtual machine
* @param userData
* - an optional binary data that can be sent to the virtual machine upon a successful deployment. This
* binary
* data must be base64 encoded before adding it to the request. Currently only HTTP GET is supported.
* Using HTTP
* GET (via querystring), you can send up to 2KB of data after base64 encoding
* - an optional binary data that can be sent to the virtual
* machine upon a successful deployment. This binary data must be
* base64 encoded before adding it to the request. Currently only
* HTTP GET is supported. Using HTTP GET (via querystring), you
* can send up to 2KB of data after base64 encoding
* @param sshKeyPair
* - name of the ssh key pair used to login to the virtual machine
* - name of the ssh key pair used to login to the virtual
* machine
* @param requestedIps
* TODO
* @param defaultIp
* TODO
* @param affinityGroupIdList
* @param accountName
* - an optional account for the virtual machine. Must be used with domainId
* - an optional account for the virtual machine. Must be used
* with domainId
* @param domainId
* - an optional domainId for the virtual machine. If the account parameter is used, domainId must also
* be used
* - an optional domainId for the virtual machine. If the account
* parameter is used, domainId must also be used
* @return UserVm object if successful.
*
* @throws InsufficientCapacityException
* if there is insufficient capacity to deploy the VM.
* @throws ConcurrentOperationException
* if there are multiple users working on the same VM or in the same environment.
* if there are multiple users working on the same VM or in the
* same environment.
* @throws ResourceUnavailableException
* if the resources required to deploy the VM is not currently available.
* if the resources required to deploy the VM is not currently
* available.
* @throws InsufficientResourcesException
*/
UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> securityGroupIdList, Account owner, String hostName,
String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIp, String keyboard)
String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps,
IpAddresses defaultIp, String keyboard, List<Long> affinityGroupIdList)
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
/**
* Creates a User VM in Advanced Zone (Security Group feature is enabled) in the database and returns the VM to the
* caller.
* Creates a User VM in Advanced Zone (Security Group feature is enabled) in
* the database and returns the VM to the caller.
*
* @param zone
* - availability zone for the virtual machine
@ -197,63 +215,69 @@ public interface UserVmService {
* @param networkIdList
* - list of network ids used by virtual machine
* @param securityGroupIdList
* - comma separated list of security groups id that going to be applied to the virtual machine
* - comma separated list of security groups id that going to be
* applied to the virtual machine
* @param hostName
* - host name for the virtual machine
* @param displayName
* - an optional user generated name for the virtual machine
* @param diskOfferingId
* - the ID of the disk offering for the virtual machine. If the template is of ISO format, the
* diskOfferingId is
* for the root disk volume. Otherwise this parameter is used to indicate the offering for the data disk
* volume.
* If the templateId parameter passed is from a Template object, the diskOfferingId refers to a DATA Disk
* Volume
* created. If the templateId parameter passed is from an ISO object, the diskOfferingId refers to a ROOT
* Disk
* Volume created
* - the ID of the disk offering for the virtual machine. If the
* template is of ISO format, the diskOfferingId is for the root
* disk volume. Otherwise this parameter is used to indicate the
* offering for the data disk volume. If the templateId parameter
* passed is from a Template object, the diskOfferingId refers to
* a DATA Disk Volume created. If the templateId parameter passed
* is from an ISO object, the diskOfferingId refers to a ROOT
* Disk Volume created
* @param diskSize
* - the arbitrary size for the DATADISK volume. Mutually exclusive with diskOfferingId
* - the arbitrary size for the DATADISK volume. Mutually
* exclusive with diskOfferingId
* @param group
* - an optional group for the virtual machine
* @param hypervisor
* - the hypervisor on which to deploy the virtual machine
* @param userData
* - an optional binary data that can be sent to the virtual machine upon a successful deployment. This
* binary
* data must be base64 encoded before adding it to the request. Currently only HTTP GET is supported.
* Using HTTP
* GET (via querystring), you can send up to 2KB of data after base64 encoding
* - an optional binary data that can be sent to the virtual
* machine upon a successful deployment. This binary data must be
* base64 encoded before adding it to the request. Currently only
* HTTP GET is supported. Using HTTP GET (via querystring), you
* can send up to 2KB of data after base64 encoding
* @param sshKeyPair
* - name of the ssh key pair used to login to the virtual machine
* - name of the ssh key pair used to login to the virtual
* machine
* @param requestedIps
* TODO
* @param defaultIps
* TODO
* @param affinityGroupIdList
* @param accountName
* - an optional account for the virtual machine. Must be used with domainId
* - an optional account for the virtual machine. Must be used
* with domainId
* @param domainId
* - an optional domainId for the virtual machine. If the account parameter is used, domainId must also
* be used
* - an optional domainId for the virtual machine. If the account
* parameter is used, domainId must also be used
* @return UserVm object if successful.
*
* @throws InsufficientCapacityException
* if there is insufficient capacity to deploy the VM.
* @throws ConcurrentOperationException
* if there are multiple users working on the same VM or in the same environment.
* if there are multiple users working on the same VM or in the
* same environment.
* @throws ResourceUnavailableException
* if the resources required to deploy the VM is not currently available.
* if the resources required to deploy the VM is not currently
* available.
* @throws InsufficientResourcesException
*/
UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList, List<Long> securityGroupIdList,
Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps,
IpAddresses defaultIps, String keyboard)
Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData, String sshKeyPair,
Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, String keyboard, List<Long> affinityGroupIdList)
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
/**
* Creates a User VM in Advanced Zone (Security Group feature is disabled) in the database and returns the VM to the
* caller.
*
* Creates a User VM in Advanced Zone (Security Group feature is disabled)
* in the database and returns the VM to the caller.
*
* @param zone
* - availability zone for the virtual machine
* @param serviceOffering
@ -267,49 +291,57 @@ public interface UserVmService {
* @param displayName
* - an optional user generated name for the virtual machine
* @param diskOfferingId
* - the ID of the disk offering for the virtual machine. If the template is of ISO format, the
* diskOfferingId is
* for the root disk volume. Otherwise this parameter is used to indicate the offering for the data disk
* volume.
* If the templateId parameter passed is from a Template object, the diskOfferingId refers to a DATA Disk
* Volume
* created. If the templateId parameter passed is from an ISO object, the diskOfferingId refers to a ROOT
* Disk
* Volume created
* - the ID of the disk offering for the virtual machine. If the
* template is of ISO format, the diskOfferingId is for the root
* disk volume. Otherwise this parameter is used to indicate the
* offering for the data disk volume. If the templateId parameter
* passed is from a Template object, the diskOfferingId refers to
* a DATA Disk Volume created. If the templateId parameter passed
* is from an ISO object, the diskOfferingId refers to a ROOT
* Disk Volume created
* @param diskSize
* - the arbitrary size for the DATADISK volume. Mutually exclusive with diskOfferingId
* - the arbitrary size for the DATADISK volume. Mutually
* exclusive with diskOfferingId
* @param group
* - an optional group for the virtual machine
* @param hypervisor
* - the hypervisor on which to deploy the virtual machine
* @param userData
* - an optional binary data that can be sent to the virtual machine upon a successful deployment. This
* binary
* data must be base64 encoded before adding it to the request. Currently only HTTP GET is supported.
* Using HTTP
* GET (via querystring), you can send up to 2KB of data after base64 encoding
* - an optional binary data that can be sent to the virtual
* machine upon a successful deployment. This binary data must be
* base64 encoded before adding it to the request. Currently only
* HTTP GET is supported. Using HTTP GET (via querystring), you
* can send up to 2KB of data after base64 encoding
* @param sshKeyPair
* - name of the ssh key pair used to login to the virtual machine
* - name of the ssh key pair used to login to the virtual
* machine
* @param requestedIps
* TODO
* @param defaultIps TODO
* @param defaultIps
* TODO
* @param affinityGroupIdList
* @param accountName
* - an optional account for the virtual machine. Must be used with domainId
* - an optional account for the virtual machine. Must be used
* with domainId
* @param domainId
* - an optional domainId for the virtual machine. If the account parameter is used, domainId must also
* be used
* - an optional domainId for the virtual machine. If the account
* parameter is used, domainId must also be used
* @return UserVm object if successful.
*
*
* @throws InsufficientCapacityException
* if there is insufficient capacity to deploy the VM.
* @throws ConcurrentOperationException
* if there are multiple users working on the same VM or in the same environment.
* if there are multiple users working on the same VM or in the
* same environment.
* @throws ResourceUnavailableException
* if the resources required to deploy the VM is not currently available.
* if the resources required to deploy the VM is not currently
* available.
* @throws InsufficientResourcesException
*/
UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList, Account owner, String hostName,
String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, String keyboard)
String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps,
IpAddresses defaultIps, String keyboard, List<Long> affinityGroupIdList)
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
/**
@ -386,12 +418,39 @@ public interface UserVmService {
*/
VirtualMachine migrateVirtualMachine(Long vmId, Host destinationHost) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException;
/**
* Migrate the given VM with its volumes to the destination host. The API returns the migrated VM if it succeeds.
* Only root admin can migrate a VM.
*
* @param destinationStorage
* TODO
* @param Long
* vmId of The VM to migrate
* @param Host
* destinationHost to migrate the VM
* @param Map
* A map of volume to which pool it should be migrated
*
* @return VirtualMachine migrated VM
* @throws ManagementServerException
* in case we get error finding the VM or host or access errors or other internal errors.
* @throws ConcurrentOperationException
* if there are multiple users working on the same VM.
* @throws ResourceUnavailableException
* if the destination host to migrate the VM is not currently available.
* @throws VirtualMachineMigrationException
* if the VM to be migrated is not in Running state
*/
VirtualMachine migrateVirtualMachineWithVolume(Long vmId, Host destinationHost, Map<String, String> volumeToPool)
throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException,
VirtualMachineMigrationException;
UserVm moveVMToUser(AssignVMCmd moveUserVMCmd) throws ResourceAllocationException, ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
VirtualMachine vmStorageMigration(Long vmId, StoragePool destPool);
UserVm restoreVM(RestoreVMCmd cmd);
UserVm restoreVM(RestoreVMCmd cmd) throws InsufficientCapacityException, ResourceUnavailableException;
UserVm upgradeVirtualMachine(ScaleVMCmd scaleVMCmd) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException;
boolean upgradeVirtualMachine(ScaleVMCmd scaleVMCmd) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException;
}

View File

@ -187,6 +187,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
SecondaryStorageVm,
ElasticIpVm,
ElasticLoadBalancerVm,
InternalLoadBalancerVm,
/*
* UserBareMetal is only used for selecting VirtualMachineGuru, there is no
@ -197,7 +198,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
public static boolean isSystemVM(VirtualMachine.Type vmtype) {
if (DomainRouter.equals(vmtype)
|| ConsoleProxy.equals(vmtype)
|| SecondaryStorageVm.equals(vmtype)) {
|| SecondaryStorageVm.equals(vmtype) || InternalLoadBalancerVm.equals(vmtype)) {
return true;
}
return false;

View File

@ -20,4 +20,5 @@ public interface VmDetailConstants {
public static final String KEYBOARD = "keyboard";
public static final String NIC_ADAPTER = "nicAdapter";
public static final String ROOK_DISK_CONTROLLER = "rootDiskController";
public static final String NESTED_VIRTUALIZATION_FLAG = "nestedVirtualizationFlag";
}

View File

@ -0,0 +1,31 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.affinity;
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
public interface AffinityGroup extends ControlledEntity, InternalIdentity, Identity {
String getName();
String getDescription();
String getType();
}

View File

@ -0,0 +1,49 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.affinity;
import com.cloud.deploy.DeploymentPlan;
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
import com.cloud.exception.AffinityConflictException;
import com.cloud.utils.component.Adapter;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
public interface AffinityGroupProcessor extends Adapter {
/**
* process() is called to apply any user preferences to the deployment plan
* and avoid set for the given VM placement.
*
* @param vm
* virtual machine.
* @param plan
* deployment plan that tells you where it's being deployed to.
* @param avoid
* avoid these data centers, pods, clusters, or hosts.
*/
void process(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid)
throws AffinityConflictException;
/**
* getType() should return the affinity/anti-affinity group being
* implemented
*
* @return String Affinity/Anti-affinity type
*/
String getType();
}

View File

@ -0,0 +1,158 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.affinity;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse;
import org.apache.cloudstack.api.EntityReference;
import org.apache.cloudstack.api.response.ControlledEntityResponse;
import org.apache.cloudstack.api.response.ControlledViewEntityResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import com.cloud.network.security.SecurityGroup;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused")
@EntityReference(value = AffinityGroup.class)
public class AffinityGroupResponse extends BaseResponse implements ControlledViewEntityResponse {
@SerializedName(ApiConstants.ID) @Param(description="the ID of the affinity group")
private String id;
@SerializedName(ApiConstants.NAME) @Param(description="the name of the affinity group")
private String name;
@SerializedName(ApiConstants.DESCRIPTION) @Param(description="the description of the affinity group")
private String description;
@SerializedName(ApiConstants.ACCOUNT) @Param(description="the account owning the affinity group")
private String accountName;
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain ID of the affinity group")
private String domainId;
@SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the affinity group")
private String domainName;
@SerializedName(ApiConstants.TYPE)
@Param(description = "the type of the affinity group")
private String type;
@SerializedName("virtualmachineIds")
@Param(description = "virtual machine Ids associated with this affinity group ")
private List<String> vmIdList;
public AffinityGroupResponse() {
}
@Override
public String getObjectId() {
return this.getId();
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
public void setDescription(String description) {
this.description = description;
}
public void setAccountName(String accountName) {
this.accountName = accountName;
}
public void setType(String type) {
this.type = type;
}
@Override
public void setDomainId(String domainId) {
this.domainId = domainId;
}
public void setDomainName(String domainName) {
this.domainName = domainName;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
AffinityGroupResponse other = (AffinityGroupResponse) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
@Override
public void setProjectId(String projectId) {
// TODO Auto-generated method stub
}
@Override
public void setProjectName(String projectName) {
// TODO Auto-generated method stub
}
public void setVMIdList(List<String> vmIdList) {
this.vmIdList = vmIdList;
}
public void addVMId(String vmId) {
if (this.vmIdList == null) {
this.vmIdList = new ArrayList<String>();
}
this.vmIdList.add(vmId);
}
}

View File

@ -0,0 +1,79 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.affinity;
import java.util.List;
import com.cloud.exception.ResourceInUseException;
import com.cloud.uservm.UserVm;
import com.cloud.utils.Pair;
public interface AffinityGroupService {
/**
* Creates an affinity/anti-affinity group for the given account/domain.
*
* @param account
* @param domainId
* @param name
* @param type
* @param description
* @return AffinityGroup
*/
AffinityGroup createAffinityGroup(String account, Long domainId, String affinityGroupName,
String affinityGroupType, String description);
/**
* Creates an affinity/anti-affinity group.
*
* @param affinityGroupId
* @param account
* @param domainId
* @param affinityGroupName
* @throws ResourceInUseException
*/
boolean deleteAffinityGroup(Long affinityGroupId, String account, Long domainId, String affinityGroupName)
throws ResourceInUseException;
/** Lists Affinity Groups in your account
* @param account
* @param domainId
* @param affinityGroupId
* @param affinityGroupName
* @param affinityGroupType
* @param vmId
* @param startIndex
* @param pageSize
* @return
*/
Pair<List<? extends AffinityGroup>, Integer> listAffinityGroups(Long affinityGroupId, String affinityGroupName,
String affinityGroupType, Long vmId, Long startIndex, Long pageSize);
/**
* List group types available in deployment
*
* @return
*/
List<String> listAffinityGroupTypes();
AffinityGroup getAffinityGroup(Long groupId);
UserVm updateVMAffinityGroups(Long vmId, List<Long> affinityGroupIds);
}

View File

@ -0,0 +1,48 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.affinity;
import java.util.HashSet;
import java.util.Set;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse;
import org.apache.cloudstack.api.EntityReference;
import org.apache.cloudstack.api.response.ControlledEntityResponse;
import org.apache.cloudstack.api.response.ControlledViewEntityResponse;
import com.cloud.network.security.SecurityGroup;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused")
@EntityReference(value = AffinityGroup.class)
public class AffinityGroupTypeResponse extends BaseResponse {
@SerializedName(ApiConstants.TYPE)
@Param(description = "the type of the affinity group")
private String type;
public AffinityGroupTypeResponse() {
}
public void setType(String type) {
this.type = type;
}
}

View File

@ -0,0 +1,44 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.affinity;
import com.cloud.deploy.DeploymentPlan;
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
import com.cloud.exception.AffinityConflictException;
import com.cloud.utils.component.AdapterBase;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
public class AffinityProcessorBase extends AdapterBase implements AffinityGroupProcessor {
protected String _type;
@Override
public void process(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid)
throws AffinityConflictException {
}
@Override
public String getType() {
return _type;
}
public void setType(String type) {
_type = type;
}
}

View File

@ -44,5 +44,9 @@ public enum ApiCommandJobType {
AutoScalePolicy,
AutoScaleVmProfile,
AutoScaleVmGroup,
GlobalLoadBalancerRule
GlobalLoadBalancerRule,
LoadBalancerRule,
AffinityGroup,
InternalLbVm,
DedicatedGuestVlanRange
}

View File

@ -85,6 +85,7 @@ public class ApiConstants {
public static final String GSLB_SERVICE_TYPE = "gslbservicetype";
public static final String GSLB_STICKY_SESSION_METHOD = "gslbstickysessionmethodname";
public static final String GUEST_CIDR_ADDRESS = "guestcidraddress";
public static final String GUEST_VLAN_RANGE = "guestvlanrange";
public static final String HA_ENABLE = "haenable";
public static final String HOST_ID = "hostid";
public static final String HOST_NAME = "hostname";
@ -221,6 +222,8 @@ public class ApiConstants {
public static final String VIRTUAL_MACHINE_ID = "virtualmachineid";
public static final String VIRTUAL_MACHINE_IDS = "virtualmachineids";
public static final String VLAN = "vlan";
public static final String VLAN_RANGE = "vlanrange";
public static final String REMOVE_VLAN="removevlan";
public static final String VLAN_ID = "vlanid";
public static final String VM_AVAILABLE = "vmavailable";
public static final String VM_LIMIT = "vmlimit";
@ -230,6 +233,7 @@ public class ApiConstants {
public static final String VOLUME_ID = "volumeid";
public static final String ZONE_ID = "zoneid";
public static final String ZONE_NAME = "zonename";
public static final String ZONE_TYPE = "zonetype";
public static final String NETWORK_TYPE = "networktype";
public static final String PAGE = "page";
public static final String PAGE_SIZE = "pagesize";
@ -333,6 +337,7 @@ public class ApiConstants {
public static final String LOAD_BALANCER_DEVICE_STATE = "lbdevicestate";
public static final String LOAD_BALANCER_DEVICE_CAPACITY = "lbdevicecapacity";
public static final String LOAD_BALANCER_DEVICE_DEDICATED = "lbdevicededicated";
public static final String LOAD_BALANCER_RULE = "loadbalancerrule";
public static final String LOAD_BALANCER_RULE_LIST = "loadbalancerrulelist";
public static final String FIREWALL_DEVICE_ID = "fwdeviceid";
public static final String FIREWALL_DEVICE_NAME = "fwdevicename";
@ -364,6 +369,8 @@ public class ApiConstants {
public static final String HA_HOST = "hahost";
public static final String CUSTOM_DISK_OFF_MAX_SIZE = "customdiskofferingmaxsize";
public static final String DEFAULT_ZONE_ID = "defaultzoneid";
public static final String LIVE_MIGRATE = "livemigrate";
public static final String MIGRATE_TO = "migrateto";
public static final String GUID = "guid";
public static final String VSWITCH_TYPE_GUEST_TRAFFIC = "guestvswitchtype";
public static final String VSWITCH_TYPE_PUBLIC_TRAFFIC = "publicvswitchtype";
@ -473,13 +480,23 @@ public class ApiConstants {
public static final String HEALTHCHECK_HEALTHY_THRESHOLD = "healthythreshold";
public static final String HEALTHCHECK_UNHEALTHY_THRESHOLD = "unhealthythreshold";
public static final String HEALTHCHECK_PINGPATH = "pingpath";
public static final String SOURCE_PORT = "sourceport";
public static final String INSTANCE_PORT = "instanceport";
public static final String SOURCE_IP = "sourceipaddress";
public static final String SOURCE_IP_NETWORK_ID = "sourceipaddressnetworkid";
public static final String SCHEME = "scheme";
public static final String PROVIDER_TYPE = "providertype";
public static final String AFFINITY_GROUP_IDS = "affinitygroupids";
public static final String AFFINITY_GROUP_NAMES = "affinitygroupnames";
public static final String ASA_INSIDE_PORT_PROFILE = "insideportprofile";
public static final String AFFINITY_GROUP_ID = "affinitygroupid";
public enum HostDetails {
all, capacity, events, stats, min;
}
public enum VMDetails {
all, group, nics, stats, secgrp, tmpl, servoff, iso, volume, min;
all, group, nics, stats, secgrp, tmpl, servoff, iso, volume, min, affgrp;
}
public enum LDAPParams {

View File

@ -27,12 +27,15 @@ import java.util.regex.Pattern;
import javax.inject.Inject;
import org.apache.cloudstack.affinity.AffinityGroupService;
import org.apache.cloudstack.network.element.InternalLoadBalancerElementService;
import org.apache.cloudstack.network.lb.ApplicationLoadBalancerService;
import org.apache.cloudstack.network.lb.InternalLoadBalancerVMService;
import org.apache.cloudstack.query.QueryService;
import org.apache.cloudstack.usage.UsageService;
import org.apache.log4j.Logger;
import com.cloud.configuration.ConfigurationService;
import com.cloud.consoleproxy.ConsoleProxyService;
import com.cloud.dao.EntityManager;
import com.cloud.domain.Domain;
import com.cloud.exception.ConcurrentOperationException;
@ -42,6 +45,7 @@ import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.NetworkModel;
import com.cloud.network.NetworkService;
import com.cloud.network.NetworkUsageService;
import com.cloud.network.StorageNetworkService;
@ -95,6 +99,11 @@ public abstract class BaseCmd {
private Object _responseObject = null;
private Map<String, String> fullUrlParams;
public enum HTTPMethod {
GET, POST, PUT, DELETE
}
private HTTPMethod httpMethod;
@Parameter(name = "response", type = CommandType.STRING)
private String responseType;
@ -109,7 +118,6 @@ public abstract class BaseCmd {
@Inject public TemplateService _templateService;
@Inject public SecurityGroupService _securityGroupService;
@Inject public SnapshotService _snapshotService;
@Inject public ConsoleProxyService _consoleProxyService;
@Inject public VpcVirtualNetworkApplianceService _routerService;
@Inject public ResponseGenerator _responseGenerator;
@Inject public EntityManager _entityMgr;
@ -134,12 +142,37 @@ public abstract class BaseCmd {
@Inject public VMSnapshotService _vmSnapshotService;
@Inject public DataStoreProviderApiService dataStoreProviderApiService;
@Inject public VpcProvisioningService _vpcProvSvc;
@Inject public ApplicationLoadBalancerService _newLbSvc;
@Inject public ApplicationLoadBalancerService _appLbService;
@Inject public AffinityGroupService _affinityGroupService;
@Inject public InternalLoadBalancerElementService _internalLbElementSvc;
@Inject public InternalLoadBalancerVMService _internalLbSvc;
@Inject public NetworkModel _ntwkModel;
public abstract void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException;
public void configure() {
}
public HTTPMethod getHttpMethod() {
return httpMethod;
}
public void setHttpMethod(String method) {
if (method != null) {
if (method.equalsIgnoreCase("GET"))
httpMethod = HTTPMethod.GET;
else if (method.equalsIgnoreCase("PUT"))
httpMethod = HTTPMethod.PUT;
else if (method.equalsIgnoreCase("POST"))
httpMethod = HTTPMethod.POST;
else if (method.equalsIgnoreCase("DELETE"))
httpMethod = HTTPMethod.DELETE;
} else {
httpMethod = HTTPMethod.GET;
}
}
public String getResponseType() {
if (responseType == null) {
return RESPONSE_TYPE_XML;
@ -156,7 +189,7 @@ public abstract class BaseCmd {
/**
* For commands the API framework needs to know the owner of the object being acted upon. This method is
* used to determine that information.
*
*
* @return the id of the account that owns the object being acted upon
*/
public abstract long getEntityOwnerId();
@ -469,7 +502,7 @@ public abstract class BaseCmd {
if (!enabledOnly || account.getState() == Account.State.enabled) {
return account.getId();
} else {
throw new PermissionDeniedException("Can't add resources to the account id=" + account.getId() + " in state=" + account.getState() + " as it's no longer active");
throw new PermissionDeniedException("Can't add resources to the account id=" + account.getId() + " in state=" + account.getState() + " as it's no longer active");
}
} else {
// idList is not used anywhere, so removed it now
@ -486,7 +519,7 @@ public abstract class BaseCmd {
return project.getProjectAccountId();
} else {
PermissionDeniedException ex = new PermissionDeniedException("Can't add resources to the project with specified projectId in state=" + project.getState() + " as it's no longer active");
ex.addProxyObject(project, projectId, "projectId");
ex.addProxyObject(project, projectId, "projectId");
throw ex;
}
} else {

View File

@ -19,11 +19,15 @@ package org.apache.cloudstack.api;
import java.text.DecimalFormat;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
import org.apache.cloudstack.affinity.AffinityGroup;
import org.apache.cloudstack.affinity.AffinityGroupResponse;
import org.apache.cloudstack.api.ApiConstants.HostDetails;
import org.apache.cloudstack.api.ApiConstants.VMDetails;
import org.apache.cloudstack.api.command.user.job.QueryAsyncJobResultCmd;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.ApplicationLoadBalancerResponse;
import org.apache.cloudstack.api.response.AsyncJobResponse;
import org.apache.cloudstack.api.response.AutoScalePolicyResponse;
import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse;
@ -41,12 +45,17 @@ import org.apache.cloudstack.api.response.EventResponse;
import org.apache.cloudstack.api.response.ExtractResponse;
import org.apache.cloudstack.api.response.FirewallResponse;
import org.apache.cloudstack.api.response.FirewallRuleResponse;
import org.apache.cloudstack.api.response.GlobalLoadBalancerResponse;
import org.apache.cloudstack.api.response.GuestOSResponse;
import org.apache.cloudstack.api.response.GuestVlanRangeResponse;
import org.apache.cloudstack.api.response.HostForMigrationResponse;
import org.apache.cloudstack.api.response.HostResponse;
import org.apache.cloudstack.api.response.HypervisorCapabilitiesResponse;
import org.apache.cloudstack.api.response.IPAddressResponse;
import org.apache.cloudstack.api.response.InstanceGroupResponse;
import org.apache.cloudstack.api.response.InternalLoadBalancerElementResponse;
import org.apache.cloudstack.api.response.IpForwardingRuleResponse;
import org.apache.cloudstack.api.response.IsolationMethodResponse;
import org.apache.cloudstack.api.response.LBHealthCheckResponse;
import org.apache.cloudstack.api.response.LBStickinessResponse;
import org.apache.cloudstack.api.response.LDAPConfigResponse;
@ -80,6 +89,7 @@ import org.apache.cloudstack.api.response.SnapshotResponse;
import org.apache.cloudstack.api.response.SnapshotScheduleResponse;
import org.apache.cloudstack.api.response.StaticRouteResponse;
import org.apache.cloudstack.api.response.StorageNetworkIpRangeResponse;
import org.apache.cloudstack.api.response.StoragePoolForMigrationResponse;
import org.apache.cloudstack.api.response.StoragePoolResponse;
import org.apache.cloudstack.api.response.SwiftResponse;
import org.apache.cloudstack.api.response.SystemVmInstanceResponse;
@ -99,6 +109,7 @@ import org.apache.cloudstack.api.response.VpcOfferingResponse;
import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.cloudstack.api.response.VpnUsersResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
import org.apache.cloudstack.region.Region;
import org.apache.cloudstack.usage.Usage;
@ -115,9 +126,25 @@ import com.cloud.domain.Domain;
import com.cloud.event.Event;
import com.cloud.host.Host;
import com.cloud.hypervisor.HypervisorCapabilities;
import com.cloud.network.*;
import com.cloud.network.GuestVlan;
import com.cloud.network.IpAddress;
import com.cloud.network.Network;
import com.cloud.network.Network.Service;
import com.cloud.network.as.*;
import com.cloud.network.Networks.IsolationType;
import com.cloud.network.PhysicalNetwork;
import com.cloud.network.PhysicalNetworkServiceProvider;
import com.cloud.network.PhysicalNetworkTrafficType;
import com.cloud.network.RemoteAccessVpn;
import com.cloud.network.Site2SiteCustomerGateway;
import com.cloud.network.Site2SiteVpnConnection;
import com.cloud.network.Site2SiteVpnGateway;
import com.cloud.network.VirtualRouterProvider;
import com.cloud.network.VpnUser;
import com.cloud.network.as.AutoScalePolicy;
import com.cloud.network.as.AutoScaleVmGroup;
import com.cloud.network.as.AutoScaleVmProfile;
import com.cloud.network.as.Condition;
import com.cloud.network.as.Counter;
import com.cloud.network.router.VirtualRouter;
import com.cloud.network.rules.FirewallRule;
import com.cloud.network.rules.HealthCheckPolicy;
@ -140,7 +167,12 @@ import com.cloud.projects.ProjectAccount;
import com.cloud.projects.ProjectInvitation;
import com.cloud.region.ha.GlobalLoadBalancerRule;
import com.cloud.server.ResourceTag;
import com.cloud.storage.*;
import com.cloud.storage.GuestOS;
import com.cloud.storage.S3;
import com.cloud.storage.Snapshot;
import com.cloud.storage.StoragePool;
import com.cloud.storage.Swift;
import com.cloud.storage.Volume;
import com.cloud.storage.snapshot.SnapshotPolicy;
import com.cloud.storage.snapshot.SnapshotSchedule;
import com.cloud.template.VirtualMachineTemplate;
@ -148,20 +180,12 @@ import com.cloud.user.Account;
import com.cloud.user.User;
import com.cloud.user.UserAccount;
import com.cloud.uservm.UserVm;
import com.cloud.utils.net.Ip;
import com.cloud.vm.InstanceGroup;
import com.cloud.vm.Nic;
import com.cloud.vm.NicSecondaryIp;
import com.cloud.vm.snapshot.VMSnapshot;
import com.cloud.vm.VirtualMachine;
import org.apache.cloudstack.api.ApiConstants.HostDetails;
import org.apache.cloudstack.api.ApiConstants.VMDetails;
import org.apache.cloudstack.api.command.user.job.QueryAsyncJobResultCmd;
import org.apache.cloudstack.api.response.*;
import org.apache.cloudstack.region.Region;
import java.text.DecimalFormat;
import java.util.EnumSet;
import java.util.List;
import com.cloud.vm.snapshot.VMSnapshot;
public interface ResponseGenerator {
UserResponse createUserResponse(UserAccount user);
@ -196,10 +220,16 @@ public interface ResponseGenerator {
HostResponse createHostResponse(Host host);
HostForMigrationResponse createHostForMigrationResponse(Host host);
HostForMigrationResponse createHostForMigrationResponse(Host host, EnumSet<HostDetails> details);
VlanIpRangeResponse createVlanIpRangeResponse(Vlan vlan);
IPAddressResponse createIPAddressResponse(IpAddress ipAddress);
GuestVlanRangeResponse createDedicatedGuestVlanRangeResponse(GuestVlan result);
GlobalLoadBalancerResponse createGlobalLoadBalancerResponse(GlobalLoadBalancerRule globalLoadBalancerRule);
LoadBalancerResponse createLoadBalancerResponse(LoadBalancer loadBalancer);
@ -223,6 +253,8 @@ public interface ResponseGenerator {
StoragePoolResponse createStoragePoolResponse(StoragePool pool);
StoragePoolForMigrationResponse createStoragePoolForMigrationResponse(StoragePool pool);
ClusterResponse createClusterResponse(Cluster cluster, Boolean showCapacities);
FirewallRuleResponse createPortForwardingRuleResponse(PortForwardingRule fwRule);
@ -384,12 +416,22 @@ public interface ResponseGenerator {
GuestOSResponse createGuestOSResponse(GuestOS os);
SnapshotScheduleResponse createSnapshotScheduleResponse(SnapshotSchedule sched);
UsageRecordResponse createUsageResponse(Usage usageRecord);
TrafficMonitorResponse createTrafficMonitorResponse(Host trafficMonitor);
VMSnapshotResponse createVMSnapshotResponse(VMSnapshot vmSnapshot);
NicSecondaryIpResponse createSecondaryIPToNicResponse(String ip,
Long nicId, Long networkId);
NicSecondaryIpResponse createSecondaryIPToNicResponse(NicSecondaryIp result);
public NicResponse createNicResponse(Nic result);
ApplicationLoadBalancerResponse createLoadBalancerContainerReponse(ApplicationLoadBalancerRule lb, Map<Ip, UserVm> lbInstances);
AffinityGroupResponse createAffinityGroupResponse(AffinityGroup group);
Long getAffinityGroupId(String name, long entityOwnerId);
InternalLoadBalancerElementResponse createInternalLbElementResponse(VirtualRouterProvider result);
IsolationMethodResponse createIsolationMethodResponse(IsolationType method);
}

View File

@ -16,9 +16,9 @@
// under the License.
package org.apache.cloudstack.api.command.admin.account;
import java.util.Collection;
import java.util.Map;
import com.cloud.user.Account;
import com.cloud.user.UserAccount;
import com.cloud.user.UserContext;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
@ -27,14 +27,12 @@ import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.UserResponse;
import org.apache.log4j.Logger;
import com.cloud.user.Account;
import com.cloud.user.UserAccount;
import com.cloud.user.UserContext;
import java.util.Collection;
import java.util.Map;
@APICommand(name = "createAccount", description="Creates an account", responseObject=UserResponse.class)
@APICommand(name = "createAccount", description="Creates an account", responseObject=AccountResponse.class)
public class CreateAccountCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(CreateAccountCmd.class.getName());

View File

@ -70,6 +70,9 @@ public class ListClustersCmd extends BaseListCmd {
@Parameter(name=ApiConstants.MANAGED_STATE, type=CommandType.STRING, description="whether this cluster is managed by cloudstack")
private String managedState;
@Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
private String zoneType;
@Parameter(name=ApiConstants.SHOW_CAPACITIES, type=CommandType.BOOLEAN, description="flag to display the capacity of the clusters")
private Boolean showCapacities;
@ -114,7 +117,10 @@ public class ListClustersCmd extends BaseListCmd {
this.managedState = managedstate;
}
public String getZoneType() {
return zoneType;
}
public Boolean getShowCapacities() {
return showCapacities;
}

View File

@ -111,14 +111,14 @@ public class UpdateClusterCmd extends BaseCmd {
if(cpuovercommitratio != null){
return Float.parseFloat(cpuovercommitratio);
}
return 1.0f;
return null;
}
public Float getMemoryOvercommitRaito (){
if (memoryovercommitratio != null){
return Float.parseFloat(memoryovercommitratio);
}
return 1.0f;
return null;
}
@Override
@ -127,9 +127,16 @@ public class UpdateClusterCmd extends BaseCmd {
if (cluster == null) {
throw new InvalidParameterValueException("Unable to find the cluster by id=" + getId());
}
if (getMemoryOvercommitRaito() !=null){
if ((getMemoryOvercommitRaito().compareTo(1f) < 0)) {
throw new InvalidParameterValueException("Memory overcommit ratio should be greater than or equal to one");
}
}
if ((getMemoryOvercommitRaito().compareTo(1f) < 0) | (getCpuOvercommitRatio().compareTo(1f) < 0)) {
throw new InvalidParameterValueException("Cpu and ram overcommit ratios should be greater than one");
if (getCpuOvercommitRatio() !=null){
if (getCpuOvercommitRatio().compareTo(1f) < 0) {
throw new InvalidParameterValueException("Cpu overcommit ratio should be greater than or equal to one");
}
}
Cluster result = _resourceService.updateCluster(cluster, getClusterType(), getHypervisor(), getAllocationState(), getManagedstate(), getMemoryOvercommitRaito(), getCpuOvercommitRatio());

View File

@ -23,8 +23,7 @@ import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ConfigurationResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.*;
import org.apache.log4j.Logger;
import com.cloud.configuration.Configuration;
@ -46,6 +45,19 @@ public class ListCfgsByCmd extends BaseListCmd {
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "lists configuration by name")
private String configName;
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class, description="the ID of the Zone to update the parameter value for corresponding zone")
private Long zone_id;
@Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.UUID, entityType=ClusterResponse.class, description="the ID of the Cluster to update the parameter value for corresponding cluster")
private Long cluster_id;
@Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.UUID, entityType=StoragePoolResponse.class, description="the ID of the Storage pool to update the parameter value for corresponding storage pool")
private Long storagepool_id;
@Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.UUID, entityType=AccountResponse.class, description="the ID of the Account to update the parameter value for corresponding account")
private Long account_id;
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@ -58,6 +70,22 @@ public class ListCfgsByCmd extends BaseListCmd {
return configName;
}
public Long getZoneId() {
return zone_id;
}
public Long getClusterId() {
return cluster_id;
}
public Long getStoragepoolId() {
return storagepool_id;
}
public Long getAccountId() {
return account_id;
}
@Override
public Long getPageSizeVal() {
Long pageSizeVal = 500L;
@ -85,6 +113,18 @@ public class ListCfgsByCmd extends BaseListCmd {
for (Configuration cfg : result.first()) {
ConfigurationResponse cfgResponse = _responseGenerator.createConfigurationResponse(cfg);
cfgResponse.setObjectName("configuration");
if(getZoneId() != null) {
cfgResponse.setScope("zone");
}
if(getClusterId() != null) {
cfgResponse.setScope("cluster");
}
if(getStoragepoolId() != null) {
cfgResponse.setScope("storagepool");
}
if(getAccountId() != null) {
cfgResponse.setScope("account");
}
configResponses.add(cfgResponse);
}

View File

@ -22,7 +22,7 @@ import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.ConfigurationResponse;
import org.apache.cloudstack.api.response.*;
import org.apache.log4j.Logger;
import com.cloud.configuration.Configuration;
@ -43,6 +43,18 @@ public class UpdateCfgCmd extends BaseCmd {
@Parameter(name=ApiConstants.VALUE, type=CommandType.STRING, description="the value of the configuration", length=4095)
private String value;
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class, description="the ID of the Zone to update the parameter value for corresponding zone")
private Long zone_id;
@Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.UUID, entityType=ClusterResponse.class, description="the ID of the Cluster to update the parameter value for corresponding cluster")
private Long cluster_id;
@Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.UUID, entityType=StoragePoolResponse.class, description="the ID of the Storage pool to update the parameter value for corresponding storage pool")
private Long storagepool_id;
@Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.UUID, entityType=AccountResponse.class, description="the ID of the Account to update the parameter value for corresponding account")
private Long account_id;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -55,6 +67,22 @@ public class UpdateCfgCmd extends BaseCmd {
return value;
}
public Long getZoneId() {
return zone_id;
}
public Long getClusterId() {
return cluster_id;
}
public Long getStoragepoolId() {
return storagepool_id;
}
public Long getAccountId() {
return account_id;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@ -75,6 +103,19 @@ public class UpdateCfgCmd extends BaseCmd {
if (cfg != null) {
ConfigurationResponse response = _responseGenerator.createConfigurationResponse(cfg);
response.setResponseName(getCommandName());
if(getZoneId() != null) {
response.setScope("zone");
}
if(getClusterId() != null) {
response.setScope("cluster");
}
if(getStoragepoolId() != null) {
response.setScope("storagepool");
}
if(getAccountId() != null) {
response.setScope("account");
}
response.setValue(value);
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update config");

View File

@ -0,0 +1,107 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.command.admin.host;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.cloudstack.api.APICommand;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.HostForMigrationResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import com.cloud.host.Host;
import com.cloud.utils.Pair;
import com.cloud.utils.Ternary;
@APICommand(name = "findHostsForMigration", description="Find hosts suitable for migrating a virtual machine.",
responseObject=HostForMigrationResponse.class)
public class FindHostsForMigrationCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(FindHostsForMigrationCmd.class.getName());
private static final String s_name = "findhostsformigrationresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType = UserVmResponse.class,
required=false, description="find hosts to which this VM can be migrated and flag the hosts with enough " +
"CPU/RAM to host the VM")
private Long virtualMachineId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public Long getVirtualMachineId() {
return virtualMachineId;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public void execute() {
ListResponse<HostForMigrationResponse> response = null;
Pair<List<? extends Host>,Integer> result;
List<? extends Host> hostsWithCapacity = new ArrayList<Host>();
Map<Host, Boolean> hostsRequiringStorageMotion;
Ternary<Pair<List<? extends Host>,Integer>, List<? extends Host>, Map<Host, Boolean>> hostsForMigration =
_mgr.listHostsForMigrationOfVM(getVirtualMachineId(), this.getStartIndex(), this.getPageSizeVal());
result = hostsForMigration.first();
hostsWithCapacity = hostsForMigration.second();
hostsRequiringStorageMotion = hostsForMigration.third();
response = new ListResponse<HostForMigrationResponse>();
List<HostForMigrationResponse> hostResponses = new ArrayList<HostForMigrationResponse>();
for (Host host : result.first()) {
HostForMigrationResponse hostResponse = _responseGenerator.createHostForMigrationResponse(host);
Boolean suitableForMigration = false;
if (hostsWithCapacity.contains(host)) {
suitableForMigration = true;
}
hostResponse.setSuitableForMigration(suitableForMigration);
Boolean requiresStorageMotion = hostsRequiringStorageMotion.get(host);
if (requiresStorageMotion != null && requiresStorageMotion) {
hostResponse.setRequiresStorageMotion(true);
} else {
hostResponse.setRequiresStorageMotion(false);
}
hostResponse.setObjectName("host");
hostResponses.add(hostResponse);
}
response.setResponses(hostResponses, result.second());
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
}

View File

@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.host;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
@ -38,6 +39,7 @@ import com.cloud.async.AsyncJob;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.host.Host;
import com.cloud.utils.Pair;
import com.cloud.utils.Ternary;
@APICommand(name = "listHosts", description="Lists hosts.", responseObject=HostResponse.class)
public class ListHostsCmd extends BaseListCmd {
@ -74,6 +76,9 @@ public class ListHostsCmd extends BaseListCmd {
description="the Zone ID for the host")
private Long zoneId;
@Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
private String zoneType;
@Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType = UserVmResponse.class,
required=false, description="lists hosts in the same cluster as this VM and flag hosts with enough CPU/RAm to host this VM")
private Long virtualMachineId;
@ -123,6 +128,10 @@ public class ListHostsCmd extends BaseListCmd {
return zoneId;
}
public String getZoneType() {
return zoneType;
}
public Long getVirtualMachineId() {
return virtualMachineId;
}
@ -171,8 +180,8 @@ public class ListHostsCmd extends BaseListCmd {
} else {
Pair<List<? extends Host>,Integer> result;
List<? extends Host> hostsWithCapacity = new ArrayList<Host>();
Pair<Pair<List<? extends Host>,Integer>, List<? extends Host>> hostsForMigration = _mgr.listHostsForMigrationOfVM(getVirtualMachineId(), this.getStartIndex(), this.getPageSizeVal());
Ternary<Pair<List<? extends Host>,Integer>, List<? extends Host>, Map<Host, Boolean>> hostsForMigration =
_mgr.listHostsForMigrationOfVM(getVirtualMachineId(), this.getStartIndex(), this.getPageSizeVal());
result = hostsForMigration.first();
hostsWithCapacity = hostsForMigration.second();
@ -193,6 +202,5 @@ public class ListHostsCmd extends BaseListCmd {
}
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
}

View File

@ -0,0 +1,114 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.command.admin.internallb;
import java.util.List;
import javax.inject.Inject;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.InternalLoadBalancerElementResponse;
import org.apache.cloudstack.network.element.InternalLoadBalancerElementService;
import org.apache.log4j.Logger;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.VirtualRouterProvider;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@APICommand(name = "configureInternalLoadBalancerElement", responseObject=InternalLoadBalancerElementResponse.class,
description="Configures an Internal Load Balancer element.", since="4.2.0")
public class ConfigureInternalLoadBalancerElementCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(ConfigureInternalLoadBalancerElementCmd.class.getName());
private static final String s_name = "configureinternalloadbalancerelementresponse";
@Inject
private List<InternalLoadBalancerElementService> _service;
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = InternalLoadBalancerElementResponse.class,
required=true, description="the ID of the internal lb provider")
private Long id;
@Parameter(name=ApiConstants.ENABLED, type=CommandType.BOOLEAN, required=true, description="Enables/Disables the Internal Load Balancer element")
private Boolean enabled;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public Long getId() {
return id;
}
public Boolean getEnabled() {
return enabled;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public String getEventType() {
return EventTypes.EVENT_NETWORK_ELEMENT_CONFIGURE;
}
@Override
public String getEventDescription() {
return "configuring internal load balancer element: " + id;
}
@Override
public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException{
s_logger.debug("hello alena");
UserContext.current().setEventDetails("Internal load balancer element: " + id);
s_logger.debug("hello alena");
VirtualRouterProvider result = _service.get(0).configureInternalLoadBalancerElement(getId(), getEnabled());
s_logger.debug("hello alena");
if (result != null){
InternalLoadBalancerElementResponse routerResponse = _responseGenerator.createInternalLbElementResponse(result);
routerResponse.setResponseName(getCommandName());
this.setResponseObject(routerResponse);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to configure the internal load balancer element");
}
}
}

View File

@ -0,0 +1,116 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.command.admin.internallb;
import java.util.List;
import javax.inject.Inject;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.InternalLoadBalancerElementResponse;
import org.apache.cloudstack.api.response.ProviderResponse;
import org.apache.cloudstack.network.element.InternalLoadBalancerElementService;
import org.apache.log4j.Logger;
import com.cloud.event.EventTypes;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.network.VirtualRouterProvider;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@APICommand(name = "createInternalLoadBalancerElement", responseObject=InternalLoadBalancerElementResponse.class, description="Create an Internal Load Balancer element.",since="4.2.0")
public class CreateInternalLoadBalancerElementCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(CreateInternalLoadBalancerElementCmd.class.getName());
private static final String s_name = "createinternalloadbalancerelementresponse";
@Inject
private List<InternalLoadBalancerElementService> _service;
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.NETWORK_SERVICE_PROVIDER_ID, type=CommandType.UUID, entityType = ProviderResponse.class, required=true, description="the network service provider ID of the internal load balancer element")
private Long nspId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public void setNspId(Long nspId) {
this.nspId = nspId;
}
public Long getNspId() {
return nspId;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public void execute(){
UserContext.current().setEventDetails("Virtual router element Id: "+getEntityId());
VirtualRouterProvider result = _service.get(0).getInternalLoadBalancerElement(getEntityId());
if (result != null) {
InternalLoadBalancerElementResponse response = _responseGenerator.createInternalLbElementResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Virtual Router entity to physical network");
}
}
@Override
public void create() throws ResourceAllocationException {
VirtualRouterProvider result = _service.get(0).addInternalLoadBalancerElement(getNspId());
if (result != null) {
setEntityId(result.getId());
setEntityUuid(result.getUuid());
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Internal Load Balancer entity to physical network");
}
}
@Override
public String getEventType() {
return EventTypes.EVENT_SERVICE_PROVIDER_CREATE;
}
@Override
public String getEventDescription() {
return "Adding physical network element Internal Load Balancer: " + getEntityId();
}
}

View File

@ -0,0 +1,152 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.command.admin.internallb;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.DomainRouterResponse;
import org.apache.cloudstack.api.response.HostResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.api.response.PodResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import com.cloud.network.router.VirtualRouter.Role;
@APICommand(name = "listInternalLoadBalancerVMs", description="List internal LB VMs.", responseObject=DomainRouterResponse.class)
public class ListInternalLBVMsCmd extends BaseListProjectAndAccountResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListInternalLBVMsCmd.class.getName());
private static final String s_name = "listinternallbvmssresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.HOST_ID, type=CommandType.UUID, entityType=HostResponse.class,
description="the host ID of the Internal LB VM")
private Long hostId;
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserVmResponse.class,
description="the ID of the Internal LB VM")
private Long id;
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the Internal LB VM")
private String routerName;
@Parameter(name=ApiConstants.POD_ID, type=CommandType.UUID, entityType=PodResponse.class,
description="the Pod ID of the Internal LB VM")
private Long podId;
@Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="the state of the Internal LB VM")
private String state;
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class,
description="the Zone ID of the Internal LB VM")
private Long zoneId;
@Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType=NetworkResponse.class,
description="list by network id")
private Long networkId;
@Parameter(name=ApiConstants.VPC_ID, type=CommandType.UUID, entityType=VpcResponse.class,
description="List Internal LB VMs by VPC")
private Long vpcId;
@Parameter(name=ApiConstants.FOR_VPC, type=CommandType.BOOLEAN, description="if true is passed for this parameter, list only VPC Internal LB VMs")
private Boolean forVpc;
@Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
private String zoneType;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public Long getHostId() {
return hostId;
}
public Long getId() {
return id;
}
public String getRouterName() {
return routerName;
}
public Long getPodId() {
return podId;
}
public String getState() {
return state;
}
public Long getZoneId() {
return zoneId;
}
public Long getNetworkId() {
return networkId;
}
public Long getVpcId() {
return vpcId;
}
public Boolean getForVpc() {
return forVpc;
}
public String getRole() {
return Role.INTERNAL_LB_VM.toString();
}
public String getZoneType() {
return zoneType;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public ApiCommandJobType getInstanceType() {
return ApiCommandJobType.DomainRouter;
}
@Override
public void execute(){
ListResponse<DomainRouterResponse> response = _queryService.searchForInternalLbVms(this);
response.setResponseName(getCommandName());
setResponseObject(response);
}
}

View File

@ -0,0 +1,99 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.command.admin.internallb;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.InternalLoadBalancerElementResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.ProviderResponse;
import org.apache.cloudstack.network.element.InternalLoadBalancerElementService;
import org.apache.log4j.Logger;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.VirtualRouterProvider;
@APICommand(name = "listInternalLoadBalancerElements", description="Lists all available Internal Load Balancer elements.",
responseObject=InternalLoadBalancerElementResponse.class, since="4.2.0")
public class ListInternalLoadBalancerElementsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListInternalLoadBalancerElementsCmd.class.getName());
private static final String _name = "listinternalloadbalancerelementsresponse";
@Inject
private InternalLoadBalancerElementService _service;
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = InternalLoadBalancerElementResponse.class,
description="list internal load balancer elements by id")
private Long id;
@Parameter(name=ApiConstants.NSP_ID, type=CommandType.UUID, entityType = ProviderResponse.class,
description="list internal load balancer elements by network service provider id")
private Long nspId;
@Parameter(name=ApiConstants.ENABLED, type=CommandType.BOOLEAN, description="list internal load balancer elements by enabled state")
private Boolean enabled;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public Long getId() {
return id;
}
public Long getNspId() {
return nspId;
}
public Boolean getEnabled() {
return enabled;
}
@Override
public String getCommandName() {
return _name;
}
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
List<? extends VirtualRouterProvider> providers = _service.searchForInternalLoadBalancerElements(getId(), getNspId(), getEnabled());
ListResponse<InternalLoadBalancerElementResponse> response = new ListResponse<InternalLoadBalancerElementResponse>();
List<InternalLoadBalancerElementResponse> providerResponses = new ArrayList<InternalLoadBalancerElementResponse>();
for (VirtualRouterProvider provider : providers) {
InternalLoadBalancerElementResponse providerResponse = _responseGenerator.createInternalLbElementResponse(provider);
providerResponses.add(providerResponse);
}
response.setResponses(providerResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
}

View File

@ -0,0 +1,123 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.command.admin.internallb;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.DomainRouterResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.router.VirtualRouter;
import com.cloud.network.router.VirtualRouter.Role;
import com.cloud.user.UserContext;
@APICommand(name = "startInternalLoadBalancerVM", responseObject=DomainRouterResponse.class, description="Starts an existing internal lb vm.")
public class StartInternalLBVMCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(StartInternalLBVMCmd.class.getName());
private static final String s_name = "startinternallbvmresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=DomainRouterResponse.class,
required=true, description="the ID of the internal lb vm")
private Long id;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public Long getId() {
return id;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
public static String getResultObjectName() {
return "router";
}
@Override
public long getEntityOwnerId() {
VirtualRouter router = _entityMgr.findById(VirtualRouter.class, getId());
if (router != null && router.getRole() == Role.INTERNAL_LB_VM) {
return router.getAccountId();
} else {
throw new InvalidParameterValueException("Unable to find internal lb vm by id");
}
}
@Override
public String getEventType() {
return EventTypes.EVENT_INTERNAL_LB_VM_START;
}
@Override
public String getEventDescription() {
return "starting internal lb vm: " + getId();
}
@Override
public ApiCommandJobType getInstanceType() {
return ApiCommandJobType.InternalLbVm;
}
@Override
public Long getInstanceId() {
return getId();
}
@Override
public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException{
UserContext.current().setEventDetails("Internal Lb Vm Id: "+getId());
VirtualRouter result = null;
VirtualRouter router = _routerService.findRouter(getId());
if (router == null || router.getRole() != Role.INTERNAL_LB_VM) {
throw new InvalidParameterValueException("Can't find internal lb vm by id");
} else {
result = _internalLbSvc.startInternalLbVm(getId(), UserContext.current().getCaller(), UserContext.current().getCallerUserId());
}
if (result != null){
DomainRouterResponse routerResponse = _responseGenerator.createDomainRouterResponse(result);
routerResponse.setResponseName(getCommandName());
setResponseObject(routerResponse);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to start internal lb vm");
}
}
}

View File

@ -0,0 +1,124 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.command.admin.internallb;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.DomainRouterResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.router.VirtualRouter;
import com.cloud.network.router.VirtualRouter.Role;
import com.cloud.user.UserContext;
@APICommand(name = "stopInternalLoadBalancerVM", description = "Stops an Internal LB vm.", responseObject = DomainRouterResponse.class)
public class StopInternalLBVMCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(StopInternalLBVMCmd.class.getName());
private static final String s_name = "stopinternallbvmresponse";
// ///////////////////////////////////////////////////
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainRouterResponse.class,
required = true, description = "the ID of the internal lb vm")
private Long id;
@Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the VM. The caller knows the VM is stopped.")
private Boolean forced;
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
public Long getId() {
return id;
}
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public long getEntityOwnerId() {
VirtualRouter vm = _entityMgr.findById(VirtualRouter.class, getId());
if (vm != null && vm.getRole() == Role.INTERNAL_LB_VM) {
return vm.getAccountId();
} else {
throw new InvalidParameterValueException("Unable to find internal lb vm by id");
}
}
@Override
public String getEventType() {
return EventTypes.EVENT_INTERNAL_LB_VM_STOP;
}
@Override
public String getEventDescription() {
return "stopping internal lb vm: " + getId();
}
@Override
public ApiCommandJobType getInstanceType() {
return ApiCommandJobType.InternalLbVm;
}
@Override
public Long getInstanceId() {
return getId();
}
public boolean isForced() {
return (forced != null) ? forced : false;
}
@Override
public void execute() throws ConcurrentOperationException, ResourceUnavailableException {
UserContext.current().setEventDetails("Internal lb vm Id: "+getId());
VirtualRouter result = null;
VirtualRouter vm = _routerService.findRouter(getId());
if (vm == null || vm.getRole() != Role.INTERNAL_LB_VM) {
throw new InvalidParameterValueException("Can't find internal lb vm by id");
} else {
result = _internalLbSvc.stopInternalLbVm(getId(), isForced(), UserContext.current().getCaller(), UserContext.current().getCallerUserId());
}
if (result != null) {
DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to stop internal lb vm");
}
}
}

View File

@ -31,7 +31,6 @@ import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.NetworkOfferingResponse;
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.log4j.Logger;
import com.cloud.exception.InvalidParameterValueException;
@ -95,6 +94,10 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
@Parameter(name=ApiConstants.IS_PERSISTENT, type=CommandType.BOOLEAN, description="true if network offering supports persistent networks; defaulted to false if not specified")
private Boolean isPersistent;
@Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, since="4.2.0", description="Template details in key/value pairs." +
" Supported keys are internallbprovider/publiclbprovider with service provider as a value")
protected Map details;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@ -215,6 +218,16 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
return capabilityMap;
}
public Map<String, String> getDetails() {
if (details == null || details.isEmpty()) {
return null;
}
Collection paramsCollection = details.values();
Map<String, String> params = (Map<String, String>) (paramsCollection.toArray())[0];
return params;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////

View File

@ -0,0 +1,118 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.cloudstack.api.command.admin.network;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.GuestVlan;
import com.cloud.user.Account;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.GuestVlanRangeResponse;
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.log4j.Logger;
@APICommand(name = "dedicateGuestVlanRange", description="Dedicates a guest vlan range to an account", responseObject=GuestVlanRangeResponse.class)
public class DedicateGuestVlanRangeCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DedicateGuestVlanRangeCmd.class.getName());
private static final String s_name = "dedicateguestvlanrangeresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.VLAN_RANGE, type=CommandType.STRING, required=true,
description="guest vlan range to be dedicated")
private String vlan;
@Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, required=true,
description="account who will own the VLAN")
private String accountName;
@Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType = ProjectResponse.class,
description="project who will own the VLAN")
private Long projectId;
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType = DomainResponse.class,
required=true, description="domain ID of the account owning a VLAN")
private Long domainId;
@Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.UUID, entityType = PhysicalNetworkResponse.class,
required=true, description="physical network ID of the vlan")
private Long physicalNetworkId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public String getVlan() {
return vlan;
}
public String getAccountName() {
return accountName;
}
public Long getDomainId() {
return domainId;
}
public Long getPhysicalNetworkId() {
return physicalNetworkId;
}
public Long getProjectId() {
return projectId;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public void execute() throws ResourceUnavailableException, ResourceAllocationException {
GuestVlan result = _networkService.dedicateGuestVlanRange(this);
if (result != null) {
GuestVlanRangeResponse response = _responseGenerator.createDedicatedGuestVlanRangeResponse(result);
response.setResponseName(getCommandName());
response.setObjectName("dedicatedguestvlanrange");
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to dedicate guest vlan range");
}
}
}

View File

@ -0,0 +1,129 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.command.admin.network;
import com.cloud.network.GuestVlan;
import com.cloud.user.Account;
import com.cloud.utils.Pair;
import org.apache.cloudstack.api.*;
import org.apache.cloudstack.api.response.*;
import org.apache.log4j.Logger;
import java.util.ArrayList;
import java.util.List;
@APICommand(name = "listDedicatedGuestVlanRanges", description="Lists dedicated guest vlan ranges", responseObject=GuestVlanRangeResponse.class)
public class ListDedicatedGuestVlanRangesCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListDedicatedGuestVlanRangesCmd.class.getName());
private static final String s_name = "listdedicatedguestvlanrangesresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=GuestVlanRangeResponse.class,
description="list dedicated guest vlan ranges by id")
private Long id;
@Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account with which the guest VLAN range is associated. Must be used with the domainId parameter.")
private String accountName;
@Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType = ProjectResponse.class,
description="project who will own the guest VLAN range")
private Long projectId;
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType = DomainResponse.class,
description="the domain ID with which the guest VLAN range is associated. If used with the account parameter, returns all guest VLAN ranges for that account in the specified domain.")
private Long domainId;
@Parameter(name=ApiConstants.GUEST_VLAN_RANGE, type=CommandType.STRING, description="the dedicated guest vlan range")
private String guestVlanRange;
@Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.UUID, entityType = PhysicalNetworkResponse.class,
description="physical network id of the guest VLAN range")
private Long physicalNetworkId;
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
description="zone of the guest VLAN range")
private Long zoneId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public Long getId() {
return id;
}
public String getAccountName() {
return accountName;
}
public Long getDomainId() {
return domainId;
}
public Long getProjectId() {
return projectId;
}
public String getGuestVlanRange() {
return guestVlanRange;
}
public Long getPhysicalNetworkId() {
return physicalNetworkId;
}
public Long getZoneId() {
return zoneId;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public void execute(){
Pair<List<? extends GuestVlan>, Integer> vlans = _networkService.listDedicatedGuestVlanRanges(this);
ListResponse<GuestVlanRangeResponse> response = new ListResponse<GuestVlanRangeResponse>();
List<GuestVlanRangeResponse> guestVlanResponses = new ArrayList<GuestVlanRangeResponse>();
for (GuestVlan vlan : vlans.first()) {
GuestVlanRangeResponse guestVlanResponse = _responseGenerator.createDedicatedGuestVlanRangeResponse(vlan);
guestVlanResponse.setObjectName("dedicatedguestvlanrange");
guestVlanResponses.add(guestVlanResponse);
}
response.setResponses(guestVlanResponses, vlans.second());
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
}

View File

@ -0,0 +1,58 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.command.admin.network;
import java.util.ArrayList;
import java.util.List;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.response.IsolationMethodResponse;
import org.apache.cloudstack.api.response.ListResponse;
import com.cloud.network.Networks;
@APICommand(name = "listNetworkIsolationMethods", description="Lists supported methods of network isolation",
responseObject=IsolationMethodResponse.class, since="4.2.0")
public class ListNetworkIsolationMethodsCmd extends BaseListCmd{
private static final String s_name = "listnetworkisolationmethodsresponse";
@Override
public void execute() {
Networks.IsolationType[] methods = _ntwkModel.listNetworkIsolationMethods();
ListResponse<IsolationMethodResponse> response = new ListResponse<IsolationMethodResponse>();
List<IsolationMethodResponse> isolationResponses = new ArrayList<IsolationMethodResponse>();
if (methods != null) {
for (Networks.IsolationType method : methods) {
IsolationMethodResponse isolationMethod = _responseGenerator.createIsolationMethodResponse(method);
isolationResponses.add(isolationMethod);
}
}
response.setResponses(isolationResponses, methods.length);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
@Override
public String getCommandName() {
return s_name;
}
}

View File

@ -0,0 +1,99 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.command.admin.network;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.GuestVlanRangeResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@APICommand(name = "releaseDedicatedGuestVlanRange", description = "Releases a dedicated guest vlan range to the system", responseObject = SuccessResponse.class)
public class ReleaseDedicatedGuestVlanRangeCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(ReleaseDedicatedGuestVlanRangeCmd.class.getName());
private static final String s_name = "releasededicatedguestvlanrangeresponse";
// ///////////////////////////////////////////////////
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=GuestVlanRangeResponse.class,
required=true, description="the ID of the dedicated guest vlan range")
private Long id;
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
public Long getId() {
return id;
}
@Override
public ApiCommandJobType getInstanceType() {
return ApiCommandJobType.DedicatedGuestVlanRange;
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public String getEventType() {
return EventTypes.EVENT_DEDICATED_GUEST_VLAN_RANGE_RELEASE;
}
@Override
public String getEventDescription() {
return "Releasing a dedicated guest vlan range.";
}
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute(){
UserContext.current().setEventDetails("Dedicated guest vlan range Id: " + id);
boolean result = _networkService.releaseDedicatedGuestVlanRange(getId());
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to release dedicated guest vlan range");
}
}
}

View File

@ -55,6 +55,8 @@ public class UpdatePhysicalNetworkCmd extends BaseAsyncCmd {
@Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="the VLAN for the physical network")
private String vlan;
@Parameter(name=ApiConstants.REMOVE_VLAN, type = CommandType.STRING, description ="The vlan range we want to remove")
private String removevlan;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@ -80,6 +82,10 @@ public class UpdatePhysicalNetworkCmd extends BaseAsyncCmd {
return vlan;
}
public String getRemoveVlan(){
return removevlan;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@ -96,7 +102,7 @@ public class UpdatePhysicalNetworkCmd extends BaseAsyncCmd {
@Override
public void execute(){
PhysicalNetwork result = _networkService.updatePhysicalNetwork(getId(),getNetworkSpeed(), getTags(), getVlan(), getState());
PhysicalNetwork result = _networkService.updatePhysicalNetwork(getId(),getNetworkSpeed(), getTags(), getVlan(), getState(), getRemoveVlan());
PhysicalNetworkResponse response = _responseGenerator.createPhysicalNetworkResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);

View File

@ -148,6 +148,7 @@ public class CreateServiceOfferingCmd extends BaseCmd {
return networkRate;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

View File

@ -55,6 +55,9 @@ public class ListPodsByCmd extends BaseListCmd {
@Parameter(name=ApiConstants.ALLOCATION_STATE, type=CommandType.STRING, description="list pods by allocation state")
private String allocationState;
@Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
private String zoneType;
@Parameter(name=ApiConstants.SHOW_CAPACITIES, type=CommandType.BOOLEAN, description="flag to display the capacity of the pods")
private Boolean showCapacities;
@ -78,6 +81,10 @@ public class ListPodsByCmd extends BaseListCmd {
return allocationState;
}
public String getZoneType() {
return zoneType;
}
public Boolean getShowCapacities() {
return showCapacities;
}

View File

@ -31,6 +31,7 @@ import org.apache.cloudstack.api.response.VirtualRouterProviderResponse;
import org.apache.log4j.Logger;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.network.VirtualRouterProvider;
import com.cloud.network.VirtualRouterProvider.VirtualRouterProviderType;
@ -52,6 +53,9 @@ public class CreateVirtualRouterElementCmd extends BaseAsyncCreateCmd {
@Parameter(name=ApiConstants.NETWORK_SERVICE_PROVIDER_ID, type=CommandType.UUID, entityType = ProviderResponse.class, required=true, description="the network service provider ID of the virtual router element")
private Long nspId;
@Parameter(name=ApiConstants.PROVIDER_TYPE, type=CommandType.UUID, entityType = ProviderResponse.class, description="The provider type. Supported types are VirtualRouter (default) and VPCVirtualRouter")
private String providerType;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@ -61,16 +65,27 @@ public class CreateVirtualRouterElementCmd extends BaseAsyncCreateCmd {
this.nspId = nspId;
}
public Long getNspId() {
return nspId;
}
public VirtualRouterProviderType getProviderType() {
if (providerType != null) {
if (providerType.equalsIgnoreCase(VirtualRouterProviderType.VirtualRouter.toString())) {
return VirtualRouterProviderType.VirtualRouter;
} else if (providerType.equalsIgnoreCase(VirtualRouterProviderType.VPCVirtualRouter.toString())) {
return VirtualRouterProviderType.VPCVirtualRouter;
} else throw new InvalidParameterValueException("Invalid providerType specified");
}
return VirtualRouterProviderType.VirtualRouter;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
@ -96,7 +111,7 @@ public class CreateVirtualRouterElementCmd extends BaseAsyncCreateCmd {
@Override
public void create() throws ResourceAllocationException {
VirtualRouterProvider result = _service.get(0).addElement(getNspId(), VirtualRouterProviderType.VirtualRouter);
VirtualRouterProvider result = _service.get(0).addElement(getNspId(), getProviderType());
if (result != null) {
setEntityId(result.getId());
setEntityUuid(result.getUuid());

View File

@ -32,6 +32,7 @@ import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.log4j.Logger;
import com.cloud.async.AsyncJob;
import com.cloud.network.router.VirtualRouter.Role;
@APICommand(name = "listRouters", description="List routers.", responseObject=DomainRouterResponse.class)
public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
@ -65,6 +66,9 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
description="the Zone ID of the router")
private Long zoneId;
@Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
private String zoneType;
@Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType=NetworkResponse.class,
description="list by network id")
private Long networkId;
@ -104,6 +108,10 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
return zoneId;
}
public String getZoneType() {
return zoneType;
}
public Long getNetworkId() {
return networkId;
}
@ -116,6 +124,10 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
return forVpc;
}
public String getRole() {
return Role.VIRTUAL_ROUTER.toString();
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

View File

@ -30,8 +30,10 @@ import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.router.VirtualRouter;
import com.cloud.network.router.VirtualRouter.Role;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@ -101,7 +103,13 @@ public class StartRouterCmd extends BaseAsyncCmd {
@Override
public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException{
UserContext.current().setEventDetails("Router Id: "+getId());
VirtualRouter result = _routerService.startRouter(id);
VirtualRouter result = null;
VirtualRouter router = _routerService.findRouter(getId());
if (router == null || router.getRole() != Role.VIRTUAL_ROUTER) {
throw new InvalidParameterValueException("Can't find router by id");
} else {
result = _routerService.startRouter(getId());
}
if (result != null){
DomainRouterResponse routerResponse = _responseGenerator.createDomainRouterResponse(result);
routerResponse.setResponseName(getCommandName());

View File

@ -29,8 +29,10 @@ import org.apache.log4j.Logger;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.router.VirtualRouter;
import com.cloud.network.router.VirtualRouter.Role;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@ -104,7 +106,14 @@ public class StopRouterCmd extends BaseAsyncCmd {
@Override
public void execute() throws ConcurrentOperationException, ResourceUnavailableException {
UserContext.current().setEventDetails("Router Id: "+getId());
VirtualRouter result = _routerService.stopRouter(getId(), isForced());
VirtualRouter result = null;
VirtualRouter router = _routerService.findRouter(getId());
if (router == null || router.getRole() != Role.VIRTUAL_ROUTER) {
throw new InvalidParameterValueException("Can't find router by id");
} else {
result = _routerService.stopRouter(getId(), isForced());
}
if (result != null) {
DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result);
response.setResponseName(getCommandName());

View File

@ -0,0 +1,100 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.command.admin.storage;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.StoragePoolForMigrationResponse;
import org.apache.cloudstack.api.response.VolumeResponse;
import com.cloud.storage.StoragePool;
import com.cloud.utils.Pair;
@APICommand(name = "findStoragePoolsForMigration", description="Lists storage pools available for migration of a volume.",
responseObject=StoragePoolForMigrationResponse.class)
public class FindStoragePoolsForMigrationCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(FindStoragePoolsForMigrationCmd.class.getName());
private static final String s_name = "findstoragepoolsformigrationresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = VolumeResponse.class, required=true,
description="the ID of the volume")
private Long id;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public Long getId() {
return id;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public ApiCommandJobType getInstanceType() {
return ApiCommandJobType.StoragePool;
}
@Override
public void execute() {
Pair<List<? extends StoragePool>, List<? extends StoragePool>> pools =
_mgr.listStoragePoolsForMigrationOfVolume(getId());
ListResponse<StoragePoolForMigrationResponse> response = new ListResponse<StoragePoolForMigrationResponse>();
List<StoragePoolForMigrationResponse> poolResponses = new ArrayList<StoragePoolForMigrationResponse>();
List<? extends StoragePool> allPools = pools.first();
List<? extends StoragePool> suitablePoolList = pools.second();
for (StoragePool pool : allPools) {
StoragePoolForMigrationResponse poolResponse = _responseGenerator.createStoragePoolForMigrationResponse(pool);
Boolean suitableForMigration = false;
for (StoragePool suitablePool : suitablePoolList) {
if (suitablePool.getId() == pool.getId()) {
suitableForMigration = true;
break;
}
}
poolResponse.setSuitableForMigration(suitableForMigration);
poolResponse.setObjectName("storagepool");
poolResponses.add(poolResponse);
}
response.setResponses(poolResponses);
response.setResponseName(getCommandName());
setResponseObject(response);
}
}

View File

@ -61,6 +61,9 @@ public class ListStoragePoolsCmd extends BaseListCmd {
description="the Zone ID for the storage pool")
private Long zoneId;
@Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
private String zoneType;
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = StoragePoolResponse.class,
description="the ID of the storage pool")
private Long id;
@ -93,6 +96,10 @@ public class ListStoragePoolsCmd extends BaseListCmd {
return zoneId;
}
public String getZoneType() {
return zoneType;
}
public Long getId() {
return id;
}

Some files were not shown because too many files have changed in this diff Show More