Merge branch 'master' into kvm-vnc-listen

Conflicts:
	plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
This commit is contained in:
Wido den Hollander 2013-09-16 10:44:53 +02:00
commit 895c51d0b1
4664 changed files with 1058754 additions and 446551 deletions

8
.gitignore vendored
View File

@ -18,10 +18,7 @@
build/replace.properties
build/build.number
bin/
cloudstack-proprietary/
premium/
.lock-wscript
artifacts/
.waf-*
waf-*
target/
@ -37,7 +34,7 @@ cloud-*.tar.bz2
*.egg-info/
*.prefs
build.number
api.log.*.gz
*.log.*.gz
cloud.log.*.*
unittest
deps/cloud.userlibraries
@ -59,6 +56,7 @@ tools/cli/build/
*.iso
*.tar.gz
*.tgz
.*
target-eclipse
awsapi/modules/*
!.gitignore
@ -83,3 +81,5 @@ debian/*.debhelper
replace.properties.tmp
build-indep-stamp
configure-stamp
*_flymake.js
engine/storage/integration-test/test-output

385
CHANGES
View File

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

View File

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

View File

@ -1,5 +1,5 @@
This document describes how to develop, build, package and install Apache CloudStack
(Incubating). For more information please refer to the project's website:
This document describes how to develop, build, package and install Apache
CloudStack. For more information please refer to:
http://cloudstack.apache.org
@ -10,7 +10,7 @@ Refer to the [wiki](http://cwiki.apache.org/confluence/display/CLOUDSTACK/Index)
for the latest information, especially:
- [Setting up development environment](https://cwiki.apache.org/confluence/display/CLOUDSTACK/Setting+up+CloudStack+Development+Environment) for Apache CloudStack.
- [Building](https://cwiki.apache.org/confluence/display/CLOUDSTACK/Building) Apache CloudStack.
- [Building](https://cwiki.apache.org/confluence/display/CLOUDSTACK/How+to+build+on+master+branch) Apache CloudStack.
## Setting up Development Environment
@ -21,12 +21,12 @@ Install tools and dependencies used for development:
$ yum install git ant ant-devel java-1.6.0-openjdk java-1.6.0-openjdk-devel
mysql mysql-server tomcat6 mkisofs gcc python MySQL-python openssh-clients wget
Set up Maven (3.0.4):
Set up Maven (3.0.5):
$ wget http://www.us.apache.org/dist/maven/maven-3/3.0.4/binaries/apache-maven-3.0.4-bin.tar.gz
$ wget http://www.us.apache.org/dist/maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz
$ cd /usr/local/ # or any path
$ tar -zxvf apache-maven-3.0.4-bin.tar.gz
$ echo export M2_HOME=/usr/local/apache-maven-3.0.4 >> ~/.bashrc # or .zshrc or .profile
$ tar -zxvf apache-maven-3.0.5-bin.tar.gz
$ echo export M2_HOME=/usr/local/apache-maven-3.0.5 >> ~/.bashrc # or .zshrc or .profile
$ echo export PATH=${M2_HOME}/bin:${PATH} >> ~/.bashrc # or .zshrc or .profile
Note: Tomcat 6.0.35 has some known issue with Apache CloudStack, please use Tomcat
@ -77,10 +77,10 @@ Start the MySQL service:
You may get the source code from the repository hosted on Apache:
$ git clone https://git-wip-us.apache.org/repos/asf/cloudstack.git
$ git clone git://git.apache.org/cloudstack.git
Or, you may fork a repository from the official Apache CloudStack mirror by
Apache on [Github](https://github.com/apache/incubator-cloudstack)
Apache on [Github](https://github.com/apache/cloudstack)
To keep yourself updated on a branch, do:
@ -92,7 +92,6 @@ For example, for master:
## Building
Clean and build:
$ mvn clean install -P systemvm,developer
@ -214,6 +213,13 @@ Install needed packages:
$ yum install cloud-agent # agent (kvm)
$ yum install cloud-usage # usage server
## Installing CloudMonkey CLI
CloudMonkey is a CLI for Apache CloudStack. It was earlier in `tools/cli` within
the source code but now it has its own repository:
https://git-wip-us.apache.org/repos/asf?p=cloudstack-cloudmonkey.git
## Notes
If you will be using Xen as your hypervisor, please download [vhd-util](http://download.cloud.com.s3.amazonaws.com/tools/vhd-util)

77
LICENSE
View File

@ -180,70 +180,6 @@ Copyright (c) 2013 The Apache Software Foundation
This distribution contains third party resources.
Within the . directory
licensed under the BSD (3-clause) http://www.opensource.org/licenses/BSD-3-Clause (as follows)
Copyright (c) 2005-2010 Thomas Nagy
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holders nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
from Thomas Nagy http://code.google.com/p/waf/
waf
Within the awsapi directory
licensed under the BSD (3-clause) http://www.opensource.org/licenses/BSD-3-Clause (as follows)
Copyright (c) 2005-2010 Thomas Nagy
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holders nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
from Thomas Nagy http://code.google.com/p/waf/
waf
Within the console-proxy/js directory
licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows)
@ -370,7 +306,7 @@ Within the scripts/vm/hypervisor/xenserver directory
from OpenStack, LLC http://www.openstack.org
swift
Within the tools/appliance/definitions/{devcloud,systemvmtemplate,systemvmtemplate64} directories
Within the tools/appliance/definitions/{devcloud,systemvmtemplate,systemvmtemplate64} directory
licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows)
Copyright (c) 2010-2012 Patrick Debois
@ -524,7 +460,7 @@ Within the ui/lib directory
licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows)
Copyright (c) 2006 - 2011 Jörn Zaefferer
Copyright (c) 2006 - 2011 Jörn Zaefferer
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@ -719,7 +655,7 @@ Within the ui/lib/jquery-ui directory
Within the ui/lib/qunit directory
licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows)
Copyright (c) 2012 John Resig, Jörn Zaefferer
Copyright (c) 2012 John Resig, Jörn Zaefferer
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@ -750,3 +686,10 @@ Within the utils/src/com/cloud/utils/db directory
from Clinton Begin http://code.google.com/p/mybatis/
ScriptRunner.java from http://code.google.com/p/mybatis/
Within the utils/src/org/apache/commons/httpclient/contrib/ssl directory
licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above)
Copyright (c) 2007 The Apache Software Foundation
from The Apache Software Foundation http://www.apache.org/
EasySSLProtocolSocketFactory.java
EasyX509TrustManager.java

View File

@ -1,8 +1,8 @@
Apache CloudStack (Incubating) Version 4.0.0
Apache CloudStack Version 4.2.0
# About Apache CloudStack (Incubating)
# About Apache CloudStack
Apache CloudStack (Incubating) is software designed to deploy
Apache CloudStack is software designed to deploy
and manage large networks of virtual machines, as a highly
available, highly scalable Infrastructure as a Service (IaaS)
cloud computing platform. CloudStack is used by a number of
@ -80,3 +80,5 @@ The following provides more details on the included cryptographic software:
CloudStack has a dependency on Apache WSS4J as part of the AWSAPI implementation.
CloudStack has a dependency on and makes use of JSch - a java SSH2 implementation.

View File

@ -16,4 +16,4 @@
# under the License.
configureSimulator=com.cloud.api.commands.ConfigureSimulator;1
configureSimulator=com.cloud.api.commands.ConfigureSimulatorCmd;1

View File

@ -1,54 +0,0 @@
<?xml version="1.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.
-->
<components-simulator.xml>
<management-server class="com.cloud.server.ManagementServerSimulatorImpl" library="com.cloud.configuration.SimulatorComponentLibrary" extends="components.xml:management-server">
<dao name="Configuration configuration server" class="com.cloud.configuration.dao.ConfigurationDaoImpl">
<param name="premium">true</param>
</dao>
<adapters key="com.cloud.ha.Investigator">
<adapter name="SimpleInvestigator" class="com.cloud.ha.CheckOnAgentInvestigator"/>
<adapter name="PingInvestigator" class="com.cloud.ha.UserVmDomRInvestigator"/>
<adapter name="ManagementIPSysVMInvestigator" class="com.cloud.ha.ManagementIPSystemVMInvestigator"/>
</adapters>
<adapters key="com.cloud.resource.Discoverer">
<adapter name="Simulator Agent" class="com.cloud.resource.SimulatorDiscoverer"/>
<adapter name="XCP Agent" class="com.cloud.hypervisor.xen.discoverer.XcpServerDiscoverer"/>
<adapter name="SecondaryStorage" class="com.cloud.storage.secondary.SecondaryStorageDiscoverer"/>
<adapter name="KVM Agent" class="com.cloud.hypervisor.kvm.discoverer.KvmServerDiscoverer"/>
<adapter name="SecondaryStorage" class="com.cloud.resource.SimulatorSecondaryDiscoverer"/>
</adapters>
<adapters key="com.cloud.hypervisor.HypervisorGuru">
<adapter name="SimulatorGuru" class="com.cloud.simulator.SimulatorGuru"/>
<adapter name="XenServerGuru" class="com.cloud.hypervisor.XenServerGuru"/>
<adapter name="KVMGuru" class="com.cloud.hypervisor.KVMGuru"/>
</adapters>
<adapters key="com.cloud.agent.StartupCommandProcessor">
<adapter name="BasicAgentAuthorizer" class="com.cloud.agent.manager.authn.impl.BasicAgentAuthManager"/>
</adapters>
</management-server>
<configuration-server class="com.cloud.server.ConfigurationServerImpl" extends="components.xml:configuration-server">
<dao name="Configuration configuration server" class="com.cloud.configuration.dao.ConfigurationDaoImpl" singleton="false">
<param name="premium">true</param>
</dao>
</configuration-server>
</components-simulator.xml>

View File

@ -95,6 +95,11 @@ if __name__ == '__main__':
parser.add_option("--prvNic", dest="prvNic", help="Private traffic interface")
parser.add_option("--guestNic", dest="guestNic", help="Guest traffic interface")
old_config = configFileOps("@AGENTSYSCONFDIR@/agent.properties")
bridgeType = old_config.getEntry("network.bridge.type").lower()
if bridgeType:
glbEnv.bridgeType = bridgeType
(options, args) = parser.parse_args()
if options.auto is None:
userInputs = getUserInputs()
@ -104,7 +109,7 @@ if __name__ == '__main__':
glbEnv.pod = userInputs[3]
glbEnv.cluster = userInputs[4]
#generate UUID
glbEnv.uuid = configFileOps("@AGENTSYSCONFDIR@/agent.properties").getEntry("guid")
glbEnv.uuid = old_config.getEntry("guid")
if glbEnv.uuid == "":
glbEnv.uuid = bash("uuidgen").getStdout()
else:

View File

@ -78,14 +78,39 @@ 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
# hypervisor.type=kvm
# set the hypervisor URI. Usually there is no need for changing this
# For KVM: qemu:///system
# For LXC: lxc:///
# hypervisor.uri=qemu:///system
# settings to enable direct networking in libvirt, should not be used
# on hosts that run system vms, values for mode are: private, bridge, vepa
# libvirt.vif.driver=com.cloud.hypervisor.kvm.resource.DirectVifDriver
# network.direct.source.mode=private
# network.direct.device=eth0
# setting to enable the cpu model to kvm guest globally.
# three option:custom,host-model and host-passthrough.
# custom - user custom the CPU model which specified by guest.cpu.model.
# host-model - identify the named CPU model which most closely matches the host,
# and then request additional CPU flags to complete the match. This should give
# close to maximum functionality/performance, which maintaining good
# reliability/compatibility if the guest is migrated to another host with slightly different host CPUs.
# host-passthrough - tell KVM to passthrough the host CPU with no modifications.
# The difference to host-model, instead of just matching feature flags,
# every last detail of the host CPU is matched. This gives absolutely best performance,
# and can be important to some apps which check low level CPU details,
# but it comes at a cost wrt migration. The guest can only be migrated to
# an exactly matching host CPU.
#
# guest.cpu.mode=custom|host-model|host-passthrough
# This param is only valid if guest.cpu.mode=custom,
# for examples:"Conroe" "Penryn", "Nehalem", "Westmere", "pentiumpro" and so
# on,run virsh capabilities for more details.
# guest.cpu.model=

View File

@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
@ -36,26 +36,15 @@
<artifactId>cloud-utils</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>commons-daemon</groupId>
<artifactId>commons-daemon</artifactId>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>generate-resource</id>
@ -107,7 +96,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.5.1</version>
<executions>
<execution>
<id>copy-dependencies</id>

View File

@ -51,8 +51,6 @@ import com.cloud.agent.api.ReadyCommand;
import com.cloud.agent.api.ShutdownCommand;
import com.cloud.agent.api.StartupAnswer;
import com.cloud.agent.api.StartupCommand;
import com.cloud.agent.api.UpgradeAnswer;
import com.cloud.agent.api.UpgradeCommand;
import com.cloud.agent.transport.Request;
import com.cloud.agent.transport.Response;
import com.cloud.exception.AgentControlChannelException;
@ -216,27 +214,6 @@ public class Agent implements HandlerFactory, IAgentControl {
return _resource.getClass().getSimpleName();
}
public void upgradeAgent(final String url, boolean protocol) {
// shell needs to take care of synchronization when multiple-instances demand upgrade
// at the same time
_shell.upgradeAgent(url);
// To stop agent after it has been upgraded, as shell executor may prematurely time out
// tasks if agent is in shutting down process
if (protocol) {
if (_connection != null) {
_connection.stop();
_connection = null;
}
if (_resource != null) {
_resource.stop();
_resource = null;
}
} else {
stop(ShutdownCommand.Update, null);
}
}
public void start() {
if (!_resource.start()) {
s_logger.error("Unable to start the resource: " + _resource.getName());
@ -482,9 +459,6 @@ public class Agent implements HandlerFactory, IAgentControl {
final CronCommand watch = (CronCommand) cmd;
scheduleWatch(link, request, watch.getInterval() * 1000, watch.getInterval() * 1000);
answer = new Answer(cmd, true, null);
} else if (cmd instanceof UpgradeCommand) {
final UpgradeCommand upgrade = (UpgradeCommand) cmd;
answer = upgradeAgent(upgrade.getUpgradeUrl(), upgrade);
} else if (cmd instanceof ShutdownCommand) {
ShutdownCommand shutdown = (ShutdownCommand) cmd;
s_logger.debug("Received shutdownCommand, due to: " + shutdown.getReason());
@ -649,25 +623,6 @@ public class Agent implements HandlerFactory, IAgentControl {
}
}
protected UpgradeAnswer upgradeAgent(final String url, final UpgradeCommand cmd) {
try {
upgradeAgent(url, cmd == null);
return null;
} catch (final Exception e) {
s_logger.error("Unable to run this agent because we couldn't complete the upgrade process.", e);
if (cmd != null) {
final StringWriter writer = new StringWriter();
writer.append(e.getMessage());
writer.append("===>Stack<===");
e.printStackTrace(new PrintWriter(writer));
return new UpgradeAnswer(cmd, writer.toString());
}
System.exit(3);
return null;
}
}
public synchronized void setLastPingResponseTime() {
_lastPingResponseTime = System.currentTimeMillis();
}

View File

@ -24,8 +24,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.HttpURLConnection;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
@ -38,18 +36,18 @@ import java.util.UUID;
import javax.naming.ConfigurationException;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.daemon.Daemon;
import org.apache.commons.daemon.DaemonContext;
import org.apache.commons.daemon.DaemonInitException;
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;
import com.cloud.agent.dao.StorageComponent;
import com.cloud.agent.dao.impl.PropertiesStorage;
import com.cloud.host.Host;
import com.cloud.resource.ServerResource;
import com.cloud.utils.LogUtils;
import com.cloud.utils.NumbersUtil;
@ -60,7 +58,7 @@ import com.cloud.utils.backoff.impl.ConstantTimeBackoff;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.script.Script;
public class AgentShell implements IAgentShell {
public class AgentShell implements IAgentShell, Daemon {
private static final Logger s_logger = Logger.getLogger(AgentShell.class
.getName());
private static final MultiThreadedHttpConnectionManager s_httpClientManager = new MultiThreadedHttpConnectionManager();
@ -81,9 +79,9 @@ public class AgentShell implements IAgentShell {
private int _nextAgentId = 1;
private volatile boolean _exit = false;
private int _pingRetries;
private Thread _consoleProxyMain = null;
private final List<Agent> _agents = new ArrayList<Agent>();
public AgentShell() {
}
@ -174,91 +172,6 @@ public class AgentShell implements IAgentShell {
_storage.persist(name, value);
}
@Override
public void upgradeAgent(final String url) {
s_logger.info("Updating agent with binary from " + url);
synchronized (this) {
final Class<?> c = this.getClass();
String path = c.getResource(c.getSimpleName() + ".class")
.toExternalForm();
final int begin = path.indexOf(File.separator);
int end = path.lastIndexOf("!");
end = path.lastIndexOf(File.separator, end);
path = path.substring(begin, end);
s_logger.debug("Current binaries reside at " + path);
File file = null;
try {
file = File.createTempFile("agent-",
"-" + Long.toString(new Date().getTime()));
wget(url, file);
} catch (final IOException e) {
s_logger.warn(
"Exception while downloading agent update package, ", e);
throw new CloudRuntimeException("Unable to update from " + url
+ ", exception:" + e.getMessage(), e);
}
if (s_logger.isDebugEnabled()) {
s_logger.debug("Unzipping " + file.getAbsolutePath() + " to "
+ path);
}
final Script unzip = new Script("unzip", 120000, s_logger);
unzip.add("-o", "-q"); // overwrite and quiet
unzip.add(file.getAbsolutePath());
unzip.add("-d", path);
final String result = unzip.execute();
if (result != null) {
throw new CloudRuntimeException(
"Unable to unzip the retrieved file: " + result);
}
if (s_logger.isDebugEnabled()) {
s_logger.debug("Closing the connection to the management server");
}
}
if (s_logger.isDebugEnabled()) {
s_logger.debug("Exiting to start the new agent.");
}
System.exit(ExitStatus.Upgrade.value());
}
public static void wget(String url, File file) throws IOException {
final HttpClient client = new HttpClient(s_httpClientManager);
final GetMethod method = new GetMethod(url);
int response;
response = client.executeMethod(method);
if (response != HttpURLConnection.HTTP_OK) {
method.releaseConnection();
s_logger.warn("Retrieving from " + url + " gives response code: "
+ response);
throw new CloudRuntimeException("Unable to download from " + url
+ ". Response code is " + response);
}
final InputStream is = method.getResponseBodyAsStream();
s_logger.debug("Downloading content into " + file.getAbsolutePath());
final FileOutputStream fos = new FileOutputStream(file);
byte[] buffer = new byte[4096];
int len = 0;
while ((len = is.read(buffer)) > 0)
fos.write(buffer, 0, len);
fos.close();
try {
is.close();
} catch (IOException e) {
s_logger.warn("Exception while closing download stream from "
+ url + ", ", e);
}
method.releaseConnection();
}
private void loadProperties() throws ConfigurationException {
final File file = PropertiesUtil.findConfigFile("agent.properties");
if (file == null) {
@ -373,11 +286,22 @@ public class AgentShell implements IAgentShell {
throw new ConfigurationException("Unable to find the guid");
}
_guid = UUID.randomUUID().toString();
_properties.setProperty("guid", _guid);
}
return true;
}
@Override
public void init(DaemonContext dc) throws DaemonInitException {
s_logger.debug("Initializing AgentShell from JSVC");
try {
init(dc.getArguments());
} catch (ConfigurationException ex) {
throw new DaemonInitException("Initialization failed", ex);
}
}
public void init(String[] args) throws ConfigurationException {
// PropertiesUtil is used both in management server and agent packages,
@ -403,11 +327,13 @@ public class AgentShell implements IAgentShell {
loadProperties();
parseCommand(args);
List<String> properties = Collections.list((Enumeration<String>)_properties.propertyNames());
for (String property:properties){
s_logger.debug("Found property: " + property);
if (s_logger.isDebugEnabled()) {
List<String> properties = Collections.list((Enumeration<String>)_properties.propertyNames());
for (String property:properties){
s_logger.debug("Found property: " + property);
}
}
s_logger.info("Defaulting to using properties file for storage");
_storage = new PropertiesStorage();
_storage.configure("Storage", new HashMap<String, Object>());
@ -435,71 +361,6 @@ public class AgentShell implements IAgentShell {
launchAgentFromTypeInfo();
}
private boolean needConsoleProxy() {
for (Agent agent : _agents) {
if (agent.getResource().getType().equals(Host.Type.ConsoleProxy)
|| agent.getResource().getType().equals(Host.Type.Routing))
return true;
}
return false;
}
private int getConsoleProxyPort() {
int port = NumbersUtil.parseInt(
getProperty(null, "consoleproxy.httpListenPort"), 443);
return port;
}
private void openPortWithIptables(int port) {
// TODO
}
private void launchConsoleProxy() throws ConfigurationException {
if (!needConsoleProxy()) {
if (s_logger.isInfoEnabled())
s_logger.info("Storage only agent, no need to start console proxy on it");
return;
}
int port = getConsoleProxyPort();
openPortWithIptables(port);
_consoleProxyMain = new Thread(new Runnable() {
@Override
public void run() {
try {
Class<?> consoleProxyClazz = Class.forName("com.cloud.consoleproxy.ConsoleProxy");
try {
Method method = consoleProxyClazz.getMethod("start",
Properties.class);
method.invoke(null, _properties);
} catch (SecurityException e) {
s_logger.error("Unable to launch console proxy due to SecurityException");
System.exit(ExitStatus.Error.value());
} catch (NoSuchMethodException e) {
s_logger.error("Unable to launch console proxy due to NoSuchMethodException");
System.exit(ExitStatus.Error.value());
} catch (IllegalArgumentException e) {
s_logger.error("Unable to launch console proxy due to IllegalArgumentException");
System.exit(ExitStatus.Error.value());
} catch (IllegalAccessException e) {
s_logger.error("Unable to launch console proxy due to IllegalAccessException");
System.exit(ExitStatus.Error.value());
} catch (InvocationTargetException e) {
s_logger.error("Unable to launch console proxy due to InvocationTargetException");
System.exit(ExitStatus.Error.value());
}
} catch (final ClassNotFoundException e) {
s_logger.error("Unable to launch console proxy due to ClassNotFoundException");
System.exit(ExitStatus.Error.value());
}
}
}, "Console-Proxy-Main");
_consoleProxyMain.setDaemon(true);
_consoleProxyMain.start();
}
private void launchAgentFromClassInfo(String resourceClassNames)
throws ConfigurationException {
String[] names = resourceClassNames.split("\\|");
@ -592,14 +453,6 @@ public class AgentShell implements IAgentShell {
launchAgent();
//
// For both KVM & Xen-Server hypervisor, we have switched to
// VM-based console proxy solution, disable launching
// of console proxy here
//
// launchConsoleProxy();
//
try {
while (!_exit)
Thread.sleep(1000);
@ -619,9 +472,6 @@ public class AgentShell implements IAgentShell {
public void stop() {
_exit = true;
if (_consoleProxyMain != null) {
_consoleProxyMain.interrupt();
}
}
public void destroy() {
@ -630,6 +480,7 @@ public class AgentShell implements IAgentShell {
public static void main(String[] args) {
try {
s_logger.debug("Initializing AgentShell from main");
AgentShell shell = new AgentShell();
shell.init(args);
shell.start();
@ -637,4 +488,5 @@ public class AgentShell implements IAgentShell {
System.out.println(e.getMessage());
}
}
}

View File

@ -50,7 +50,5 @@ public interface IAgentShell {
public int getPingRetries();
public void upgradeAgent(final String url);
public String getVersion();
}

View File

@ -1,504 +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.agent;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import javax.naming.ConfigurationException;
import org.apache.log4j.Logger;
import com.cloud.agent.Agent.ExitStatus;
import com.cloud.agent.api.Command;
import com.cloud.agent.api.StartupVMMAgentCommand;
import com.cloud.agent.dao.StorageComponent;
import com.cloud.agent.dao.impl.PropertiesStorage;
import com.cloud.agent.transport.Request;
import com.cloud.resource.ServerResource;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.PropertiesUtil;
import com.cloud.utils.backoff.BackoffAlgorithm;
import com.cloud.utils.backoff.impl.ConstantTimeBackoff;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.net.MacAddress;
import com.cloud.utils.nio.HandlerFactory;
import com.cloud.utils.nio.Link;
import com.cloud.utils.nio.NioServer;
import com.cloud.utils.nio.Task;
/**
* Implementation of agent shell to run the agents on System Center Virtual Machine manager
**/
public class VmmAgentShell implements IAgentShell, HandlerFactory {
private static final Logger s_logger = Logger.getLogger(VmmAgentShell.class.getName());
private final Properties _properties = new Properties();
private final Map<String, Object> _cmdLineProperties = new HashMap<String, Object>();
private StorageComponent _storage;
private BackoffAlgorithm _backoff;
private String _version;
private String _zone;
private String _pod;
private String _cluster;
private String _host;
private String _privateIp;
private int _port;
private int _proxyPort;
private int _workers;
private String _guid;
static private NioServer _connection;
static private int _listenerPort=9000;
private int _nextAgentId = 1;
private volatile boolean _exit = false;
private int _pingRetries;
private final Thread _consoleProxyMain = null;
private final List<Agent> _agents = new ArrayList<Agent>();
public VmmAgentShell() {
}
@Override
public Properties getProperties() {
return _properties;
}
@Override
public BackoffAlgorithm getBackoffAlgorithm() {
return _backoff;
}
@Override
public int getPingRetries() {
return _pingRetries;
}
@Override
public String getZone() {
return _zone;
}
@Override
public String getPod() {
return _pod;
}
@Override
public String getHost() {
return _host;
}
@Override
public String getPrivateIp() {
return _privateIp;
}
@Override
public int getPort() {
return _port;
}
@Override
public int getProxyPort() {
return _proxyPort;
}
@Override
public int getWorkers() {
return _workers;
}
@Override
public String getGuid() {
return _guid;
}
@Override
public void upgradeAgent(String url) {
// TODO Auto-generated method stub
}
@Override
public String getVersion() {
return _version;
}
@Override
public Map<String, Object> getCmdLineProperties() {
// TODO Auto-generated method stub
return _cmdLineProperties;
}
public String getProperty(String prefix, String name) {
if(prefix != null)
return _properties.getProperty(prefix + "." + name);
return _properties.getProperty(name);
}
@Override
public String getPersistentProperty(String prefix, String name) {
if(prefix != null)
return _storage.get(prefix + "." + name);
return _storage.get(name);
}
@Override
public void setPersistentProperty(String prefix, String name, String value) {
if(prefix != null)
_storage.persist(prefix + "." + name, value);
else
_storage.persist(name, value);
}
private void loadProperties() throws ConfigurationException {
final File file = PropertiesUtil.findConfigFile("agent.properties");
if (file == null) {
throw new ConfigurationException("Unable to find agent.properties.");
}
s_logger.info("agent.properties found at " + file.getAbsolutePath());
try {
_properties.load(new FileInputStream(file));
} catch (final FileNotFoundException ex) {
throw new CloudRuntimeException("Cannot find the file: " + file.getAbsolutePath(), ex);
} catch (final IOException ex) {
throw new CloudRuntimeException("IOException in reading " + file.getAbsolutePath(), ex);
}
}
protected boolean parseCommand(final String[] args) throws ConfigurationException {
String host = null;
String workers = null;
String port = null;
String zone = null;
String pod = null;
String guid = null;
for (int i = 0; i < args.length; i++) {
final String[] tokens = args[i].split("=");
if (tokens.length != 2) {
System.out.println("Invalid Parameter: " + args[i]);
continue;
}
// save command line properties
_cmdLineProperties.put(tokens[0], tokens[1]);
if (tokens[0].equalsIgnoreCase("port")) {
port = tokens[1];
} else if (tokens[0].equalsIgnoreCase("threads")) {
workers = tokens[1];
} else if (tokens[0].equalsIgnoreCase("host")) {
host = tokens[1];
} else if(tokens[0].equalsIgnoreCase("zone")) {
zone = tokens[1];
} else if(tokens[0].equalsIgnoreCase("pod")) {
pod = tokens[1];
} else if(tokens[0].equalsIgnoreCase("guid")) {
guid = tokens[1];
} else if(tokens[0].equalsIgnoreCase("eth1ip")) {
_privateIp = tokens[1];
}
}
if (port == null) {
port = getProperty(null, "port");
}
_port = NumbersUtil.parseInt(port, 8250);
_proxyPort = NumbersUtil.parseInt(getProperty(null, "consoleproxy.httpListenPort"), 443);
if (workers == null) {
workers = getProperty(null, "workers");
}
_workers = NumbersUtil.parseInt(workers, 5);
if (host == null) {
host = getProperty(null, "host");
}
if (host == null) {
host = "localhost";
}
_host = host;
if(zone != null)
_zone = zone;
else
_zone = getProperty(null, "zone");
if (_zone == null || (_zone.startsWith("@") && _zone.endsWith("@"))) {
_zone = "default";
}
if(pod != null)
_pod = pod;
else
_pod = getProperty(null, "pod");
if (_pod == null || (_pod.startsWith("@") && _pod.endsWith("@"))) {
_pod = "default";
}
if (_host == null || (_host.startsWith("@") && _host.endsWith("@"))) {
throw new ConfigurationException("Host is not configured correctly: " + _host);
}
final String retries = getProperty(null, "ping.retries");
_pingRetries = NumbersUtil.parseInt(retries, 5);
String value = getProperty(null, "developer");
boolean developer = Boolean.parseBoolean(value);
if(guid != null)
_guid = guid;
else
_guid = getProperty(null, "guid");
if (_guid == null) {
if (!developer) {
throw new ConfigurationException("Unable to find the guid");
}
_guid = MacAddress.getMacAddress().toString(":");
}
return true;
}
private void launchAgentFromTypeInfo() throws ConfigurationException {
String typeInfo = getProperty(null, "type");
if (typeInfo == null) {
s_logger.error("Unable to retrieve the type");
throw new ConfigurationException("Unable to retrieve the type of this agent.");
}
s_logger.trace("Launching agent based on type=" + typeInfo);
}
private void launchAgent() throws ConfigurationException {
String resourceClassNames = getProperty(null, "resource");
s_logger.trace("resource=" + resourceClassNames);
if(resourceClassNames != null) {
launchAgentFromClassInfo(resourceClassNames);
return;
}
launchAgentFromTypeInfo();
}
private void init(String[] args) throws ConfigurationException{
final Class<?> c = this.getClass();
_version = c.getPackage().getImplementationVersion();
if (_version == null) {
throw new CloudRuntimeException("Unable to find the implementation version of this agent");
}
s_logger.info("Implementation Version is " + _version);
parseCommand(args);
s_logger.info("Defaulting to using properties file for storage");
_storage = new PropertiesStorage();
_storage.configure("Storage", new HashMap<String, Object>());
// merge with properties from command line to let resource access command line parameters
for(Map.Entry<String, Object> cmdLineProp : getCmdLineProperties().entrySet()) {
_properties.put(cmdLineProp.getKey(), cmdLineProp.getValue());
}
s_logger.info("Defaulting to the constant time backoff algorithm");
_backoff = new ConstantTimeBackoff();
_backoff.configure("ConstantTimeBackoff", new HashMap<String, Object>());
}
private void launchAgentFromClassInfo(String resourceClassNames) throws ConfigurationException {
String[] names = resourceClassNames.split("\\|");
for(String name: names) {
Class<?> impl;
try {
impl = Class.forName(name);
final Constructor<?> constructor = impl.getDeclaredConstructor();
constructor.setAccessible(true);
ServerResource resource = (ServerResource)constructor.newInstance();
launchAgent(getNextAgentId(), resource);
} catch (final ClassNotFoundException e) {
throw new ConfigurationException("Resource class not found: " + name);
} catch (final SecurityException e) {
throw new ConfigurationException("Security excetion when loading resource: " + name);
} catch (final NoSuchMethodException e) {
throw new ConfigurationException("Method not found excetion when loading resource: " + name);
} catch (final IllegalArgumentException e) {
throw new ConfigurationException("Illegal argument excetion when loading resource: " + name);
} catch (final InstantiationException e) {
throw new ConfigurationException("Instantiation excetion when loading resource: " + name);
} catch (final IllegalAccessException e) {
throw new ConfigurationException("Illegal access exception when loading resource: " + name);
} catch (final InvocationTargetException e) {
throw new ConfigurationException("Invocation target exception when loading resource: " + name);
}
}
}
private void launchAgent(int localAgentId, ServerResource resource) throws ConfigurationException {
// we don't track agent after it is launched for now
Agent agent = new Agent(this, localAgentId, resource);
_agents.add(agent);
agent.start();
}
public synchronized int getNextAgentId() {
return _nextAgentId++;
}
private void run(String[] args) {
try {
System.setProperty("java.net.preferIPv4Stack","true");
loadProperties();
init(args);
String instance = getProperty(null, "instance");
if (instance == null) {
instance = "";
} else {
instance += ".";
}
// TODO need to do this check. For Agentshell running on windows needs different approach
//final String run = "agent." + instance + "pid";
//s_logger.debug("Checking to see if " + run + "exists.");
//ProcessUtil.pidCheck(run);
// TODO: For Hyper-V agent.properties need to be revamped to support multiple agents
// corresponding to multiple clusters but running on a SCVMM host
// read the persistent storage and launch the agents
//launchAgent();
// FIXME get rid of this approach of agent listening for boot strap commands from the management server
// now listen for bootstrap request from the management server and launch agents
_connection = new NioServer("VmmAgentShell", _listenerPort, 1, this);
_connection.start();
s_logger.info("SCVMM agent is listening on port " +_listenerPort + " for bootstrap command from management server");
while(_connection.isRunning());
} catch(final ConfigurationException e) {
s_logger.error("Unable to start agent: " + e.getMessage());
System.out.println("Unable to start agent: " + e.getMessage());
System.exit(ExitStatus.Configuration.value());
} catch (final Exception e) {
s_logger.error("Unable to start agent: ", e);
System.out.println("Unable to start agent: " + e.getMessage());
System.exit(ExitStatus.Error.value());
}
}
@Override
public Task create(com.cloud.utils.nio.Task.Type type, Link link,
byte[] data) {
return new AgentBootStrapHandler(type, link, data);
}
public void stop() {
_exit = true;
if(_consoleProxyMain != null) {
_consoleProxyMain.interrupt();
}
}
public static void main(String[] args) {
VmmAgentShell shell = new VmmAgentShell();
Runtime.getRuntime().addShutdownHook(new ShutdownThread(shell));
shell.run(args);
}
// class to handle the bootstrap command from the management server
private class AgentBootStrapHandler extends Task {
public AgentBootStrapHandler(Task.Type type, Link link, byte[] data) {
super(type, link, data);
}
@Override
protected void doTask(Task task) throws Exception {
final Type type = task.getType();
s_logger.info("recieved task of type "+ type.toString() +" to handle in BootStrapTakHandler");
if (type == Task.Type.DATA)
{
final byte[] data = task.getData();
final Request request = Request.parse(data);
final Command cmd = request.getCommand();
if (cmd instanceof StartupVMMAgentCommand) {
StartupVMMAgentCommand vmmCmd = (StartupVMMAgentCommand) cmd;
_zone = Long.toString(vmmCmd.getDataCenter());
_cmdLineProperties.put("zone", _zone);
_pod = Long.toString(vmmCmd.getPod());
_cmdLineProperties.put("pod", _pod);
_cluster = vmmCmd.getClusterName();
_cmdLineProperties.put("cluster", _cluster);
_guid = vmmCmd.getGuid();
_cmdLineProperties.put("guid", _guid);
_host = vmmCmd.getManagementServerIP();
_port = NumbersUtil.parseInt(vmmCmd.getport(), 8250);
s_logger.info("Recieved boot strap command from management server with parameters " +
" Zone:"+ _zone + " "+
" Cluster:"+ _cluster + " "+
" pod:"+_pod + " "+
" host:"+ _host +" "+
" port:"+_port);
launchAgentFromClassInfo("com.cloud.hypervisor.hyperv.resource.HypervResource");
// TODO: persist the info in agent.properties for agent restarts
}
}
}
}
private static class ShutdownThread extends Thread {
VmmAgentShell _shell;
public ShutdownThread(VmmAgentShell shell) {
this._shell = shell;
}
@Override
public void run() {
_shell.stop();
}
}
}

