Commit Graph

1491 Commits

Author SHA1 Message Date
Rohit Yadav 8f3cd943b1 APPLE-333: Oobm plugin for nested-cloudstack environments
This implements an out-of-band management plugin for nested-cloudstack
environments where the hypervisor host is a VM in a parent CloudStack environment
that is used as a host in the (testing) CloudStack environment. This plugin
allows power operations to translate into start/stop/reboot of the VM (host).

The out-of-band management configuration accepted are:
- Address: The API URL of the parent CloudStack enviroment
- Port: The uuid of the (host) VM in the parent CloudStack environment
- Username: The apikey of the user account who has ownership on the (host) VM
- Password: The secretkey of the user account who has ownership on the (host) VM

Note: change password of the oobm interface is not support by this plugin

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2017-04-19 16:58:38 +05:30
Rohit Yadav a00cb07ee0 APPLE-328: Metrics View APIs
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2017-02-16 13:20:30 +05:30
Rohit Yadav 876fc7434d APPLE-165: Host HA management and HA provider for KVM
Host-HA offers investigation, fencing and recovery mechanisms for host that for
any reason are malfunctioning. It uses Activity and Health checks to determine
current host state based on which it may degrade a host or try to recover it. On
failing to recover it, it may try to fence the host.

The core feature is implemented in a hypervisor agnostic way, with two separate
implementations of the driver/provider for Simulator and KVM hypervisors. The
framework also allows for implementation of other hypervisor specific provider
implementation in future.

The Host-HA provider implementation for KVM hypervisor uses the out-of-band
management sub-system to issue IPMI calls to reset (recover) or poweroff (fence)
a host.

The Host-HA provider implementation for Simulator provides a means of testing
and validating the core framework implementation.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2017-01-18 18:18:53 +05:30
Rohit Yadav 0841471cef Merge pull request #20 from shapeblue/roles-usage-fix
APPLE-274: Add role_id to cloud_usage.account
2016-10-25 10:42:00 +05:30
Rohit Yadav 1c3afb8279 APPLE-274: Add role_id to cloud_usage.account
Fixes usage server blocker which fails to work due to missing role_id
column in cloud_usage.account table.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-06-08 11:41:42 +09:00
Rohit Yadav a4848c1435 APPLE-272: Host Connects Without Storage
KVM hosts on shared storage failure was accepted by mgmt server with the
host state as Up, even though there was no primary/shared storage available on
it. This patch offers a quick fix by throwing an exception in the storage monitor
which connects storage pool on host. The failure is trapped by agent manager
that disconnects the agent without any investigation.

Based on Lab tests, KVM agent may take upto 2 minutes to attempt NFS mount when
the storage is inaccessible (firewalled, or shutdown) before returning back with
an error. It is safe to assume that this won't add pressure on mgmt server due to
several reconnection attempts, and KVM agent would retry reconnection every 2
minutes.

For such KVM hosts, where failure happens due to storage issues; they will be
briefly put in Alert state but will be mostly be in Connecting state during which
the KVM host attempts to mount/reconfigure NFS storage pool.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-06-08 09:19:57 +09:00
Rohit Yadav c8e0fc74ae dynamic-roles: remove order by ID
Removes order by id which is not necessary as we already do order by
sort_order. An additional order by seems to have caused mysql errors
in some environment, though it was not reproducible with MySQL 5.5/5.6/5.7
but this can be safely removed as it's not necessary.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-05-19 11:15:36 +05:30
Rohit Yadav bb0282dfa1 CLOUDSTACK-9299: Incorporate out-of-band management PR changes
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-05-10 14:12:10 +05:30
Rohit Yadav a5de2714e9 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-10 13:16:03 +05:30
Rohit Yadav 6f1e834753 CLOUDSTACK-8562: Make role permissions orderable
- Makes role permissions orderable in UI/backend
- Role permissions evaluated by fixed order
- Rules draggable in UI
- Migration script adds a default order

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-05-09 10:53:45 +05:30
John Burwell 50355907a3 Merge pull request #14 from shapeblue/dynamicrbac-4.5
Make role permissions orderable
2016-05-06 13:09:40 -04:00
Rohit Yadav e51f524039 CLOUDSTACK-9348: Use non-blocking SSL handshake
- Uses non-blocking SSL handshake and non-blocking connections
- Uses 60s as timeout for both client/server to guard against indefinitely
  blocking clients
