1973 Commits

Author SHA1 Message Date
Rohit Yadav
abfcd5b95f CLOUDSTACK-9632: Upgrade bouncy castle to version 1.55
- Upgrades Maven dependency version to v1.55
- Fixes bountycastle usages and issues
- Adds timeout to jetty/annotation scanning
- Fixes servlet issue, uses servlet 3.1.0
- Downgrade javassist used by reflections to fix annotation process errors
- Make console-proxy-rdp bc dependency same as rest of the codebase
- Picks up PR #1510 by Daan

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-12-06 17:24:24 +05:30
Rohit Yadav
a5d5784859
Merge pull request #1710 from ustcweizhou/CLOUDSTACK-9538-deletesnapshot
CLOUDSTACK-9538: FIX failure in Deleting Snapshot From Primary Storage RBD Storage if vm has been removed

* pr/1710:
  CLOUDSTACK-9538: FIX failure in Deleting Snapshot From Primary Storage RBD Storage if vm has been removed

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-11-28 16:47:19 +05:30
Rohit Yadav
50f80cc2a0
Merge branch '4.8' into 4.9 2016-11-25 13:03:04 +05:30
Rohit Yadav
5811d33658 Merge pull request #1635 from myENA/feature/honor_force_stop_vm
CLOUDSTACK-9451https://issues.apache.org/jira/browse/CLOUDSTACK-9451

Re-doing against 4.8 since this is a bug, not a feature.

* pr/1635:
  CLOUDSTACK-9451

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-11-25 12:56:23 +05:30
Rohit Yadav
e59897bad8
Merge branch '4.8' into 4.9 2016-11-24 22:58:08 +05:30
Rohit Yadav
445d36c122
Merge PR #1737
CLOUDSTACK-9561 After domain/account deletion, snapshot taken by the
domain/account remains undeleted

While deleting the UserAccount Cleanup for the removed VMs/volumes are not
happening. For the removed VMs, snapshots doesn't get cleaned. Only for running
VMs(volumes in ready state) the cleanup happens.

When the VM is desroyed, the volume is marked as destroyed and later storage
garbage collector perform the cleanup. But if we try delete domain/account
before storage garbage collector runs, then it fails.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-11-24 22:56:22 +05:30
Rohit Yadav
19951346ad
Merge branch '4.8' into 4.9 2016-11-02 23:03:31 +05:30
Sudharma Jain
2c443cd189 CLOUDSTACK-9561 Unable to delete domain/Account 2016-10-27 10:58:37 +05:30
Rohit Yadav
32a397aa93 CLOUDSTACK-9509: 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-10-21 10:22:32 +05:30
Wei Zhou
784c33585f CLOUDSTACK-9538: FIX failure in Deleting Snapshot From Primary Storage RBD Storage if vm has been removed 2016-10-17 08:25:34 +02:00
Nathan Johnson
53fd4a7997 CLOUDSTACK-9451
Honor the forced parameter to stop virtual machine api call.
2016-09-09 13:00:17 -05:00
John Burwell
eabda0eb55 Renames of 4.9.0->4.9.1.0 upgrade scripts to match the four position version scheme
* Renames schema-490to491*.sql to schema490to4910*.sql
    * Renames the Upgrade490to491 class to Upgrade490to4910
    * Removes the unused s_logger contant from Upgrade490to4910
    * Updates the version in tools/marvin/setup to 4.9.1.0-SNAPSHOT
2016-09-01 21:19:29 -04:00
Rohit Yadav
08edd0c7cd
Merge branch '4.8' into 4.9 2016-09-01 17:01:51 +05:30
Rohit Yadav
f4ae87cb05 Merge pull request #1654 from shapeblue/jsb/4.8.2.0-version
Updating pom.xml version numbers for release 4.8.2.0-SNAPSHOTOften, patch and security releases do not require schema migrations or
data migrations.  However, if an empty upgrade class and associated
scripts are not defined, the upgrade process will break.  With this
change, if a release does not have an upgrade, a noop DbUpgrade is added
to the upgrade path.  This approach allows the upgrade to proceed and
for the database to properly reflect the installed version.  This change
should make the release process simpler as RMs no longer need to
rememeber to create this boilerplate code when starting a new release.