View File

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

View File

@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
@ -34,12 +34,32 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${cs.gson.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-framework-db</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-framework-config</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -23,6 +23,7 @@ public class Answer extends Command {
protected String details;
protected Answer() {
this(null);
}
public Answer(Command command) {

View File

@ -1,99 +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.agent.api;
import com.cloud.storage.Storage.StoragePoolType;
public class AttachVolumeCommand extends Command {
boolean attach;
String vmName;
StoragePoolType pooltype;
String poolUuid;
String volumeFolder;
String volumePath;
String volumeName;
Long deviceId;
String chainInfo;
protected AttachVolumeCommand() {
}
public AttachVolumeCommand(boolean attach, String vmName, StoragePoolType pooltype, String volumeFolder, String volumePath, String volumeName, Long deviceId, String chainInfo) {
this.attach = attach;
this.vmName = vmName;
this.pooltype = pooltype;
this.volumeFolder = volumeFolder;
this.volumePath = volumePath;
this.volumeName = volumeName;
this.deviceId = deviceId;
this.chainInfo = chainInfo;
}
@Override
public boolean executeInSequence() {
return true;
}
public boolean getAttach() {
return attach;
}
public String getVmName() {
return vmName;
}
public StoragePoolType getPooltype() {
return pooltype;
}
public void setPooltype(StoragePoolType pooltype) {
this.pooltype = pooltype;
}
public String getVolumeFolder() {
return volumeFolder;
}
public String getVolumePath() {
return volumePath;
}
public String getVolumeName() {
return volumeName;
}
public Long getDeviceId() {
return deviceId;
}
public void setDeviceId(Long deviceId) {
this.deviceId = deviceId;
}
public String getPoolUuid() {
return poolUuid;
}
public void setPoolUuid(String poolUuid) {
this.poolUuid = poolUuid;
}
public String getChainInfo() {
return chainInfo;
}
}

View File

@ -1,75 +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.agent.api;
import java.util.List;
public class CleanupSnapshotBackupCommand extends Command {
private String secondaryStoragePoolURL;
private Long dcId;
private Long accountId;
private Long volumeId;
private List<String> validBackupUUIDs;
protected CleanupSnapshotBackupCommand() {
}
/*
* @param secondaryStoragePoolURL This is what shows up in the UI when you click on Secondary storage.
* In the code, it is present as: In the vmops.host_details table, there is a field mount.parent. This is the value of that field
* If you have better ideas on how to get it, you are welcome.
* @param validBackupUUID The VHD which are valid
*/
public CleanupSnapshotBackupCommand(String secondaryStoragePoolURL,
Long dcId,
Long accountId,
Long volumeId,
List<String> validBackupUUIDs)
{
this.secondaryStoragePoolURL = secondaryStoragePoolURL;
this.dcId = dcId;
this.accountId = accountId;
this.volumeId = volumeId;
this.validBackupUUIDs = validBackupUUIDs;
}
public String getSecondaryStoragePoolURL() {
return secondaryStoragePoolURL;
}
public Long getDcId() {
return dcId;
}
public Long getAccountId() {
return accountId;
}
public Long getVolumeId() {
return volumeId;
}
public List<String> getValidBackupUUIDs() {
return validBackupUUIDs;
}
@Override
public boolean executeInSequence() {
return false;
}
}

View File

@ -27,6 +27,10 @@ import com.cloud.agent.api.LogLevel.Log4jLevel;
*/
public abstract class Command {
public static enum OnError {
Continue, Stop
}
public static final String HYPERVISOR_TYPE = "hypervisorType";
// allow command to carry over hypervisor or other environment related context info

View File

@ -1,94 +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.agent.api;
import com.cloud.agent.api.LogLevel.Log4jLevel;
import com.cloud.agent.api.to.S3TO;
import com.cloud.agent.api.to.SwiftTO;
/**
* This command encapsulates a primitive operation which enables coalescing the backed up VHD snapshots on the secondary server
* This currently assumes that the secondary storage are mounted on the XenServer.
*/
public class DeleteSnapshotBackupCommand extends SnapshotCommand {
@LogLevel(Log4jLevel.Off)
private SwiftTO swift;
private S3TO s3;
private Boolean all;
public SwiftTO getSwift() {
return swift;
}
public Boolean isAll() {
return all;
}
public void setAll(Boolean all) {
this.all = all;
}
public void setSwift(SwiftTO swift) {
this.swift = swift;
}
public S3TO getS3() {
return s3;
}
protected DeleteSnapshotBackupCommand() {
}
/**
* Given 2 VHD files on the secondary storage which are linked in a parent chain as follows:
* backupUUID = parent(childUUID)
* It gets another VHD
* previousBackupVHD = parent(backupUUID)
*
* And
* 1) it coalesces backupUuid into its parent.
* 2) It deletes the VHD file corresponding to backupUuid
* 3) It sets the parent VHD of childUUID to that of previousBackupUuid
*
* It takes care of the cases when
* 1) childUUID is null. - Step 3 is not done.
* 2) previousBackupUUID is null
* - Merge childUUID into its parent backupUUID
* - Set the UUID of the resultant VHD to childUUID
* - Essentially we are deleting the oldest VHD file and setting the current oldest VHD to childUUID
*
* @param volumeName The name of the volume whose snapshot was taken (something like i-3-SV-ROOT)
* @param secondaryStoragePoolURL This is what shows up in the UI when you click on Secondary storage.
* In the code, it is present as: In the vmops.host_details table, there is a field mount.parent. This is the value of that field
* If you have better ideas on how to get it, you are welcome.
* @param backupUUID The VHD which has to be deleted
* @param childUUID The child VHD file of the backup whose parent is reset to its grandparent.
*/
public DeleteSnapshotBackupCommand(SwiftTO swift,
S3TO s3,
String secondaryStoragePoolURL,
Long dcId,
Long accountId,
Long volumeId,
String backupUUID, Boolean all)
{
super(null, secondaryStoragePoolURL, backupUUID, null, dcId, accountId, volumeId);
setSwift(swift);
this.s3 = s3;
setAll(all);
}
}

View File

@ -1,106 +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.agent.api;
import com.cloud.agent.api.to.S3TO;
public class DeleteTemplateFromS3Command extends Command {
private S3TO s3;
private Long templateId;
private Long accountId;
protected DeleteTemplateFromS3Command() {
super();
}
public DeleteTemplateFromS3Command(final S3TO s3, final Long accountId,
final Long templateId) {
super();
this.s3 = s3;
this.accountId = accountId;
this.templateId = templateId;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((accountId == null) ? 0 : accountId.hashCode());
result = prime * result + ((s3 == null) ? 0 : s3.hashCode());
result = prime * result
+ ((templateId == null) ? 0 : templateId.hashCode());
return result;
}
@Override
public boolean equals(Object thatObject) {
if (this == thatObject) {
return true;
}
if (thatObject == null) {
return false;
}
if (getClass() != thatObject.getClass()) {
return false;
}
final DeleteTemplateFromS3Command thatCommand = (DeleteTemplateFromS3Command) thatObject;
if (!(accountId == thatCommand.accountId)
|| (this.accountId != null && this.accountId
.equals(thatCommand.accountId))) {
return false;
}
if (!(templateId == thatCommand.templateId)
|| (this.templateId != null && this.templateId
.equals(thatCommand.templateId))) {
return false;
}
return true;
}
public S3TO getS3() {
return s3;
}
public Long getTemplateId() {
return templateId;
}
public Long getAccountId() {
return accountId;
}
@Override
public boolean executeInSequence() {
return true;
}
}

View File

@ -1,61 +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.agent.api;
import com.cloud.agent.api.to.S3TO;
public class DownloadSnapshotFromS3Command extends SnapshotCommand {
private S3TO s3;
private String parent;
protected DownloadSnapshotFromS3Command() {
super();
}
public DownloadSnapshotFromS3Command(S3TO s3, String parent,
String secondaryStorageUrl, Long dcId, Long accountId,
Long volumeId, String backupUuid, int wait) {
super(null, secondaryStorageUrl, backupUuid, "", dcId, accountId,
volumeId);
this.s3 = s3;
this.parent = parent;
setWait(wait);
}
public S3TO getS3() {
return s3;
}
public void setS3(S3TO s3) {
this.s3 = s3;
}
public String getParent() {
return parent;
}
public void setParent(String parent) {
this.parent = parent;
}
}

View File

@ -1,66 +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.agent.api;
import com.cloud.agent.api.to.S3TO;
public final class DownloadTemplateFromS3ToSecondaryStorageCommand extends Command {
private final S3TO s3;
private final Long accountId;
private final Long templateId;
private final String storagePath;
public DownloadTemplateFromS3ToSecondaryStorageCommand(final S3TO s3,
final Long accountId, final Long templateId,
final String storagePath, final int wait) {
super();
this.s3 = s3;
this.accountId = accountId;
this.templateId = templateId;
this.storagePath = storagePath;
setWait(wait);
}
public S3TO getS3() {
return this.s3;
}
public Long getAccountId() {
return this.accountId;
}
public Long getTemplateId() {
return this.templateId;
}
public String getStoragePath() {
return this.storagePath;
}
@Override
public boolean executeInSequence() {
return true;
}
}

View File

@ -0,0 +1,121 @@
// 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;
import java.net.URI;
import com.cloud.utils.net.NetUtils;
public class PvlanSetupCommand extends Command {
public enum Type {
DHCP,
VM
}
private String op;
private String primary;
private String isolated;
private String vmMac;
private String dhcpName;
private String dhcpMac;
private String dhcpIp;
private Type type;
private String networkTag;
protected PvlanSetupCommand() {}
protected PvlanSetupCommand(Type type, String op, URI uri, String networkTag)
{
this.type = type;
this.op = op;
this.primary = NetUtils.getPrimaryPvlanFromUri(uri);
this.isolated = NetUtils.getIsolatedPvlanFromUri(uri);
this.networkTag = networkTag;
}
static public PvlanSetupCommand createDhcpSetup(String op, URI uri, String networkTag, String dhcpName, String dhcpMac, String dhcpIp)
{
PvlanSetupCommand cmd = new PvlanSetupCommand(Type.DHCP, op, uri, networkTag);
cmd.setDhcpName(dhcpName);
cmd.setDhcpMac(dhcpMac);
cmd.setDhcpIp(dhcpIp);
return cmd;
}
static public PvlanSetupCommand createVmSetup(String op, URI uri, String networkTag, String vmMac)
{
PvlanSetupCommand cmd = new PvlanSetupCommand(Type.VM, op, uri, networkTag);
cmd.setVmMac(vmMac);
return cmd;
}
@Override
public boolean executeInSequence() {
return true;
}
public String getOp() {
return op;
}
public String getPrimary() {
return primary;
}
public String getIsolated() {
return isolated;
}
public String getVmMac() {
return vmMac;
}
protected void setVmMac(String vmMac) {
this.vmMac = vmMac;
}
public String getDhcpMac() {
return dhcpMac;
}
protected void setDhcpMac(String dhcpMac) {
this.dhcpMac = dhcpMac;
}
public String getDhcpIp() {
return dhcpIp;
}
protected void setDhcpIp(String dhcpIp) {
this.dhcpIp = dhcpIp;
}
public Type getType() {
return type;
}
public String getDhcpName() {
return dhcpName;
}
public void setDhcpName(String dhcpName) {
this.dhcpName = dhcpName;
}
public String getNetworkTag() {
return networkTag;
}
}

View File

@ -1,121 +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.agent.api;
import com.cloud.agent.api.to.S3TO;
public class UploadTemplateToS3FromSecondaryStorageCommand extends Command {
private final S3TO s3;
private final String storagePath;
private final Long dataCenterId;
private final Long accountId;
private final Long templateId;
public UploadTemplateToS3FromSecondaryStorageCommand(final S3TO s3,
final String storagePath, final Long dataCenterId, final Long accountId,
final Long templateId) {
super();
this.s3 = s3;
this.storagePath = storagePath;
this.dataCenterId = dataCenterId;
this.accountId = accountId;
this.templateId = templateId;
}
@Override
public boolean executeInSequence() {
return false;
}
@Override
public boolean equals(final Object thatObject) {
if (this == thatObject) {
return true;
}
if (thatObject == null || getClass() != thatObject.getClass()) {
return false;
}
final UploadTemplateToS3FromSecondaryStorageCommand thatCommand =
(UploadTemplateToS3FromSecondaryStorageCommand) thatObject;
if (this.accountId != null ? !this.accountId.equals(thatCommand
.accountId) : thatCommand.accountId != null) {
return false;
}
if (this.dataCenterId != null ? !this.dataCenterId.equals(thatCommand
.dataCenterId) : thatCommand.dataCenterId != null) {
return false;
}
if (this.s3 != null ? !this.s3.equals(thatCommand.s3) : thatCommand.s3 != null) {
return false;
}
if (this.storagePath != null ? !this.storagePath.equals(thatCommand
.storagePath) : thatCommand.storagePath != null) {
return false;
}
if (this.templateId != null ? !this.templateId.equals(thatCommand.templateId) :
thatCommand.templateId != null) {
return false;
}
return true;
}
@Override
public int hashCode() {
int result = this.s3 != null ? this.s3.hashCode() : 0;
result = 31 * result + (this.storagePath != null ? this.storagePath.hashCode() : 0);
result = 31 * result + (this.dataCenterId != null ? this.dataCenterId.hashCode() : 0);
result = 31 * result + (this.accountId != null ? this.accountId.hashCode() : 0);
result = 31 * result + (this.templateId != null ? this.templateId.hashCode() : 0);
return result;
}
public S3TO getS3() {
return this.s3;
}
public String getStoragePath() {
return this.storagePath;
}
public Long getDataCenterId() {
return this.dataCenterId;
}
public Long getAccountId() {
return this.accountId;
}
public Long getTemplateId() {
return this.templateId;
}
}

View File

@ -1,60 +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.agent.api;
import com.cloud.agent.api.LogLevel.Log4jLevel;
import com.cloud.agent.api.to.SwiftTO;
/**
* This currently assumes that both primary and secondary storage are mounted on the XenServer.
*/
public class downloadSnapshotFromSwiftCommand extends SnapshotCommand {
@LogLevel(Log4jLevel.Off)
private SwiftTO _swift;
private String _parent;
protected downloadSnapshotFromSwiftCommand() {
}
public downloadSnapshotFromSwiftCommand(SwiftTO swift, String secondaryStorageUrl, Long dcId, Long accountId, Long volumeId, String parent, String BackupUuid, int wait) {
super(null, secondaryStorageUrl, BackupUuid, "", dcId, accountId, volumeId);
setParent(parent);
setSwift(swift);
setWait(wait);
}
public SwiftTO getSwift() {
return this._swift;
}
public void setSwift(SwiftTO swift) {
this._swift = swift;
}
public String getParent() {
return _parent;
}
public void setParent(String parent) {
this._parent = parent;
}
}

View File

@ -1,90 +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.agent.api;
import com.cloud.agent.api.LogLevel.Log4jLevel;
import com.cloud.agent.api.to.SwiftTO;
/**
*
*
*/
public class downloadTemplateFromSwiftToSecondaryStorageCommand extends Command {
@LogLevel(Log4jLevel.Off)
private SwiftTO swift;
private String secondaryStorageUrl;
private Long dcId;
private Long accountId;
private Long templateId;
private String path;
protected downloadTemplateFromSwiftToSecondaryStorageCommand() {
}
public downloadTemplateFromSwiftToSecondaryStorageCommand(SwiftTO swift, String secondaryStorageUrl, Long dcId, Long accountId, Long templateId, String path, int wait) {
this.swift = swift;
this.secondaryStorageUrl = secondaryStorageUrl;
this.dcId = dcId;
this.accountId = accountId;
this.templateId = templateId;
this.path = path;
setWait(wait);
}
public SwiftTO getSwift() {
return this.swift;
}
public void setSwift(SwiftTO swift) {
this.swift = swift;
}
public String getSecondaryStorageUrl() {
return secondaryStorageUrl;
}
public Long getDcId() {
return dcId;
}
public Long getAccountId() {
return accountId;
}
public Long getTemplateId() {
return templateId;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
@Override
public boolean executeInSequence() {
// TODO Auto-generated method stub
return true;
}
}

View File

@ -1,3 +1,4 @@
package com.cloud.agent.api.storage;
// 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
@ -14,9 +15,3 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.migration;
import com.cloud.utils.db.GenericDao;
public interface DiskOffering20Dao extends GenericDao<DiskOffering20VO, Long> {
}

View File

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

View File

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

View File

@ -16,25 +16,24 @@
// under the License.
package com.cloud.agent.api.storage;
/**
* Password authentication
*/
public class PasswordAuth {
public class DeleteTemplateCommand extends ssCommand {
private String templatePath;
String userName;
String password;
public PasswordAuth() {
public DeleteTemplateCommand() {
}
public DeleteTemplateCommand(String secUrl, String templatePath) {
this.setSecUrl(secUrl);
this.templatePath = templatePath;
}
@Override
public boolean executeInSequence() {
return true;
public PasswordAuth(String user, String password) {
this.userName = user;
this.password = password;
}
public String getUserName() {
return userName;
}
public String getPassword() {
return password;
}
public String getTemplatePath() {
return templatePath;
}
}

View File

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

View File

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

View File

@ -0,0 +1,72 @@
// 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 java.net.URI;
/**
* Download Proxy
*/
public class Proxy {
private String _host;
private int _port;
private String _userName;
private String _password;
public Proxy() {
}
public Proxy(String host, int port, String userName, String password) {
this._host = host;
this._port = port;
this._userName = userName;
this._password = password;
}
public Proxy(URI uri) {
this._host = uri.getHost();
this._port = uri.getPort() == -1 ? 3128 : uri.getPort();
String userInfo = uri.getUserInfo();
if (userInfo != null) {
String[] tokens = userInfo.split(":");
if (tokens.length == 1) {
this._userName = userInfo;
this._password = "";
} else if (tokens.length == 2) {
this._userName = tokens[0];
this._password = tokens[1];
}
}
}
public String getHost() {
return _host;
}
public int getPort() {
return _port;
}
public String getUserName() {
return _userName;
}
public String getPassword() {
return _password;
}
}

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.cloudstack.engine.subsystem.api.storage;
package com.cloud.agent.api.to;
public enum DataObjectType {
VOLUME,

View File

@ -16,8 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.cloudstack.storage.volume;
package com.cloud.agent.api.to;
public interface VolumeMotionService {
boolean copyVolume(String volumeUri, String destVolumeUri);
import com.cloud.storage.DataStoreRole;
public interface DataStoreTO {
public DataStoreRole getRole();
}

View File

@ -0,0 +1,33 @@
/*
* 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.to;
import com.cloud.hypervisor.Hypervisor;
public interface DataTO {
public DataObjectType getObjectType();
public DataStoreTO getDataStore();
public Hypervisor.HypervisorType getHypervisorType();
/**
* @return
*/
String getPath();
long getId();
}

View File

@ -0,0 +1,64 @@
// 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.to;
public class DhcpTO {
String routerIp;
String gateway;
String netmask;
String startIpOfSubnet;
public DhcpTO(String routerIp, String gateway, String netmask, String StartIpOfSubnet) {
this.routerIp = routerIp;
this.startIpOfSubnet = StartIpOfSubnet;
this.gateway = gateway;
this.netmask =netmask;
}
public void setRouterIp(String routerIp){
this.routerIp = routerIp;
}
public void setGateway(String gateway) {
this.gateway = gateway;
}
public void setNetmask(String netmask) {
this.netmask = netmask ;
}
public void setStartIpOfSubnet( String ipOfSubNet) {
startIpOfSubnet = ipOfSubNet;
}
public String getRouterIp() {
return routerIp;
}
public String getGateway() {
return gateway;
}
public String getNetmask() {
return netmask;
}
public String getStartIpOfSubnet() {
return startIpOfSubnet;
}
}

View File

@ -0,0 +1,70 @@
/*
* 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.to;
import com.cloud.storage.Volume;
public class DiskTO {
private DataTO data;
private Long diskSeq;
private String vdiUuid;
private Volume.Type type;
public DiskTO() {
}
public DiskTO(DataTO data, Long diskSeq, String vdiUuid, Volume.Type type) {
this.data = data;
this.diskSeq = diskSeq;
this.vdiUuid = vdiUuid;
this.type = type;
}
public DataTO getData() {
return data;
}
public void setData(DataTO data) {
this.data = data;
}
public Long getDiskSeq() {
return diskSeq;
}
public void setDiskSeq(Long diskSeq) {
this.diskSeq = diskSeq;
}
public String getVdiUuid() {
return vdiUuid;
}
public void setVdiUuid(String vdiUuid) {
this.vdiUuid = vdiUuid;
}
public Volume.Type getType() {
return type;
}
public void setType(Volume.Type type) {
this.type = type;
}
}

View File

@ -23,6 +23,7 @@ import org.apache.cloudstack.api.InternalIdentity;
import com.cloud.network.rules.FirewallRule;
import com.cloud.network.rules.FirewallRule.State;
import com.cloud.network.rules.FirewallRule.TrafficType;
import com.cloud.utils.net.NetUtils;
/**
@ -52,6 +53,9 @@ public class FirewallRuleTO implements InternalIdentity {
private Integer icmpType;
private Integer icmpCode;
private FirewallRule.TrafficType trafficType;
private String guestCidr;
private boolean defaultEgressPolicy;
private FirewallRule.FirewallRuleType type;
protected FirewallRuleTO() {
}
@ -105,10 +109,24 @@ public class FirewallRuleTO implements InternalIdentity {
this.trafficType = trafficType;
}
public FirewallRuleTO(FirewallRule rule, String srcVlanTag, String srcIp, FirewallRule.Purpose purpose, FirewallRule.TrafficType trafficType, boolean defaultEgressPolicy) {
this(rule.getId(),srcVlanTag, srcIp, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(), rule.getState()==State.Revoke, rule.getState()==State.Active, purpose,rule.getSourceCidrList(),rule.getIcmpType(),rule.getIcmpCode());
this.trafficType = trafficType;
this.defaultEgressPolicy = defaultEgressPolicy;
}
public FirewallRuleTO(FirewallRule rule, String srcVlanTag, String srcIp, FirewallRule.Purpose purpose, boolean revokeState, boolean alreadyAdded) {
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, String guestCidr, boolean defaultEgressPolicy, FirewallRule.FirewallRuleType type) {
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;
this.defaultEgressPolicy = defaultEgressPolicy;
this.guestCidr = guestCidr;
this.type = type;
}
public FirewallRule.TrafficType getTrafficType(){
return trafficType;
}
@ -164,4 +182,15 @@ public class FirewallRuleTO implements InternalIdentity {
return purpose;
}
public boolean isDefaultEgressPolicy() {
return defaultEgressPolicy;
}
public String getGuestCidr() {
return guestCidr;
}
public FirewallRule.FirewallRuleType getType() {
return type;
}
}

View File

@ -20,10 +20,10 @@ package com.cloud.agent.api.to;
import java.util.ArrayList;
import java.util.List;
import com.cloud.network.vpc.NetworkACLItem;
import com.cloud.network.vpc.NetworkACLItem.TrafficType;
import org.apache.cloudstack.api.InternalIdentity;
import com.cloud.network.rules.FirewallRule;
import com.cloud.network.rules.FirewallRule.TrafficType;
import com.cloud.utils.net.NetUtils;
@ -37,15 +37,16 @@ public class NetworkACLTO implements InternalIdentity {
private List<String> cidrList;
private Integer icmpType;
private Integer icmpCode;
private FirewallRule.TrafficType trafficType;
private TrafficType trafficType;
String action;
int number;
protected NetworkACLTO() {
}
public NetworkACLTO(long id,String vlanTag, String protocol, Integer portStart, Integer portEnd, boolean revoked,
boolean alreadyAdded, List<String> cidrList, Integer icmpType,Integer icmpCode,TrafficType trafficType) {
boolean alreadyAdded, List<String> cidrList, Integer icmpType,Integer icmpCode,TrafficType trafficType, boolean allow, int number) {
this.vlanTag = vlanTag;
this.protocol = protocol;
@ -70,12 +71,20 @@ public class NetworkACLTO implements InternalIdentity {
this.icmpType = icmpType;
this.icmpCode = icmpCode;
this.trafficType = trafficType;
if(!allow){
this.action = "DROP";
} else {
this.action = "ACCEPT";
}
this.number = number;
}
public NetworkACLTO(FirewallRule rule, String vlanTag, FirewallRule.TrafficType trafficType ) {
public NetworkACLTO(NetworkACLItem rule, String vlanTag, NetworkACLItem.TrafficType trafficType ) {
this(rule.getId(), vlanTag, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(),
rule.getState() == FirewallRule.State.Revoke, rule.getState() == FirewallRule.State.Active,
rule.getSourceCidrList() ,rule.getIcmpType(), rule.getIcmpCode(),trafficType);
rule.getState() == NetworkACLItem.State.Revoke, rule.getState() == NetworkACLItem.State.Active,
rule.getSourceCidrList() ,rule.getIcmpType(), rule.getIcmpCode(),trafficType, rule.getAction() == NetworkACLItem.Action.Allow, rule.getNumber());
}
public long getId() {
@ -83,7 +92,7 @@ public class NetworkACLTO implements InternalIdentity {
}
public String getSrcVlanTag() {
return vlanTag;
return vlanTag;
}
public String getProtocol() {
@ -95,18 +104,18 @@ public class NetworkACLTO implements InternalIdentity {
}
public Integer getIcmpType(){
return icmpType;
return icmpType;
}
public Integer getIcmpCode(){
return icmpCode;
return icmpCode;
}
public String getStringPortRange() {
if (portRange == null || portRange.length < 2)
return "0:0";
else
return NetUtils.portRangeToString(portRange);
if (portRange == null || portRange.length < 2)
return "0:0";
else
return NetUtils.portRangeToString(portRange);
}
public boolean revoked() {
@ -121,7 +130,15 @@ public class NetworkACLTO implements InternalIdentity {
return alreadyAdded;
}
public FirewallRule.TrafficType getTrafficType() {
public TrafficType getTrafficType() {
return trafficType;
}
public String getAction() {
return action;
}
public int getNumber(){
return number;
}
}

View File

@ -14,14 +14,47 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.migration;
package com.cloud.agent.api.to;
import javax.ejb.Local;
import com.cloud.storage.DataStoreRole;
public class NfsTO implements DataStoreTO {
private String _url;
private DataStoreRole _role;
public NfsTO() {
super();
}
public NfsTO(String url, DataStoreRole role) {
super();
this._url = url;
this._role = role;
}
public String getUrl() {
return _url;
}
public void setUrl(String _url) {
this._url = _url;
}
@Override
public DataStoreRole getRole() {
return _role;
}
public void setRole(DataStoreRole _role) {
this._role = _role;
}
import org.springframework.stereotype.Component;
import com.cloud.utils.db.GenericDaoBase;
@Local(value={ServiceOffering20Dao.class})
public class ServiceOffering20DaoImpl extends GenericDaoBase<ServiceOffering20VO, Long> implements ServiceOffering20Dao {
}

View File

@ -18,13 +18,18 @@ package com.cloud.agent.api.to;
import java.util.Date;
import com.cloud.agent.api.LogLevel;
import com.cloud.agent.api.LogLevel.Log4jLevel;
import com.cloud.storage.DataStoreRole;
import com.cloud.utils.S3Utils;
public final class S3TO implements S3Utils.ClientOptions {
public final class S3TO implements S3Utils.ClientOptions, DataStoreTO {
private Long id;
private String uuid;
@LogLevel(Log4jLevel.Off)
private String accessKey;
@LogLevel(Log4jLevel.Off)
private String secretKey;
private String endPoint;
private String bucketName;
@ -33,6 +38,7 @@ public final class S3TO implements S3Utils.ClientOptions {
private Integer maxErrorRetry;
private Integer socketTimeout;
private Date created;
private boolean enableRRS;
public S3TO() {
@ -44,7 +50,7 @@ public final class S3TO implements S3Utils.ClientOptions {
final String secretKey, final String endPoint,
final String bucketName, final Boolean httpsFlag,
final Integer connectionTimeout, final Integer maxErrorRetry,
final Integer socketTimeout, final Date created) {
final Integer socketTimeout, final Date created, final boolean enableRRS) {
super();
@ -59,16 +65,19 @@ public final class S3TO implements S3Utils.ClientOptions {
this.maxErrorRetry = maxErrorRetry;
this.socketTimeout = socketTimeout;
this.created = created;
this.enableRRS = enableRRS;
}
@Override
public boolean equals(final Object thatObject) {
if (this == thatObject)
if (this == thatObject) {
return true;
if (thatObject == null || getClass() != thatObject.getClass())
}
if (thatObject == null || getClass() != thatObject.getClass()) {
return false;
}
final S3TO thatS3TO = (S3TO) thatObject;
@ -128,6 +137,10 @@ public final class S3TO implements S3Utils.ClientOptions {
return false;
}
if (enableRRS != thatS3TO.enableRRS) {
return false;
}
return true;
}
@ -249,4 +262,20 @@ public final class S3TO implements S3Utils.ClientOptions {
this.created = created;
}
@Override
public DataStoreRole getRole() {
return DataStoreRole.Image;
}
public boolean getEnableRRS() {
return enableRRS;
}
public void setEnableRRS(boolean enableRRS) {
this.enableRRS = enableRRS;
}
}

View File

@ -16,7 +16,10 @@
// under the License.
package com.cloud.agent.api.to;
public class SwiftTO {
import com.cloud.storage.DataStoreRole;
import com.cloud.utils.SwiftUtil;
public class SwiftTO implements DataStoreTO, SwiftUtil.SwiftClientCfg {
Long id;
String url;
String account;
@ -26,7 +29,8 @@ public class SwiftTO {
public SwiftTO() { }
public SwiftTO(Long id, String url, String account, String userName, String key) {
public SwiftTO(Long id, String url, String account, String userName, String key
) {
this.id = id;
this.url = url;
this.account = account;
@ -54,5 +58,13 @@ public class SwiftTO {
return key;
}
@Override
public DataStoreRole getRole() {
return DataStoreRole.Image;
}
@Override
public String getEndPoint() {
return this.url;
}
}

View File

@ -52,12 +52,13 @@ public class VirtualMachineTO {
boolean rebootOnCrash;
boolean enableHA;
boolean limitCpuUse;
boolean enableDynamicallyScaleVm;
String vncPassword;
String vncAddr;
Map<String, String> params;
String uuid;
VolumeTO[] disks;
DiskTO[] disks;
NicTO[] nics;
public VirtualMachineTO(long id, String instanceName, VirtualMachine.Type type, int cpus, Integer speed, long minRam, long maxRam, BootloaderType bootloader, String os, boolean enableHA, boolean limitCpuUse, String vncPassword) {
@ -102,6 +103,14 @@ public class VirtualMachineTO {
this.id = id;
}
public boolean isEnableDynamicallyScaleVm() {
return enableDynamicallyScaleVm;
}
public void setEnableDynamicallyScaleVm(boolean enableDynamicallyScaleVm) {
this.enableDynamicallyScaleVm = enableDynamicallyScaleVm;
}
public String getName() {
return name;
}
@ -206,11 +215,11 @@ public class VirtualMachineTO {
this.bootupScripts = bootupScripts;
}
public VolumeTO[] getDisks() {
public DiskTO[] getDisks() {
return disks;
}
public void setDisks(VolumeTO[] disks) {
public void setDisks(DiskTO[] disks) {
this.disks = disks;
}

View File

@ -37,6 +37,11 @@ public class VolumeTO implements InternalIdentity {
private long deviceId;
private String chainInfo;
private String guestOsType;
private Long bytesReadRate;
private Long bytesWriteRate;
private Long iopsReadRate;
private Long iopsWriteRate;
private Long chainSize;
public VolumeTO(long id, Volume.Type type, StoragePoolType poolType, String poolUuid, String name, String mountPoint, String path, long size, String chainInfo) {
this.id = id;
@ -73,6 +78,7 @@ public class VolumeTO implements InternalIdentity {
this.storagePoolUuid = pool.getUuid();
this.mountPoint = volume.getFolder();
this.chainInfo = volume.getChainInfo();
this.chainSize = volume.getVmSnapshotChainSize();
if (volume.getDeviceId() != null)
this.deviceId = volume.getDeviceId();
}
@ -120,6 +126,10 @@ public class VolumeTO implements InternalIdentity {
public String getChainInfo() {
return chainInfo;
}
public void setChainInfo(String chainInfo) {
this.chainInfo = chainInfo;
}
public String getOsType() {
return guestOsType;
@ -133,4 +143,44 @@ public class VolumeTO implements InternalIdentity {
public String toString() {
return new StringBuilder("Vol[").append(id).append("|").append(type).append("|").append(path).append("|").append(size).append("]").toString();
}
public void setBytesReadRate(Long bytesReadRate) {
this.bytesReadRate = bytesReadRate;
}
public Long getBytesReadRate() {
return bytesReadRate;
}
public void setBytesWriteRate(Long bytesWriteRate) {
this.bytesWriteRate = bytesWriteRate;
}
public Long getBytesWriteRate() {
return bytesWriteRate;
}
public void setIopsReadRate(Long iopsReadRate) {
this.iopsReadRate = iopsReadRate;
}
public Long getIopsReadRate() {
return iopsReadRate;
}
public void setIopsWriteRate(Long iopsWriteRate) {
this.iopsWriteRate = iopsWriteRate;
}
public Long getIopsWriteRate() {
return iopsWriteRate;
}
public Long getChainSize() {
return chainSize;
}
public void setChainSize(Long chainSize) {
this.chainSize = chainSize;
}
}

View File

@ -1,80 +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.agent.api;
import com.cloud.agent.api.LogLevel.Log4jLevel;
import com.cloud.agent.api.to.SwiftTO;
/**
*
*
*/
public class uploadTemplateToSwiftFromSecondaryStorageCommand extends Command {
@LogLevel(Log4jLevel.Off)
private SwiftTO swift;
private String secondaryStorageUrl;
private Long dcId;
private Long accountId;
private Long templateId;
protected uploadTemplateToSwiftFromSecondaryStorageCommand() {
}
public uploadTemplateToSwiftFromSecondaryStorageCommand(SwiftTO swift, String secondaryStorageUrl, Long dcId, Long accountId, Long templateId, int wait) {
this.swift = swift;
this.secondaryStorageUrl = secondaryStorageUrl;
this.dcId = dcId;
this.accountId = accountId;
this.templateId = templateId;
setWait(wait);
}
public SwiftTO getSwift() {
return this.swift;
}
public void setSwift(SwiftTO swift) {
this.swift = swift;
}
public String getSecondaryStorageUrl() {
return secondaryStorageUrl;
}
public Long getDcId() {
return dcId;
}
public Long getAccountId() {
return accountId;
}
public Long getTemplateId() {
return templateId;
}
@Override
public boolean executeInSequence() {
// TODO Auto-generated method stub
return true;
}
}

View File

@ -35,9 +35,9 @@ public interface HostAllocator extends Adapter {
**/
boolean isVirtualMachineUpgradable(final VirtualMachine vm, final ServiceOffering offering);
/**
* Determines which physical hosts are suitable to
* allocate the guest virtual machines on
/**
* Determines which physical hosts are suitable to
* allocate the guest virtual machines on
*
* @param VirtualMachineProfile vmProfile
* @param DeploymentPlan plan
@ -45,13 +45,13 @@ public interface HostAllocator extends Adapter {
* @param ExcludeList avoid
* @param int returnUpTo (use -1 to return all possible hosts)
* @return List<Host> List of hosts that are suitable for VM allocation
**/
**/
public List<Host> allocateTo(VirtualMachineProfile<?extends VirtualMachine> vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, int returnUpTo);
public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, int returnUpTo);
/**
* Determines which physical hosts are suitable to
* allocate the guest virtual machines on
/**
* Determines which physical hosts are suitable to
* allocate the guest virtual machines on
*
* @param VirtualMachineProfile vmProfile
* @param DeploymentPlan plan
@ -60,11 +60,26 @@ public interface HostAllocator extends Adapter {
* @param int returnUpTo (use -1 to return all possible hosts)
* @param boolean considerReservedCapacity (default should be true, set to false if host capacity calculation should not look at reserved capacity)
* @return List<Host> List of hosts that are suitable for VM allocation
**/
**/
public List<Host> allocateTo(VirtualMachineProfile<?extends VirtualMachine> vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, int returnUpTo, boolean considerReservedCapacity);
public static int RETURN_UPTO_ALL = -1;
public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, int returnUpTo, boolean considerReservedCapacity);
/**
* Determines which physical hosts are suitable to
* allocate the guest virtual machines on
*
* @param VirtualMachineProfile vmProfile
* @param DeploymentPlan plan
* @param GuestType type
* @param ExcludeList avoid
* @param List<HostVO> hosts
* @param int returnUpTo (use -1 to return all possible hosts)
* @param boolean considerReservedCapacity (default should be true, set to false if host capacity calculation should not look at reserved capacity)
* @return List<Host> List of hosts that are suitable for VM allocation
**/
public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, List<? extends Host> hosts,
int returnUpTo, boolean considerReservedCapacity);
public static int RETURN_UPTO_ALL = -1;
}

View File

@ -19,17 +19,15 @@ package com.cloud.agent.manager.allocator;
import java.util.Set;
import com.cloud.dc.DataCenter;
import com.cloud.dc.DataCenterVO;
import com.cloud.dc.HostPodVO;
import com.cloud.dc.Pod;
import com.cloud.service.ServiceOfferingVO;
import com.cloud.offering.ServiceOffering;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.utils.Pair;
import com.cloud.utils.component.Adapter;
import com.cloud.vm.VirtualMachineProfile;
public interface PodAllocator extends Adapter {
Pair<HostPodVO, Long> allocateTo(VirtualMachineTemplate template, ServiceOfferingVO offering, DataCenterVO dc, long userId, Set<Long> avoids);
Pair<Pod, Long> allocateTo(VirtualMachineTemplate template, ServiceOffering offering, DataCenter dc, long userId, Set<Long> avoids);
Pod allocateTo(VirtualMachineProfile vm, DataCenter dc, Set<? extends Pod> avoids);
}

View File

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

View File

@ -21,8 +21,6 @@ import java.util.List;
import javax.naming.NamingException;
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;
import org.apache.cloudstack.api.command.admin.network.CreateNetworkOfferingCmd;
import org.apache.cloudstack.api.command.admin.network.DeleteNetworkOfferingCmd;
import org.apache.cloudstack.api.command.admin.network.UpdateNetworkOfferingCmd;
@ -34,18 +32,27 @@ import org.apache.cloudstack.api.command.admin.offering.UpdateDiskOfferingCmd;
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.region.CreatePortableIpRangeCmd;
import org.apache.cloudstack.api.command.admin.region.DeletePortableIpRangeCmd;
import org.apache.cloudstack.api.command.admin.region.ListPortableIpRangesCmd;
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;
import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd;
import org.apache.cloudstack.config.Configuration;
import org.apache.cloudstack.region.PortableIp;
import org.apache.cloudstack.region.PortableIpRange;
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.InvalidParameterValueException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Networks.TrafficType;
@ -63,7 +70,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 +241,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);
@ -242,33 +253,17 @@ public interface ConfigurationService {
boolean deleteNetworkOffering(DeleteNetworkOfferingCmd cmd);
NetworkOffering getNetworkOffering(long id);
Integer getNetworkOfferingNetworkRate(long networkOfferingId);
Account getVlanAccount(long vlanId);
List<? extends NetworkOffering> listNetworkOfferings(TrafficType trafficType, boolean systemOnly);
DataCenter getZone(long id);
ServiceOffering getServiceOffering(long serviceOfferingId);
Long getDefaultPageSize();
Integer getServiceOfferingNetworkRate(long serviceOfferingId);
PortableIpRange createPortableIpRange(CreatePortableIpRangeCmd cmd) throws ConcurrentOperationException;
DiskOffering getDiskOffering(long diskOfferingId);
boolean deletePortableIpRange(DeletePortableIpRangeCmd cmd);
boolean updateLDAP(LDAPConfigCmd cmd) throws NamingException;
List<? extends PortableIpRange> listPortableIpRanges(ListPortableIpRangesCmd cmd);
boolean removeLDAP(LDAPRemoveCmd cmd);
LDAPConfigCmd listLDAPConfig(LDAPConfigCmd cmd);
/**
* @param offering
* @return
*/
boolean isOfferingForVpc(NetworkOffering offering);
List<? extends PortableIp> listPortableIps(long id);
}

View File

@ -20,8 +20,15 @@ import java.util.List;
import java.util.Map;
import com.cloud.utils.component.Adapter;
import com.cloud.vm.ConsoleProxyVO;
import com.cloud.vm.ConsoleProxy;
public interface ConsoleProxyAllocator extends Adapter {
public ConsoleProxyVO allocProxy(List<ConsoleProxyVO> candidates, Map<Long, Integer> loadInfo, long dataCenterId);
/**
* Finds the least loaded console proxy.
* @param candidates
* @param loadInfo
* @param dataCenterId
* @return id of the console proxy to use or null if none.
*/
public Long allocProxy(List<? extends ConsoleProxy> candidates, Map<Long, Integer> loadInfo, long dataCenterId);
}

View File

@ -0,0 +1,33 @@
// 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.dc;
import org.apache.cloudstack.acl.InfrastructureEntity;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
public interface DedicatedResources extends InfrastructureEntity, InternalIdentity, Identity{
long getId();
Long getDataCenterId();
Long getPodId();
Long getClusterId();
Long getHostId();
Long getDomainId();
Long getAccountId();
String getUuid();
long getAffinityGroupId();
}

View File

@ -0,0 +1,45 @@
// 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.deploy;
import java.util.List;
import com.cloud.exception.InsufficientServerCapacityException;
import com.cloud.vm.VirtualMachineProfile;
/**
*/
public interface DeploymentClusterPlanner extends DeploymentPlanner {
/**
* This is called to determine list of possible clusters where a virtual
* machine can be deployed.
*
* @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.
* @return DeployDestination for that virtual machine.
*/
List<Long> orderClusters(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid)
throws InsufficientServerCapacityException;
PlannerResourceUsage getResourceUsage(VirtualMachineProfile vmProfile,
DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException;
}

View File

@ -29,12 +29,12 @@ import com.cloud.host.Host;
import com.cloud.org.Cluster;
import com.cloud.storage.StoragePool;
import com.cloud.utils.component.Adapter;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
/**
*/
public interface DeploymentPlanner extends Adapter {
/**
* plan is called to determine where a virtual machine should be running.
*
@ -46,7 +46,8 @@ public interface DeploymentPlanner extends Adapter {
* avoid these data centers, pods, clusters, or hosts.
* @return DeployDestination for that virtual machine.
*/
DeployDestination plan(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException;
@Deprecated
DeployDestination plan(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException;
/**
* check() is called right before the virtual machine starts to make sure
@ -63,7 +64,7 @@ public interface DeploymentPlanner extends Adapter {
* @return true if it's okay to start; false if not. If false, the exclude list will include what should be
* excluded.
*/
boolean check(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, DeployDestination dest, ExcludeList exclude);
boolean check(VirtualMachineProfile vm, DeploymentPlan plan, DeployDestination dest, ExcludeList exclude);
/**
* canHandle is called before plan to determine if the plan can do the allocation. Planers should be exclusive so
@ -78,7 +79,7 @@ public interface DeploymentPlanner extends Adapter {
* avoid these data centers, pods, clusters, or hosts.
* @return true if it's okay to allocate; false or not
*/
boolean canHandle(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid);
boolean canHandle(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid);
public enum AllocationAlgorithm {
random,
@ -88,6 +89,10 @@ public interface DeploymentPlanner extends Adapter {
userconcentratedpod_firstfit;
}
public enum PlannerResourceUsage {
Shared, Dedicated;
}
public static class ExcludeList {
private Set<Long> _dcIds;
private Set<Long> _podIds;
@ -99,10 +104,22 @@ public interface DeploymentPlanner extends Adapter {
}
public ExcludeList(Set<Long> _dcIds, Set<Long> _podIds, Set<Long> _clusterIds, Set<Long> _hostIds, Set<Long> _poolIds) {
this._dcIds = _dcIds;
this._podIds = _podIds;
this._clusterIds = _clusterIds;
this._poolIds = _poolIds;
if (_dcIds != null) {
this._dcIds = new HashSet<Long>(_dcIds);
}
if (_podIds != null) {
this._podIds = new HashSet<Long>(_podIds);
}
if (_clusterIds != null) {
this._clusterIds = new HashSet<Long>(_clusterIds);
}
if (_hostIds != null) {
this._hostIds = new HashSet<Long>(_hostIds);
}
if (_poolIds != null) {
this._poolIds = new HashSet<Long>(_poolIds);
}
}
public boolean add(InsufficientCapacityException e) {
@ -174,6 +191,13 @@ public interface DeploymentPlanner extends Adapter {
_podIds.add(podId);
}
public void addPodList(Collection<Long> podList) {
if (_podIds == null) {
_podIds = new HashSet<Long>();
}
_podIds.addAll(podList);
}
public void addCluster(long clusterId) {
if (_clusterIds == null) {
_clusterIds = new HashSet<Long>();
@ -195,6 +219,13 @@ public interface DeploymentPlanner extends Adapter {
_hostIds.add(hostId);
}
public void addHostList(Collection<Long> hostList) {
if (_hostIds == null) {
_hostIds = new HashSet<Long>();
}
_hostIds.addAll(hostList);
}
public boolean shouldAvoid(Host host) {
if (_dcIds != null && _dcIds.contains(host.getDataCenterId())) {
return true;

View File

@ -52,4 +52,5 @@ public class EventCategory {
public static final EventCategory ALERT_EVENT = new EventCategory("AlertEvent");
public static final EventCategory USAGE_EVENT = new EventCategory("UsageEvent");
public static final EventCategory RESOURCE_STATE_CHANGE_EVENT = new EventCategory("ResourceStateEvent");
public static final EventCategory ASYNC_JOB_CHANGE_EVENT = new EventCategory("AsyncJobEvent");
}

View File

@ -16,15 +16,29 @@
// under the License.
package com.cloud.event;
import com.cloud.configuration.Configuration;
import java.util.HashMap;
import java.util.Map;
import org.apache.cloudstack.config.Configuration;
import com.cloud.dc.DataCenter;
import com.cloud.dc.Pod;
import com.cloud.dc.StorageNetworkIpRange;
import com.cloud.dc.Vlan;
import com.cloud.domain.Domain;
import com.cloud.host.Host;
import com.cloud.network.*;
import com.cloud.network.as.*;
import com.cloud.network.GuestVlan;
import com.cloud.network.Network;
import com.cloud.network.PhysicalNetwork;
import com.cloud.network.PhysicalNetworkServiceProvider;
import com.cloud.network.PhysicalNetworkTrafficType;
import com.cloud.network.PublicIpAddress;
import com.cloud.network.RemoteAccessVpn;
import com.cloud.network.as.AutoScaleCounter;
import com.cloud.network.as.AutoScalePolicy;
import com.cloud.network.as.AutoScaleVmGroup;
import com.cloud.network.as.AutoScaleVmProfile;
import com.cloud.network.as.Condition;
import com.cloud.network.router.VirtualRouter;
import com.cloud.network.rules.LoadBalancer;
import com.cloud.network.rules.StaticNat;
@ -43,9 +57,6 @@ import com.cloud.user.Account;
import com.cloud.user.User;
import com.cloud.vm.VirtualMachine;
import java.util.HashMap;
import java.util.Map;
public class EventTypes {
//map of Event and corresponding entity for which Event is applicable
@ -59,7 +70,7 @@ public class EventTypes {
public static final String EVENT_VM_REBOOT = "VM.REBOOT";
public static final String EVENT_VM_UPDATE = "VM.UPDATE";
public static final String EVENT_VM_UPGRADE = "VM.UPGRADE";
public static final String EVENT_VM_SCALE = "VM.SCALE";
public static final String EVENT_VM_DYNAMIC_SCALE = "VM.DYNAMIC.SCALE";
public static final String EVENT_VM_RESETPASSWORD = "VM.RESETPASSWORD";
public static final String EVENT_VM_RESETSSHKEY = "VM.RESETSSHKEY";
public static final String EVENT_VM_MIGRATE = "VM.MIGRATE";
@ -83,6 +94,7 @@ public class EventTypes {
public static final String EVENT_PROXY_REBOOT = "PROXY.REBOOT";
public static final String EVENT_PROXY_HA = "PROXY.HA";
// VNC Console Events
public static final String EVENT_VNC_CONNECT = "VNC.CONNECT";
public static final String EVENT_VNC_DISCONNECT = "VNC.DISCONNECT";
@ -90,6 +102,8 @@ public class EventTypes {
// Network Events
public static final String EVENT_NET_IP_ASSIGN = "NET.IPASSIGN";
public static final String EVENT_NET_IP_RELEASE = "NET.IPRELEASE";
public static final String EVENT_PORTABLE_IP_ASSIGN = "PORTABLE.IPASSIGN";
public static final String EVENT_PORTABLE_IP_RELEASE = "PORTABLE.IPRELEASE";
public static final String EVENT_NET_RULE_ADD = "NET.RULEADD";
public static final String EVENT_NET_RULE_DELETE = "NET.RULEDELETE";
public static final String EVENT_NET_RULE_MODIFY = "NET.RULEMODIFY";
@ -103,6 +117,10 @@ public class EventTypes {
public static final String EVENT_NIC_CREATE = "NIC.CREATE";
public static final String EVENT_NIC_DELETE = "NIC.DELETE";
public static final String EVENT_NIC_UPDATE = "NIC.UPDATE";
public static final String EVENT_NIC_DETAIL_ADD = "NIC.DETAIL.ADD";
public static final String EVENT_NIC_DETAIL_UPDATE = "NIC.DETAIL.UPDATE";
public static final String EVENT_NIC_DETAIL_REMOVE = "NIC.DETAIL.REMOVE";
// Load Balancers
public static final String EVENT_ASSIGN_TO_LOAD_BALANCER_RULE = "LB.ASSIGN.TO.RULE";
@ -120,6 +138,7 @@ public class EventTypes {
public static final String EVENT_REMOVE_FROM_GLOBAL_LOAD_BALANCER_RULE = "GLOBAL.LB.REMOVE";
public static final String EVENT_GLOBAL_LOAD_BALANCER_CREATE = "GLOBAL.LB.CREATE";
public static final String EVENT_GLOBAL_LOAD_BALANCER_DELETE = "GLOBAL.LB.DELETE";
public static final String EVENT_GLOBAL_LOAD_BALANCER_UPDATE = "GLOBAL.LB.UPDATE";
// Account events
public static final String EVENT_ACCOUNT_ENABLE = "ACCOUNT.ENABLE";
@ -142,6 +161,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";
@ -163,6 +185,9 @@ public class EventTypes {
public static final String EVENT_VOLUME_UPLOAD = "VOLUME.UPLOAD";
public static final String EVENT_VOLUME_MIGRATE = "VOLUME.MIGRATE";
public static final String EVENT_VOLUME_RESIZE = "VOLUME.RESIZE";
public static final String EVENT_VOLUME_DETAIL_UPDATE = "VOLUME.DETAIL.UPDATE";
public static final String EVENT_VOLUME_DETAIL_ADD = "VOLUME.DETAIL.ADD";
public static final String EVENT_VOLUME_DETAIL_REMOVE = "VOLUME.DETAIL.REMOVE";
// Domains
public static final String EVENT_DOMAIN_CREATE = "DOMAIN.CREATE";
@ -223,6 +248,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";
@ -329,6 +356,14 @@ public class EventTypes {
public static final String EVENT_VPC_DELETE = "VPC.DELETE";
public static final String EVENT_VPC_RESTART = "VPC.RESTART";
// Network ACL
public static final String EVENT_NETWORK_ACL_CREATE = "NETWORK.ACL.CREATE";
public static final String EVENT_NETWORK_ACL_DELETE = "NETWORK.ACL.DELETE";
public static final String EVENT_NETWORK_ACL_REPLACE = "NETWORK.ACL.REPLACE";
public static final String EVENT_NETWORK_ACL_ITEM_CREATE = "NETWORK.ACL.ITEM.CREATE";
public static final String EVENT_NETWORK_ACL_ITEM_UPDATE = "NETWORK.ACL.ITEM.UPDATE";
public static final String EVENT_NETWORK_ACL_ITEM_DELETE = "NETWORK.ACL.ITEM.DELETE";
// VPC offerings
public static final String EVENT_VPC_OFFERING_CREATE = "VPC.OFFERING.CREATE";
public static final String EVENT_VPC_OFFERING_UPDATE = "VPC.OFFERING.UPDATE";
@ -345,7 +380,11 @@ public class EventTypes {
// tag related events
public static final String EVENT_TAGS_CREATE = "CREATE_TAGS";
public static final String EVENT_TAGS_DELETE = "DELETE_TAGS";
// meta data related events
public static final String EVENT_RESOURCE_DETAILS_CREATE = "CREATE_RESOURCE_DETAILS";
public static final String EVENT_RESOURCE_DETAILS_DELETE = "DELETE_RESOURCE_DETAILS";
// 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 +418,33 @@ public class EventTypes {
public static final String EVENT_BAREMETAL_PXE_SERVER_ADD = "PHYSICAL.PXE.ADD";
public static final String EVENT_BAREMETAL_PXE_SERVER_DELETE = "PHYSICAL.PXE.DELETE";
public static final String EVENT_AFFINITY_GROUP_CREATE = "AG.CREATE";
public static final String EVENT_AFFINITY_GROUP_DELETE = "AG.DELETE";
public static final String EVENT_AFFINITY_GROUP_ASSIGN = "AG.ASSIGN";
public static final String EVENT_AFFINITY_GROUP_REMOVE = "AG.REMOVE";
public static final String EVENT_VM_AFFINITY_GROUP_UPDATE = "VM.AG.UPDATE";
public static final String EVENT_INTERNAL_LB_VM_START = "INTERNALLBVM.START";
public static final String EVENT_INTERNAL_LB_VM_STOP = "INTERNALLBVM.STOP";
public static final String EVENT_HOST_RESERVATION_RELEASE = "HOST.RESERVATION.RELEASE";
// 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";
public static final String EVENT_PORTABLE_IP_RANGE_CREATE = "PORTABLE.IP.RANGE.CREATE";
public static final String EVENT_PORTABLE_IP_RANGE_DELETE = "PORTABLE.IP.RANGE.DELETE";
public static final String EVENT_PORTABLE_IP_TRANSFER = "PORTABLE.IP.TRANSFER";
// Dedicated Resources
public static final String EVENT_DEDICATE_RESOURCE = "DEDICATE.RESOURCE";
public static final String EVENT_DEDICATE_RESOURCE_RELEASE = "DEDICATE.RESOURCE.RELEASE";
public static final String EVENT_CLEANUP_VM_RESERVATION = "VM.RESERVATION.CLEANUP";
public static final String EVENT_UCS_ASSOCIATED_PROFILE = "UCS.ASSOCIATEPROFILE";
static {
// TODO: need a way to force author adding event types to declare the entity details as well, with out braking
@ -536,6 +602,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 +745,8 @@ public class EventTypes {
entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_UPDATE, AutoScaleVmGroup.class.getName());
entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_ENABLE, AutoScaleVmGroup.class.getName());
entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_DISABLE, AutoScaleVmGroup.class.getName());
entityEventDetails.put(EVENT_GUEST_VLAN_RANGE_DEDICATE, GuestVlan.class.getName());
entityEventDetails.put(EVENT_DEDICATED_GUEST_VLAN_RANGE_RELEASE, GuestVlan.class.getName());
}
public static String getEntityForEvent (String eventName) {

View File

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

View File

@ -27,6 +27,8 @@ public class InsufficientServerCapacityException extends InsufficientCapacityExc
private static final long serialVersionUID = SerialVersionUID.InsufficientServerCapacityException;
private boolean affinityGroupsApplied = false;
public InsufficientServerCapacityException(String msg, Long clusterId) {
this(msg, Cluster.class, clusterId);
}
@ -34,4 +36,13 @@ public class InsufficientServerCapacityException extends InsufficientCapacityExc
public InsufficientServerCapacityException(String msg, Class<?> scope, Long id) {
super(msg, scope, id);
}
public InsufficientServerCapacityException(String msg, Class<?> scope, Long id, boolean affinityGroupsApplied) {
super(msg, scope, id);
this.affinityGroupsApplied = affinityGroupsApplied;
}
public boolean isAffinityApplied() {
return affinityGroupsApplied;
}
}

View File

@ -0,0 +1,25 @@
// 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.exception.CloudRuntimeException;
public class MissingParameterValueException extends CloudRuntimeException {
public MissingParameterValueException(String message) {
super(message);
}
}

View File

@ -16,9 +16,9 @@
// under the License.
package com.cloud.ha;
import com.cloud.host.HostVO;
import com.cloud.host.Host;
import com.cloud.utils.component.Adapter;
import com.cloud.vm.VMInstanceVO;
import com.cloud.vm.VirtualMachine;
public interface FenceBuilder extends Adapter {
/**
@ -27,5 +27,5 @@ public interface FenceBuilder extends Adapter {
* @param vm vm
* @param host host where the vm was running on.
*/
public Boolean fenceOff(VMInstanceVO vm, HostVO host);
public Boolean fenceOff(VirtualMachine vm, Host host);
}

View File

@ -16,10 +16,10 @@
// under the License.
package com.cloud.ha;
import com.cloud.host.HostVO;
import com.cloud.host.Host;
import com.cloud.host.Status;
import com.cloud.utils.component.Adapter;
import com.cloud.vm.VMInstanceVO;
import com.cloud.vm.VirtualMachine;
public interface Investigator extends Adapter {
/**
@ -27,7 +27,7 @@ public interface Investigator extends Adapter {
*
* @param vm to work on.
*/
public Boolean isVmAlive(VMInstanceVO vm, HostVO host);
public Boolean isVmAlive(VirtualMachine vm, Host host);
public Status isAgentAlive(HostVO agent);
public Status isAgentAlive(Host agent);
}

View File

@ -147,6 +147,7 @@ public enum Status {
s_fsm.addTransition(Status.Down, Event.Remove, Status.Removed);
s_fsm.addTransition(Status.Down, Event.ManagementServerDown, Status.Down);
s_fsm.addTransition(Status.Down, Event.AgentDisconnected, Status.Down);
s_fsm.addTransition(Status.Down, Event.PingTimeout, Status.Down);
s_fsm.addTransition(Status.Alert, Event.AgentConnected, Status.Connecting);
s_fsm.addTransition(Status.Alert, Event.Ping, Status.Up);
s_fsm.addTransition(Status.Alert, Event.Remove, Status.Removed);

View File

@ -16,6 +16,8 @@
// under the License.
package com.cloud.hypervisor;
import com.cloud.storage.Storage.ImageFormat;
public class Hypervisor {
public static enum HypervisorType {
@ -63,6 +65,26 @@ public class Hypervisor {
return HypervisorType.None;
}
}
/**
* This method really needs to be part of the properties of the hypervisor type itself.
*
* @param hyperType
* @return
*/
public static ImageFormat getSupportedImageFormat(HypervisorType hyperType) {
if (hyperType == HypervisorType.XenServer) {
return ImageFormat.VHD;
} else if (hyperType == HypervisorType.KVM) {
return ImageFormat.QCOW2;
} else if (hyperType == HypervisorType.VMware) {
return ImageFormat.OVA;
} else if (hyperType == HypervisorType.Ovm) {
return ImageFormat.RAW;
} else {
return null;
}
}
}
}

View File

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

View File

@ -16,10 +16,13 @@
// 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;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.utils.Pair;
import com.cloud.utils.component.Adapter;
import com.cloud.vm.NicProfile;
import com.cloud.vm.VirtualMachine;
@ -34,16 +37,17 @@ public interface HypervisorGuru extends Adapter {
* @param vm
* @return
*/
<T extends VirtualMachine> VirtualMachineTO implement(VirtualMachineProfile<T> vm);
VirtualMachineTO implement(VirtualMachineProfile vm);
/**
* Give hypervisor guru opportunity to decide if certain command needs to be delegated to other host, mainly to secondary storage VM host
*
* @param hostId original hypervisor host
* @param cmd command that is going to be sent, hypervisor guru usually needs to register various context objects into the command object
*
* @return delegated host id if the command will be delegated
*/
long getCommandHostDelegation(long hostId, Command cmd);
Pair<Boolean, Long> getCommandHostDelegation(long hostId, Command cmd);
/**
* @return true if VM can be migrated independently with CloudStack, and therefore CloudStack needs to track and reflect host change
@ -57,4 +61,18 @@ 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);
/**
* Give the hypervisor guru the opportinity to decide if additional clean is
* required for nics before expunging the VM
*
*/
List<Command> finalizeExpungeNics(VirtualMachine vm, List<NicProfile> nics);
}

View File

@ -14,24 +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;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
import com.cloud.agent.api.to.SwiftTO;
public interface GuestVlan extends InternalIdentity, Identity {
public interface Swift extends InternalIdentity {
public long getId();
public String getUuid();
public long getAccountId();
public String getUrl();
public String getGuestVlanRange();
public String getAccount();
public String getUserName();
public String getKey();
public SwiftTO toSwiftTO();
public long getPhysicalNetworkId();
}

View File

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

View File

@ -19,29 +19,17 @@ package com.cloud.network;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
import com.cloud.network.Networks.BroadcastDomainType;
import com.cloud.network.Networks.Mode;
import com.cloud.network.Networks.TrafficType;
import com.cloud.network.Networks.BroadcastDomainType;
import com.cloud.network.Networks.Mode;
import com.cloud.network.Networks.TrafficType;
import com.cloud.utils.fsm.StateMachine2;
import com.cloud.utils.fsm.StateObject;
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
/**
* owned by an account.
*/
@ -63,7 +51,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
Capability.MultipleIps, Capability.TrafficStatistics, Capability.SupportedTrafficDirection, Capability.SupportedEgressProtocols);
public static final Service Lb = new Service("Lb", Capability.SupportedLBAlgorithms, Capability.SupportedLBIsolation,
Capability.SupportedProtocols, Capability.TrafficStatistics, Capability.LoadBalancingSupportedIps,
Capability.SupportedStickinessMethods, Capability.ElasticLb);
Capability.SupportedStickinessMethods, Capability.ElasticLb, Capability.LbSchemes);
public static final Service UserData = new Service("UserData");
public static final Service SourceNat = new Service("SourceNat", Capability.SupportedSourceNatTypes, Capability.RedundantRouter);
public static final Service StaticNat = new Service("StaticNat", Capability.ElasticIp);
@ -73,8 +61,8 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
public static final Service Connectivity = new Service("Connectivity");
private String name;
private Capability[] caps;
private final String name;
private final Capability[] caps;
public Service(String name, Capability... caps) {
this.name = name;
@ -135,12 +123,13 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
public static final Provider SecurityGroupProvider = new Provider("SecurityGroupProvider", false);
public static final Provider VPCVirtualRouter = new Provider("VpcVirtualRouter", false);
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 MidokuraMidonet = new Provider("MidokuraMidonet", true);
// NiciraNvp is not an "External" provider, otherwise we get in trouble with NetworkServiceImpl.providersConfiguredForExternalNetworking
public static final Provider NiciraNvp = new Provider("NiciraNvp", false);
public static final Provider InternalLbVm = new Provider("InternalLbVm", false);
public static final Provider CiscoVnmc = new Provider("CiscoVnmc", true);
private String name;
private boolean isExternal;
private final String name;
private final boolean isExternal;
public Provider(String name, boolean isExternal) {
this.name = name;
@ -183,14 +172,17 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
public static final Capability AllowDnsSuffixModification = new Capability("AllowDnsSuffixModification");
public static final Capability RedundantRouter = new Capability("RedundantRouter");
public static final Capability ElasticIp = new Capability("ElasticIp");
public static final Capability AssociatePublicIP = new Capability("AssociatePublicIP");
public static final Capability ElasticLb = new Capability("ElasticLb");
public static final Capability AutoScaleCounters = new Capability("AutoScaleCounters");
public static final Capability InlineMode = new Capability("InlineMode");
public static final Capability SupportedTrafficDirection = new Capability("SupportedTrafficDirection");
public static final Capability SupportedEgressProtocols = new Capability("SupportedEgressProtocols");
public static final Capability HealthCheckPolicy = new Capability("HealthCheckPolicy");
public static final Capability LbSchemes = new Capability("LbSchemes");
public static final Capability DhcpAccrossMultipleSubnets = new Capability("DhcpAccrossMultipleSubnets");
private String name;
private final String name;
public Capability(String name) {
this.name = name;
@ -255,8 +247,8 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
private String ip6Address;
public IpAddresses(String ip4Address, String ip6Address) {
this.setIp4Address(ip4Address);
this.setIp6Address(ip6Address);
setIp4Address(ip4Address);
setIp6Address(ip6Address);
}
public String getIp4Address() {
@ -305,6 +297,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
long getNetworkOfferingId();
@Override
State getState();
long getRelated();
@ -331,9 +324,16 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
boolean getSpecifyIpRanges();
boolean getDisplayNetwork();
String getGuruName();
/**
* @return
*/
Long getVpcId();
Long getNetworkACLId();
void setNetworkACLId(Long networkACLId);
}

View File

@ -0,0 +1,70 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.network;
import com.cloud.deploy.DeployDestination;
import com.cloud.vm.NicProfile;
import com.cloud.vm.ReservationContext;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
/**
* NetworkGuru and NetworkElements that implement this interface
* will be called during Virtual Machine migration.
*/
public interface NetworkMigrationResponder {
/**
* Prepare for migration.
*
* This method will be called per nic before the vm migration.
* @param nic
* @param network
* @param vm
* @param dest
* @param context
* @return true when operation was successful.
*/
public boolean prepareMigration(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context);
/**
* Cancel for migration preparation.
*
* This method will be called per nic when the entire vm migration
* process failed and need to release the resouces that was
* allocated at the migration preparation.
* @param nic destination nic
* @param network destination network
* @param vm destination vm profile
* @param src The context nic migrates from.
* @param dst The context nic migrates to.
*/
public void rollbackMigration(NicProfile nic, Network network, VirtualMachineProfile vm, ReservationContext src, ReservationContext dst);
/**
* Commit the migration resource.
*
* This method will be called per nic when the entire vm migration
* process was successful. This is useful to release the resource of
* source deployment where vm has left.
* @param nic source nic
* @param network source network
* @param vm source vm profile
* @param src the context nic migrates from.
* @param dst the context nic migrates to.
*/
public void commitMigration(NicProfile nic, Network network, VirtualMachineProfile vm, ReservationContext src, ReservationContext dst);
}

View File

@ -33,6 +33,7 @@ import com.cloud.network.Networks.TrafficType;
import com.cloud.network.element.NetworkElement;
import com.cloud.network.element.UserDataServiceProvider;
import com.cloud.offering.NetworkOffering;
import com.cloud.offering.NetworkOffering.Detail;
import com.cloud.user.Account;
import com.cloud.vm.Nic;
import com.cloud.vm.NicProfile;
@ -96,8 +97,6 @@ public interface NetworkModel {
List<? extends Network> listAllNetworksInAllZonesByType(Network.GuestType type);
String getGlobalGuestDomainSuffix();
String getStartIpAddress(long networkId);
String getIpInNetwork(long vmId, long networkId);
@ -178,11 +177,6 @@ public interface NetworkModel {
*/
String getAccountNetworkDomain(long accountId, long zoneId);
/**
* @return
*/
String getDefaultNetworkDomain();
/**
* @param ntwkOffId
* @return
@ -260,7 +254,21 @@ public interface NetworkModel {
String getStartIpv6Address(long id);
Nic getPlaceholderNic(Network network, Long podId);
boolean isProviderEnabledInZone(long zoneId, String provider);
Nic getPlaceholderNicForRouter(Network network, Long podId);
IpAddress getPublicIpAddress(String ipAddress, long zoneId);
List<String> getUsedIpsInNetwork(Network network);
Map<Detail, String> getNtwkOffDetails(long offId);
Networks.IsolationType[] listNetworkIsolationMethods();
Nic getNicInNetworkIncludingRemoved(long vmId, long networkId);
boolean getExecuteInSeqNtwkElmtCmd();
boolean isNetworkReadyForGc(long networkId);
}

View File

@ -23,64 +23,70 @@ import com.cloud.network.Networks.Mode;
import com.cloud.network.Networks.TrafficType;
public class NetworkProfile implements Network {
private long id;
private String uuid;
private long dataCenterId;
private long ownerId;
private long domainId;
private final long id;
private final String uuid;
private final long dataCenterId;
private final long ownerId;
private final long domainId;
private String dns1;
private String dns2;
private URI broadcastUri;
private State state;
private String name;
private Mode mode;
private BroadcastDomainType broadcastDomainType;
private final State state;
private final String name;
private final Mode mode;
private final BroadcastDomainType broadcastDomainType;
private TrafficType trafficType;
private String gateway;
private String cidr;
private String networkCidr;
private String ip6Gateway;
private String ip6Cidr;
private long networkOfferingId;
private long related;
private String displayText;
private String reservationId;
private String networkDomain;
private Network.GuestType guestType;
private final String gateway;
private final String cidr;
private final String networkCidr;
private final String ip6Gateway;
private final String ip6Cidr;
private final long networkOfferingId;
private final long related;
private final String displayText;
private final String reservationId;
private final String networkDomain;
private final Network.GuestType guestType;
private Long physicalNetworkId;
private ACLType aclType;
private boolean restartRequired;
private boolean specifyIpRanges;
private Long vpcId;
private final ACLType aclType;
private final boolean restartRequired;
private final boolean specifyIpRanges;
private final Long vpcId;
private final boolean displayNetwork;
private Long networkAclId;
private final String guruName;
public NetworkProfile(Network network) {
this.id = network.getId();
this.uuid = network.getUuid();
this.broadcastUri = network.getBroadcastUri();
this.dataCenterId = network.getDataCenterId();
this.ownerId = network.getAccountId();
this.state = network.getState();
this.name = network.getName();
this.mode = network.getMode();
this.broadcastDomainType = network.getBroadcastDomainType();
this.trafficType = network.getTrafficType();
this.gateway = network.getGateway();
this.cidr = network.getCidr();
this.networkCidr = network.getNetworkCidr();
this.ip6Gateway = network.getIp6Gateway();
this.ip6Cidr = network.getIp6Cidr();
this.networkOfferingId = network.getNetworkOfferingId();
this.related = network.getRelated();
this.displayText = network.getDisplayText();
this.reservationId = network.getReservationId();
this.networkDomain = network.getNetworkDomain();
this.domainId = network.getDomainId();
this.guestType = network.getGuestType();
this.physicalNetworkId = network.getPhysicalNetworkId();
this.aclType = network.getAclType();
this.restartRequired = network.isRestartRequired();
this.specifyIpRanges = network.getSpecifyIpRanges();
this.vpcId = network.getVpcId();
id = network.getId();
uuid = network.getUuid();
broadcastUri = network.getBroadcastUri();
dataCenterId = network.getDataCenterId();
ownerId = network.getAccountId();
state = network.getState();
name = network.getName();
mode = network.getMode();
broadcastDomainType = network.getBroadcastDomainType();
trafficType = network.getTrafficType();
gateway = network.getGateway();
cidr = network.getCidr();
networkCidr = network.getNetworkCidr();
ip6Gateway = network.getIp6Gateway();
ip6Cidr = network.getIp6Cidr();
networkOfferingId = network.getNetworkOfferingId();
related = network.getRelated();
displayText = network.getDisplayText();
reservationId = network.getReservationId();
networkDomain = network.getNetworkDomain();
domainId = network.getDomainId();
guestType = network.getGuestType();
physicalNetworkId = network.getPhysicalNetworkId();
aclType = network.getAclType();
restartRequired = network.isRestartRequired();
specifyIpRanges = network.getSpecifyIpRanges();
vpcId = network.getVpcId();
displayNetwork = network.getDisplayNetwork();
networkAclId = network.getNetworkACLId();
guruName = network.getGuruName();
}
public String getDns1() {
@ -99,6 +105,11 @@ public class NetworkProfile implements Network {
this.dns2 = dns2;
}
@Override
public String getGuruName() {
return guruName;
}
public void setBroadcastUri(URI broadcastUri) {
this.broadcastUri = broadcastUri;
}
@ -231,14 +242,29 @@ public class NetworkProfile implements Network {
return false;
}
@Override
public boolean getDisplayNetwork() {
return displayNetwork;
}
@Override
public Long getVpcId() {
return vpcId;
}
@Override
public Long getNetworkACLId() {
return networkAclId;
}
@Override
public void setNetworkACLId(Long networkACLId) {
networkAclId = networkACLId;
}
@Override
public void setTrafficType(TrafficType type) {
this.trafficType = type;
trafficType = type;
}
@Override

View File

@ -17,11 +17,13 @@
package com.cloud.network;
import java.util.List;
import java.util.Map;
import com.cloud.offering.NetworkOffering;
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;
import org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
import org.apache.cloudstack.api.command.user.network.*;
import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
import com.cloud.exception.ConcurrentOperationException;
@ -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,11 +49,16 @@ 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;
IpAddress allocatePortableIP(Account ipOwner, int regionId, Long zoneId, Long networkId, Long vpcId) throws ResourceAllocationException,
InsufficientAddressCapacityException, ConcurrentOperationException;
boolean releasePortableIpAddress(long ipAddressId);
Network createGuestNetwork(CreateNetworkCmd cmd) throws InsufficientCapacityException, ConcurrentOperationException,
ResourceAllocationException;
@ -70,7 +78,7 @@ public interface NetworkService {
IpAddress getIp(long id);
Network updateGuestNetwork(long networkId, String name, String displayText, Account callerAccount, User callerUser,
String domainSuffix, Long networkOfferingId, Boolean changeCidr, String guestVmCidr);
String domainSuffix, Long networkOfferingId, Boolean changeCidr, String guestVmCidr, Boolean displayNetwork);
PhysicalNetwork createPhysicalNetwork(Long zoneId, String vnetRange, String networkSpeed,
List<String> isolationMethods, String broadcastDomainRange, Long domainId, List<String> tags, String name);
@ -79,7 +87,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);
boolean deletePhysicalNetwork(Long id);
@ -114,6 +122,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 +152,7 @@ public interface NetworkService {
ResourceAllocationException, ResourceUnavailableException, ConcurrentOperationException;
/**
*
* @param networkName
* @param displayText
* @param physicalNetworkId
@ -148,21 +163,24 @@ 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);
/* lists the nic informaton */
List<? extends Nic> listNics(ListNicsCmd listNicsCmd);
Map<Network.Capability, String> getNetworkOfferingServiceCapabilities(NetworkOffering offering, Service service);
}

View File

@ -23,7 +23,7 @@ import com.cloud.utils.exception.CloudRuntimeException;
/**
* Network includes all of the enums used within networking.
*
*
*/
public class Networks {
@ -55,17 +55,63 @@ public class Networks {
* Different types of broadcast domains.
*/
public enum BroadcastDomainType {
Native(null, null),
Vlan("vlan", Integer.class),
Native(null, null) {
@Override
public <T> URI toUri(T value) {
try {
if (value.toString().contains("://"))
return new URI(value.toString());
else
// strange requirement but this is how the code expects it
return new URI("vlan://" + value.toString());
} catch (URISyntaxException e) {
throw new CloudRuntimeException("Unable to convert to broadcast URI: " + value);
}
}
},
Vlan("vlan", Integer.class) {
@Override
public <T> URI toUri(T value) {
try {
if (value.toString().contains("://"))
return new URI(value.toString());
else
return new URI("vlan://" + value.toString());
} catch (URISyntaxException e) {
throw new CloudRuntimeException(
"Unable to convert to broadcast URI: " + value);
}
}
},
Vswitch("vs", String.class),
LinkLocal(null, null),
Vnet("vnet", Long.class),
Storage("storage", Integer.class),
Lswitch("lswitch", String.class),
Lswitch("lswitch", String.class) {
@Override
public <T> URI toUri(T value) {
try {
return new URI("lswitch",value.toString(),null,null);
} catch (URISyntaxException e) {
throw new CloudRuntimeException(
"Unable to convert to broadcast URI: " + value);
}
}
/**
* gets scheme specific part instead of host
*/
@Override
public String getValueFrom(URI uri) {
return uri.getSchemeSpecificPart();
}
},
Mido("mido", String.class),
Pvlan("pvlan", String.class),
UnDecided(null, null);
private String scheme;
private Class<?> type;
private final String scheme;
private final Class<?> type;
private BroadcastDomainType(String scheme, Class<?> type) {
this.scheme = scheme;
@ -73,24 +119,137 @@ public class Networks {
}
/**
* @return scheme to be used in broadcast uri. Null indicates that this type does not have broadcast tags.
* @return scheme to be used in broadcast uri. Null indicates that this
* type does not have broadcast tags.
*/
public String scheme() {
return scheme;
}
/**
* @return type of the value in the broadcast uri. Null indicates that this type does not have broadcast tags.
* @return type of the value in the broadcast uri. Null indicates that
* this type does not have broadcast tags.
*/
public Class<?> type() {
return type;
}
/**
* The default implementation of toUri returns an uri with the scheme and value as host
*
* @param value will be put in the host field
* @return the resulting URI
*/
public <T> URI toUri(T value) {
try {
return new URI(scheme + "://" + value);
return new URI(scheme + "://" + value.toString());
} catch (URISyntaxException e) {
throw new CloudRuntimeException("Unable to convert to broadcast URI: " + value);
throw new CloudRuntimeException(
"Unable to convert to broadcast URI: " + value);
}
}
/**
* get the enum value from this uri
*
* @param uri to get the scheme value from
* @return the scheme as BroadcastDomainType
*/
public static BroadcastDomainType getSchemeValue(URI uri) {
return toEnumValue(uri.getScheme());
}
/**
* gets the type from a string encoded uri
*
* @param str the uri string
* @return the scheme as BroadcastDomainType
* @throws URISyntaxException when the string can not be converted to URI
*/
public static BroadcastDomainType getTypeOf(String str)
throws URISyntaxException {
if (com.cloud.dc.Vlan.UNTAGGED.equalsIgnoreCase(str)) {
return Native;
}
return getSchemeValue(new URI(str));
}
/**
* converts a String to a BroadcastDomainType
*
* @param scheme convert a string representation to a BroacastDomainType
* @return the value of this
*/
public static BroadcastDomainType toEnumValue(String scheme) {
if (scheme == null) {
return UnDecided;
}
for (BroadcastDomainType type : values()) {
if (scheme.equalsIgnoreCase(type.scheme())) {
return type;
}
}
return UnDecided;
}
/**
* The default implementation of getValueFrom returns the host part of the uri
*
* @param uri to get the value from
* @return the host part as String
*/
public String getValueFrom(URI uri) {
return uri.getHost();
}
/**
* get the BroadcastDomain value from an arbitrary URI
* TODO what when the uri is useless
*
* @param uri the uri
* @return depending on the scheme/BroadcastDomainType
*/
public static String getValue(URI uri) {
return getSchemeValue(uri).getValueFrom(uri);
}
/**
* get the BroadcastDomain value from an arbitrary String
* TODO what when the uriString is useless
*
* @param uriString the string encoded uri
* @return depending on the scheme/BroadcastDomainType
* @throws URISyntaxException the string is not even an uri
*/
public static String getValue(String uriString)
throws URISyntaxException {
return getValue(new URI(uriString));
}
/**
* encode a string into a BroadcastUri
* @param candidate the input string
* @return an URI containing an appropriate (possibly given) scheme and the value
*/
public static URI fromString(String candidate) {
try {
Long.parseLong(candidate);
return Vlan.toUri(candidate);
} catch (NumberFormatException nfe) {
if (com.cloud.dc.Vlan.UNTAGGED.equalsIgnoreCase(candidate)) {
return Native.toUri(candidate);
}
try {
URI uri = new URI(candidate);
BroadcastDomainType tiep = getSchemeValue(uri);
if (tiep.scheme.equals(uri.getScheme())) {
return uri;
} else {
throw new CloudRuntimeException("string '" + candidate + "' has an unknown BroadcastDomainType.");
}
} catch (URISyntaxException e) {
throw new CloudRuntimeException("string is not a broadcast URI: " + candidate);
}
}
}
};
@ -108,8 +267,7 @@ public class Networks {
Vpn;
public static boolean isSystemNetwork(TrafficType trafficType) {
if (Storage.equals(trafficType)
|| Management.equals(trafficType)
if (Storage.equals(trafficType) || Management.equals(trafficType)
|| Control.equals(trafficType)) {
return true;
}
@ -138,7 +296,20 @@ public class Networks {
public enum IsolationType {
None(null, null),
Ec2("ec2", String.class),
Vlan("vlan", Integer.class),
Vlan("vlan", Integer.class) {
@Override
public <T> URI toUri(T value) {
try {
if (value.toString().contains(":"))
return new URI(value.toString());
else
return new URI("vlan", value.toString(), null, null);
} catch (URISyntaxException e) {
throw new CloudRuntimeException(
"Unable to convert to isolation URI: " + value);
}
}
},
Vswitch("vs", String.class),
Undecided(null, null),
Vnet("vnet", Long.class);
@ -161,11 +332,10 @@ public class Networks {
public <T> URI toUri(T value) {
try {
// assert(this!=Vlan || value.getClass().isAssignableFrom(Integer.class)) :
// "Why are you putting non integer into vlan url";
return new URI(scheme + "://" + value.toString());
} catch (URISyntaxException e) {
throw new CloudRuntimeException("Unable to convert to isolation type URI: " + value);
throw new CloudRuntimeException(
"Unable to convert to isolation type URI: " + value);
}
}
}
@ -174,7 +344,7 @@ public class Networks {
Vlan("vlan"),
VSwitch("vswitch");
private String scheme;
private final String scheme;
private BroadcastScheme(String scheme) {
this.scheme = scheme;

View File

@ -18,6 +18,7 @@ package com.cloud.network;
import java.util.List;
import com.cloud.utils.Pair;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
@ -36,7 +37,9 @@ public interface PhysicalNetwork extends Identity, InternalIdentity {
L3,
GRE,
STT,
VNS;
VNS,
MIDO,
SSP;
}
public enum BroadcastDomainRange {
@ -58,7 +61,9 @@ public interface PhysicalNetwork extends Identity, InternalIdentity {
Long getDomainId();
String getVnet();
List<Pair<Integer,Integer>> getVnet();
String getVnetString();
String getSpeed();

View File

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

View File

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

View File

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

View File

@ -27,5 +27,7 @@ import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
public interface DhcpServiceProvider extends NetworkElement {
boolean addDhcpEntry(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
boolean addDhcpEntry(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
boolean configDhcpSupportForSubnet(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
boolean removeDhcpSupportForSubnet(Network network) throws ResourceUnavailableException;
}

View File

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

View File

@ -21,6 +21,7 @@ import java.util.List;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Network;
import com.cloud.network.rules.FirewallRule;
import com.cloud.network.vpc.NetworkACLItem;
public interface NetworkACLServiceProvider extends NetworkElement{
@ -30,6 +31,6 @@ public interface NetworkACLServiceProvider extends NetworkElement{
* @return
* @throws ResourceUnavailableException
*/
boolean applyNetworkACLs(Network config, List<? extends FirewallRule> rules) throws ResourceUnavailableException;
boolean applyNetworkACLs(Network config, List<? extends NetworkACLItem> rules) throws ResourceUnavailableException;
}

View File

@ -71,7 +71,7 @@ public interface NetworkElement extends Adapter {
* @throws ResourceUnavailableException
* @throws InsufficientNetworkCapacityException
*/
boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm,
boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm,
DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
ResourceUnavailableException, InsufficientCapacityException;
@ -85,7 +85,7 @@ public interface NetworkElement extends Adapter {
* @throws ConcurrentOperationException
* @throws ResourceUnavailableException
*/
boolean release(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm,
boolean release(Network network, NicProfile nic, VirtualMachineProfile vm,
ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException;
/**

View File

@ -27,8 +27,8 @@ import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
public interface UserDataServiceProvider extends NetworkElement {
public boolean addPasswordAndUserdata(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
boolean savePassword(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws ResourceUnavailableException;
boolean saveUserData(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws ResourceUnavailableException;
boolean saveSSHKey(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String SSHPublicKey) throws ResourceUnavailableException;
public boolean addPasswordAndUserdata(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
boolean savePassword(Network network, NicProfile nic, VirtualMachineProfile vm) throws ResourceUnavailableException;
boolean saveUserData(Network network, NicProfile nic, VirtualMachineProfile vm) throws ResourceUnavailableException;
boolean saveSSHKey(Network network, NicProfile nic, VirtualMachineProfile vm, String SSHPublicKey) throws ResourceUnavailableException;
}

View File

@ -24,6 +24,7 @@ import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InsufficientNetworkCapacityException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.vpc.NetworkACLItem;
import com.cloud.network.vpc.PrivateGateway;
import com.cloud.network.vpc.StaticRouteProfile;
import com.cloud.network.vpc.Vpc;
@ -52,4 +53,6 @@ public interface VpcProvider extends NetworkElement{
boolean deletePrivateGateway(PrivateGateway privateGateway) throws ConcurrentOperationException, ResourceUnavailableException;
boolean applyStaticRoutes(Vpc vpc, List<StaticRouteProfile> routes) throws ResourceUnavailableException;
boolean applyACLItemsToPrivateGw(PrivateGateway gateway, List<? extends NetworkACLItem> rules) throws ResourceUnavailableException;
}

View File

@ -29,7 +29,6 @@ import com.cloud.user.Account;
import com.cloud.utils.component.Adapter;
import com.cloud.vm.NicProfile;
import com.cloud.vm.ReservationContext;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
/**
@ -127,7 +126,7 @@ public interface NetworkGuru extends Adapter {
* @throws InsufficientAddressCapacityException if there are not addresses
* to be assigned.
*/
NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException;
NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException;
/**
* Once a guest network is implemented, then the virtual machine must
@ -147,7 +146,7 @@ public interface NetworkGuru extends Adapter {
* @throws ConcurrentOperationException if there are multiple operations
* happening on this guest network or vm.
*/
void reserve(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException;
void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException;
/**
* When a virtual machine is stopped, the NetworkGuru is informed via the
@ -158,7 +157,7 @@ public interface NetworkGuru extends Adapter {
* @param reservationId reservation id passed to it in the ReservationContext
* @return true if release is successful or false if unsuccessful.
*/
boolean release(NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String reservationId);
boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId);
/**
* When a virtual machine is destroyed, the NetworkGuru is informed via
@ -169,7 +168,7 @@ public interface NetworkGuru extends Adapter {
* @param nic nic that the vm was using to access the guest network.
* @param vm virtual machine being destroyed.
*/
void deallocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm);
void deallocate(Network network, NicProfile nic, VirtualMachineProfile vm);
/**
* @deprecated This method should not be here in the first place. What does this really mean? Is it always persisted
@ -196,10 +195,9 @@ public interface NetworkGuru extends Adapter {
*
* @param network guest network being destroyed.
* @param offering network offering the guest network was created with.
* @param owner owner of the network.
* @return true if trash was successful; false if not.
*/
boolean trash(Network network, NetworkOffering offering, Account owner);
boolean trash(Network network, NetworkOffering offering);
void updateNetworkProfile(NetworkProfile networkProfile);

View File

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

View File

@ -17,10 +17,10 @@
package com.cloud.network.lb;
import java.util.List;
import java.util.Map;
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLBHealthCheckPolicyCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLBStickinessPolicyCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLoadBalancerRuleCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.ListLBHealthCheckPoliciesCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.ListLBStickinessPoliciesCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.ListLoadBalancerRuleInstancesCmd;
@ -30,12 +30,13 @@ import org.apache.cloudstack.api.command.user.loadbalancer.UpdateLoadBalancerRul
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.lb.LoadBalancingRule.LbStickinessPolicy;
import com.cloud.network.rules.HealthCheckPolicy;
import com.cloud.network.rules.LoadBalancer;
import com.cloud.network.rules.LoadBalancerContainer.Scheme;
import com.cloud.network.rules.StickinessPolicy;
import com.cloud.uservm.UserVm;
import com.cloud.utils.Pair;
import com.cloud.utils.net.Ip;
public interface LoadBalancingRulesService {
@ -49,7 +50,9 @@ public interface LoadBalancingRulesService {
* @return the newly created LoadBalancerVO if successful, null otherwise
* @throws InsufficientAddressCapacityException
*/
LoadBalancer createLoadBalancerRule(CreateLoadBalancerRuleCmd lb, boolean openFirewall) throws NetworkRuleConflictException, InsufficientAddressCapacityException;
LoadBalancer createPublicLoadBalancerRule(String xId, String name, String description,
int srcPortStart, int srcPortEnd, int defPortStart, int defPortEnd, Long ipAddrId, String protocol, String algorithm,
long networkId, long lbOwnerId, boolean openFirewall) throws NetworkRuleConflictException, InsufficientAddressCapacityException;
LoadBalancer updateLoadBalancerRule(UpdateLoadBalancerRuleCmd cmd);
@ -100,9 +103,10 @@ public interface LoadBalancingRulesService {
* balancer.
*
* @param cmd
* @return list of vm instances that have been or can be applied to a load balancer
* @return list of vm instances that have been or can be applied to a load balancer along with service state,
* if the LB has health check policy created on it from cloudstack.
*/
List<? extends UserVm> listLoadBalancerInstances(ListLoadBalancerRuleInstancesCmd cmd);
Pair<List<? extends UserVm>, List<String>> listLoadBalancerInstances(ListLoadBalancerRuleInstancesCmd cmd);
/**
* List load balancer rules based on the given criteria
@ -134,8 +138,9 @@ public interface LoadBalancingRulesService {
List<? extends HealthCheckPolicy> searchForLBHealthCheckPolicies(ListLBHealthCheckPoliciesCmd cmd);
List<LoadBalancingRule> listByNetworkId(long networkId);
LoadBalancer findById(long LoadBalancer);
public void updateLBHealthChecks() throws ResourceUnavailableException;
public void updateLBHealthChecks(Scheme scheme) throws ResourceUnavailableException;
Map<Ip, UserVm> getLbInstances(long lbId);
}

View File

@ -22,8 +22,8 @@ import com.cloud.vm.VirtualMachine;
* bridge internal and external traffic.
*/
public interface VirtualRouter extends VirtualMachine {
public enum Role {
VIRTUAL_ROUTER, LB
public enum Role {
VIRTUAL_ROUTER, LB, INTERNAL_LB_VM
}
Role getRole();
boolean getIsRedundantRouter();

View File

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

View File

@ -14,13 +14,20 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.agent.api;
package com.cloud.network.rules;
public class UpgradeAnswer extends Answer {
protected UpgradeAnswer() {
public interface LoadBalancerContainer {
public enum Scheme {
Public, Internal;
}
public UpgradeAnswer(UpgradeCommand cmd, String failure) {
super(cmd, false, failure);
}
String getName();
String getDescription();
String getAlgorithm();
Scheme getScheme();
}

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