32144 Commits

Author SHA1 Message Date
Paul Angus
8e08b47cc9 Updating pom.xml version numbers for release 4.13.0.0
Signed-off-by: Paul Angus <paul.angus@shapeblue.com>
2019-08-20 15:35:49 +01:00
Paul Angus
77f9ab2727
add vSphere 6.7.3 and update 6.7.2 & 6.7.1 (#3564) 2019-08-20 14:21:56 +01:00
Nicolas Vazquez
bfc08715cc Display VM snapshot tags on usage records (#3560)
* Refactor usage helper tables to include VM snapshot id

* Fix resource type and resource id while listing usage records

* Add defensive checks
2019-08-20 14:20:23 +01:00
Paul Angus
7ac9f00eee
add hypervisor and guest OS data for XenServer 7.1.2, 7.6, 8.0, vSphere 6.5 & 6.7 (#3549)
* add detailed hypervisor and guest OS data

Merged with x2 LGTM
2019-08-15 10:40:29 +01:00
Gabriel Beims Bräscher
d7aa0a2718 server: Prevent NullPointer on a network with removed IP ranges/"VLANs" (#3551)
When a network IP range is removed, the "vlan" stays mapped on pod_vlan_map; therefore, the method that lists the VLANs by pod id will return null VLANS.

This PR adds proper verifications to avoid null pointer exception when deploying VRs on a pod with removed VLANs. The exception was caused on getPlaceholderNicForRouter.
2019-08-15 13:35:58 +05:30
Rohit Yadav
b576972f71
test: stabilize 4.13/master (#3547)
Fix failing smoketests, fix NPEs. 

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2019-08-13 11:51:10 +05:30
Nicolas Vazquez
3c2af55d81 vmware: allow configuring appliances on the VM instance wizard when OVF properties are available (#3271)
Problem: In Vmware, appliances that have options that are required to be answered before deployments are configurable through vSphere vCenter user interface but it is not possible from the CloudStack user interface.

Root cause: CloudStack does not handle vApp configuration options during deployments if the appliance contains configurable options. These configurations are mandatory for VM deployment from the appliance on Vmware vSphere vCenter. As shown in the image below, Vmware detects there are mandatory configurations that the administrator must set before deploy the VM from the appliance (in red on the image below):

Solution:
On template registration, after it is downloaded to secondary storage, the OVF file is examined and OVF properties are extracted from the file when available.
OVF properties extracted from templates after being downloaded to secondary storage are stored on the new table 'template_ovf_properties'.
A new optional section is added to the VM deployment wizard in the UI:
If the selected template does not contain OVF properties, then the optional section is not displayed on the wizard.
If the selected template contains OVF properties, then the optional new section is displayed. Each OVF property is displayed and the user must complete every property before proceeding to the next section.
If any configuration property is empty, then a dialog is displayed indicating that there are empty properties which must be set before proceeding
image
The specific OVF properties set on deployment are stored on the 'user_vm_details' table with the prefix: 'ovfproperties-'.
The VM is configured with the vApp configuration section containing the values that the user provided on the wizard.
2019-08-09 16:14:46 +05:30
Andrija Panic
f56c50fd6a
Single letter typo fix
Merging since only removed a single letter from the error message (typo)
2019-08-08 14:13:39 +02:00
Abhishek Kumar
a10e539dd6 ui: fix for custom constrained offering params range check (#3545)
This PR fixes range check in VM deployment wizard while using custom constrained offering.
Existing code was failing while checking user input value in the form for CPU cores and RAM size when minimum and maximum value vary in digit count.
Also, while re-selecting offerings slider position was not restored to minimum value. THis has been fixed with changes.

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2019-08-07 18:38:22 +05:30
Gabriel Beims Bräscher
5dc982d8ba KVM local migration issue #3521 (#3533)
Fix regression bug that affects KVM local storage migration. Some of the desired execution flows for KVM local storage migration had been altered to allow only managed storage to execute. Fixed allowing managed and non managed storages to execute.

Fixes #3521
2019-08-07 15:41:30 +05:30
Andrija Panic
3dad7f3134
Merge pull request #3537 from shapeblue/upload-iso-template-fix
Revert #3152
2019-08-02 14:19:44 +02:00
Andrija Panic
a9569d5ed6
Merge pull request #3535 from shapeblue/minor_413_fixes
Misc fixes to sharing templates functionality
2019-08-02 12:35:46 +02:00
Rohit Yadav
263b404386 Revert "Refactoring to remove duplicate code. (#3152)"
This reverts commit 7a27e35a612f13a0ce43459b22e01d9b69627220.

We're near 4.13 RC1, we've low confidence if the changes from #3152
would cause other regressions so reverting this. The author may send a
PR again towards 4.14.

Regressions found are all related to template and iso registration and
upload.
2019-08-02 13:04:12 +05:30
Anurag Awasthi
f9b3771489 Add usernames to map for remove operations as well 2019-08-01 14:17:47 +05:30
Rohit Yadav
d3b292ace9
server: Fixes API permissions, global settings and template UX (#3534)
Fixes:

- This allows getUploadParamsForIso for all user role types, also fixes
authorised field for getUploadParamsForTemplate API.
- Fix global setting description to say what is used when value is empty/blank.
- For VM running/allocated usage description, use parenthesis to return the instance name and ID.
- Display template download progress when template is added to a project

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2019-08-01 13:30:34 +05:30
Abhishek Kumar
b2db8979f2 server: fix for respecting secondary storage threshold limit (#3480)
Retrieval of an image store using ImageStoreProviderManager has been refactored by introducing three different methods,
DataStore getRandomImageStore(List<DataStore> imageStores);
To get an image store for reading purpose. Threshold capacity check will not be used here.
DataStore getImageStoreWithFreeCapacity(List<DataStore> imageStores);
To get an image store for reading purpose. Threshold capacity check will be used here and the store with max free space will be returned. If no store with filled storage less than the threshold is found, the NULL value will be returned.
List<DataStore> listImageStoresWithFreeCapacity(List<DataStore> imageStores);
To get a list of image stores for writing purpose which fulfills threshold capacity check.

Correspondingly DataStoreManager methods have been refactored to return similar values for a given zone.

Fixes #3287 - NULL value will be returned when secondary storage is needed for writing but there is not store with free space.
Fixes #3041 - Rather than returning random secondary storage for writing, storage with max. free space will be returned.
Fixes #3478 - For migration on VMware, all writable secondary storage will be mounted while preparation.

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2019-07-31 15:37:59 +05:30
Anurag Awasthi
8190b68771 Misc fixes to sharing templates functionality
1. Fix populating g_allowUserViewAllDomainAccounts flag. This was
implemented incorrectly and caused flag's effect to not reflect
directly after login.
2. Filter account/project names only for add operation. update
template permissions API is implemented in such a way that it allows
removal of any account that could have had permissions but allows
only adding accounts/projects which are in caller's domain.
3. Added some checks where null variable could result in crash.
2019-07-31 15:19:21 +05:30
Anurag Awasthi
cf0649def1 server: Add size to listUsageRecords response for VMSnapShotOnPrimary (type 27) (#3529)
Add size to list usage records for VMSnapShotOnPrimary (type 27).
The size was included in description but missing from response.
2019-07-31 12:39:10 +05:30
Nicolas Vazquez
1141377e50 ui: Improve visibility of dropdown menus on dialogs (#3528)
It was not possible to display the entire name of items in dropdown menus within dialogs in CloudStack, such as:

Create compute offering
Create network offering
Create VPC offering
2019-07-30 12:16:28 +05:30
Sven Vogel
bf7e59587d systemvm: Fix VR bootstrapping/connection state in KVM (#3524)
Enable qemu-guest-agent / add start qemu-guest-agent back.
Improve hotplug kernel module loading and verbosity.
2019-07-29 11:51:39 +05:30
Frank Maximus
7a27e35a61 Refactoring to remove duplicate code. (#3152)
Make use of Java 8 default implementation in interfaces,
to remove code duplication between XxxCmd and XxxCmdAsAdmin.

Refactor checkFormat by pre-calculating the supported
extensions. Also make use of this in ImageStoreUtil.
Makes it easier to add new file and compression formats.
2019-07-27 20:21:43 +05:30
manojkverma
e3d70b7dcc storage: Datera storage plugin (#3470)
Features:

Zone-wide and cluster-wide primary storage support
VM template caching automatically on Datera, the subsequent VMs can be created instantaneously by fast cloning the root volume.
Rapid storage-native snapshot
Multiple managed primary storages can be created with a single Datera cluster to provide better management of
Total provisioned capacity
Default storage QoS values
Replica size ( 1 to 5 )
IP pool assignment for iSCSI target
Volume Placement ( hybrid, single_flash, all_flash )
Volume snapshot to VM template
Volume to VM template
Volume size increase using service policy
Volume QoS change using service policy
Enabled KVM support
New Datera app_instance name format to include ACS volume name
VM live migration
2019-07-25 14:13:04 +05:30
Wido den Hollander
e894658f8c kvm: Allow Link Local Cidr (cloud0 interface) to be configured (#3500)
There are certain scenarios where the 169.254.0.0/16 subnet is used for different
purposes then CloudStack on a hypervisor.

Once of such scenarios is a BGP+EVPN+VXLAN setup using BGP Unnumbered where the
169.254.0.1 address is used by Frr/Zebra BGP routing to send traffic to the
neighboring router.

The following settings can be changed in the agent.properties (default values added):

control.cidr=169.254.0.0/16

Make sure the global setting 'control.cidr' matches the values defined in the agent.propeties!

In the future the mgmt server can send this parameter to a KVM Agent on startup, but at the moment
this framework is not in place and thus these values can't be send to the Agent in a proper manner.

Signed-off-by: Wido den Hollander <wido@widodh.nl>
2019-07-25 12:13:39 +05:30
Sid Kattoju
333409a83c maven: remove depcrecated pip option --allow-external (#3492)
Removing deprecated pip option --allow-external
2019-07-24 23:32:46 +05:30
Sid Kattoju
c1d3f98775 server: filter volumes by host when refreshing stats (#3486)
Currently when refreshing disk usage stats all kvm agents are asked to collect stats for all volumes. In setups with multiple kvm hosts where managed storage is used, not all volumes are attached to all kvm hosts, this results in a large number of warnings in the kvm agent logs. This change introduces a filter step in case managed storage is used so that the management server only requests kvm agents for stats about volumes that are connected to each kvm host.
2019-07-24 11:59:51 +05:30
Rohit Yadav
d930982a1c engine/storage: remove unused import
Fixes checkstyle issue caused by previous commit 6a511fce40f5363d71c5515df9841c2493c73c31
from PR #3466 where a minor review fix did not address this. Merging this
one to unblock few other PRs after running a local build test.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2019-07-24 11:59:08 +05:30
Nicolas Vazquez
2050a90ee8 vmware: Fix bad ovf null error when registering template (#3511)
Fix template registration regression.
2019-07-24 11:37:25 +05:30
Gabriel Beims Bräscher
6a511fce40 kvm: Add ceph RBD snapshot rollback (#3502)
Add CephSnapshotStrategy to handle RBD revert (rollback) snapshot. In order to support RBD revert (rbd_rollback), this PR adds a CephSnapshotStrategy class to handle Ceph/RBD snapshot actions.
2019-07-23 19:40:56 +05:30
Nicolas Vazquez
281148d551 server: Fix stop VM issue on basic zones (#3501)
CloudStack reports an error while stopping/expunging VMs on basic zones

Fixes #3497
2019-07-23 19:38:51 +05:30
Anurag Awasthi
5690cd6364 server: fix the subnet overlap checking logic for tagged and untagged vlans when adding ipranges (#3430)
Fixes: #3114

When adding iprange for VLANs there are 3 cases -

VLAN under consideration has a tag (like 101)
VLAN under consideration has a tag but as a range (like 101-124)
VLAN is untagged (i.e. id is "untagged")
Before adding iprange we have to check for possible overlaps and throw exception. This needs to be done as follows -

If VLAN Tag ID is numeric or a range we need to call UriUtils.checkVlanUriOverlapmethod which internally tries to expand the range as verifies if there are overlaps. If URI overlaps (i.e. there are overlapping VLAN tags) we then need to verify if the iprange being added overlaps with previously added ranges.
If there are no overlapping tags we simply need to test for public networks being present in the VLAN.
A Regression was introduced in 41fdb88#diff-6e2b61984e8fa2823bb47da3caafa4eeR3174 which caused comparing 'untagged' string as a numeric VLAN Tag range and and attempted expanding it to test overlap in UriUtils.checkVlanUriOverlap.

To fix the bug in the issue, we need to handle the untagged case separately as it's non-numeric tag in code. For untagged VLANs and overlapping VLAN URIs we need to check for ipranges and gateways which happens naturally after this change. For tagged VLANs with non-overlapping URIs we need to check if there is a public network.
2019-07-23 00:27:50 +05:30
Nicolas Vazquez
38f97c65b8 server: Fix hardcoded max data volumes when VM has been created but not started before (#3494)
When VM is created but not started on any host, attaching a volume on it causes the maximum number of allowed volumes to be 6 (hardcoded).
2019-07-22 17:33:00 +05:30
Rohit Yadav
e1fa270593
vmware: fix volume stats logic (#3473)
During volume stats calculation, if a volume has more than one disk in
the chain-info it is not used to sum the physical and virtual size
in the loop, instead any previous entry was overwritten by the last disk.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2019-07-22 17:27:41 +05:30
Gabriel Beims Bräscher
6a336f8bc1 server: disable unauthenticated integration.api.port by default (#3504)
Set integration.api.port to (0) zero as default. CloudStack provides CloudStack API Unauthenticated Access through port 8096. It should not be open to the Internet in any case.
2019-07-22 17:22:02 +05:30
Rohit Yadav
5d8157422d Allow users to share templates with Accounts or Projects through the UI
* Allow users to share templates with Accounts or Projects through the
updateTemplate permissions API

* Change behaviour to show only supported projects and accounts with update template permissions

* Allow admins to see accounts dropdown and only hide lists for users

* Don't allow sharing project owned templates as you cannot retrieve them in list api calls
2019-07-18 17:42:55 +01:00
Nicolas Vazquez
a1a9fb8977
KVM: Enhancements for direct download feature (#3374)
* Add revoke certificates API

* Add background task to sync certificates

* Fix marvin test and revoke certificate

* Fix certificate sent to hypervisor was missing headers

* Fix background task for uploading certificates to hosts
2019-07-18 02:39:00 -03:00
Nicolas Vazquez
a1faf09a2c ui: Fix SystemVMs public range dedication (#3495)
Fix small UI issue when dedicating public IR range for system VMs:
Unable to execute API command createvlaniprange due to invalid value. Invalid parameter domainid value=undefined due to incorrect long value format, or entity does not exist or due to incorrect parameter annotation for the field in api cmd class.

Fixes: #3485
2019-07-17 20:13:40 +05:30
Paul Angus
e15c3112e4
Merge pull request #3248 from shapeblue/storage-offering-domains-zones
Enable service offerings to be scoped to domain(s) and zone(s)
2019-07-16 10:25:35 +01:00
Abhishek Kumar
98e84e372f server: fix public IP association/disassociation to new network (#3489)
Fixes #3321

This changes removes exception throwing while associating an IP address to a new isolated network which is in Allocated state. And it allows disassociating an IP address when it is used for source NAT purpose but network is in allocated state.

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2019-07-14 17:23:11 +05:30
Anurag Awasthi
9e6ee7c63e server: Add support for new heuristics based VM Deployement for admins (#3454)
Currently an admin can choose which host a VM is to be started on.
They should be able to 'override' the allocation algorthm to a greater
or lesser extent at will, and be able to choose the pod, cluster or host
that they wish a new VM to be deployed in.

DeployVirtualMachine API has been extended with additional, optional
parameters podid and clusterid that will be passed to and used in the
deployment planner, when selecting a viable host. If the user supplies
a pod, a suitable host in the given pod will be selected. If the user
supplies a cluster, a suitable host in the given cluster will be selected.

Based on the parameter supplied and on passing validation, the VM will
then be deployed on the selected host, cluster or pod.
2019-07-13 12:52:48 +05:30
Rohit Yadav
97df52956c
master: travis and trillian smoketests fixes and stabilisation (#3476)
Fix failing test, add more component tests, optimise and refactor test jobs.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2019-07-12 17:27:49 +05:30
Abhishek Kumar
6d516891ec ui: fix for multiple network offering listing
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2019-07-12 13:51:39 +05:30
Abhishek Kumar
cb8f58b706 server: fix for user account able to list child domain n/w offering
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2019-07-12 13:39:25 +05:30
Abhishek Kumar
b40fdbb2f7 api: fix account deletion event description (#3483)
Fix account deletion event description.
Fixes #3109

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2019-07-12 13:10:30 +05:30
Sid Kattoju
1bf4dd39ca kvm: use IDE as the bus type for root disks and VIRTIO for data disks on platforms without support for para virtualization when using managed storage (#3319)
This change addresses #3089. There was an issue when disks were being added with bus type IDE when creating windows VMs from ISOs. It is not possible to select bus type when creating a VM with an ISO. The bus type is inferred based on the platform emulator string provided to the KVM agent. Currently when creating a VM with managed storage (ex: Solidfire) and OS type string Windows*, all disks are added as IDE. Qemu currently does not support multiple IDE controllers and this configuration results in VMs that cannot be started. This issue does not occur when using NFS as the storage provider due to logic in that KVM agent that makes all data volumes (non root) use a virtio controller for file based disk. Similar logic was added for raw physical disks so that managed storage has the same behavior as NFS. In addition specific versions were removed from the code that guesses the disk controller to be used based on the platform emulator string since most modern operating systems support virtio.

Fixes #3089
2019-07-12 12:35:23 +05:30
Abhishek Kumar
7010f855b5 Merge branch 'master' into storage-offering-domains-zones 2019-07-12 10:21:51 +05:30
Abhishek Kumar
5df11b5c43 ui: fix custom offerings selection in upload volume form (#3479)
Removed duplicate code for diskOffering field.

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2019-07-11 15:14:53 +05:30
Wei Zhou
b7988a3e5f vr: Fix vpc router in UNKNOWN state (#3465)
If there are more than 10 vpc tiers or public ip subnets in a VPC, eth1X will be added in vpc router.
The redundant state is UNKNOWN in this case.
2019-07-11 01:48:37 +05:30
Spaceman1984
b509e086f9 api: Allowing template owner to download template (#3475)
Removed the download icon when a template is not extractable.

Modified the api to allow a user from the same account as the template, to change the extractable attribute on the template.

Fixes #3400
2019-07-09 12:42:41 +05:30
Anurag Awasthi
c88540d5a5 framework/db: Fix bug in counting items for search query (#3457)
The implementation of GenericBaseDao#searchAndCount() can result in
incorrect count. This happens because the implementation of the
GenericBaseDao#getCount method excludes the groupBy components of the
search queries. This means the count returned will always be larger than
the actual count when not considering pagination.

The change was brought in b0ce8fd which also fails to explain the rationale.

Further investigation of the getCount usage reveal they are always
accompanied by search queries which include groupBy components via
GenericBaseDao#searchIncludingRemoved method.

```
Current code diff between search and count methods is as follows -
diff --git a/framework/db/src/main/java/com/cloud/uddtils/db/GenericDaoBase.java b/framework/db/src/main/java/com/cloud/utils/db/GenericDaoBase.java
@@ -371,7 +371,7 @@ public abstract class GenericDaoBase<T, ID extends Serializable> extends Compone
             clause = null;
         }

-        final StringBuilder str = createPartialSelectSql(sc, clause != null, enableQueryCache);
+        final StringBuilder str = createCountSelect(sc, clause != null);
@@ -384,19 +384,12 @@ public abstract class GenericDaoBase<T, ID extends Serializable> extends Compone
             }
         }

-        List<Object> groupByValues = addGroupBy(str, sc);
-        addFilter(str, filter);
-
+        // we have to disable group by in getting count, since count for groupBy clause will be different.
+        //List<Object> groupByValues = addGroupBy(str, sc);
         final TransactionLegacy txn = TransactionLegacy.currentTxn();
-        if (lock != null) {
-            assert (txn.dbTxnStarted() == true) : "As nice as I can here now....how do you lock when there's no DB transaction?  Review your db 101 course from college.";
-            str.append(lock ? FOR_UPDATE_CLAUSE : SHARE_MODE_CLAUSE);
-        }
-
@@ -410,20 +403,19 @@ public abstract class GenericDaoBase<T, ID extends Serializable> extends Compone

+            /*
             if (groupByValues != null) {
                 for (Object value : groupByValues) {
                     pstmt.setObject(i++, value);
                 }
             }
+             */

-            if (s_logger.isDebugEnabled() && lock != null) {
-                txn.registerLock(pstmt.toString());
-            }
             final ResultSet rs = pstmt.executeQuery();
             while (rs.next()) {
-                result.add(toEntityBean(rs, cache));
+                return rs.getInt(1);
             }
-            return result;
+            return 0;
--
2.17.1
```

The fix is to update the way we setup query for counting with group by
params.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2019-07-08 17:05:47 +05:30
Richard Lawley
d70f574a7e plugins: fix removing SRX port forwarding rules, improve add/remove logic (#3393)
This PR partially fixes the logic around port forwarding rules on the Juniper SRX plugin. The code in the plugin is based on JunOS 10, which is very old. The changes here should not break compatibility, but should enable the plugin to be used on newer devices. Note that an additional change to a script file is required to be able to add port forwarding rules, but as this PR was targetted for 4.11.3, I thought it best not to include this change as it might break compatibility for anyone still using JunOS 10.

I've made the logic better and consistent for adding/removing static nat and port forwarding rules - these were multi-step processes which did not check each individual step. This would aid in manually fixing rules in case of further problems.

I've also improved the logging for communication with the SRX by stripping out the Apache header before sending it, and indicating the name of the template filename in use.

To be able to add port forwarding rules, the <dst-port> tags in dest-nat-rule-add.xml must be changed to <low>.

Fixes: #3379
2019-07-08 15:46:12 +05:30