- Unit test to prove fix, client and malicious clients trying to connect to server

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-05-06 10:07:47 +05:30
Rohit Yadav 9d8b1fd7e5 CLOUDSTACK-8562: Make role permissions orderable
- Makes role permissions orderable in UI/backend
- Role permissions evaluated by fixed order
- Rules draggable in UI
- Migration script adds a default order

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-05-03 23:00:46 +05:30
Rohit Yadav 16323f83f3 engine: fix upgrade path to work with mysql 5.7
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-04-25 14:52:08 +05:30
Rohit Yadav f30c52a16c CLOUDSTACK-8562: DB-Backed Dynamic Role Based API Access Checker
This feature allows root administrators to define new roles and associate API
permissions to them.

A limited form of role-based access control for the CloudStack management server
API is provided through a properties file, commands.properties, embedded in the
WAR distribution. Therefore, customizing API permissions requires unpacking the
distribution and modifying this file consistently on all servers. The old system
also does not permit the specification of additional roles.

FS:
https://cwiki.apache.org/confluence/display/CLOUDSTACK/Dynamic+Role+Based+API+Access+Checker+for+CloudStack

DB-Backed Dynamic Role Based API Access Checker for CloudStack brings following
changes, features and use-cases:
- Moves the API access definitions from commands.properties to the mgmt server DB
- Allows defining custom roles (such as a read-only ROOT admin) beyond the
  current set of four (4) roles
- All roles will resolve to one of the four known roles types (Admin, Resource
  Admin, Domain Admin and User) which maintains this association by requiring
  all new defined roles to specify a role type.
- Allows changes to roles and API permissions per role at runtime including additions or
  removal of roles and/or modifications of permissions, without the need
  of restarting management server(s)

Upgrade/installation notes:
- The feature will be enabled by default for new installations, existing
  deployments will continue to use the older static role based api access checker
  with an option to enable this feature
- During fresh installation or upgrade, the upgrade paths will add four default
  roles based on the four default role types
- For ease of migration, at the time of upgrade commands.properties will be used
  to add existing set of permissions to the default roles. cloud.account
  will have a new role_id column which will be populated based on default roles
  as well

Dynamic-roles migration tool: scripts/util/migrate-dynamicroles.py
- Allows admins to migrate to the dynamic role based checker at a future date
- Performs a harder one-way migrate and update
- Migrates rules from existing commands.properties file into db and deprecates it
- Enables an internal hidden switch to enable dynamic role based checker feature

Deprecate commands.properties

- Fixes apidocs and marvin to be independent of commands.properties usage
- Removes bundling of commands.properties in deb/rpm packaging
- Removes file references across codebase

Reviewed-by: John Burwell <john.burwell@shapeblue.com>
QA-by: Boris Stoyanov <boris.stoyanov@shapeblue.com>

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-04-25 14:52:02 +05:30
Daan Hoogland 84e9ff746b CLOUDSTACK-8848: added null pointer guard to new public method 2016-01-20 12:54:04 +01:00
Rene Moser f7e1029cfc CLOUDSTACK-8848: ensure power state is up to date when handling missing VMs in powerReport
There 2 things which has been changed.

* We look on power_state_update_time instead of update_time. Didn't make sense to me at all to look at update_time.
* Due DB update optimisation, powerState will only be updated if < MAX_CONSECUTIVE_SAME_STATE_UPDATE_COUNT. That is why we can not rely on these information unless we make sure these are up to date.
2016-01-20 12:54:03 +01:00
Rohit Yadav 17166eb631 schema: add 4.5.2 to 4.5.3 upgrade path stubs
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-09-15 09:57:48 +05:30
Rohit Yadav 284ce1fb88 engine/schema: add 4.5.2 to 4.5.3 upgrade path
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-09-15 09:57:12 +05:30
Rohit Yadav a4f552d46d cloudstack: set next version to 4.5.3-SNAPSHOT
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-09-14 09:59:40 +05:30
Rohit Yadav 0b4f97251a Merge remote-tracking branch 'origin/4.5-RC20150819T1442' into 4.5 2015-08-23 20:47:31 +05:30
Rohit Yadav 0062ff2672 CLOUDSTACK-8748: VM UUID accessible in CreateVMSnapshotCommand and RevertToVMSnapshotCommand
This patch makes it possible to expose VM UUID to subsystems, this can be
useful for implementing VM Snapshots for KVM in future.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-08-19 15:31:37 +05:30
Rohit Yadav 7385441807 Updating pom.xml version numbers for release 4.5.2
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-08-19 14:42:54 +05:30
Rohit Yadav 3c9d1fdf5d engine: fix accountState setter name
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-08-14 11:55:14 +05:30
Rohit Yadav 17366f2b18 CLOUDSTACK-8301: Enable configuring local storage use for system VMs at zone level
Backported from #263 for 4.5 branch, original bugfix by @koushik-das et al