Beginning with the 4.8.2.0 and 4.9.1.0 releases, the project will
formally adopt a four (4) position release number to properly accomodate
rekeases that contain only CVE fixes.  The DatabaseUpgradeChecker and
Version classes made assumptions that they would always parse and
compare three (3) position version numbers.  This change adds the
CloudStackVersion value object that supports both three (3) and four (4)
version numbers.   It encapsulates version comparsion logic, as well as,
the rules to allow three (3) and four (4) to interoperate.

  * Modifies DatabaseUpgradeChecker to handle derive an upgrade path for
  a version that was not explicitly specified.  It determines the
  releases the first release before it with database migrations and uses
  that list as the basis for the list for version being calculated.  A
  noop upgrade is then added to the list which causes no schema changes
  or data migrations, but will update the database to the version.
  * Adds unit tests for the upgrade path calculation logic in
  DatabaseUpgradeChecker
  * Removes dummy upgrade logic for the 4.8.2.0 introduced in previous
  versions of this patch
  * Introduces the CloudStackVersion value object which parses and
  compares three (3) and four (4) position version numbers.  This class
  is intended to replace com.cloud.maint.Version.
  * Adds the junit-dataprovider dependency -- allowing test data to be
  concisely generated separately from the execution of a test case.
  Used extensively in the CloudStackVersionTest.

Signed-off-by: John Burwell <meaux@cockamamy.net>

/cc @rhtyd @karuturi

* pr/1654:
  Adds support for four position versions and optional db upgrades

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-09-01 15:11:20 +05:30
John Burwell
8d11511b1f Adds support for four position versions and optional db upgrades
Often, patch and security releases do not require schema migrations or
data migrations.  However, if an empty upgrade class and associated
scripts are not defined, the upgrade process will break.  With this
change, if a release does not have an upgrade, a noop DbUpgrade is added
to the upgrade path.  This approach allows the upgrade to proceed and
for the database to properly reflect the installed version.  This change
should make the release process simpler as RMs no longer need to
rememeber to create this boilerplate code when starting a new release.

Beginning with the 4.8.2.0 and 4.9.1.0 releases, the project will
formally adopt a four (4) position release number to properly accomodate
rekeases that contain only CVE fixes.  The DatabaseUpgradeChecker and
Version classes made assumptions that they would always parse and
compare three (3) position version numbers.  This change adds the
CloudStackVersion value object that supports both three (3) and four (4)
version numbers.   It encapsulates version comparsion logic, as well as,
the rules to allow three (3) and four (4) to interoperate.

  * Modifies DatabaseUpgradeChecker to handle derive an upgrade path for
  a version that was not explicitly specified.  It determines the
  releases the first release before it with database migrations and uses
  that list as the basis for the list for version being calculated.  A
  noop upgrade is then added to the list which causes no schema changes
  or data migrations, but will update the database to the version.
  * Adds unit tests for the upgrade path calculation logic in
  DatabaseUpgradeChecker
  * Removes dummy upgrade logic for the 4.8.2.0 introduced in previous
  versions of this patch
  * Introduces the CloudStackVersion value object which parses and
  compares three (3) and four (4) position version numbers.  This class
  is intended to replace com.cloud.maint.Version.
  * Adds the junit-dataprovider dependency -- allowing test data to be
  concisely generated separately from the execution of a test case.
  Used extensively in the CloudStackVersionTest.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-08-30 13:32:32 +05:30
Rohit Yadav
4c59a6b17e Merge branch '4.8' into 4.9 2016-08-24 12:43:37 +05:30
Rohit Yadav
7530f4b6dd CLOUDSTACK-9466: Fix fk constraint failure in upgrade path
In the 4.1.0-4.2.0 db upgrade path, it creates new tables to store secondary
(nfs) storage in image_store table and volumes in volume_store_ref table. In
the upgrade path, it first tries to migrate NFS storage pool where it excludes
storage pools which have been removed, but it migrates all the volumes without
checking if their storage pools have been removed. This causes fk constraint
failure as the volume/row being inserted refers to a storage pool which does
not exist in the image_store table.

The fix migrates all the nfs storage pools to image_store including removed
storage pools and in doing so migrates with the 'removed' field. This fixes
db upgrade for old pre-4.0 and 4.0/4.1 CloudStack clouds.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-08-24 12:03:46 +05:30
Rohit Yadav
e49ca1ecd2 Merge pull request #1646 from shapeblue/4.9-491upgradepath
[4.9/LTS] Add upgrade path from 4.9.0 to 4.9.1, change version to 4.9.1.0-SNAPSHOTThis adds db upgrade path from 4.9.0 to 4.9.1 and fixes a typo in default user role description (CLOUDSTACK-9449)

