mirror of https://github.com/apache/cloudstack.git
Merged
This commit is contained in:
commit
3047929367
|
|
@ -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
385
CHANGES
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
60
server/src/com/cloud/maint/UpgradeMonitor.java → api/src/com/cloud/agent/api/storage/CreateVolumeOVAAnswer.java
Normal file → Executable file
60
server/src/com/cloud/maint/UpgradeMonitor.java → api/src/com/cloud/agent/api/storage/CreateVolumeOVAAnswer.java
Normal file → Executable file
|
|
@ -1,34 +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.maint;
|
||||
|
||||
/**
|
||||
* has been released.
|
||||
*
|
||||
*/
|
||||
public class UpgradeMonitor implements Runnable {
|
||||
private String _url;
|
||||
private long _period;
|
||||
|
||||
public UpgradeMonitor(String url, long period) {
|
||||
_url = url;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
// 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
57
core/src/com/cloud/vm/VirtualDisk.java → api/src/com/cloud/agent/api/storage/PrepareOVAPackingAnswer.java
Normal file → Executable file
57
core/src/com/cloud/vm/VirtualDisk.java → api/src/com/cloud/agent/api/storage/PrepareOVAPackingAnswer.java
Normal file → Executable 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 PrepareOVAPackingAnswer extends Answer {
|
||||
public PrepareOVAPackingAnswer(PrepareOVAPackingCommand cmd, boolean result, String details) {
|
||||
super(cmd, result, details);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -49,7 +49,9 @@ public interface AsyncJob extends Identity, InternalIdentity {
|
|||
AutoScalePolicy,
|
||||
AutoScaleVmProfile,
|
||||
AutoScaleVmGroup,
|
||||
GlobalLoadBalancerRule
|
||||
GlobalLoadBalancerRule,
|
||||
AffinityGroup,
|
||||
DedicatedGuestVlanRange
|
||||
}
|
||||
|
||||
long getUserId();
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -142,6 +142,9 @@ public class EventTypes {
|
|||
//registering SSH keypair events
|
||||
public static final String EVENT_REGISTER_SSH_KEYPAIR = "REGISTER.SSH.KEYPAIR";
|
||||
|
||||
//register for user API and secret keys
|
||||
public static final String EVENT_REGISTER_FOR_SECRET_API_KEY = "REGISTER.USER.KEY";
|
||||
|
||||
// Template Events
|
||||
public static final String EVENT_TEMPLATE_CREATE = "TEMPLATE.CREATE";
|
||||
public static final String EVENT_TEMPLATE_DELETE = "TEMPLATE.DELETE";
|
||||
|
|
@ -223,6 +226,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";
|
||||
|
|
@ -345,7 +350,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";
|
||||
|
|
@ -379,6 +384,16 @@ 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";
|
||||
|
||||
// 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
|
||||
|
|
@ -536,6 +551,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());
|
||||
|
|
@ -677,6 +694,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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -52,4 +52,6 @@ public interface HypervisorCapabilities extends Identity, InternalIdentity{
|
|||
*/
|
||||
Integer getMaxHostsPerCluster();
|
||||
|
||||
boolean isStorageMotionSupported();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,17 +14,18 @@
|
|||
// 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;
|
||||
|
||||
public interface SecondaryStorage {
|
||||
|
||||
String getBackupPath();
|
||||
|
||||
String getTemplatePath();
|
||||
|
||||
String getIsoPath();
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
void createTemplate();
|
||||
|
||||
void destroyTemplate();
|
||||
public interface GuestVlan extends InternalIdentity, Identity {
|
||||
|
||||
public long getId();
|
||||
|
||||
public long getAccountId();
|
||||
|
||||
public String getGuestVlanRange();
|
||||
|
||||
public long getPhysicalNetworkId();
|
||||
}
|
||||
|
|
@ -78,16 +78,7 @@ public interface IpAddress extends ControlledEntity, Identity, InternalIdentity
|
|||
|
||||
boolean getSystem();
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
Long getVpcId();
|
||||
|
||||
/**
|
||||
* @param vpcId
|
||||
*/
|
||||
void setVpcId(Long vpcId);
|
||||
String getVmIp();
|
||||
void setVmIp(String vmIp);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,24 +16,11 @@
|
|||
// under the License.
|
||||
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;
|
||||
|
|
@ -137,6 +124,7 @@ 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 CiscoVnmc = new Provider("CiscoVnmc", true);
|
||||
|
||||
private String name;
|
||||
private boolean isExternal;
|
||||
|
|
@ -182,6 +170,7 @@ 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");
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ public interface NetworkModel {
|
|||
/**
|
||||
* @return
|
||||
*/
|
||||
String getDefaultNetworkDomain();
|
||||
String getDefaultNetworkDomain(long zoneId);
|
||||
|
||||
/**
|
||||
* @param ntwkOffId
|
||||
|
|
@ -263,4 +263,6 @@ public interface NetworkModel {
|
|||
boolean isProviderEnabledInZone(long zoneId, String provider);
|
||||
|
||||
Nic getPlaceholderNicForRouter(Network network, Long podId);
|
||||
|
||||
Networks.IsolationType[] listNetworkIsolationMethods();
|
||||
}
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,4 @@ public interface PublicIpAddress extends ControlledEntity, IpAddress, Vlan, Inte
|
|||
public String getNetmask();
|
||||
|
||||
public String getGateway();
|
||||
|
||||
@Override
|
||||
public String getVlanTag();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ public interface SecurityGroupRules extends InternalIdentity {
|
|||
|
||||
Long getRuleId();
|
||||
|
||||
String getRuleUuid();
|
||||
|
||||
int getStartPort();
|
||||
|
||||
int getEndPort();
|
||||
|
|
|
|||
|
|
@ -44,5 +44,6 @@ public interface PrivateIp {
|
|||
String getMacAddress();
|
||||
|
||||
long getNetworkId();
|
||||
boolean getSourceNat();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,4 +77,8 @@ public interface VpcGateway extends Identity, ControlledEntity, InternalIdentity
|
|||
* @return
|
||||
*/
|
||||
State getState();
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
boolean getSourceNat();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -46,6 +46,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 +107,8 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
|
|||
|
||||
boolean getElasticIp();
|
||||
|
||||
boolean getAssociatePublicIP();
|
||||
|
||||
boolean getElasticLb();
|
||||
|
||||
boolean getSpecifyIpRanges();
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -357,10 +359,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();
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,5 +72,7 @@ public interface User extends OwnedBy, InternalIdentity {
|
|||
String getRegistrationToken();
|
||||
|
||||
boolean isRegistered();
|
||||
|
||||
boolean isDefault();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ public class DiskProfile {
|
|||
this.hyperType = hyperType;
|
||||
}
|
||||
|
||||
public HypervisorType getHypersorType() {
|
||||
public HypervisorType getHypervisorType() {
|
||||
return this.hyperType;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
}
|
||||
|
|
@ -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();
|
||||
|
||||
}
|
||||
|
|
@ -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();
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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,17 @@ 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 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 {
|
||||
|
|
|
|||
|
|
@ -27,12 +27,12 @@ import java.util.regex.Pattern;
|
|||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.affinity.AffinityGroupService;
|
||||
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 +42,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 +96,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 +115,6 @@ public abstract class BaseCmd {
|
|||
@Inject public TemplateApiService _templateService;
|
||||
@Inject public SecurityGroupService _securityGroupService;
|
||||
@Inject public SnapshotApiService _snapshotService;
|
||||
@Inject public ConsoleProxyService _consoleProxyService;
|
||||
@Inject public VpcVirtualNetworkApplianceService _routerService;
|
||||
@Inject public ResponseGenerator _responseGenerator;
|
||||
@Inject public EntityManager _entityMgr;
|
||||
|
|
@ -134,12 +139,33 @@ public abstract class BaseCmd {
|
|||
@Inject public VMSnapshotService _vmSnapshotService;
|
||||
@Inject public DataStoreProviderApiService dataStoreProviderApiService;
|
||||
@Inject public VpcProvisioningService _vpcProvSvc;
|
||||
@Inject public AffinityGroupService _affinityGroupService;
|
||||
@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 +182,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 +495,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 +512,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 {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@ import java.text.DecimalFormat;
|
|||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.vm.NicSecondaryIp;
|
||||
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;
|
||||
|
|
@ -47,6 +50,7 @@ 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.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;
|
||||
|
|
@ -117,6 +121,7 @@ import com.cloud.host.Host;
|
|||
import com.cloud.hypervisor.HypervisorCapabilities;
|
||||
import com.cloud.network.*;
|
||||
import com.cloud.network.Network.Service;
|
||||
import com.cloud.network.Networks.IsolationType;
|
||||
import com.cloud.network.as.*;
|
||||
import com.cloud.network.router.VirtualRouter;
|
||||
import com.cloud.network.rules.FirewallRule;
|
||||
|
|
@ -150,18 +155,9 @@ import com.cloud.user.UserAccount;
|
|||
import com.cloud.uservm.UserVm;
|
||||
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;
|
||||
|
||||
public interface ResponseGenerator {
|
||||
UserResponse createUserResponse(UserAccount user);
|
||||
|
|
@ -196,10 +192,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 +225,8 @@ public interface ResponseGenerator {
|
|||
|
||||
StoragePoolResponse createStoragePoolResponse(StoragePool pool);
|
||||
|
||||
StoragePoolForMigrationResponse createStoragePoolForMigrationResponse(StoragePool pool);
|
||||
|
||||
ClusterResponse createClusterResponse(Cluster cluster, Boolean showCapacities);
|
||||
|
||||
FirewallRuleResponse createPortForwardingRuleResponse(PortForwardingRule fwRule);
|
||||
|
|
@ -393,7 +397,13 @@ public interface ResponseGenerator {
|
|||
|
||||
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);
|
||||
|
||||
AffinityGroupResponse createAffinityGroupResponse(AffinityGroup group);
|
||||
|
||||
Long getAffinityGroupId(String name, long entityOwnerId);
|
||||
|
||||
IsolationMethodResponse createIsolationMethodResponse(IsolationType method);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
@ -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.ApiConstants;
|
||||
|
|
@ -37,6 +38,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 {
|
||||
|
|
@ -73,6 +75,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;
|
||||
|
|
@ -122,6 +127,10 @@ public class ListHostsCmd extends BaseListCmd {
|
|||
return zoneId;
|
||||
}
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
}
|
||||
|
||||
public Long getVirtualMachineId() {
|
||||
return virtualMachineId;
|
||||
}
|
||||
|
|
@ -170,8 +179,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();
|
||||
|
||||
|
|
@ -192,6 +201,5 @@ public class ListHostsCmd extends BaseListCmd {
|
|||
}
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
// 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.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.ResourceInUseException;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
import org.apache.cloudstack.api.*;
|
||||
import org.apache.cloudstack.api.response.CounterResponse;
|
||||
import org.apache.cloudstack.api.response.GuestVlanRangeResponse;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
@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 AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.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());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to release dedicated guest vlan range");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -54,6 +54,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 ///////////////////////
|
||||
|
|
@ -79,6 +81,10 @@ public class UpdatePhysicalNetworkCmd extends BaseAsyncCmd {
|
|||
return vlan;
|
||||
}
|
||||
|
||||
public String getRemoveVlan(){
|
||||
return removevlan;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -95,7 +101,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);
|
||||
|
|
|
|||
|
|
@ -148,6 +148,7 @@ public class CreateServiceOfferingCmd extends BaseCmd {
|
|||
return networkRate;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,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;
|
||||
|
|
@ -103,6 +106,10 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
|
|||
return zoneId;
|
||||
}
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
}
|
||||
|
||||
public Long getNetworkId() {
|
||||
return networkId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,98 @@
|
|||
// 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.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.ListResponse;
|
||||
import org.apache.cloudstack.api.response.StoragePoolForMigrationResponse;
|
||||
import org.apache.cloudstack.api.response.VolumeResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
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;
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.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());
|
||||
this.setResponseObject(response);
|
||||
}
|
||||
}
|
||||
|
|
@ -60,6 +60,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;
|
||||
|
|
@ -92,6 +95,10 @@ public class ListStoragePoolsCmd extends BaseListCmd {
|
|||
return zoneId;
|
||||
}
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,6 +74,9 @@ public class ListSystemVMsCmd extends BaseListCmd {
|
|||
description="the storage ID where vm's volumes belong to", since="3.0.1")
|
||||
private Long storageId;
|
||||
|
||||
@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 ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -110,6 +113,10 @@ public class ListSystemVMsCmd extends BaseListCmd {
|
|||
return storageId;
|
||||
}
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -0,0 +1,108 @@
|
|||
// 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.vlan;
|
||||
|
||||
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.ProjectResponse;
|
||||
import org.apache.cloudstack.api.response.VlanIpRangeResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.dc.Vlan;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
@APICommand(name = "dedicatePublicIpRange", description="Dedicates a Public IP range to an account", responseObject=VlanIpRangeResponse.class)
|
||||
public class DedicatePublicIpRangeCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DedicatePublicIpRangeCmd.class.getName());
|
||||
|
||||
private static final String s_name = "dedicatepubliciprangeresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = VlanIpRangeResponse.class,
|
||||
required=true, description="the id of the VLAN IP range")
|
||||
private Long id;
|
||||
|
||||
@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;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getAccountName() {
|
||||
return accountName;
|
||||
}
|
||||
|
||||
public Long getDomainId() {
|
||||
return domainId;
|
||||
}
|
||||
|
||||
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 {
|
||||
Vlan result = _configService.dedicatePublicIpRange(this);
|
||||
if (result != null) {
|
||||
VlanIpRangeResponse response = _responseGenerator.createVlanIpRangeResponse(result);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to dedicate vlan ip range");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -14,34 +14,34 @@
|
|||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.api.commands;
|
||||
package org.apache.cloudstack.api.command.admin.vlan;
|
||||
|
||||
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.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.cloudstack.api.response.VlanIpRangeResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
|
||||
//@APICommand(description="Destroys console proxy", responseObject=SuccessResponse.class)
|
||||
public class DestroyConsoleProxyCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DestroyConsoleProxyCmd.class.getName());
|
||||
@APICommand(name = "releasePublicIpRange", description="Releases a Public IP range back to the system pool", responseObject=SuccessResponse.class)
|
||||
public class ReleasePublicIpRangeCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ReleasePublicIpRangeCmd.class.getName());
|
||||
|
||||
private static final String s_name = "destroyconsoleproxyresponse";
|
||||
private static final String s_name = "releasepubliciprangeresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="console proxy ID")
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = VlanIpRangeResponse.class,
|
||||
required=true, description="the id of the Public IP range")
|
||||
private Long id;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -50,7 +50,6 @@ public class DestroyConsoleProxyCmd extends BaseAsyncCmd {
|
|||
return id;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -62,32 +61,17 @@ public class DestroyConsoleProxyCmd extends BaseAsyncCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Account account = (Account)UserContext.current().getCaller();
|
||||
if (account != null) {
|
||||
return account.getId();
|
||||
}
|
||||
|
||||
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_PROXY_DESTROY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "destroying console proxy: " + getId();
|
||||
return Account.ACCOUNT_ID_SYSTEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
boolean result = _consoleProxyService.destroyConsoleProxy(this);
|
||||
boolean result = _configService.releasePublicIpRange(this);
|
||||
if (result) {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to destroy console proxy");
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to release public ip range");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -58,7 +58,7 @@ public class MigrateVMCmd extends BaseAsyncCmd {
|
|||
required=true, description="the ID of the virtual machine")
|
||||
private Long virtualMachineId;
|
||||
|
||||
@Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.LONG, entityType=StoragePoolResponse.class,
|
||||
@Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.UUID, entityType=StoragePoolResponse.class,
|
||||
required=false, description="Destination storage pool ID to migrate VM volumes to. Required for migrating the root disk volume")
|
||||
private Long storageId;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,160 @@
|
|||
// 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.vm;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.cloudstack.api.*;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
|
||||
import org.apache.cloudstack.api.BaseCmd.CommandType;
|
||||
import org.apache.cloudstack.api.response.HostResponse;
|
||||
import org.apache.cloudstack.api.response.StoragePoolResponse;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.ManagementServerException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.exception.VirtualMachineMigrationException;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.storage.StoragePool;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
import com.cloud.uservm.UserVm;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
|
||||
@APICommand(name = "migrateVirtualMachineWithVolume", description="Attempts Migration of a VM with its volumes to a different host", responseObject=UserVmResponse.class)
|
||||
public class MigrateVirtualMachineWithVolumeCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(MigrateVMCmd.class.getName());
|
||||
|
||||
private static final String s_name = "migratevirtualmachinewithvolumeresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.HOST_ID, type=CommandType.UUID, entityType=HostResponse.class,
|
||||
required=true, description="Destination Host ID to migrate VM to.")
|
||||
private Long hostId;
|
||||
|
||||
@Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType=UserVmResponse.class,
|
||||
required=true, description="the ID of the virtual machine")
|
||||
private Long virtualMachineId;
|
||||
|
||||
@Parameter(name = ApiConstants.MIGRATE_TO, type = CommandType.MAP, required=false,
|
||||
description = "Map of pool to which each volume should be migrated (volume/pool pair)")
|
||||
private Map migrateVolumeTo;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public Long getHostId() {
|
||||
return hostId;
|
||||
}
|
||||
|
||||
public Long getVirtualMachineId() {
|
||||
return virtualMachineId;
|
||||
}
|
||||
|
||||
public Map<String, String> getVolumeToPool() {
|
||||
Map<String, String> volumeToPoolMap = new HashMap<String, String>();
|
||||
if (migrateVolumeTo != null && !migrateVolumeTo.isEmpty()) {
|
||||
Collection<?> allValues = migrateVolumeTo.values();
|
||||
Iterator<?> iter = allValues.iterator();
|
||||
while (iter.hasNext()) {
|
||||
HashMap<String, String> volumeToPool = (HashMap<String, String>) iter.next();
|
||||
String volume = volumeToPool.get("volume");
|
||||
String pool = volumeToPool.get("pool");
|
||||
volumeToPoolMap.put(volume, pool);
|
||||
}
|
||||
}
|
||||
return volumeToPoolMap;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
UserVm userVm = _entityMgr.findById(UserVm.class, getVirtualMachineId());
|
||||
if (userVm != null) {
|
||||
return userVm.getAccountId();
|
||||
}
|
||||
|
||||
return Account.ACCOUNT_ID_SYSTEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_VM_MIGRATE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "Attempting to migrate VM Id: " + getVirtualMachineId() + " to host Id: "+ getHostId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
UserVm userVm = _userVmService.getUserVm(getVirtualMachineId());
|
||||
if (userVm == null) {
|
||||
throw new InvalidParameterValueException("Unable to find the VM by id=" + getVirtualMachineId());
|
||||
}
|
||||
|
||||
Host destinationHost = _resourceService.getHost(getHostId());
|
||||
if (destinationHost == null) {
|
||||
throw new InvalidParameterValueException("Unable to find the host to migrate the VM, host id =" + getHostId());
|
||||
}
|
||||
|
||||
try{
|
||||
VirtualMachine migratedVm = _userVmService.migrateVirtualMachineWithVolume(getVirtualMachineId(),
|
||||
destinationHost, getVolumeToPool());
|
||||
if (migratedVm != null) {
|
||||
UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", (UserVm)migratedVm).get(0);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate vm");
|
||||
}
|
||||
} catch (ResourceUnavailableException ex) {
|
||||
s_logger.warn("Exception: ", ex);
|
||||
throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
|
||||
} catch (ConcurrentOperationException e) {
|
||||
s_logger.warn("Exception: ", e);
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
|
||||
} catch (ManagementServerException e) {
|
||||
s_logger.warn("Exception: ", e);
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
|
||||
} catch (VirtualMachineMigrationException e) {
|
||||
s_logger.warn("Exception: ", e);
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -69,6 +69,11 @@ public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd {
|
|||
required=true, description="the VPC network belongs to")
|
||||
private Long vpcId;
|
||||
|
||||
@Parameter(name=ApiConstants.SOURCE_NAT_SUPPORTED, type=CommandType.BOOLEAN, required=false,
|
||||
description="source NAT supported value. Default value false. If 'true' source NAT is enabled on the private gateway" +
|
||||
" 'false': sourcenat is not supported")
|
||||
private Boolean isSourceNat;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -97,6 +102,13 @@ public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd {
|
|||
return vpcId;
|
||||
}
|
||||
|
||||
public Boolean getIsSourceNat () {
|
||||
if (isSourceNat == null) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -111,7 +123,7 @@ public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd {
|
|||
PrivateGateway result = null;
|
||||
try {
|
||||
result = _vpcService.createVpcPrivateGateway(getVpcId(), getPhysicalNetworkId(),
|
||||
getVlan(), getStartIp(), getGateway(), getNetmask(), getEntityOwnerId());
|
||||
getVlan(), getStartIp(), getGateway(), getNetmask(), getEntityOwnerId(), getIsSourceNat());
|
||||
} catch (InsufficientCapacityException ex){
|
||||
s_logger.info(ex);
|
||||
s_logger.trace(ex);
|
||||
|
|
|
|||
|
|
@ -16,38 +16,21 @@
|
|||
// under the License.
|
||||
package org.apache.cloudstack.api.command.user.address;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.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.IPAddressResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkResponse;
|
||||
import org.apache.cloudstack.api.response.ProjectResponse;
|
||||
import org.apache.cloudstack.api.response.VpcResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.DataCenter.NetworkType;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.exception.*;
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.vpc.Vpc;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
import org.apache.cloudstack.api.*;
|
||||
import org.apache.cloudstack.api.response.*;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@APICommand(name = "associateIpAddress", description="Acquires and associates a public IP to an account.", responseObject=IPAddressResponse.class)
|
||||
public class AssociateIPAddrCmd extends BaseAsyncCreateCmd {
|
||||
|
|
@ -213,7 +196,7 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd {
|
|||
@Override
|
||||
public void create() throws ResourceAllocationException{
|
||||
try {
|
||||
IpAddress ip = _networkService.allocateIP(_accountService.getAccount(getEntityOwnerId()), false, getZoneId());
|
||||
IpAddress ip = _networkService.allocateIP(_accountService.getAccount(getEntityOwnerId()), getZoneId(), getNetworkId());
|
||||
|
||||
if (ip != null) {
|
||||
this.setEntityId(ip.getId());
|
||||
|
|
|
|||
|
|
@ -0,0 +1,167 @@
|
|||
// 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.user.affinitygroup;
|
||||
|
||||
import org.apache.cloudstack.affinity.AffinityGroup;
|
||||
import org.apache.cloudstack.affinity.AffinityGroupResponse;
|
||||
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.DomainResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
|
||||
@APICommand(name = "createAffinityGroup", responseObject = AffinityGroupResponse.class, description = "Creates an affinity/anti-affinity group")
|
||||
public class CreateAffinityGroupCmd extends BaseAsyncCreateCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(CreateAffinityGroupCmd.class.getName());
|
||||
|
||||
private static final String s_name = "createaffinitygroupresponse";
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ////////////// API parameters /////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an account for the affinity group. Must be used with domainId.")
|
||||
private String accountName;
|
||||
|
||||
@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, description = "domainId of the account owning the affinity group", entityType = DomainResponse.class)
|
||||
private Long domainId;
|
||||
|
||||
@Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "optional description of the affinity group")
|
||||
private String description;
|
||||
|
||||
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "name of the affinity group")
|
||||
private String affinityGroupName;
|
||||
|
||||
@Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, required = true, description = "Type of the affinity group from the available affinity/anti-affinity group types")
|
||||
private String affinityGroupType;
|
||||
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////////// Accessors ///////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
public String getAccountName() {
|
||||
return accountName;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public Long getDomainId() {
|
||||
return domainId;
|
||||
}
|
||||
|
||||
public String getAffinityGroupName() {
|
||||
return affinityGroupName;
|
||||
}
|
||||
|
||||
public String getAffinityGroupType() {
|
||||
return affinityGroupType;
|
||||
}
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////// API Implementation///////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Account account = UserContext.current().getCaller();
|
||||
if ((account == null) || isAdmin(account.getType())) {
|
||||
if ((domainId != null) && (accountName != null)) {
|
||||
Account userAccount = _responseGenerator.findAccountByNameDomain(accountName, domainId);
|
||||
if (userAccount != null) {
|
||||
return userAccount.getId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (account != null) {
|
||||
return account.getId();
|
||||
}
|
||||
|
||||
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this
|
||||
// command to SYSTEM so ERROR events
|
||||
// are tracked
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
AffinityGroup group = _affinityGroupService.getAffinityGroup(getEntityId());
|
||||
if (group != null) {
|
||||
AffinityGroupResponse response = _responseGenerator.createAffinityGroupResponse(group);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create affinity group:"
|
||||
+ affinityGroupName);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create() throws ResourceAllocationException {
|
||||
AffinityGroup result = _affinityGroupService.createAffinityGroup(accountName, domainId, affinityGroupName,
|
||||
affinityGroupType, description);
|
||||
if (result != null) {
|
||||
setEntityId(result.getId());
|
||||
setEntityUuid(result.getUuid());
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create affinity group entity" + affinityGroupName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_AFFINITY_GROUP_CREATE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "creating Affinity Group";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCreateEventType() {
|
||||
return EventTypes.EVENT_AFFINITY_GROUP_CREATE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCreateEventDescription() {
|
||||
return "creating Affinity Group";
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.AffinityGroup;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,154 @@
|
|||
// 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.user.affinitygroup;
|
||||
|
||||
import org.apache.cloudstack.affinity.AffinityGroupResponse;
|
||||
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.DomainResponse;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.ResourceInUseException;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
|
||||
@APICommand(name = "deleteAffinityGroup", description = "Deletes affinity group", responseObject = SuccessResponse.class)
|
||||
public class DeleteAffinityGroupCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DeleteAffinityGroupCmd.class.getName());
|
||||
private static final String s_name = "deleteaffinitygroupresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "the account of the affinity group. Must be specified with domain ID")
|
||||
private String accountName;
|
||||
|
||||
@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, description = "the domain ID of account owning the affinity group", entityType = DomainResponse.class)
|
||||
private Long domainId;
|
||||
|
||||
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, description = "The ID of the affinity group. Mutually exclusive with name parameter", entityType = AffinityGroupResponse.class)
|
||||
private Long id;
|
||||
|
||||
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name of the affinity group. Mutually exclusive with id parameter")
|
||||
private String name;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public String getAccountName() {
|
||||
return accountName;
|
||||
}
|
||||
|
||||
public Long getDomainId() {
|
||||
return domainId;
|
||||
}
|
||||
|
||||
|
||||
public Long getId() {
|
||||
if (id != null && name != null) {
|
||||
throw new InvalidParameterValueException("name and id parameters are mutually exclusive");
|
||||
}
|
||||
|
||||
if (name != null) {
|
||||
id = _responseGenerator.getAffinityGroupId(name, getEntityOwnerId());
|
||||
if (id == null) {
|
||||
throw new InvalidParameterValueException("Unable to find affinity group by name " + name
|
||||
+ " for the account id=" + getEntityOwnerId());
|
||||
}
|
||||
}
|
||||
|
||||
if (id == null) {
|
||||
throw new InvalidParameterValueException(
|
||||
"Either id or name parameter is requred by deleteAffinityGroup command");
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Account account = UserContext.current().getCaller();
|
||||
if ((account == null) || isAdmin(account.getType())) {
|
||||
if ((domainId != null) && (accountName != null)) {
|
||||
Account userAccount = _responseGenerator.findAccountByNameDomain(accountName, domainId);
|
||||
if (userAccount != null) {
|
||||
return userAccount.getId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (account != null) {
|
||||
return account.getId();
|
||||
}
|
||||
|
||||
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this
|
||||
// command to SYSTEM so ERROR events
|
||||
// are tracked
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
try{
|
||||
boolean result = _affinityGroupService.deleteAffinityGroup(id, accountName, domainId, name);
|
||||
if (result) {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete affinity group");
|
||||
}
|
||||
} catch (ResourceInUseException ex) {
|
||||
s_logger.warn("Exception: ", ex);
|
||||
throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_AFFINITY_GROUP_DELETE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "Deleting Affinity Group";
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.AffinityGroup;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
// 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.user.affinitygroup;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.affinity.AffinityGroupTypeResponse;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.BaseListCmd;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.user.Account;
|
||||
|
||||
@APICommand(name = "listAffinityGroupTypes", description = "Lists affinity group types available", responseObject = AffinityGroupTypeResponse.class)
|
||||
public class ListAffinityGroupTypesCmd extends BaseListCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListAffinityGroupTypesCmd.class.getName());
|
||||
|
||||
private static final String s_name = "listaffinitygrouptypesresponse";
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
public long getEntityOwnerId() {
|
||||
return Account.ACCOUNT_ID_SYSTEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
List<String> result = _affinityGroupService.listAffinityGroupTypes();
|
||||
ListResponse<AffinityGroupTypeResponse> response = new ListResponse<AffinityGroupTypeResponse>();
|
||||
ArrayList<AffinityGroupTypeResponse> responses = new ArrayList<AffinityGroupTypeResponse>();
|
||||
if (result != null) {
|
||||
for (String type : result) {
|
||||
AffinityGroupTypeResponse affinityTypeResponse = new AffinityGroupTypeResponse();
|
||||
affinityTypeResponse.setType(type);
|
||||
affinityTypeResponse.setObjectName("affinityGroupType");
|
||||
responses.add(affinityTypeResponse);
|
||||
}
|
||||
}
|
||||
response.setResponses(responses);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
// 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.user.affinitygroup;
|
||||
|
||||
import org.apache.cloudstack.affinity.AffinityGroupResponse;
|
||||
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.ListResponse;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.async.AsyncJob;
|
||||
|
||||
@APICommand(name = "listAffinityGroups", description = "Lists affinity groups", responseObject = AffinityGroupResponse.class)
|
||||
public class ListAffinityGroupsCmd extends BaseListCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListAffinityGroupsCmd.class.getName());
|
||||
|
||||
private static final String s_name = "listaffinitygroupsresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "lists affinity groups by name")
|
||||
private String affinityGroupName;
|
||||
|
||||
@Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, description = "lists affinity groups by virtual machine id", entityType = UserVmResponse.class)
|
||||
private Long virtualMachineId;
|
||||
|
||||
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, description = "list the affinity group by the id provided", entityType = AffinityGroupResponse.class)
|
||||
private Long id;
|
||||
|
||||
@Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "lists affinity groups by type")
|
||||
private String affinityGroupType;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
public String getAffinityGroupName() {
|
||||
return affinityGroupName;
|
||||
}
|
||||
|
||||
public Long getVirtualMachineId() {
|
||||
return virtualMachineId;
|
||||
}
|
||||
|
||||
public Long getId(){
|
||||
return id;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
|
||||
ListResponse<AffinityGroupResponse> response = _queryService.listAffinityGroups(id, affinityGroupName,
|
||||
affinityGroupType, virtualMachineId, this.getStartIndex(), this.getPageSizeVal());
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.AffinityGroup;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,164 @@
|
|||
// 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.user.affinitygroup;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.affinity.AffinityGroupResponse;
|
||||
import org.apache.cloudstack.api.ACL;
|
||||
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.ApiConstants.VMDetails;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
import com.cloud.uservm.UserVm;
|
||||
|
||||
|
||||
@APICommand(name = "updateVMAffinityGroup", description = "Updates the affinity/anti-affinity group associations of a virtual machine. The VM has to be stopped and restarted for the "
|
||||
+ "new properties to take effect.", responseObject = UserVmResponse.class)
|
||||
public class UpdateVMAffinityGroupCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(UpdateVMAffinityGroupCmd.class.getName());
|
||||
private static final String s_name = "updatevirtualmachineresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@ACL
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserVmResponse.class,
|
||||
required=true, description="The ID of the virtual machine")
|
||||
private Long id;
|
||||
|
||||
@ACL
|
||||
@Parameter(name = ApiConstants.AFFINITY_GROUP_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = AffinityGroupResponse.class, description = "comma separated list of affinity groups id that are going to be applied to the virtual machine. "
|
||||
+ "Should be passed only when vm is created from a zone with Basic Network support."
|
||||
+ " Mutually exclusive with securitygroupnames parameter")
|
||||
private List<Long> affinityGroupIdList;
|
||||
|
||||
@ACL
|
||||
@Parameter(name = ApiConstants.AFFINITY_GROUP_NAMES, type = CommandType.LIST, collectionType = CommandType.STRING, entityType = AffinityGroupResponse.class, description = "comma separated list of affinity groups names that are going to be applied to the virtual machine."
|
||||
+ " Should be passed only when vm is created from a zone with Basic Network support. "
|
||||
+ "Mutually exclusive with securitygroupids parameter")
|
||||
private List<String> affinityGroupNameList;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public List<Long> getAffinityGroupIdList() {
|
||||
if (affinityGroupNameList != null && affinityGroupIdList != null) {
|
||||
throw new InvalidParameterValueException(
|
||||
"affinitygroupids parameter is mutually exclusive with affinitygroupnames parameter");
|
||||
}
|
||||
|
||||
// transform group names to ids here
|
||||
if (affinityGroupNameList != null) {
|
||||
List<Long> affinityGroupIds = new ArrayList<Long>();
|
||||
for (String groupName : affinityGroupNameList) {
|
||||
Long groupId = _responseGenerator.getAffinityGroupId(groupName, getEntityOwnerId());
|
||||
if (groupId == null) {
|
||||
throw new InvalidParameterValueException("Unable to find group by name " + groupName
|
||||
+ " for account " + getEntityOwnerId());
|
||||
} else {
|
||||
affinityGroupIds.add(groupId);
|
||||
}
|
||||
}
|
||||
return affinityGroupIds;
|
||||
} else {
|
||||
return affinityGroupIdList;
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
public static String getResultObjectName() {
|
||||
return "virtualmachine";
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
UserVm userVm = _entityMgr.findById(UserVm.class, getId());
|
||||
if (userVm != null) {
|
||||
return userVm.getAccountId();
|
||||
}
|
||||
|
||||
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws ResourceUnavailableException,
|
||||
InsufficientCapacityException, ServerApiException {
|
||||
UserContext.current().setEventDetails("Vm Id: "+getId());
|
||||
UserVm result = _affinityGroupService.updateVMAffinityGroups(getId(), getAffinityGroupIdList());
|
||||
ArrayList<VMDetails> dc = new ArrayList<VMDetails>();
|
||||
dc.add(VMDetails.valueOf("affgrp"));
|
||||
EnumSet<VMDetails> details = EnumSet.copyOf(dc);
|
||||
|
||||
if (result != null){
|
||||
UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", details, result).get(0);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update vm's affinity groups");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_VM_AFFINITY_GROUP_UPDATE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "updating VM Affinity Group";
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.AffinityGroup;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -78,6 +78,9 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd {
|
|||
description="the ID of the zone")
|
||||
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;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -115,6 +118,10 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd {
|
|||
return zoneId;
|
||||
}
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
}
|
||||
|
||||
public boolean listInReadyState() {
|
||||
Account account = UserContext.current().getCaller();
|
||||
// It is account specific if account is admin type and domainId and accountName are not null
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ public class EnableStaticNatCmd extends BaseCmd{
|
|||
@Override
|
||||
public void execute() throws ResourceUnavailableException{
|
||||
try {
|
||||
boolean result = _rulesService.enableStaticNat(ipAddressId, virtualMachineId, getNetworkId(), false, getVmSecondaryIp());
|
||||
boolean result = _rulesService.enableStaticNat(ipAddressId, virtualMachineId, getNetworkId(), getVmSecondaryIp());
|
||||
if (result) {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
|
|
|
|||
|
|
@ -48,6 +48,9 @@ public class ListNetworksCmd extends BaseListTaggedResourcesCmd {
|
|||
description="the Zone ID of the network")
|
||||
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.TYPE, type=CommandType.STRING, description="the type of the network. Supported values are: Isolated and Shared")
|
||||
private String guestIpType;
|
||||
|
||||
|
|
@ -96,6 +99,10 @@ public class ListNetworksCmd extends BaseListTaggedResourcesCmd {
|
|||
return zoneId;
|
||||
}
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
}
|
||||
|
||||
public String getGuestIpType() {
|
||||
return guestIpType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,6 +93,9 @@ public class CreateGlobalLoadBalancerRuleCmd extends BaseAsyncCreateCmd {
|
|||
}
|
||||
|
||||
public String getStickyMethod() {
|
||||
if (stickyMethod == null) {
|
||||
return "sourceip";
|
||||
}
|
||||
return stickyMethod;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public class ListGlobalLoadBalancerRuleCmd extends BaseListTaggedResourcesCmd {
|
|||
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = GlobalLoadBalancerResponse.class, description = "the ID of the global load balancer rule")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name = ApiConstants.REGION_ID, type = CommandType.UUID, entityType = RegionResponse.class, description = "region ID")
|
||||
@Parameter(name = ApiConstants.REGION_ID, type = CommandType.INTEGER, entityType = RegionResponse.class, description = "region ID")
|
||||
private Integer regionId;
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -163,6 +163,7 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
|
|||
|
||||
@Override
|
||||
public void execute() {
|
||||
s_logger.info("VOLSS: createSnapshotCmd starts:" + System.currentTimeMillis());
|
||||
UserContext.current().setEventDetails("Volume Id: "+getVolumeId());
|
||||
Snapshot snapshot;
|
||||
try {
|
||||
|
|
@ -177,7 +178,6 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
|
|||
} catch (Exception e) {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create snapshot due to an internal error creating snapshot for volume " + volumeId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -58,6 +58,9 @@ public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd {
|
|||
@Parameter(name=ApiConstants.VOLUME_ID, type=CommandType.UUID, entityType = VolumeResponse.class,
|
||||
description="the ID of the disk volume")
|
||||
private Long volumeId;
|
||||
|
||||
@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 ///////////////////////
|
||||
|
|
@ -83,6 +86,10 @@ public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd {
|
|||
return volumeId;
|
||||
}
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import org.apache.log4j.Logger;
|
|||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.server.ResourceTag;
|
||||
import com.cloud.server.ResourceTag.TaggedResourceType;
|
||||
@APICommand(name = "createTags", description = "Creates resource tag(s)", responseObject = SuccessResponse.class, since = "Burbank")
|
||||
@APICommand(name = "createTags", description = "Creates resource tag(s)", responseObject = SuccessResponse.class, since = "4.0.0")
|
||||
public class CreateTagsCmd extends BaseAsyncCmd{
|
||||
public static final Logger s_logger = Logger.getLogger(CreateTagsCmd.class.getName());
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import org.apache.log4j.Logger;
|
|||
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.server.ResourceTag.TaggedResourceType;
|
||||
@APICommand(name = "deleteTags", description = "Deleting resource tag(s)", responseObject = SuccessResponse.class, since = "Burbank")
|
||||
@APICommand(name = "deleteTags", description = "Deleting resource tag(s)", responseObject = SuccessResponse.class, since = "4.0.0")
|
||||
public class DeleteTagsCmd extends BaseAsyncCmd{
|
||||
public static final Logger s_logger = Logger.getLogger(DeleteTagsCmd.class.getName());
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue