178 Commits

Author SHA1 Message Date
Suresh Kumar Anaparti
2820a36f86
Check the network access when deploying VM in Advanced Security Group. (#6050)
* Check the network access when deploying VM in Advanced Security Group.

* Removed comment

* Removed redundant network access check, owner access check already exists
2022-03-06 10:07:57 -03:00
Abhishek Kumar
af58284560
server,config: respect storage.max.volume.size and make it dynamic (#5857)
* server,config: respect storage.max.volume.size and make it dynamic

Fixes #5830

* fix test

* size change

* fix check

* server: donot include ISO size while checking volume sizes

* revert size check

* refactor

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Co-authored-by: sureshanaparti <12028987+sureshanaparti@users.noreply.github.com>
2022-02-08 13:29:35 +05:30
Abhishek Kumar
d78a815442
server: fix update vm with unconstrained offering (#5828)
Fixes #5694

Signed-off-by: Abhishek Kumar <abhishek.kumar@shapeblue.com>
2022-01-13 12:30:12 +05:30
dahn
028d338aaa
remove VmWorkJob after adding a nic to a vm (#5658)
Co-authored-by: Daan Hoogland <dahn@onecht.net>
Co-authored-by: Suresh Kumar Anaparti <suresh.anaparti@shapeblue.com>
Co-authored-by: Wei Zhou <weizhou@apache.org>
2022-01-10 16:31:50 +01:00
Nicolas Vazquez
946f9156e5
vmware: Persist empty values instead of null (#5748)
This PR allows deploying VMware appliances missing default values on some properties
Fixes: #5747
2022-01-08 08:58:46 +05:30
Wei Zhou
7823868746
network: update ip in lb/pf/dnat tables when update vm nic ip (#5757)
* network: update ip in lb/pf/dnat tables when update vm nic ip

* Update: create 3 separated methods for DNAT/LB/PF update

* Update: invert if condition to reduce code indentation
2021-12-28 01:35:29 +05:30
sureshanaparti
39e41f6b6e
Allow force reboot VM from user account, to start VM on the same host (#5791) 2021-12-22 17:43:02 +01:00
Nicolas Vazquez
261fe326ff
Revert "parallel nic adding (#5541)" (#5665)
This reverts commit 3574d8d20be01b90ca09e58ab4b492604c1a8d1f.
2021-11-04 13:29:59 -03:00
davidjumani
6ac834a358
Adding AutoScaling for cks + CKS CoreOS EOL update + systemvmtemplate improvements (#4329)
Adding AutoScaling support for cks
Kubernetes PR : kubernetes/autoscaler#3629
Also replaces CoreOS with Debian
Fixes #4198

Co-authored-by: Pearl Dsilva <pearl1594@gmail.com>
Co-authored-by: Pearl Dsilva <pearl.dsilva@shapeblue.com>
Co-authored-by: Wei Zhou <w.zhou@global.leaseweb.com>
Co-authored-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2021-10-06 21:17:41 +05:30
dahn
ad4def5d1b
an inject annotation short (#5547)
Co-authored-by: Daan Hoogland <dahn@onecht.net>
2021-10-04 21:20:31 +02:00
dahn
3574d8d20b
parallel nic adding (#5541)
* trace nics additions

* work queue patch for network to add

* add secondary key to job

* logging improvements and naming of field(s)

* several naming corrections

* extra check if net already exists for vm

* placeholder job with secondary object

* constraint on entering the same job multiple times

* error handling/warning message

* review comments applied

Co-authored-by: Daan Hoogland <dahn@onecht.net>
Co-authored-by: Wei Zhou <wei.zhou@shapeblue.com>
2021-10-04 12:21:21 -03:00
Wei Zhou
669ab73efe
server: check service offering (storage) tags when reallocate a ROOT disk (#5501)
* server: check service offering (storage) tags when reallocate a ROOT disk

* server: resize volumes in Allocated state
2021-10-03 19:45:59 -03:00
Pearl Dsilva
37d22646b2
simulator: Add support to scale a VM (#5515)
* simulator: Add support to scale VM

* make list a constant
2021-09-29 09:47:58 +05:30
slavkap
75c15fd0d6
Allow storage plugins to get storage/volume stats without sending commands to hosts (#4826)
* Allow storage plugins to use storage/volume stats

Allow the rest of the storage plugins, not only ScaleIO to implement and
use the storage/volume statistics directly instead of sending cmd to
hosts

* Get the store driver from pool instead of passing it as argument

required change from code review to pick the store driver from pool not
to pass it as argument
2021-09-28 16:17:34 -03:00
Rohit Yadav
b955b38ccb Merge remote-tracking branch 'origin/4.15' into main 2021-09-27 16:17:49 +05:30
Abhishek Kumar
25d522fb3d
server: add vm boot details for start vm api (#5469)
Add vm boot details for start vm api

Fixes #5466

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2021-09-27 16:16:27 +05:30
Pearl Dsilva
74bb80687d
resource limit: Fix resource limit check on VM start (#5428)
* resource limit: Fix resource limit check on VM start

* add check to validate if cpu/memory are within limits for custom offering + exception handling

* unit tests

Co-authored-by: utchoang <hoangnm@unitech.vn>
2021-09-24 09:51:16 +05:30
Pearl Dsilva
f409e7a922
api: Update DNS on changing VM name (#5425)
* api: Update DNS on changing VM name

* refactor backend code + UI - add warning messaging to prompt users to restart VM in case particular fields are updated

* address comments
2021-09-15 00:26:12 -03:00
Nicolas Vazquez
413d10dd81
server: Extend the Annotations framework (#5103)
* Extend addAnnotation and listAnnotations APIs

* Allow users to add, list and remove comments

* Add adminsonly UI and allow admins or owners to remove comments

* New annotations tab

* In progress: new comments section

* Address review comments

* Fix

* Fix annotationfilter and comments section

* Add keyword and delete action

* Fix and rename annotations tab

* Update annotation visibility API and update comments table accordingly

* Allow users seeing all the comments for their owned resources

* Extend comments for volumes and snapshots

* Extend comments to multiple entities

* Add uuid to ssh keypairs

* SSH keypair UI refactor

* Extend comments to the infrastructure entities

* Add missing entities

* Fix upgrade version for ssh keypairs

* Fix typo on DB upgrade schema

* Fix annotations table columns when there is no data

* Extend the list view of items showing they if they have comments

* Remove extra test

* Add annotation permissions

* Address review comments

* Extend marvin tests for annotations

* updating ui stuff

* addition to toggle visibility

* Fix pagination on comments section

* Extend to kubernetes clusters

* Fixes after last review

* Change default value for adminsonly column

* Remove the required field for the annotationfilter parameter

* Small fixes on visibility and other fixes

* Cleanup to reduce files changed

* Rollback extra line

* Address review comments

* Fix cleanup error on smoke test

* Fix sending incorrect parameter to checkPermissions method

* Add check domain access for the calling account for domain networks

* Fix only display annotations icon if there are comments the user can see

* Simply change the Save button label to Submit

* Change order of the Tools menu to provent users getting 404 error on clicking the text instead of expanding

* Remove comments when removing entities

* Address review comments on marvin tests

* Allow users to list annotations for an entity ID

* Allow users to see all comments for allowed entities

* Fix search filters

* Remove username from search filter

* Add pagination to the annotations tab

* Display username for user comments

* Fix add permissions for domain and resource admins

* Fix for domain admins

* Trivial but important UI fix

* Replace pagination for annotations tab

* Add confirmation for delete comment

* Lint warnings

* Fix reduced list as domain admin

* Fix display remove comment button for non admins

* Improve display remove action button

* Remove unused parameter on groupShow

* Include a clock icon to the all comments filter except for root admin

* Move cleanup SQL to the correct file after rebasing main

Co-authored-by: davidjumani <dj.davidjumani1994@gmail.com>
2021-09-08 10:14:06 +05:30
Wei Zhou
b13930f946
server: fix reset sshkey is broken in master/4.16 (#5390)
* server: fix reset sshkey is broken in master/4.16

* Revert "server: fix reset sshkey is broken in master/4.16"

This reverts commit db278cf412f5ba4de2787e9511de75fc861097df.

* update #5390

* server: fix another regression of #4819 and #5274

* update #5390
2021-09-07 21:59:06 -03:00
Wei Zhou
a755ecfce8
Migrate vm across clusters (#4534)
* server: Optional destination host when migrate a vm

* #4378: migrate systemvms/routers with optional host

* Migrate vms across clusters

After enabling maintenance mode on host, if no suitable hosts
are found in the same cluster then search for hosts in
different clusters having the same hypervisor type

set global setting migrate.vm.across.clusters to true

* search all clusters in zone when migrate vm across clusters if applicable

* Honor migrate.vm.across.clusters when migrate vm without destination

* Check MIGRATE_VM_ACROSS_CLUSTERS in zone setting

* #4534 Fix Vms are migrated to same clusters in CloudStack caused by dedicated resources.

* #4534 extract some codes to methods

* fix #4534: an error in 'git merge'

* fix #4534: remove useless methods in FirstFitPlanner.java

* fix #4534: vms are stopped in host maintenance

* fix #4534: across-cluster migration of vms with cluster-scoped pools is supported by vmware vmotion

* fix #4534: migrate systemvms is only possible across clusters in same pod to avoid potential network errors.

* fix #4534: code optimization

Co-authored-by: Rakesh Venkatesh <r.venkatesh@global.leaseweb.com>
Co-authored-by: Sina Kashipazha <s.kashipazha@global.leaseweb.com>
Co-authored-by: Wei Zhou <weizhou@apache.org>
Co-authored-by: Sina Kashipazha <soreana@users.noreply.github.com>
2021-09-07 21:50:29 -03:00
nicolas
4de35426c4
Merge branch '4.15' into main 2021-09-02 22:04:12 -03:00
Wei Zhou
cf6dc663de
server: check server capacity when start/deploy a vm (#5339) 2021-09-02 21:45:00 -03:00
Pearl Dsilva
37761c610a
travis: fix consistent failures noticed on few tests (#5399) 2021-09-02 15:10:53 +05:30
nicolas
8860fc8143
Merge branch '4.15' into main 2021-08-28 01:11:52 -03:00
Wei Zhou
e968f3b16a
server: detach data disks before destroying vms (#5356) 2021-08-28 01:00:04 -03:00
Daniel Augusto Veronezi Salvador
8a16729fcf
Support vm dynamic scaling with kvm (#4878)
* Create utility to centralize byte convertions

* Add/change toString definitions

* Create Libvirt handler to ScaleVmCommand

* Enable dynamic scalling VM with KVM

* Move config from interface to class and rename it

As every variable declared in interfaces are already final,
this moving will be needed to mock tests in nexts commits

* Configure VM max memory and cpu cores

The values are according to service offering or global configs

* Extract dpdk configuration to a method and test it

* Extract OS desc config to a method and test it

* Extract guest resource def to a method and test it

Improve libvirt def

* Refactor LibvirtVMDef.GuestResourceDef

* Refactor ScaleVmCommand

* Improve VMInstaVO toString()

* Refactor upgradeRunningVirtualMachine method

* Turn int variables into long on utility

* Verify if VM is scalable on KVMGuru

* Rename some KVMGuruTest's methods

* Change vm's xml to work with max memory

* Verify if service offering is dynamic before scale

* Create methods to retrieve data from domain

* Create def to hotplug memory

* Adjust the way command was scaling the VM

* Fix database persistence before executing command

* Send more info to host to improve log

* Fix var name

* Fix missing "}"

* Undo unnecessary changes

* Address review

* Fix scale validation

* Add VM prepared for dynamic scaling validation

* Refactor LibvirtScaleVmCommandWrapper and improve unit tests

* Remove duplicated method

* Add RuntimeException check

* Remove copyright from header

* Remove copyright from header

* Remove copyright from header

* Remove copyright from header

* Remove copyright from header

* Update ByteScaleUtilsTest.java

Co-authored-by: Daniel Augusto Veronezi Salvador <daniel@scclouds.com.br>
2021-08-21 09:29:02 +02:00
Wei Zhou
846efdbfe4
server: Optional destination host when migrate a vm (#4378)
* server: Optional destination host when migrate a vm

* #4378: migrate systemvms/routers with optional host

* #4378: fix mistake

* #4378: fix issue when migrate systemvm

* #4378 add autoselect to migrate api commands

* #4378: more ui change

* #4378: add label label.migrate.auto.select

* #4378: add method chooseVmMigrationDestination

* #4378: fix vm migration wih storageid on vmware

* #4378: add method to collect vm disk/network statistics

* #4378: set autoSelect to default 'true'

* #4378: use BooleanUtils.isNotFalse

Co-authored-by: Wei Zhou <weizhou@apache.org>
2021-08-10 01:25:57 -03:00
Rakesh
2f8d557f58
api: Change GET/POST request max length of VM user data to 4K/1M (#4737)
Currently we can send a default value of 4K/32K for GET/POST request of
user data field. Most new browsers and also nginx support till 1MB of
post data.

Added a new global setting `vm.userdata.max.length` with default value of
32KB which can be increased till 1MB.
2021-08-09 14:14:19 +05:30
Gabriel Beims Bräscher
95de82750e
server: Fix migration issue in UserVmManagerImpl.migrateVirtualMachineWithVolume (#5288)
I've upgraded a stage environment from an older 4.16-SNAPSHOT to the current one and found a regression bug at the VM migration.

When calling the migrateVirtualMachineWithVolume, the following InvalidParameterValueException is launched: Unsupported hypervisor: KVM for VM migration, we support XenServer/VMware/KVM only.
2021-08-09 13:39:09 +05:30
Abhishek Kumar
5ac184edd6 Merge remote-tracking branch 'apache/4.15' into main 2021-07-15 14:02:49 +05:30
Abhishek Kumar
e0141ab348
server: fix network access for addNicToVirtualMachine API (#5184)
New NICs shouldn't added to VM with network from admin account, same as deployment.

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2021-07-15 12:57:37 +05:30
Abhishek Kumar
50a16979c5
refactor: migrate vm with storage (#5030)
* refactor: migrate with storage host capability check

Refactors Boolean HypervisorCapabilitiesDao::isStorageMotionSupported to boolean HypervisorCapabilitiesDao::isStorageMotionSupported for simplifying callers.
Refactors log messages.

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>

* simplify

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>

* refactor

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>

* changes

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>

* review comments addressed

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>

* var rename

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2021-07-15 12:57:13 +05:30
Gabriel Beims Bräscher
ca78f5b386
Enhance log messages with host name (#4575)
* Enhance log messages with hostName

* Use host.toString() on most of host logs.

* Remove redundant "Host" in logs and enhance logs

* duplicated "for"

* Adopt String.format, and enhance code

* Address reviews enhancing log messages

Update server/src/main/java/com/cloud/resource/ResourceManagerImpl.java
    -- server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
    -- server/src/main/java/com/cloud/resource/RollingMaintenanceManagerImpl.java

Co-authored-by: Daniel Augusto Veronezi Salvador <38945620+GutoVeronezi@users.noreply.github.com>

* Fix String.format issue and change log message from debug to warn

* Fix checkstyle issue

* Fix string.format log

* Address review: enhance logs

* Enhance log of hosts in maintenance avoid list

* Remove "VM" on logs as vm.toString() already appends VM-<details>

* Add more details of the VM when postStateTransitionEvent

* Address reviewer and enhance VMInstanceVO.toString()

Co-authored-by: Daniel Augusto Veronezi Salvador <38945620+GutoVeronezi@users.noreply.github.com>
2021-07-13 17:35:59 -03:00
Pearl Dsilva
b5d75352f2
expunge vm: Allow expunging a VM in destroyed state (#5183) 2021-07-13 09:33:40 +02:00
Daniel Augusto Veronezi Salvador
a3f39db62b
server: Remove meaningless password regeneration on resetSSHKeyForVirtualMachine (#4819)
On API `resetSSHKeyForVirtualMachine`, ACS also regenerates VM password when it uses a template with `Password Enabled` as true; there is already anAPI to reset VM password, therefore, the reset SSH keys API should not reset the VM SSH password as well.

Besides running a meaningless process, the VM's password regeneration slows down the main process and may cause a confusion in operations due to password change in the VM without being explicity requested.

Co-authored-by: Daniel Augusto Veronezi Salvador <daniel@scclouds.com.br>
2021-06-17 11:57:52 +05:30
nicolas
d2ab350a40 Merge branch '4.15' into main 2021-06-16 15:38:18 -03:00
Wei Zhou
46a3032178
server: set correct gateway when update vm nic on shared networks (#5105)
This PR fixes the issue that nic has wrong gateway after updating vm nic.

Steps to reproduce the issue
(1) create shared network (in advanced zone or advanced zone with sg)
(2) create new shared network (with same startip/endip/netmask, but different gateway).
(3) create a vm in new network
(4) stop vm and update vm nic ip address

Expected result:
The vm has correct gateway and netmask (of second network)

Actual result:
The vm has wrong gateway and netmask (of first network)
2021-06-16 21:19:42 +05:30
Harikrishna
083646b3c3
server: VM dynamic scaling option granularity (#4643)
This PR introduces new granularity levels to configure VM dynamic scalability. Previously VM is configured to be dynamically scalable based on the template and global setting. Now we bringing this option to configure at service offering and VM level also.

VM can dynamically scale only when all flags are ON at VM level, template, service offering and global setting. If any of the flags is set to false then VM cannot be scalable. This result will be persisted in DB for each VM and will be honoured for that VM till it is updated.

We are introducing 'dynamicscalingallowed' parameter with permitted values of true or false for deployVM API and createServiceOffering API.

Following are the API parameter changes:
createServiceOffering API: 
          dynamicscalingenabled: an optional parameter of type Boolean with default value “true”.
deployVirtualMachine API: 
          dynamicscalingenabled: an optional parameter of type Boolean with default value “true”.

Following are the UI changes:
Service offering creation has ON/OFF switch for dynamic scaling enabled with default value true
2021-06-08 17:10:00 +05:30
Suresh Kumar Anaparti
958182481e cloudstack: make code more inclusive
Inclusivity changes for CloudStack

- Change default git branch name from 'master' to 'main' (post renaming/changing default git branch to 'main' in git repo)
- Rename some offensive words/terms as appropriate for inclusiveness.

This PR updates the default git branch to 'main', as part of #4887.

Signed-off-by: Suresh Kumar Anaparti <suresh.anaparti@shapeblue.com>
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2021-06-08 15:47:20 +05:30
Rohit Yadav
d184e282b2 Merge remote-tracking branch 'origin/4.15' 2021-05-31 20:01:09 +05:30
Pearl Dsilva
d04fa0201d
server: usage generated for destroyed VMs with no backups (#5017)
Fixes: #4990
When a VM associated with a backup offering is destroyed/expunged, the backup offering isn't unassigned, and despite the VM having no backups present, backup usage is generated. This PR prevent usage record generation when there are no backups present for a VM with a backup offering associated to it. This is done by ensuring that usage event for backups is generated only when a the backup size > 0
2021-05-31 18:59:48 +05:30
Rohit Yadav
57e4e3b6b1 Merge remote-tracking branch 'origin/4.15' 2021-05-31 16:04:42 +05:30
Abhishek Kumar
b0cb087bd0
server: fixes NPE on empty vmware.root.disk.controller config (#5045)
* server: fixes NPE on empty vmware.root.disk.controller config

When global config - vmware.root.disk.controller is set to empty and template is registered with deployasis, server will throw NPE while deploying a VM. This change fixes the problem by using default value of the config in this case.

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>

* use StringUtils utility

Co-authored-by: Pearl Dsilva <pearl1594@gmail.com>

* fix indentation

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>

Co-authored-by: Pearl Dsilva <pearl1594@gmail.com>
2021-05-31 14:30:11 +05:30
Abhishek Kumar
4b7fa4e630 Merge remote-tracking branch 'apache/4.15'
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2021-05-24 16:43:53 +05:30
slavkap
d47e273329
server: Prevent NPE if hypervisor's capabilities are null (#5029)
If the hypervisor's capabilities are null, CloudRuntimeException will be thrown;
Format the error message.
2021-05-21 15:19:04 +05:30
Spaceman1984
5f734f718e
vmware: Disk controller vmware deploy as is (#5006)
Fixes #4344
2021-05-19 14:33:16 +05:30
Rohit Yadav
cb167072a1 Merge remote-tracking branch 'origin/4.15'
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2021-05-07 16:37:42 +05:30
Rohit Yadav
f5e665cd63
server: NPE may cause management server to not start (#5001)
This NPE may happen when a VM is marked removed in the DB but not its
nics on a shared network. This can usually happen due to a failed
expunged VM or when an admin manually marks a VM as removed in DB but
does not cleanup the nics/network resources.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2021-05-07 00:03:16 +05:30
Rohit Yadav
4742ac15f7 Merge remote-tracking branch 'origin/4.15' 2021-04-29 21:50:40 +05:30