More information on:
https://issues.apache.org/jira/browse/CLOUDSTACK-8301
https://cwiki.apache.org/confluence/display/CLOUDSTACK/Enable+configuring+local+storage+use+for+system+VMs+at+zone+level

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

This closes #661
2015-08-08 22:41:52 +05:30
Daan Hoogland fd459b89ff CLOUDSTACK-7539: no return in synchronised block 2015-07-17 13:06:23 +02:00
Hiroki Ohashi 9cb4a913d3 CLOUDSTACK-7539: [S3] Parallel deployment makes reference count of a cache in nfs secondary staging store negative(-1) 2015-07-17 13:05:21 +02:00
Rohit Yadav ba750293cc XenserverSnapshotStrategy: check if primary is null before proceeding in backupSnapshot
In backupSnapshot, it checks for snapshot in primary but does not check in advance if
it is null.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-06-29 18:38:04 +02:00
Rohit Yadav e50547a3ea engine/storage/snapshot: Fix NPE when parent could be null
Fixed potential NPE in SnapshotServiceImpl where parent snapshot is null

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-06-29 18:33:22 +02:00
Rohit Yadav 20ce346f3a CLOUDSTACK-8457: SAML auth plugin improvements for production usage
* Move config options to SAML plugin
  This moves all configuration options from Config.java to SAML auth manager. This
  allows us to use the config framework.
* Make SAML2UserAuthenticator validate SAML token in httprequest
* Make logout API use ConfigKeys defined in saml auth manager
* Before doing SAML auth, cleanup local states and cookies
* Fix configurations in 4.5.1 to 4.5.2 upgrade path
* Fail if idp has no sso URL defined
* Add a default set of SAML SP cert for testing purposes
  Now to enable and use saml, one needs to do a deploydb-saml after doing a deploydb
* UI remembers login selections, IDP server

- CLOUDSTACK-8458:
    * On UI show dropdown list of discovered IdPs
    * Support SAML Federation, where there may be more than one IdP
        - New datastructure to hold metadata of SP or IdP
        - Recursive processing of IdP metadata
        - Fix login/logout APIs to get new interface and metadata data structure
        - Add org/contact information to metadata
        - Add new API: listIdps that returns list of all discovered IdPs
        - Refactor and cleanup code and tests

- CLOUDSTACK-8459:
    * Add HTTP-POST binding to SP metadata
    * Authn requests must use either HTTP POST/Artifact binding

- CLOUDSTACK-8461:
    * Use unspecified x509 cert as a fallback encryption/signing key
      In case a IDP's metadata does not clearly say if their certificates need to be
      used as signing or encryption and we don't find that, fallback to use the
      unspecified key itself.

- CLOUDSTACK-8462:
    * SAML Auth plugin should not do authorization
      This removes logic to create user if they don't exist. This strictly now
      assumes that users have been already created/imported/authorized by admins.
      As per SAML v2.0 spec section 4.1.2, the SP provider should create authn requests using
      either HTTP POST or HTTP Artifact binding to transfer the message through a
      user agent (browser in our case). The use of HTTP Redirect was one of the reasons
      why this plugin failed to work for some IdP servers that enforce this.
    * Add new User Source
      By reusing the source field, we can find if a user has been SAML enabled or not.
      The limitation is that, once say a user is imported by LDAP and then SAML
      enabled - they won't be able to use LDAP for authentication
    * UI should allow users to pass in domain they want to log into, though it is
      optional and needed only when a user has accounts across domains with same
      username and authorized IDP server
    * SAML users need to be authorized before they can authenticate
        - New column entity to track saml entity id for a user
        - Reusing source column to check if user is saml enabled or not
        - Add new source types, saml2 and saml2disabled
        - New table saml_token to solve the issue of multiple users across domains and
          to enforce security by tracking authn token and checking the samlresponse for
          the tokens
        - Implement API: authorizeSamlSso to enable/disable saml authentication for a
          user
        - Stubs to implement saml token flushing/expiry

- CLOUDSTACK-8463:
    * Use username attribute specified in global setting
      Use username attribute defined by admin from a global setting
      In case of encrypted assertion/attributes:
      - Decrypt them
      - Check signature if provided to check authenticity of message using IdP's
        public key and SP's private key
      - Loop through attributes to find the username

- CLOUDSTACK-8538:
    * Add new global config for SAML request sig algorithm

- CLOUDSTACK-8539:
    * Add metadata refresh timer task and token expiring
        - Fix domain path and save it to saml_tokens
        - Expire hour old saml tokens
        - Refresh metadata based on timer task
        - Fix unit tests

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

