286 Commits

Author SHA1 Message Date
Nicolas Vazquez
e86bb41e0e CLOUDSTACK-10146: Bypass Secondary Storage for KVM templates (#2379)
This feature allows using templates and ISOs avoiding secondary storage as intermediate cache on KVM. The virtual machine deployment process is enhanced to supported bypassed registered templates and ISOs, delegating the work of downloading them to primary storage to the KVM agent instead of the SSVM agent.

Template and ISO registration:
- When hypervisor is KVM, a checkbox is displayed with 'Direct Download' label.
- API methods registerTemplate and registerISO are both extended with this new parameter directdownload.
- On template or ISO registration, no download job is sent to SSVM agent, CloudStack would only persist an entry on template_store_ref indicating that template or ISO has been marked as 'Direct Download' (bypassing Secondary Storage). These entries are persisted as:
template_id = Template or ISO id on vm_template table
store_id NULL
download_state = BYPASSED
state = Ready
(Note: these entries allow users to deploy virtual machine from registered templates or ISOs)
- An URL validation command is sent to a random KVM host to check if template/ISO location can be reached. Metalink are also supported by this feature. In case of a metalink, it is fetched and URL check is performed on each of its URLs.
- Checksum should be provided as indicated on #2246: {ALGORITHM}CHKSUMHASH
- After template or ISO is registered, it would be displayed in the UI

Virtual machine deployment:
When a 'Direct Download' template is selected for deployment, CloudStack would delegate template downloading to destination storage pool via destination host by a new pluggable download manager.
Download manager would handle template downloading depending on URL protocol. In case of HTTP, request headers can be set by the user via vm_template_details. Those details should be persisted as:
Key: HTTP_HEADER
Value: HEADERNAME:HEADERVALUE

In case of HTTPS, a new API method is added uploadTemplateDirectDownloadCertificate to allow user importing a client certificate into all KVM hosts' keystore before deployment.
After template or ISO is downloaded to primary storage, usual entry would be persisted on template_spool_ref indicating the mapping between template/ISO and storage pool.
2018-01-09 12:22:18 +05:30
Rohit Yadav
facc5945f0 CLOUDSTACK-10193: Fix smoke tests failures with new systemvmtemplate
- Several systemvmtemplate optimizations
- Uses new macchinina template for running smoke tests
- Switch to latest Debian 9.3.0 release for systemvmtemplate
- Introduce a new `get_test_template` that uses tiny test template
  such as macchinina as defined test_data.py
- rVR related fixes and improvements

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2017-12-23 09:22:44 +05:30
Nitin Kumar Maharana
8c6fb0e312 CLOUDSTACK-10157: Wrong notification while migration (#2337)
Root Cause:
Earlier, it was failing with ArrayIndexOutOfBoundsException, when the list is empty and accessing the first element.
The error was only observed in Log, but was not showing in UI as it was not throwing any exception.
Hence the API call was in turn successful.

Solution:
Added the empty check before sending device details.
Which says either the required GPU device is not available or out of capacity.
2017-12-11 21:50:37 +05:30
SudharmaJain
c670691bfb CLOUDSTACK-8865: Adding SR doesn't create Storage_pool_host_ref entry for disabled host (#876)
This causes VM deployment failure on the host that was disabled while adding the storage repository.
In the attachCluster function of the PrimaryDataStoreLifeCycle, we were only selecting hosts that are up and are in enabled state. Here if we select all up hosts, it will populate the DB properly and will fix this issue. Also added a unit test for attachCluster function.
2017-09-21 10:49:11 +05:30
Boris Stoyanov
f917ab660e CLOUDSTACK-9782: Improve host HA tests
- All tests should pass on KVM, Simulator
- Add test cases covering FSM state transitions and actions

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2017-08-30 18:06:48 +02:00
Rohit Yadav
7ce54bf7a8 CLOUDSTACK-9993: Securing Agents Communications (#2239)
This introduces a new certificate authority framework that allows
pluggable CA provider implementations to handle certificate operations
around issuance, revocation and propagation. The framework injects
itself to `NioServer` to handle agent connections securely. The
framework adds assumptions in `NioClient` that a keystore if available
with known name `cloud.jks` will be used for SSL negotiations and
handshake.

This includes a default 'root' CA provider plugin which creates its own
self-signed root certificate authority on first run and uses it for
issuance and provisioning of certificate to CloudStack agents such as
the KVM, CPVM and SSVM agents and also for the management server for
peer clustering.

Additional changes and notes:
- Comma separate list of management server IPs can be set to the 'host'
  global setting. Newly provisioned agents (KVM/CPVM/SSVM etc) will get
  radomized comma separated list to which they will attempt connection
  or reconnection in provided order. This removes need of a TCP LB on
  port 8250 (default) of the management server(s).
- All fresh deployment will enforce two-way SSL authentication where
  connecting agents will be required to present certificates issued
  by the 'root' CA plugin.
- Existing environment on upgrade will continue to use one-way SSL
  authentication and connecting agents will not be required to present
  certificates.
- A script `keystore-setup` is responsible for initial keystore setup
  and CSR generation on the agent/hosts.
- A script `keystore-cert-import` is responsible for import provided
  certificate payload to the java keystore file.
- Agent security (keystore, certificates etc) are setup initially using
  SSH, and later provisioning is handled via an existing agent connection
  using command-answers. The supported clients and agents are limited to
  CPVM, SSVM, and KVM agents, and clustered management server (peering).
- Certificate revocation does not revoke an existing agent-mgmt server
  connection, however rejects a revoked certificate used during SSL
  handshake.
- Older `cloudstackmanagement.keystore` is deprecated and will no longer
  be used by mgmt server(s) for SSL negotiations and handshake. New
  keystores will be named `cloud.jks`, any additional SSL certificates
  should not be imported in it for use with tomcat etc. The `cloud.jks`
  keystore is stricly used for agent-server communications.
- Management server keystore are validated and renewed on start up only,
  the validity of them are same as the CA certificates.

New APIs:
- listCaProviders: lists all available CA provider plugins
- listCaCertificate: lists the CA certificate(s)
- issueCertificate: issues X509 client certificate with/without a CSR
- provisionCertificate: provisions certificate to a host
- revokeCertificate: revokes a client certificate using its serial

Global settings for the CA framework:
- ca.framework.provider.plugin: The configured CA provider plugin
- ca.framework.cert.keysize: The key size for certificate generation
- ca.framework.cert.signature.algorithm: The certificate signature algorithm
- ca.framework.cert.validity.period: Certificate validity in days
- ca.framework.cert.automatic.renewal: Certificate auto-renewal setting
- ca.framework.background.task.delay: CA background task delay/interval
- ca.framework.cert.expiry.alert.period: Days to check and alert expiring certificates

Global settings for the default 'root' CA provider:
- ca.plugin.root.private.key: (hidden/encrypted) CA private key
- ca.plugin.root.public.key: (hidden/encrypted) CA public key
- ca.plugin.root.ca.certificate: (hidden/encrypted) CA certificate
- ca.plugin.root.issuer.dn: The CA issue distinguished name
- ca.plugin.root.auth.strictness: Are clients required to present certificates
- ca.plugin.root.allow.expired.cert: Are clients with expired certificates allowed

UI changes:
- Button to download/save the CA certificates.

Misc changes:
- Upgrades bountycastle version and uses newer classes
- Refactors SAMLUtil to use new CertUtils

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2017-08-28 12:15:11 +02:00
Rajani Karuturi
02996fcabf Merge pull request #1779 from priyankparihar/CLOUDSTACK-9610
CLOUDSTACK-9610: Disabled Host Keeps Being up status after unmanaging …
2017-06-06 16:05:21 +05:30
Rajani Karuturi
d962cc1b60 Merge pull request #1869 from sudhansu7/CLOUDSTACK-9701
CLOUDSTACK-9701: Local storage capacity is not handled properly
2017-06-06 15:52:51 +05:30
Sudhansu
e06e3b7cd4 CLOUDSTACK-9701: When host is disabled/removed,
capacity_type for local storage in op_host_capacity
is still enabled
2017-05-09 15:44:02 +05:30
Priyank Parihar
4b165f1b8f CLOUDSTACK-9610: Disabled Host Keeps Being up status after unmanging cluster. 2017-03-07 14:23:29 +05:30
Harikrishna Patnala
1e256ccf50 CLOUDSTACK-8897: baremetal:addHost:make host tag info mandtory in baremetal addhost Api call
addhost api is successful with out providing the host tag info and we recommend host tag is mandatory for bare-metal.
In the current implementation host tag check is happening at vm deployment stage but it will be good to have host tag field as mandatory field during adding of the host it self.
2017-03-01 14:18:49 +05:30
nvazquez
6ce6cf67f0 CLOUDSTACK-9738: [Vmware] Optimize vm expunge process for instances with vm snapshots 2017-02-06 23:39:01 -03:00
Nick Livens
ffe72ca227 CLOUDSTACK-9399 : NPE during deletion of host when clusterId is null 2016-06-08 08:18:14 +02:00
Will Stevens
82b702dc9a Merge pull request #1403 from mike-tutkowski/xs-snapshots
Taking fast and efficient volume snapshots with XenServer (and your storage provider)A XenServer storage repository (SR) and virtual disk image (VDI) each have UUIDs that are immutable.

This poses a problem for SAN snapshots, if you intend on mounting the underlying snapshot SR alongside the source SR (duplicate UUIDs).

VMware has a solution for this called re-signaturing (so, in other words, the snapshot UUIDs can be changed).

This PR only deals with the CloudStack side of things, but it works in concert with a new XenServer storage manager created by CloudOps (this storage manager enables re-signaturing of XenServer SR and VDI UUIDs).

I have written Marvin integration tests to go along with this, but cannot yet check those into the CloudStack repo as they rely on SolidFire hardware.

If anyone would like to see these integration tests, please let me know.

JIRA ticket: https://issues.apache.org/jira/browse/CLOUDSTACK-9281

Here's a video I made that shows this feature in action:

https://www.youtube.com/watch?v=YQ3pBeL-WaA&list=PLqOXKM0Bt13DFnQnwUx8ZtJzoyDV0Uuye&index=13

* pr/1403:
  Faster logic to see if a cluster supports resigning
  Support for backend snapshots with XenServer

Signed-off-by: Will Stevens <williamstevens@gmail.com>
2016-05-20 08:33:07 -04:00
Sudhansu
18a6aa89be CLOUDSTACK-9366: Capacity of one zone-wide primary storage ignored
introduced new capacityType parameter in updateCapacityState method and necessary changes to add capacity_type clause in sql
also fixed incorrect sql builder logic (unused code path for which it is never surfaced )
Added marvin test to  check host and storagepool capacity when host is disabled
Added conditions to ensure the capacity_type is added only when capacity_type length is greater than 0.
Added checks in marvin test to ensure the capacity exists for a host before disabling it.
Added  checks to avoid index out of range exception
2016-05-19 20:24:04 +05:30
Mike Tutkowski
9d215562eb Faster logic to see if a cluster supports resigning 2016-05-16 07:18:39 -06:00
Mike Tutkowski
2bd035d199 Support for backend snapshots with XenServer 2016-05-13 01:02:04 -06:00
Will Stevens
7e41747c33 Merge pull request #816 from mike-tutkowski/addremovehosts2
Notify listeners when a host has been added to a cluster, is about to be removed from a cluster, or has been removed from a cluster

This PR addresses the following JIRA ticket:

https://issues.apache.org/jira/browse/CLOUDSTACK-8813

The problem is that there needs to be notifications sent when a host is added to, about to be removed from, and removed from a cluster.

Such notifications can be used for many purposes. For example, it can allow storage plug-ins to update ACLs on their storage systems. Also, it can allow us to clean up IQNs from ESXi hosts that are no longer needed.

* pr/816:
  CLOUDSTACK-8813: Notify listeners when a host has been added to a cluster, is about to be removed from a cluster, or has been removed from a cluster

Signed-off-by: Will Stevens <williamstevens@gmail.com>
2016-05-12 11:07:36 -04:00
Rohit Yadav
07564469e9 CLOUDSTACK-9299: Out-of-band Management for CloudStack
Support access to a host’s out-of-band management interface (e.g. IPMI, iLO,
DRAC, etc.) to manage host power operations (on/off etc.) and querying current
power state in CloudStack.

Given the wide range of out-of-band management interfaces such as iLO and iDRA,
the service implementation allows for development of separate drivers as plugins.
This feature comes with a ipmitool based driver that uses the
ipmitool (http://linux.die.net/man/1/ipmitool) to communicate with any
out-of-band management interface that support IPMI 2.0.

This feature allows following common use-cases:
- Restarting stalled/failed hosts
- Powering off under-utilised hosts
- Powering on hosts for provisioning or to increase capacity
- Allowing system administrators to see the current power state of the host

For testing this feature `ipmisim` can be used:
https://pypi.python.org/pypi/ipmisim

FS:
https://cwiki.apache.org/confluence/display/CLOUDSTACK/Out-of-band+Management+for+CloudStack

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-05-12 11:05:40 +05:30
Mike Tutkowski
dad9e5d868 CLOUDSTACK-8813: Notify listeners when a host has been added to a cluster, is about to be removed from a cluster, or has been removed from a cluster 2016-05-11 08:02:46 -06:00
Abhinandan Prateek
182ab648b5 CLOUDSTACK-9323: Fix Cancel maintenance so that if maintenance is cancelled the host come back to normal state gracefully.
Added marvin tests for host maintennace.
2016-04-25 15:28:32 +05:30
cirstofolini
1a64c247ad Removed unnecessary @Local annotations and their respective imports from the ComponentLifecycleBase class and its subclasses. 2015-11-21 18:31:11 -02:00
Rajani Karuturi
8bc0294014 Revert "Merge pull request #714 from rafaelweingartner/master-lrg-cs-hackday-003"
This reverts commit cd7218e241a8ac93df7a73f938320487aa526de6, reversing
changes made to f5a7395cc2ec37364a2e210eac60720e9b327451.

Reason for Revert:

noredist build failed with the below error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project cloud-plugin-hypervisor-vmware: Compilation failure
[ERROR] /home/jenkins/acs/workspace/build-master-noredist/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java:[484,12] error: non-static variable logger cannot be referenced from a static context
[ERROR] -> [Help 1]

even the normal build is broken as reported by @koushik-das on dev list
http://markmail.org/message/nngimssuzkj5gpbz
2015-08-31 11:27:57 +05:30
Rafael Weingartner
3818257a68 Solved jira ticket: CLOUDSTACK-8750 2015-08-28 22:35:08 -03:00
wilderrodrigues
86297e70be CLOUDSTACK-8607 - Make sure the new password replaces the old one in the queue
- Added log info to show details of the operation
   - Renamed the addPwdToQueue to replaceOldPasswdInQueue
2015-07-04 11:33:52 +02:00
wilderrodrigues
efa34361df CLOUDSTACK-8607 - Changed update script to return exit code based on the result
- Changed location of the update_host_passwd script
   - Updated the patch files for XenServer
   - Updated the script path on LibvirtComputing class
   - Removed the hostIP from the LibvirtUpdateHostPasswordCommandWrapper execute() method
2015-07-03 14:29:57 +02:00
wilderrodrigues
6c92ccf8d1 CLOUDSTACK-8607 - Refactoring attribute name
- Refactoring attribute name from shouldUpdateHost to updatePasswdOnHost
   - Fixing ApiConstants class because it had an error in the constant name
2015-07-03 11:43:56 +02:00
wilderrodrigues
47c7a1083f CLOUDSTACK-8607 - Adding update_host_passwd.sh script
- Modifying the LibvirtUpdateHostPasswordCommandWrapper in order to execute the script on the host
   - Adding the script path to LibvirtComputingResource
   - Adding the host IP address as an instance variable on UpdateHostPasswordCommand
   - Improving the Unit Test (LibvirtComputingResourceTest) to get it covering the new code
2015-07-02 14:54:51 +02:00
wilderrodrigues
a74971df06 CLOUDSTACK-8607 - Adding shouldUpdateHost flag
- Make sure doUpdateHostPassword() doesn't get called if flag is set to false
   - Do not update XenServer hosts if the cluster ID is not informed
2015-07-02 11:12:08 +02:00
wilderrodrigues
527d6ee77b Making possible to update KVM hosts password in the database via the API
- Make sure the doUpdateHostPassword() method returns the result from the answer, not always true
   - Added the LibvirtUpdateHostPasswordCommandWrapper class, which will handle the changes in the KVM agent
     That's will be further implemented in the future. The command will avoid the agent to complain about Unsupported command
   - Added a test to make sure the current implementation of the comment works
     - If changes in the future, it will also require changes. In that way, we make sure nobody will break it

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>

This closes #527
2015-06-29 09:59:12 +02:00
wilderrodrigues
b8ab3cd3b3 Fix a bug in the doUpdateHostPassword() method
- 2 years ago a change in that method caused an issue when trying to update the hosts password:
    - they would be updated in the databse but not in the host it self, causing the hosts to disconnect after a management server resstart

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-06-29 09:59:11 +02:00
wilderrodrigues
3367ecc71c Improving exception message
- Adding both ID and UUID of the host

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-06-29 09:59:11 +02:00
wilderrodrigues
284e2d68e1 In case we cannot update the password of all hosts in a cluster, please stop and notify the user about the failure.
- The host id that failed to get updated will be informed in the error.

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-06-29 09:59:11 +02:00
wilderrodrigues
03dd34039a Decouple the use of updateHostPassword
- The code was hard to maintain because updating a host or all the hosts in a cluster was handled in the same method
   - Created updateHost and updateCluster password in both ResourceManager and ManagementServer interfaces/classes
   - The chck for whihc method to use is done in the API level
   - Started adding the support for KVM host passwd update

No API changes are needed and it will be backwards compatible.

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-06-29 09:59:10 +02:00
wilderrodrigues
ac1b5e3705 Formatting the ResourceManagerImpl class
- Needed to be formatted before applying the changes

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-06-29 09:59:09 +02:00
Daan Hoogland
1669bb98a4 spaces in log message 2015-04-29 14:54:13 +02:00
Daan Hoogland
22e71be034 space in log message 2015-04-29 14:54:04 +02:00
Funs
c27c69438b hypervisors: add OVM3 plugin that supports OVM 3.2.1/3.3.x
This is a plugin that puts in ovm3 support ranging from 3.3.1 to 3.3.2. Basic
functionality is in here, advanced networking etc..

Snapshots only work when a VM is stopped now due to the semantics of OVM's raw
image implementation (so snapshots should work on a storage level underneath the
hypervisor shrug)

This closes #113

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-03-12 11:33:42 +05:30
Rohit Yadav
43cf1da865 CLOUDSTACK-5238: password checks, NPE fixes and minor fixes
- insecure authenticators excluded in configuration
- snapshot response should have zone
- remove vmsnapshots when removing accounts

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit 5481485a083957ff58da3b6fea9d7b6d20f06875)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

Conflicts:
	api/src/org/apache/cloudstack/api/response/VMSnapshotResponse.java
	server/src/com/cloud/api/ApiResponseHelper.java
	server/src/com/cloud/storage/download/DownloadActiveState.java
2015-02-27 18:24:46 +05:30
Mike Tutkowski
31f67c2b3c If the HypervisorType of a storage pool is Any, we need to retrieve hosts in the given zone for each HypervisorType. 2015-01-29 19:18:04 -07:00
Koushik Das
f6854bc984 CLOUDSTACK-8054: No event generated on host maintenance mode is completed
Added events for host maintenance start and completion
2014-12-10 10:18:34 +05:30
Laszlo Hornyak
3577423da9 removed executable flags from java classes
Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
2014-11-23 19:49:01 +01:00
Nitin Mehta
ade305be20 CLOUDSTACK-7909: Change the capacity_state in op_host_Capacity table only on explicit enabling/disabling of the host and remove the logic for changing it when cluster/pod/zone is enabled/disabled. Also add the logic in capacity checker thread so that previous changes finally get consistent with this new model and also its good to have it for sanity reasons. 2014-11-13 13:54:45 -08:00
Santhosh Edukulla
ef6ec7b276 Fixed few coverity issues like invalid boxing unboxing issues, resource leaks, null dereferences 2014-11-13 17:26:24 +05:30
Sanjay Tripathi
330bd2748e CLOUDSTACK-7859: Host tags are not getting removed in cloud.host_tags table when a Host is deleted from CS. 2014-11-07 17:32:25 +05:30
Sanjay Tripathi
7a8f511014 CLOUDSTACK-7372: [vGPU] When a host is put in maintenance mode, vGPU enabled VMs
failed to migrate to the other host in the cluster.

Migration for vGPU VMs is not supported in XS, so instead of migrating them to
new server, stopping them.
2014-11-04 16:46:28 +05:30
Anthony Xu
c78f14cbc2 fixed NPE 2014-10-29 17:05:42 -07:00
Daan Hoogland
1de0cb7094 restore barematel work after merge 2014-10-17 10:24:01 +02:00
Daan Hoogland
148efbb73f Merge remote-tracking branch 'origin/4.5' into merge-master
Conflicts:
	engine/schema/src/com/cloud/upgrade/dao/Upgrade441to450.java
	plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalManagerImpl.java
	plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalVlanManager.java
	plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalVlanManagerImpl.java
	plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartServiceImpl.java
	plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
	server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
	server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
	setup/db/db/schema-441to450.sql
	test/integration/component/test_deploy_vgpu_vm.py
	tools/marvin/marvin/config/test_data.py
2014-10-16 12:29:37 +02:00
Sanjay Tripathi
80e0c99189 Removed duplicate code and unused imports which was causing build failure. 2014-10-16 13:53:32 +05:30