2693 Commits

Author SHA1 Message Date
Rohit Yadav
424f10cc77 Merge remote-tracking branch 'origin/4.13' 2020-01-31 14:18:11 +05:30
Abhishek Kumar
9d105b6546
template: copy md5 mismatch (#3383)
Fixes #3191

When a template is registered, code stores md5sum of the downloaded file in the vm_template table. However, this downloaded file could be deleted after template installation if it is not an actual (.qcow2, .ova, etc.) file. When the user copies a template using copyTemplate API, the actual template file will be copied across the image stores. Matching checksum for the copied templated file and the stored value from the vm_template table will result in a mismatch.
Changes will set an empty checksum value for the copied template while passing to download service which allows skipping wrong checksum check for the copied while install.
However, this results in a change in checksum value for concerned template entry in vm_template table post template install.

Co-authored-by: dahn <daan.hoogland@gmail.com>
2020-01-31 14:16:37 +05:30
Anurag Awasthi
c0abfce8fa
Health check feature for virtual router (#3575) 2020-01-30 12:39:03 +01:00
Wei Zhou
ac581d1546
New feature: Resource count (CPU/RAM) take only running vms into calculation (#3760)
* marvin: check resource count of more types

* New feature: add flag resource.count.running.vms.only to count resource consumption of only running vms

Stopped VMs do not use CPU/RAM actually.
A new global configuration resource.count.running.vms.only is added to determine whether resource (cpu/memory) of only running vms (including Starting/Stopping) will be taken into calculation of resource consumption.

* Add integration test for resource count of only running vms
2020-01-30 10:36:50 +01:00
Rakesh
920531f42d
network: set restart_required to 0 after restarting network (#3803)
After restarting the network with or without cleanup option, the restart_required field in networks table should be reset to 0.
2020-01-30 11:12:38 +05:30
Rohit Yadav
0cb2db6e1d Merge remote-tracking branch 'origin/4.13' 2020-01-28 11:26:40 +05:30
Andrija Panic
0095272a38 upgrade: kvm-local-pool-trailing-slash (#3813)
Stop asking user (in the upgrade documentation) to remove a trailing slash for local KVM pool - do it here in upgrade path - so not needed in DOC for the upgrade to 4.14 and onwards.
2020-01-28 11:18:27 +05:30
Wei Zhou
136505b22c server: double check host capacity when start/migrate a vm (#3728)
When start a vm or migrate a vm (away from a host in host maintenance), cloudstack will check capacity of all hosts and choose one. If there are hundreds of hosts on the platform, it will take some seconds. When cloudstack choose a host and start/migrate vm to it, the resource consumption of the host might have been changed. This normally happens when we start/migrate multiple vms.
It would be better to double check the host capacity when start vm on a host.

This PR includes the fix for cpucore capacity when start/migrate a vm.
2020-01-28 10:55:11 +05:30
Wei Zhou
71e53ab01d server: Capacity check should take vms in Migrating state into calculation (#3727)
When we calculate a resource consumption of a host, we need to take the vms in following states into calculation: Running, Starting, Stopping, Migrating (to the host), and vms are Migrating from the host. Because, when stop a vm, the resource on host will be released when vm is stopped. When migrate a vm, the resource on destination host will be increased before migration starts, and resource on source host will be decreased after migraiton succeeds.

In cloudstack, there is a task named CapacityChecked which run every 5 minutes (capacity.check.period =300000 ms by default). It recalculates capacity of all hosts. However, it takes only vms in Running and Starting into consideration. We have faced some issues in host maintenance due to it.

Steps to reproduce the issue
(1) migrate N vms from host A to host B, cpu/ram resource increases before the migration.
(2) capacity check recalculate the capacity of hosts. used capacity of Host B will be reset to original value (not including the vms in Migrating).
(3) migrate some more vms from other host to host B, the migrations are allowed by cloudstack (because used capacity is incorrect). If the actual used memory exceed the physical memory on the host, there might be some critical issues (for example, libvirt dies)
2020-01-28 10:54:32 +05:30
Daan Hoogland
09e812f9cb Merge branch '4.13' 2020-01-15 15:46:19 +01:00
dahn
8ef10c0fdd
python/c++ formatting in java corrected (#3806) 2020-01-15 15:31:28 +01:00
dahn
4780a27255
Add missing HA config keys (#3776) (#3814)
* Add missing HA config keys (#3776)

* merge conflict-bugs fixed

Co-authored-by: mdominka <50666672+mdominka@users.noreply.github.com>
2020-01-15 12:24:05 +01:00
mdominka
54cc73af08 Add missing HA config keys (#3776) 2020-01-14 09:35:34 +01:00
Gabriel Beims Bräscher
d8a2f5dc20 Fix typo: the past tense of shutdown is shutdown, not shutdowned (#3659) 2020-01-13 23:39:48 +01:00
Anurag Awasthi
70fcf755f7 Allow additional configuration metadata to VMs (#3510)
* Suqash commits to a single commit and rebase against master

Update marvin tests to use white list

* * Fix marvin test failure
* Add new marvin negative tests cases
* Remove hard-coded hypervisor types in marvin tests

* Fix build error after rebase and add hugepagesless

* Fix readability of python code

* Fix failing test

* Adding cleanup of vms for negative tests

* Bug fixes - change config checks properly and block extraconfig in details

* Trim to compare the keys

* CR comments

* Don't skip extraconfig without exception

Co-authored-by: Boris Stoyanov - a.k.a Bobby <bss.stoyanov@gmail.com>
2020-01-08 17:53:45 +01:00
Daan Hoogland
6e19c17652 Merge release branch 4.13 to master
* 4.13:
  only update powerstate if sure it is the latest (#3743)
  ui: fix migrate host form no host popup (#3682)
  client: jetty session timeout set after server is started (#3658)
  Increase DHCP lease time to infinite (#3662)
2020-01-07 09:15:00 +01:00
dahn
d44dc0730b
only update powerstate if sure it is the latest (#3743) 2020-01-07 09:12:41 +01:00
Daan Hoogland
809561a7c6 Merge release branch 4.13 to master
* 4.13:
  network: cleanup dhcp/dns entries while remove a nic from vm (#3721)
2020-01-03 14:04:55 +01:00
Wei Zhou
75ccb53fa3 network: cleanup dhcp/dns entries while remove a nic from vm (#3721) 2020-01-03 14:03:09 +01:00
Rakesh
482e7ebf9a New feature: Acquire specific public IP for network (#3775)
Currently in cloudstack, when we click on "Acquire New Ip", it will
randomly acquire IP from the pool. With this enhancement, it is
possible to select the IP from the drop down IP list of that network.
Same thing applies for a VPC as well.
2019-12-24 10:08:53 +01:00
dahn
06060399ba
Honour promiscuous mode from networkOffering (#3765) (#3781)
Honour promiscuous mode from networkOffering (#3765)
2019-12-20 13:56:04 +01:00
Spaceman1984
c75c228c2d Honour promiscuous mode from networkOffering (#3765) 2019-12-20 13:54:55 +01:00
Anurag Awasthi
4b43c2684f Better tracking host maintanence and handling of migration jobs (#3425)
* Service layer changes for new way of tracking maintanence progress

* Fixes after offline code review

* Fix marvin tests

* Change state name and add documentation

* Fix test

* Fix and add more unit tests for different caseS

* Fix and enhance Marvin Tests

* Fixes for corner cases

* More fixes and logging

* UI fixes

* Some minor changes and reducing VMs on host for more contained tests

* Fixed ssh client auth problem causing test failure

* Code review changes + fixes + some more logging

* Fix flaky tests by adding delays between host states

* Added fetching only enabled hosts for tests

* Make port blocking KVM specific and refactor to handle failure

* Make failing migrations due to tagged host instead of port blocking

* Added additional check for migrating VMs

* Refactor to use single place for methods checking maintenance states
2019-12-19 16:36:20 +01:00
Sven Vogel
cf6e616d5b
Revert "Add missing HA config keys (#3737)" (#3774)
This reverts commit 16527f1eb070a796732e99cf8fe466b61cf972c3.
2019-12-18 14:54:27 +01:00
mdominka
16527f1eb0 Add missing HA config keys (#3737)
* Add missing HA config keys
* Change time value to seconds
* Change Integer to Long
* Using ConfigKey defaultValue
* Do some code refactoring
* Simplify code
2019-12-17 15:24:53 +01:00
Andrija Panic
0d92b92935
Fix OS category for some OS-es added in 4.13 (#3746) 2019-12-11 19:02:06 +01:00
Gabriel Beims Bräscher
93aad24bbb storage: Handle RBD snapshot deletion (#3615)
When deleting volume snapshots, only records in the database are deleted, and snapshots are not deleted on the main storage.

Fixes: #3586
2019-12-08 14:48:51 +05:30
nvazquez
828405d297 Merge branch '4.13' 2019-12-05 08:31:14 -03:00
Nicolas Vazquez
07d64cb65a
[KVM] Agent LB Fix: Connections from disabled KVM host agents are refused (#3617)
* Remove constraint for just enabled hosts receiving the ms list

* Allow sending SetupMSList command when host is in maintenance
2019-12-04 10:43:17 -03:00
Rakesh
f30b5ceba9 Fix resource count of expunged volume (#3669)
If the volume is in "Expunged" state then it should not be
considered towards total resource count of "primarystoragetotal"
field.
Currently cloudstack takes into resource calculation even if the
volume is expunged. The volume itself doesnt exist in primage
storage and hence it should not be considered towrds resource
caculation.

Steps to reproduce the issue:

1 . Get the resource count of "primarystoragetotal" of a particular domain.
2 . Create a VM with 5GB root disk size and stop it.
3 . Now the value of "primarystoragetotal" should be intitial value plus 5.
4 . Navigate to "volumes" of the VM and select "Download Volume" option.
5 . Once the volume is downloaded, expunge the VM.
6 . Get the resource count of "primarystoragetotal". it will be same value as in step 3
    But it should be same as initial value obtained in step 1.

With this fix, the value obtained at step 6 will be same as in step 1.
2019-11-29 15:42:04 +01:00
Rohit Yadav
7f5096a4d0
storage: don't select an SSVM that is removed (#3668)
In case an older SSVM is removed without changing it's state from Up
to Destroyed/Removed etc, the SSVM may be randomly selected for image
store related operations. This fix ensures that endpoints for an image
store are found only from a set of SSVM hosts that are not removed.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2019-11-12 00:47:21 +05:30
Rohit Yadav
b0e3fbec3a Merge remote-tracking branch 'origin/4.13' 2019-11-11 21:57:59 +05:30
dahn
95fbe7c55b datamotion: snapshot failure diagnostics unhidden (#3666)
Diagnostics are hard when a snapshot fails if a null pointer occurs. This is because no stack trace or location of the error is logged. I.E.
2019-10-21 12:55:00,056 DEBUG [o.a.c.s.m.AncientDataMotionStrategy] (Work-Job-Executor-131:ctx-80420156 job-10033827/job-10033828 ctx-4864e2f5) (logid:21454564) copy snasphot failed: java.lang.NullPointerException
2019-11-11 21:55:36 +05:30
Rohit Yadav
294813e8fe Merge remote-tracking branch 'origin/4.13' 2019-10-18 12:29:24 +05:30
Wei Zhou
cc27095554 server: Do NOT cleanup dhcp and dns when stop a vm (#3627)
* server: Do NOT cleanup dhcp and dns when stop a vm

According comment in PR #3608, dhcp and dns entries are cleaned up only when a VM is expunged.
Revert part of commit 8fb388e9312b917a8f36c7d7e3f45985a95ce773.

* server: cleanup dns/dhcp entries in removeNic instead of finalizeExpunge
2019-10-18 01:20:55 +05:30
Rohit Yadav
89053c7612
packaging: deprecate el6 and add 4.13-4.14 upgrade path (#3591)
- Removes CentOS6/el6 packaging (voting thread reference https://markmail.org/message/u3ka4hwn2lzwiero)
- Add upgrade path from 4.13 to 4.14
- Enable live storage migration support for KVM by default as el6 is deprecated
- PRs using live storage migration
  #2997 KVM VM live migration with ROOT volume on file storage type
  #2983 KVM live storage migration intra cluster from NFS source and destination
  #2298 CLOUDSTACK-9620: Enhancements for managed storage

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2019-09-19 10:01:08 +05:30
Paul Angus
50fc045f36 Updating pom.xml version numbers for release 4.14.0.0-SNAPSHOT
Signed-off-by: Paul Angus <paul.angus@shapeblue.com>
2019-09-07 09:57:46 +01:00
Paul Angus
61b8b77913 Updating pom.xml version numbers for release 4.13.1.0-SNAPSHOT
Signed-off-by: Paul Angus <paul.angus@shapeblue.com>
2019-09-01 13:36:50 +01:00
Paul Angus
80c740fd4e Merge branch '4.13.0.0-RC20190820T1535' into 4.13 2019-09-01 13:29:59 +01:00
Paul Angus
653bee3ddf schema: fix xenserver 7.1.0 OS mapping typo (#3567)
Fixes a typo in schema upgrade path
2019-08-28 11:41:59 +05:30
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
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
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
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