This closes #489
2015-06-29 12:25:02 +02:00
Daan Hoogland a8959bca55 4.4.4 to 4.5.2 upgrade
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

This closes #528
2015-06-26 00:02:35 +02:00
Daan Hoogland 570d162692 CLOUDSTACK-8537 add check for unique public key and account on ssh keypair registration
Signed-off-by: Daan Hoogland <daan.hoogland@gmail.com>
2015-06-17 22:19:23 +02:00
Rohit Yadav 19cc5eb9e6 schema: Encode URL safe random vnc password string
/+= may break on some environments, url safe encoded passwords will have -_,
characters which are more acceptable

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-06-01 14:10:54 +02:00
Milamber 8eafdbd224 CLOUDSTACK-6181 Specify GB for the value of rootdisksize parameter. Add some Bytes/GB for log or exception messages. Fix Gb->GB. 2015-05-23 18:53:18 +01:00
Abhinandan Prateek c21aa89a47 CLOUDSTACK-8491: Host maintenance fails if a vm on it is running a custom service offering VM 2015-05-21 10:40:59 +05:30
Rohit Yadav bc636de122 engine: add upgrade path from 4.5.1 to 4.5.2
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-05-18 22:09:36 +01:00
Daan Hoogland 06de2d6292 backport of CLOUDSTACK-8197 create MinVRVersion config item
Conflicts:
  api/src/com/cloud/network/VirtualNetworkApplianceService.java
  engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

This closes #244
2015-05-13 09:33:16 +02:00
Abhinandan Prateek 94b5e27a23 Adding upgrade path to go with current 4.5.2 version for this branch 2015-05-11 09:57:37 +05:30
Rohit Yadav 4ba72a877c Updating pom.xml version numbers for release 4.5.2-SNAPSHOT
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-05-07 15:33:01 +02:00
Rohit Yadav 0eb4eb2370 Updating pom.xml version numbers for release 4.5.1
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-05-04 12:17:03 +02:00
Koushik Das 23bde8ea7a CLOUDSTACK-8438: Proper enforcement of hypervisor capability "max. guest limit"
VMs in transition states - Starting, Stopping, Migrating - are also taken into account for enforcing "max. guest limit"

(cherry picked from commit 3100fc1554)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-05-03 15:56:10 +02:00
Likitha Shetty 6c649ce3ae CLOUDSTACK-8411. Unable to delete an uploaded volume after CCP fails to attach the volume to a VM.
Correctly update the status of an uploaded volume upon failure to attach it to a VM.

(cherry picked from commit 10a106f5d8)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-04-29 16:50:40 +02:00
Likitha Shetty e1db982d6b CLOUDSTACK-8410. ESXi host stuck disconnects frequently.
During ping task, while scanning and updating status of all VMs on the host that are stuck in a transitional state
and are missing from the power report, do so only for VMs that are not removed.

(cherry picked from commit de7173a0ed)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-04-29 16:50:40 +02:00
Santhosh Edukulla 86943da26e Fixed few coverity issues
Signed-off-by: Santhosh Edukulla <santhosh.edukulla@gmail.com>
(cherry picked from commit 0a9742f914)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-04-27 14:43:48 +02:00
Likitha Shetty 326bb3e0a4 CLOUDSTACK-8320. Upon a failed migration, a dummy volume is created which remains in 'Expunging' state.
Set destination volume path as NULL while duplicating volume during migration.
If migration fails, destination volume will be marked as removed. And if migration succeeds, volume path will be rightly updated.

(cherry picked from commit d30d5644bb)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-04-17 15:42:02 +02:00
Likitha Shetty 55f2e45d14 CLOUDSTACK-8319. For both 'MigrateVolume' and 'MigrateVMWithVolumes, ensure VM's vconfiguration files are migrated along with VM's root volume.
(cherry picked from commit bdd28a45ed)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-04-17 15:42:02 +02:00
Rohit Yadav 752d784d92 vmware: support vmfs as local storage pool type
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-04-16 17:10:43 +05:30
MS b34202a84e CLOUDSTACK-8387 - Close mgmt server peer socket on failure, without relying on autoclose 2015-04-15 09:50:32 -07:00
MS fde2615c33 CLOUDSTACK-8387 - Close mgmt server peer socket on failure, without relying on autoclose 2015-04-15 08:43:37 -07:00
MS cb7bcf23fe CLOUDSTACK-8387 - Don't autoclose new mgmt server peer connections as soon as they open 2015-04-15 08:18:24 -07:00