/cc @karuturi @jburwell  -- this will cause issues when fwd-merged to master, I can do the fwd-merging if you would like to avoid fixing the conflicts yourself

@blueorangutan package

* pr/1646:
  Updating pom.xml version numbers for release 4.9.1.0-SNAPSHOT
  cloudstack: upgrade path from 4.9.0 to 4.9.1

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-08-23 13:48:30 +05:30
Rohit Yadav
f13c224da1 Updating pom.xml version numbers for release 4.9.1.0-SNAPSHOT
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-08-19 13:53:39 +05:30
Rohit Yadav
b87eda230a cloudstack: upgrade path from 4.9.0 to 4.9.1
- Adds db upgrade path from 4.9.0 to 4.9.1
- CLOUDSTACK-9449: Fix typo in default user role description

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-08-19 13:53:15 +05:30
Abhinandan Prateek
a2fcc65d90 CLOUDSTACK-9459: the try's catch block was shortening the preparedstatement life
resulting in bad resultset when used outside of try catch.
2016-08-16 14:19:07 +05:30
Will Stevens
740bd45be6 Updating pom.xml version numbers for release 4.8.2-SNAPSHOT
Signed-off-by: Will Stevens <williamstevens@gmail.com>
2016-08-15 10:31:09 -04:00
Will Stevens
a63db21d16 Updating pom.xml version numbers for release 4.8.1
Signed-off-by: Will Stevens <williamstevens@gmail.com>
2016-08-08 10:06:21 -04:00
Will Stevens
227ff3884d Updating pom.xml version numbers for release 4.9.0
Signed-off-by: Will Stevens <williamstevens@gmail.com>
2016-07-25 16:56:04 -04:00
Will Stevens
46a6530e70 Revert "Merge pull request #1594 from nvazquez/vmnetworkmapissue"
This reverts commit 9be93c6e9022f35a2cd3dab6a099d69a77dd72ff, reversing
changes made to 8d45d711bff631efb45954631c123dcb2beffb3c.
2016-07-21 11:04:10 -04:00
nvazquez
c754a0cf30 CLOUDSTACK-9407: Refactor 2016-06-21 13:49:55 -03:00
nvazquez
d3f3fb0590 CLOUDSTACK-9407: Release network resources on expunge command 2016-06-16 12:35:42 -03:00
Rohit Yadav
fd67871a27 CLOUDSTACK-9409: Add role_id to cloud_usage.account
Adds role_id column to cloud_usage.account, fixes UsageDaoImpl to insert
Accounts with role_id from account table.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-06-08 11:20:46 +09:00
Will Stevens
121b3d6403 Merge pull request #1567 from exoscale/CLOUDSTACK-9238
CLOUDSTACK-9238: Fix URL length to 2048 for all url fields in VOI will update the PR to add max field length in the API commands too

* pr/1567:
  API: update url field max length
  not needed on host table
  Fix URL length to 2048 for all url fields in VO

Signed-off-by: Will Stevens <williamstevens@gmail.com>
2016-05-27 15:20:22 -04:00
Marc-Aurèle Brothier
d0453fc296 not needed on host table 2016-05-27 08:26:09 +02:00
Marc-Aurèle Brothier
a59ee03fd7 Fix URL length to 2048 for all url fields in VO 2016-05-27 08:16:05 +02:00
Will Stevens
3c800b4bfe Merge pull request #1518 from nvazquez/testnfs
CLOUDSTACK-9368: Fix for Support configurable NFS version for Secondary Storage mounts## Description
JIRA TICKET: https://issues.apache.org/jira/browse/CLOUDSTACK-9368
This pull request address a problem introduced in #1361 in which NFS version couldn't be changed after hosts resources were configured on startup (for hosts using `VmwareResource`), and as host parameters didn't include `nfs.version` key, it was set `null`.

## Proposed solution
In this proposed solution `nfsVersion` would be passed in `NfsTO` through `CopyCommand` to `VmwareResource`, who will check if NFS version is still configured or not. If not, it will use the one sent in the command and will set it to its storage processor and storage handler. After those setups, it will proceed executing command.

* pr/1518:
  CLOUDSTACK-9368: Fix for Support configurable NFS version for Secondary Storage mounts

Signed-off-by: Will Stevens <williamstevens@gmail.com>
2016-05-25 23:05:07 -04:00
Will Stevens
b5606dcce8 Merge pull request #1553 from nlivens/mysql_driver_issue
Dynamically load drivers before creating our DB connectionsSolution to the mailing thread titled "MySQL : No suitable driver found for jdbc:mysql".
It doesn't harm that we explicitely load the MySQL driver, and for those which would use a commons-dbcp version < 1.4 this would fix it as well. Since JDBC 4.0, the JDBC driver can auto-register itself, but for some weird cases (like ours), it's not working. Therefore we need to explicitly load the JDBC driver.

* pr/1553:
  Dynamic loading of DB driver + support for other DB providers

Signed-off-by: Will Stevens <williamstevens@gmail.com>
2016-05-25 23:00:42 -04:00
Will Stevens
05a7beccfe Merge pull request #1494 from nlivens/master_nuage
Remodeling of Nuage VSP Plugin + CLOUDSTACK-9294Hi all,

We've remodeled the Nuage VSP plugin to use the same model as VMWare is using (non-OSS). Before, we had a runtime dependency to the Nuage Client, this has been changed to a compile-time dependency instead because of multiple reasons (build management, readability, maintainability, ...)

We've adapted the code so it now uses model objects defined in the Nuage client instead of passing a list of parameters to the Nuage client. This is a lot more readable, and a lot more maintainable.

I've had a chat with @DaanHoogland about this approach, and he told me that ACS is trying to move away from the whole non-OSS approach. We're looking into the Juniper approach, we would set up a custom maven repository which would host the required dependencies for the Nuage VSP plugin.

Any remarks or suggestions are always welcome :)

* pr/1494:
  Nuage VSP : Extending Marvin test coverage
  Nuage VSP : Fix for NPE while cleaning up account when there are still resources belonging to that account
  CLOUDSTACK-9294 : Make sure to remove VR from VSD when removing the VPC
  CLOUDSTACK-9242 : Remodel Nuage VSP plugin

Signed-off-by: Will Stevens <williamstevens@gmail.com>
2016-05-25 22:58:10 -04:00
Will Stevens
87f6ad3cc9 Merge pull request #846 from kishankavala/CLOUDSTACK-8870
Bug-ID: CLOUDSTACK-8870: Skip external device usage collection if no external devices existexternal network device usage monitor thread that runs every 5mins by default (based on global config external.network.stats.interval) and runs coalesce query to acquire a lock. When there are no external devices exist, there is no need to run usage collection.
Added test case to verify that usage collection task is not run when there are no External LB or External FW

* pr/846:
  Bug-ID: CLOUDSTACK-8870: Skip external device usage collection if no external devices exist

Signed-off-by: Will Stevens <williamstevens@gmail.com>
2016-05-25 22:55:11 -04:00
Will Stevens
678b28f273 Merge release branch 4.8 to master
* 4.8:
  CLOUDSTACK-6928: fix issue disk I/O throttling not applied
  CLOUDSTACK-6975: Prevent dnsmasq from starting on backup redundant RvR.
2016-05-25 22:54:23 -04:00
Will Stevens
b80696cbc0 Merge release branch 4.7 to 4.8
* 4.7:
  CLOUDSTACK-6928: fix issue disk I/O throttling not applied
  CLOUDSTACK-6975: Prevent dnsmasq from starting on backup redundant RvR.
2016-05-25 22:53:42 -04:00
Will Stevens
82f1198ee6 Merge pull request #1410 from ustcweizhou/CLOUDSTACK-6928-io-throttling
CLOUDSTACK-6928: fix issue disk I/O throttling not appliedDisk IO throttling (for KVM) is not applied in the merge of 4.2.

Tests passed:
(1) start vm
(2) attach volume
(3) start vm with volume
(4) migrate vm (with volume)

* pr/1410:
  CLOUDSTACK-6928: fix issue disk I/O throttling not applied

Signed-off-by: Will Stevens <williamstevens@gmail.com>
2016-05-25 22:51:38 -04:00
Nick Livens
4b6179940d CLOUDSTACK-9294 : Make sure to remove VR from VSD when removing the VPC 2016-05-24 11:12:19 +02:00
Nick Livens
02c5d44f0b Dynamic loading of DB driver + support for other DB providers 2016-05-23 15:50:28 +02:00
Kishan Kavala
c12d83601d Bug-ID: CLOUDSTACK-8870: Skip external device usage collection if no external devices exist 2016-05-23 15:23:23 +05:30
Will Stevens
570b676b1f Merge pull request #1549 from shapeblue/nio-fixagain-singlepr
CLOUDSTACK-9348: NioConnection improvementsReopened PR with squashed changes for a re-review and testing after https://github.com/apache/cloudstack/pull/1493 and sub-sequent PRs got reverted

* pr/1549:
  CLOUDSTACK-9348: NioConnection improvements

Signed-off-by: Will Stevens <williamstevens@gmail.com>
2016-05-20 11:20:49 -04:00
nvazquez
2d2819974e CLOUDSTACK-9368: Fix for Support configurable NFS version for Secondary Storage mounts 2016-05-20 07:31:16 -07: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
Will Stevens
3f5b3a16dd Merge pull request #1516 from sudhansu7/CLOUDSTACK-9366
CLOUDSTACK-9366: Capacity of one zone-wide primary storage ignoredDisable and Remove Host operation disables the primary storage capacity.

Steps to replicate:
Base Condition: There exists a host and storage pool with same id
Steps:
1. Find a host and storage pool having same id
2. Disable the host
3. CPU(1) and MEMORY(0) capacity in op_host_capacity for above host is disabled
4. STORAGE(3) capacity in op_host_capacity for storage pool with id same as above host is also disabled

RCA:
'host_id' column in 'op_host_capacity' table used for storing both storage pool id (for STORAGE capacity) and host id (MEMORY and CPU). While disabling a HOST we also disable the capacity associated with host.

Ideally while disabling capacity we should only disable MEMORY and CPU capacity, but we are not doing so.

Code Path:
ResourceManagerImpl.doDeleteHost() -> ResourceManagerImpl.resourceStateTransitTo() -> CapacityDaoImpl.updateCapacityState(null, null, null, host.getId(), capacityState.toString())

updateCapacityState is updating disabling all entries which matches the host_id. This will also disable a entry having storage pool id same as that of host id.

Changes:
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

Test Result:
```
Before Fix:
mysql> select ohc.host_id, ohc.`capacity_state`,  case capacity_type  when 0 then  'MEMORY'  when 1 then  'CPU'  ELSE  'STORAGE'  END as 'capacity_type' ,  total_capacity, case capacity_type  when 0 then  'HOST'  when 1 then  'HOST' ELSE  'STORAGE POOL' END as 'HOST/STORAGE POOL'  from op_host_capacity ohc where host_id=3;
+---------+----------------+---------------+----------------+-------------------+
| host_id | capacity_state | capacity_type | total_capacity | HOST/STORAGE POOL |
+---------+----------------+---------------+----------------+-------------------+
|       3 | Enabled        | MEMORY        |     8589934592 | HOST              |
|       3 | Enabled        | CPU           |          32000 | HOST              |
|       3 | Enabled        | STORAGE       |  2199023255552 | STORAGE POOL      |
+---------+----------------+---------------+----------------+-------------------+

9 rows in set (0.00 sec)

Disable Host 3 from UI.

mysql> select ohc.host_id, ohc.`capacity_state`,  case capacity_type  when 0 then  'MEMORY'  when 1 then  'CPU'  ELSE  'STORAGE'  END as 'capacity_type' ,  total_capacity, case capacity_type  when 0 then  'HOST'  when 1 then  'HOST' ELSE  'STORAGE POOL' END as 'HOST/STORAGE POOL'  from op_host_capacity ohc where host_id=3;
+---------+----------------+---------------+----------------+-------------------+
| host_id | capacity_state | capacity_type | total_capacity | HOST/STORAGE POOL |
+---------+----------------+---------------+----------------+-------------------+
|       3 | Disabled       | MEMORY        |     8589934592 | HOST              |
|       3 | Disabled       | CPU           |          32000 | HOST              |
|       3 | Disabled       | STORAGE       |  2199023255552 | STORAGE POOL      |
+---------+----------------+---------------+----------------+-------------------+

After Fix:

mysql> select ohc.host_id, ohc.`capacity_state`,  case capacity_type  when 0 then  'MEMORY'  when 1 then  'CPU'  ELSE  'STORAGE'  END as 'capacity_type' ,  total_capacity, case capacity_type  when 0 then  'HOST'  when 1 then  'HOST' ELSE  'STORAGE POOL' END as 'HOST/STORAGE POOL'  from op_host_capacity ohc where host_id=3;
+---------+----------------+---------------+----------------+-------------------+
| host_id | capacity_state | capacity_type | total_capacity | HOST/STORAGE POOL |
+---------+----------------+---------------+----------------+-------------------+
|       3 | Enabled        | MEMORY        |     8589934592 | HOST              |
|       3 | Enabled        | CPU           |          32000 | HOST              |
|       3 | Enabled        | STORAGE       |  2199023255552 | STORAGE POOL      |
+---------+----------------+---------------+----------------+-------------------+
3 rows in set (0.01 sec)

Disable Host 3 from UI.

mysql> select ohc.host_id, ohc.`capacity_state`,  case capacity_type  when 0 then  'MEMORY'  when 1 then  'CPU'  ELSE  'STORAGE'  END as 'capacity_type' ,  total_capacity, case capacity_type  when 0 then  'HOST'  when 1 then  'HOST' ELSE  'STORAGE POOL' END as 'HOST/STORAGE POOL'  from op_host_capacity ohc where host_id=3;
+---------+----------------+---------------+----------------+-------------------+
| host_id | capacity_state | capacity_type | total_capacity | HOST/STORAGE POOL |
+---------+----------------+---------------+----------------+-------------------+
|       3 | Disabled       | MEMORY        |     8589934592 | HOST              |
|       3 | Disabled       | CPU           |          32000 | HOST              |
|       3 | Enabled        | STORAGE       |  2199023255552 | STORAGE POOL      |
+---------+----------------+---------------+----------------+-------------------+
3 rows in set (0.00 sec)

Sudhansus-MAC:cloudstack sudhansu$  nosetests-2.7 --with-marvin --marvin-config=setup/dev/advanced.cfg test/integration/component/maint/test_capacity_host_delete.py

==== Marvin Init Started ====

=== Marvin Parse Config Successful ===

=== Marvin Setting TestData Successful===

==== Log Folder Path: /tmp//MarvinLogs//Apr_22_2016_22_42_27_X4VBWD. All logs will be available here ====

=== Marvin Init Logging Successful===

==== Marvin Init Successful ====
===final results are now copied to: /tmp//MarvinLogs/test_capacity_host_delete_9RHSNB===
Sudhansus-MAC:cloudstack sudhansu$ cat /tmp//MarvinLogs/test_capacity_host_delete_9RHSNB/results.txt
test_01_op_host_capacity_disable_host (integration.component.maint.test_capacity_host_delete.TestHosts) ... === TestName: test_01_op_host_capacity_disable_host | Status : SUCCESS ===
ok

----------------------------------------------------------------------
Ran 1 test in 0.168s

OK
```

* pr/1516:
  CLOUDSTACK-9366: Capacity of one zone-wide primary storage ignored

Signed-off-by: Will Stevens <williamstevens@gmail.com>
2016-05-20 08:31:46 -04:00
Will Stevens
34111df02f Merge pull request #1551 from shapeblue/rbac-mysql-fix
dynamic-roles: packaging improvementsOn some MySQL server envs, this may cause a SQL statement error, though
I was unable to reproduce it. Since it's not needed, an order by 'sort_order'
is enough, we can safely remove it.

/cc @swill @anshulgangwar @DaanHoogland and others

* pr/1551:
  migrate-dynamicroles: use mysql.connector due to #1054
  packaging: don't bundle systemvm.zip in rpms
  packaging: backup commands.properties as it does not exist in new rpms
  dynamic-roles: remove unnecessary order by ID

Signed-off-by: Will Stevens <williamstevens@gmail.com>
2016-05-20 08:30:39 -04:00
Will Stevens
88cd182272 Forward merged 4.8 to master and fixed conflicts in #1331 2016-05-19 12:08:08 -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
Rohit Yadav
9c7518698d CLOUDSTACK-9348: NioConnection improvements
- Unit test to demonstrate denial of service attack
  The NioConnection uses blocking handlers for various events such as connect,
  accept, read, write. In case a client connects NioServer (used by
  agent mgr to service agents on port 8250) but fails to participate in SSL
  handshake or just sits idle, this would block the main IO/selector loop in
  NioConnection. Such a client could be either malicious or aggresive.

  This unit test demonstrates such a malicious client that can perform a
  denial-of-service attack on NioServer that blocks it to serve any other client.

- Use non-blocking SSL handshake
  - Uses non-blocking socket config in NioClient and NioServer/NioConnection
  - Scalable connectivity from agents and peer clustered-management server
  - Removes blocking ssl handshake code with a non-blocking code
  - Protects from denial-of-service issues that can degrade mgmt server responsiveness
    due to an aggressive/malicious client
  - Uses separate executor services for handling ssl handshakes

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-05-19 16:45:16 +05:30
Wei Zhou
976b3b7df4 CLOUDSTACK-6928: fix issue disk I/O throttling not applied 2016-05-19 11:26:43 +02:00