32216 Commits

Author SHA1 Message Date
Wei Zhou
ac7bcde45b
KVM: Propagating changes on host parameters to the agents (#3491) 2020-02-19 13:13:37 +00:00
Wei Zhou
37d2b8537c
kvm: Enable virtio drivers based on guest os display name (#3879)
When we add new guest os, sometimes we missed the records in guest_os_hypervisor.
However, the guest disk model (virtio/ide) is determined by record in the table.
It causes the issue that some new guest os(eg Debian 8/9) uses e1000 instead of virtio nic, and ide disk instead of virtio disk.

To fix the issue permanantly, pass the guest os name in guest_os if the record for kvm is not found in guest_os_hypervisor.

Related commit:7ac9f00eeeb4cd37ec39efeba066e799b581b1a0
2020-02-19 13:12:20 +05:30
Wei Zhou
649ed45965
kvm: fix exception in volume statts after storage migration (#3884)
On kvm, the 'path' of volume is the file name on primary storage. we should use 'path' instead of 'uuid' in volume statistics.

Fixes: #3878
2020-02-19 13:06:19 +05:30
Rakesh
bbe2bf1a6e
server: ignore site to site vpn status check on internallbvm (#3864)
When the state of the site to site vpn changes, the check
is done on all the virtual routers including the internal
load balancing vm as well. It is not needed to check the
state for internal load balancing vm
2020-02-18 14:03:30 +05:30
Spaceman1984
a443f31b78
jobs: fixed duplicate id error when creating VM work jobs (#3871)
This PR removes related VMWorkjob records when the async_job table is cleaned out.

Fixes: #3829
2020-02-12 19:06:01 +05:30
Spaceman1984
5ae65bfab0
ui: Fixed root volume resize from ui (#3873)
This PR fixes the volume resize action for a root volume from the UI.

Fixes: #3860 #3874
2020-02-12 19:03:14 +05:30
Rohit Yadav
78cc0a44c1
server: use host record related to a ssvm/cpvm (#3876)
This implements the systemvm list API response creator to find and use
the host record for a ssvm/cpvm to get the agent status and other
details like last disconnected date and agent version.

Fixes 3875

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2020-02-10 19:01:34 +05:30
Rohit Yadav
afcbbc4b3e
systemvm: list systemvm does not return agent state and version (#3870)
This makes the listSystemVms API to return the host status (agent state),
version and last pinged information. This makes it possible for UIs
to call a single API to get this information.
2020-02-07 13:19:35 +01:00
Wei Zhou
cd55674afe packaging: install python-dnspython or python-dns to fix issue with cloudstack-setup-management (#3854)
Fixes #3817 #3841

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2020-02-07 11:18:00 +05:30
Spaceman1984
f769c66bc1 ui: fix default text missing from network selection on instance wizard (#3865)
This PR fixes the missing "Default" display issue on the instance wizard when selecting a network.

Fixes: #3633
2020-02-07 11:17:38 +05:30
Wei Zhou
d88c614a35
vr: add missing rule for port forwarding rule in vpc (#3857) 2020-02-06 20:25:56 +01:00
Wei Zhou
a9a1737dd9
vpc: set traffic type of private gateway IP to Public to fix ke… (#3851) 2020-02-06 20:22:08 +01:00
Pearl Dsilva
bfdb914693
usage: publish zone id while uploading template and volume (#3867)
After a local template is uploaded via browser, the generated usage event with type = "TEMPLATE.CREATE" is persisted with the data store ID instead of the zone ID on the zone_id column. The fix will refactor the upload monitor logic, as after the upload completes, it sets the datastore ID on the zone ID column for the created "TEMPLATE.CREATE" usage event. This refactor will query the DB for the data store and will set its associated zone ID in the usage field.
The fix produces the same behaviour as when registering a template from URL.
FIx is also for uploading VOLUME from local/via browser.
2020-02-06 11:31:24 +05:30
Wei Zhou
c22e99c638
test: check more connectivity in test_privategw_acl.py (#3861) 2020-02-05 12:15:22 +01:00
Rakesh
70daee9b10 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-02-04 14:42:46 +01:00
Abhishek Kumar
a71874682c
server: fix checking disk offering access for snapshot volume (#3791)
Fixes #3783
As reported in the issue, creating volumes from pure snapshot fails with NPE. This is due to order of calls where disk offering access is checked before checking disk offering value. This PR fixes the same.

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2020-01-31 15:24:25 +05:30
Wei Zhou
75aa6e3659
ui: fix cannot assign vms to internal lb in VPC (#3832)
This fixes the issue that cannot assign VMs in Internal LB in VPC.
listView is overwritten due to commit 2e2b670 (#3161)

Fixes: #3827
2020-01-31 15:23:11 +05:30
Wei Zhou
76fb811e08
kvm: Fix router migration issue when router has control/public nics on other physical network than guest (#3855)
In VM migration on KVM, libvirt qemu hook script will change the bridge name to bridges for guest networks. It works for user vm. However for virtual router, it has nics on control network and public network. If control/public use different physical networks than guest network, virtual router cannot be migrated.

Fixes: #2783
2020-01-31 15:14:35 +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
Sid Kattoju
6baa598033
Clean up inactive iscsi sessions when VMs get moved due to crashes (#3819) 2020-01-30 19:52:28 +01:00
Dennis Konrad
82d94a87c5
Fix Policy Based Routing for private gateway static routes (#3604)
* Fix for routing table issue with NAT interfaces

* Mark only packets with the public ip as destination
2020-01-30 11:31:30 +01:00
davidjumani
7a25e40d5a
api: allow listing management server by id and name (#3840)
The List Management Server api returns a list of all the management servers but fails when trying to list by id or name. This ensures that it fetches the details as per the parameters passed.
Fixes: #3833
2020-01-30 10:38:25 +05:30
Pearl Dsilva
1c130a5dd4
api: metrics API response is not super-set of resources response keys (#3834)
The metrics API has few properties missing that are present in the corresponding resource. 

Fixes #3831

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
Co-authored-by: Rohit Yadav <rohit@apache.org>
2020-01-30 08:49:45 +05:30
Wei Zhou
521217c852
vr: fix vr in unknown state (more) (#3848)
This fixes similar issue with #3465.

Meanwhile change log level of CsHelper.execute2 from DEBUG to INFO and fix some typo.
2020-01-30 08:43:46 +05:30
Wei Zhou
be112a0220
vrouter: reload haproxy when cfg file is updated (#3726)
since 4.11.3, haproxy is always restarted when add/delete a lb rule.
When haproxy is started, the processes are
```
root@r-854-VM:~# ps aux |grep haproxy
root     22272  0.0  0.2   4036   668 ?        Ss   07:52   0:00 /usr/sbin/haproxy-systemd-wrapper -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid
haproxy  22274  0.0  2.3  38444  5856 ?        S    07:52   0:00 /usr/sbin/haproxy-master
haproxy  22275  0.0  0.3  38444   880 ?        Ss   07:52   0:00 /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -Ds
```
When haproxy is reload, the processes are
```
root@r-854-VM:~# ps aux |grep haproxy
root     22272  0.0  0.2   4168   632 ?        Ss   07:52   0:00 /usr/sbin/haproxy-systemd-wrapper -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid
haproxy  22283  0.0  2.3  38444  5884 ?        S    07:53   0:00 /usr/sbin/haproxy-master
haproxy  22286  0.0  0.3  38444   880 ?        Ss   07:53   0:00 /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -Ds -sf 22275
```

We need to change the pid file from /var/run/haproxy.pid to /run/haproxy.pid, so the haproxy will be reloaded instead of restarted.
2020-01-29 16:01:19 +05:30
Spaceman1984
4ea6f32566
ui: Fixed unable to edit domain settings (#3846)
This pull request adds a scroll bar to the domain settings page that will allow a user to scroll to the right to change settings.

Fixes: #3032
2020-01-29 12:49:20 +05:30
Rohit Yadav
b1783fbcf1
travis: use https based maven repo mirror (#3845)
Travis has been failing lately as it requires that repositories use
https:// URLs.

Reference:
https://blog.sonatype.com/central-repository-moving-to-https

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2020-01-28 18:50:37 +05:30
Gregor Riepl
8792070f84 Rethrow takeVMSnapshot() exception instead of returning null in VMSnapshotManagerImpl (#3761)
Fixes: #3518
2020-01-28 11:05:15 +05:30
Wei Zhou
a77d74ba0d server: Fix NPE while update displayvm on vm with dynamic service offering (#3758)
Steps to reproduce the issue
(1) create a custom service offering
(2) create a vm with the offering
(3) update vm with displayvm=false, returns an error

(local) > update virtualmachine id=f33fd06a-7643-40d1-833f-272845d9ba09 displayvm=false
Error 530: {"updatevirtualmachineresponse":{"uuidList":[],"errorcode":530,"cserrorcode":9999}}
2020-01-28 11:04:26 +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
Wei Zhou
ff1c6e78f4 router: Set up metadata/password/dhcp server on gateway IP instead of guest IP in RVR (#3477)
When we create a vm in the network with redundant VRs, the lease file in the vm (for example /var/lib/dhcp/dhclient.eth0.leases) shows the dhcp-server-identifier is the guest ip (not vip/gateway) of master VR. That's the ip ipaddress where the vm fetch password and metadata from.
if we stop the master VR (then backup will be master) or restart the network with cleanup (VRs will be created), the guest ip of master VR changes so vm are not able to get metadata/ssh-key using the ips in dhcp lease file.

Setting up metadata/password/dhcp server on gateway instead of guest IP in redundant VRs will fix the issues.

FIxes #3409
2020-01-28 10:35:59 +05:30
Pearl Dsilva
b581f85d4b fixed inconsistency of IP on VR when VR is destroyed and recrea… (#3825) 2020-01-23 16:59:00 +01:00
Wei Zhou
b79a539191 server: fix resource count error when upgrade a vm (#3759)
Steps to reproduce the issue
(1) create an account (test)
(2) create a vm with the account (test)
(3) login with admin, and upgrade the vm to another offering
(4) the resource count (cpu,memory) of admin increases, not the account (test).
2020-01-23 16:53:43 +01:00
dahn
8ef10c0fdd
python/c++ formatting in java corrected (#3806) 2020-01-15 15:31:28 +01:00
dahn
6ebd02e7af Agent lb on svm (#3795)
* add host if needed

* allow for test with null-host

* full coverage of states

* EnumSet.contains instead of Arrays.binarySearch
2020-01-14 15:40:21 +01:00
mdominka
54cc73af08 Add missing HA config keys (#3776) 2020-01-14 09:35:34 +01:00
Spaceman1984
005019b0e6 Endless settings on templates and instances (#3778)
* Endless settings on templates and instances

* Removed unintentionaly committed file

* Fix indentation

Co-authored-by: Anurag Awasthi <anurag.awasthi@shapeblue.com>
2020-01-08 14:48:23 +01:00
dahn
d44dc0730b
only update powerstate if sure it is the latest (#3743) 2020-01-07 09:12:41 +01:00
Abhishek Kumar
701f606dc9 ui: fix migrate host form no host popup (#3682)
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2020-01-03 15:19:32 +01:00
Marc-Aurèle Brothier
02714f263e client: jetty session timeout set after server is started (#3658)
fixed inability to set a custom session duration via server.properties on mgmt server.
2020-01-03 15:19:08 +01:00
Andrija Panic
2ffc0c5073 Increase DHCP lease time to infinite (#3662)
* Increase lease time to infinite

Lease time set to effectively infinite (36000+ days) since we fully control VM lifecycle via CloudStack
Infinite time helps avoid some edge cases which could cause DHCPNAK being sent to VMs since
(RHEL) system lose routes when they receive DHCPNAK
When VM is expunged, it's active lease and DHCP/DNS config is properly removed from related files in VR.

* desc fix
2020-01-03 15:18:40 +01:00
Abhishek Kumar
cca6608aa5 ui: fix for truncated name for project accounts (#3793)
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2020-01-03 14:53:55 +01:00
Wido den Hollander
7e64945b88 kvm: Logrotate should not touch agent.log (#3597)
Logrotate should only touch security_group.log and resizevolume.log
as the agent.log is already rotated by log4j inside the Agent.

Having two systems trying to rotate agent.log leads to all kinds of
issues like having binary (compressed) data in the middle of a plain-text
log file.

In addition we do not have to rotate the logs every day, only when they
grow larger than 10M. On fairly idle hypervisors this should not cause
those logs to rotate every day.

Signed-off-by: Wido den Hollander <wido@widodh.nl>
2020-01-03 14:12:08 +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
dahn
8844f59247
break session only on illegal origin (#3715) 2019-12-24 10:22:34 +01:00
Spaceman1984
100308536c Added zone check for attach iso (#3755) 2019-12-23 16:48:51 +01:00
Wei Zhou
2712decf50 config: add isdynamic flag in configuration response (#3729) 2019-12-20 15:17:21 +01:00
dahn
3ac03c8858
filter hosts to query on zone wide storage (#3733) 2019-12-20 14:12:10 +01:00
dahn
90ce1d8c39
convert protocal names to be found as labels (#3747)
* convert protocal names to be found as labels

* format
2019-12-20 14:11:36 +01:00