110 Commits

Author SHA1 Message Date
Vishesh
1303a4f323
Feature: Allow adding delete protection for VMs & volumes (#9633)
Co-authored-by: Suresh Kumar Anaparti <sureshkumar.anaparti@gmail.com>
2024-09-09 14:44:50 +02:00
Gabriel Pordeus Santos
f84e04372c
Fix being able to expunge a VM through destroyVirtualMachine even when role rule does not allow (#8689) 2024-08-20 12:02:04 +02:00
Wei Zhou
6def370f4a
test: fix unknown parameter hostid in test_vm_life_cycle.py (#8948) 2024-04-24 08:59:33 +02:00
Abhishek Kumar
d83d994929
test: additional check to ensure hosts are left in up state (#8383)
With this change, a fix is added for failures seen with test_08_migrate_vm or other migration-related tests because the target host is in `Connecting` state,
#8356 (comment)
#8374 (comment)
and more
2023-12-21 20:54:43 +05:30
Wei Zhou
aa02d9b3c1
test: skip live storage migration on CentOS 7 (#7862)
since #7570, The detail 'Host.OS' of centos7 host is changed from 'CentOS' to 'CentOS Linux'
2023-08-15 08:39:18 +02:00
nvazquez
83c2bfacd8
Merge branch '4.17' 2023-01-30 07:53:58 -03:00
Nicolas Vazquez
c78a777d3a
Fix: memory leak on volume allocation (#7136) 2023-01-30 09:44:50 +01:00
Nicolas Vazquez
eac357cb77
kvm: Secure KVM VNC Console Access Using the CA Framework (#7015)
This PR allows securing the console access through CloudStack to the virtual machines running on KVM. The secure access is achieved through the generated certificates for the CA Framework in CloudStack, that provides mutual TLS connections between agents. These certificates are used to also secure the connection between the console proxies and the VNC ports for VM console access.

This feature is only supported on the KVM hypervisor

Design Document: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Secure+KVM+VNC+connection+using+the+CA+framework
2023-01-27 17:22:06 +05:30
John Bampton
e65c22d883
Fix spelling (#6860) 2022-11-13 10:56:15 +01:00
John Bampton
fa39e61a4c
Fix spelling (#6609) 2022-11-01 08:30:01 +01:00
Abhishek Kumar
b15c202ee5
test: add test for importUnmanagedInstance (#6385)
* test: add test for importUnmanagedInstance

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

* refactor

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

* fix test

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2022-05-17 11:18:45 -03:00
Abhishek Kumar
6581a1bccd
test/vmware: add live migratevmwithvolume test and fix (#5289)
Co-authored-by: Gabriel Brascher <gabriel@apache.org>
2021-08-11 13:52:05 +02:00
davidjumani
4645863b25
tests: Fix test failures for Local storage and Basic zones (#5106)
tests: Fix test failures for Local storage and Basic (SG) zones

* Skip migrate vm when localstorage enabled
* Fix test_direct_download.py
* Skip test_03_create_network_domain_network_offering in basic zones
* Skip test_03_create_vpc_domain_vpc_offering in basic zones
* Skip test_01_add_primary_storage_disabled_host if localstorageenabled
2021-07-01 09:45:21 +05:30
dahn
a1f825e7c7
python3: Migrate Marvin and smoketests to python3 (#4727)
This PR prepares marvin and tests for python3. it was part of #4479, until nose2 was decided to be abandoned from that PR.

Re-PR of #4543 and #3730 to enable cooperation

Co-authored-by: Daan Hoogland <dahn@onecht.net>
Co-authored-by: Gabriel Beims Bräscher <gabriel@apache.org>
Co-authored-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2021-05-04 23:19:37 +05:30
Rohit Yadav
8fd9150a89 Merge remote-tracking branch 'origin/4.15' 2021-04-13 00:10:17 +05:30
Nicolas Vazquez
9cf1e0e869
vmware: Fix VMware OVF properties copy from template (#4738)
* Fix VMware OVF properties copy from template

* Fix vapp marvin test

* Remove unused code

* Fix check for deploy as is details

* Access class fields
2021-04-12 18:04:58 +05:30
Abhishek Kumar
cce736709e Merge remote-tracking branch 'apache/4.15' 2021-04-12 11:43:57 +05:30
dahn
03c05bc38a
tests: skip livemigration for centos (#4801)
This PR skips live migration on centos as the default installations for qemu/libvirt don't support it.

Fixes #4757

Co-authored-by: Daan Hoogland <dahn@onecht.net>
2021-04-10 13:11:59 +05:30
Rohit Yadav
c8f7c0d823 Merge remote-tracking branch 'origin/4.15'
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2021-03-11 13:33:44 +05:30
Rohit Yadav
3f84b9ab42 Merge remote-tracking branch 'origin/4.14' into 4.15 2021-03-11 13:31:46 +05:30
Abhishek Kumar
7a9d43e959
test: fix listVolumes call for detach volume migration check (#4785)
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2021-03-11 13:05:37 +05:30
sureshanaparti
81dfcbb5f5
server: Use ACPI event to reboot VM on KVM, and Use 'forced' reboot option to stop and start the VM(s) (#4681)
* Updated libvirt's native reboot operation for VM on KVM using ACPI event, and Added 'forced' reboot option to stop and start the VM (using rebootVirtualMachine API)

* Added 'forced' reboot option for System VM and Router

- New parameter 'forced' in rebootSystemVm API, to stop and then start System VM
- New parameter 'forced' in rebootRouter API, to force stop and then start Router

* Added force reboot tests for User VM, System VM and Router
2021-03-06 14:58:56 +05:30
nvazquez
d864e9dc39 [VMware] Full OVF properties support 2020-10-19 15:05:56 +05:30
davidjumani
d949302d0f
packaging: Adding Centos8, Ubuntu 20.04, XCPNG8.1 Support (#4068)
* DB : Add support for MySQL 8

- Splits commands to create user and grant access on database, the old
statement is no longer supported by MySQL 8.x
- `NO_AUTO_CREATE_USER` is no longer supported by MySQL 8.x so remove
that from db.properties conn parameters

For mysql-server 8.x setup the following changes were added/tested to
make it work with CloudStack in /etc/mysql/mysql.conf.d/mysqld.cnf and
then restart the mysql-server process:

    server_id = 1
    sql-mode="STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,ERROR_FOR_DIVISION_BY_ZERO,NO_ZERO_DATE,NO_ZERO_IN_DATE,NO_ENGINE_SUBSTITUTION"
    innodb_rollback_on_timeout=1
    innodb_lock_wait_timeout=600
    max_connections=1000
    log-bin=mysql-bin
    binlog-format = 'ROW'

    default-authentication-plugin=mysql_native_password

Notice the last line above, this is to reset the old password based
authentication used by MySQL 5.x.

Developers can set empty password as follows:

    > sudo mysql -u root
    ALTER USER 'root'@'localhost' IDENTIFIED BY '';

In libvirt repository, there are two related commits

2019-08-23 13:13 Daniel P. Berrangé            ● rpm: don't enable socket activation in upgrade if --listen present
2019-08-22 14:52 Daniel P. Berrangé            ● remote: forbid the --listen arg when systemd socket activation

In libvirt.spec.in

        /bin/systemctl mask libvirtd.socket >/dev/null 2>&1 || :
        /bin/systemctl mask libvirtd-ro.socket >/dev/null 2>&1 || :
        /bin/systemctl mask libvirtd-admin.socket >/dev/null 2>&1 || :
        /bin/systemctl mask libvirtd-tls.socket >/dev/null 2>&1 || :
        /bin/systemctl mask libvirtd-tcp.socket >/dev/null 2>&1 || :

Co-authored-by: Wei Zhou <w.zhou@global.leaseweb.com>
Co-authored-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Co-authored-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2020-08-17 16:28:30 +05:30
Nicolas Vazquez
8c1d749360
[VMware] Enable unmanaging guest VMs (#4103)
* Enable unmanaging guest VMs

* Minor fixes

* Fix stop usage event only if VM is not stopped when unmanaging

* Rename unmanaged VMs manager

* Generate netofferingremove usage event if VM is not stopped

* Generate usage event VM snapshot primary off when unmanaging
2020-06-26 08:31:43 -03:00
Wei Zhou
e5efb59414
simulator: fix travis failure after merging volume destroy/recover (#3880)
* test: do not associate public ip in test while deploy vm

* simulator: remove template/volume only if it exist

* simulator: fix build error
2020-02-13 09:58:31 +05:30
Nicolas Vazquez
0fbf5006b8 kvm: live storage migration intra cluster from NFS source and destination (#2983)
Feature Specification: https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=95653548

Live storage migration on KVM under these conditions:

From source and destination hosts within the same cluster
From NFS primary storage to NFS cluster-wide primary storage
Source NFS and destination NFS storage mounted on hosts
In order to enable this functionality, database should be updated in order to enable live storage capacibilty for KVM, if previous conditions are met. This is due to existing conflicts between qemu and libvirt versions. This has been tested on CentOS 6 hosts.

Additional notes:

To use this feature set the storage_motion_supported=1 in the hypervisor_capability table for KVM. This is done by default as the feature may not work in some environments, read below.
This feature of online storage+VM migration for KVM will only work with CentOS6 and possible Ubuntu as KVM hosts but not with CentOS7 due to:
https://bugs.centos.org/view.php?id=14026
https://bugzilla.redhat.com/show_bug.cgi?id=1219541
On CentOS7 the error we see is: " error: unable to execute QEMU command 'migrate': this feature or command is not currently supported" (reference https://ask.openstack.org/en/question/94186/live-migration-unable-to-execute-qemu-command-migrate/). Reading through various lists looks like the migrate feature with qemu may be available with paid versions of RHEL-EV but not centos7 however this works with CentOS6.
Fix for CentOS 7:

Create repo file on /etc/yum.repos.d/:
[qemu-kvm-rhev]
name=oVirt rebuilds of qemu-kvm-rhev
baseurl=http://resources.ovirt.org/pub/ovirt-3.5/rpm/el7Server/
mirrorlist=http://resources.ovirt.org/pub/yum-repo/mirrorlist-ovirt-3.5-el7Server
enabled=1
skip_if_unavailable=1
gpgcheck=0
yum install qemu-kvm-common-ev-2.3.0-29.1.el7.x86_64 qemu-kvm-ev-2.3.0-29.1.el7.x86_64 qemu-img-ev-2.3.0-29.1.el7.x86_64
Reboot host

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2019-06-10 15:35:26 +05:30
Rohit Yadav
12c0d88e31 Merge remote-tracking branch 'origin/4.11' into 4.12 2019-03-26 15:34:41 +05:30
Paul Angus
8b25fdf520 tests: fix some Marvin smoketests (#2869)
Fixes intermittent failures:
- Add a pause to avoid  tests restarting before VRs recovering from HA have fully booted.
- Add some pauses to allow services to restart and hosts to reconnect before continuing tests.
- Adding a loop around this method because sometimes VRs are overloaded and just respond with exception, so it'll catch it and try 5 times with 30sec cooldown. If that fails as well it'll fail the test.
- wait until host is up using explicit check
2019-03-26 15:33:40 +05:30
dahn
b363fd49f7 Vmware offline migration (#2848)
* - Offline VM and Volume migration on Vmware hypervisor hosts
- Also add VM disk consolidation call on successful VM migrations

* Fix indentation of marvin test file and reformat against PEP8

* * Fix few comment typos
* Refactor debug messages to use String.format() when debug log level is enabled.

* Send list of commands returned by hypervisor Guru instead of explicitly selecting the first one

* Fix unhandled NPE during VM migration

* Revert back to distinct event descriptions for VM to host or storage pool migration

* Reformat test_primary_storage file against PEP-8 and Remove unused imports

* Revert back the deprecation messages in the custom StringUtils class to favour the use of the ApacheUtils
2019-01-25 10:05:13 -02:00
Henko
525ddfb717 Destroyvm also removes volumes (#2793)
* Allow user to detach and delete volumes when destroyinh VMs

* Minor code refactoring
2018-11-30 10:27:31 -03:00
Rohit Yadav
f60f3cec34
router: Fixes #2789 fix proper mark based packet routing across interfaces (#2791)
Previously, the ethernet device index was used as rt_table index and
packet marking id/integer. With eth0 that is sometimes used as link-local
interface, the rt_table index `0` would fail as `0` is already defined
as a catchall (unspecified). The fwmarking on packets on eth0 with 0x0
would also fail. This fixes the routing issues, by adding 100 to the
ethernet device index so the value is a non-zero, for example then the
relationship between rt_table index and ethernet would be like:

100 -> Table_eth0 -> eth0 -> fwmark 100 or 0x64
101 -> Table_eth1 -> eth1 -> fwmark 101 or 0x65
102 -> Table_eth2 -> eth2 -> fwmark 102 or 0x66

This would maintain the legacy design of routing based on packet mark
and appropriate routing table rules per table/ids. This also fixes a
minor NPE issue around listing of snapshots.

This also backports fixes to smoketests from master.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2018-08-08 12:05:42 +05:30
Rohit Yadav
7667846bfa
kvm: Fixes #2763 move post-renewal libvirt restart class suitably (#2764)
This fixes #2763 by moving a post cert-renewal class for kvm
plugin/hypervisor to src/main/java. The regression is due to change
in file-system layout due to maven standard refactoring on master and
issue was not caught during forward-merging of a PR from 4.11 branch.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2018-07-26 12:51:24 +05:30
Rohit Yadav
d4e302dcc6
smoketest: Fix test_vm_life_cycle secure migration tests (#2715)
This fixes intermittently failing secure live VM migration tests on KVM.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2018-06-20 21:18:38 +05:30
Rohit Yadav
85ad4639b0 test/integration: fix invalid VMware smoketests failures
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2018-05-04 12:37:23 +05:30
Rohit Yadav
8da2462469
CLOUDSTACK-10333: Secure Live VM Migration for KVM (#2505)
This extends securing of KVM hosts to securing of libvirt on KVM
host as well for TLS enabled live VM migration. To simplify implementation
securing of host implies that both host and libvirtd processes are
secured with management server's CA plugin issued certificates.

Based on whether keystore and certificates files are available at
/etc/cloudstack/agent, the KVM agent determines whether to use TLS or
TCP based uris for live VM migration. It is also enforced that a secured
host will allow live VM migration to/from other secured host, and an
unsecured hosts will allow live VM migration to/from other unsecured
host only.

Post upgrade the KVM agent on startup will expose its security state
(secured detail is sent as true or false) to the managements server that
gets saved in host_details for the host. This host detail can be accesed
via the listHosts response, and in the UI unsecured KVM hosts will show
up with the host state of ‘unsecured’. Further, a button has been added
that allows admins to provision/renew certificates to KVM hosts and can
be used to secure any unsecured KVM host.

The `cloudstack-setup-agent` was modified to accept a new flag `-s`
which will reconfigure libvirtd with following settings:

    listen_tcp=0
    listen_tls=1
    tcp_port="16509"
    tls_port="16514"
    auth_tcp="none"
    auth_tls="none"
    key_file = "/etc/pki/libvirt/private/serverkey.pem"
    cert_file = "/etc/pki/libvirt/servercert.pem"
    ca_file = "/etc/pki/CA/cacert.pem"

For a connected KVM host agent, when the certificate are
renewed/provisioned a background task is scheduled that waits until all
of the agent tasks finish after which libvirt process is restarted and
finally the agent is restarted via AgentShell.

There are no API or DB changes.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2018-04-20 00:36:18 +05:30
Rohit Yadav
15b11a3b27 CLOUDSTACK-10013: Fix VMware related issues and fix misc tests
This fixes test failures around VMware with the new systemvmtemplate.
In addition:

- Does not skip rVR related test cases for VMware
- Removes rc.local
- Processes unprocessed cmd_line.json
- Fixed NPEs around VMware tests/code
- On VMware, use udevadm to reconfigure nic/mac address than rebooting
- Fix proper acpi shutdown script for faster systemvm shutdowns
- Give at least 256MB of swap for VRs to avoid OOM on VMware
- Fixes smoke tests for environment related failures

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2017-12-23 09:22:44 +05:30
Rohit Yadav
8323a175f1 CLOUDSTACK-9860: Power off VMs when stopVM is called with forced=true
The 'force' option provided with the stopVirtualMachine API command is
often assumed to be a hard shutdown sent to the hypervisor, when in fact
it is for CloudStacks' internal use. CloudStack should be able to send
the 'hard' power-off request to the hosts.

When forced parameter on the stopVM API is true, power off (hard shutdown)
a VM. This uses initial changes from #1635 to pass the forced parameter
to hypervisor plugin via the StopCommand, and fixes force stop (poweroff)
handling for KVM, VMware and XenServer.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2017-05-25 17:25:22 +05:30
sanjeev
18fee95109 Removed medium dictionary from test_data and modified the tests dependent on it
Removed duplicate test data related to vm properties.Modified tests dependent on it

Removed duplicte service offerings from test data and modified tests dependent on it
Bug-Id: CLOUDSTACK-8617
This closes #644
2015-08-06 11:29:13 +05:30
Sanjeev Neelarapu
8f1e0510cd Skipping all unsupported tests on LXC
This closes #379
2015-06-10 13:47:28 +05:30
Alex Brett
20d3cf1acc CLOUDSTACK-7727 Skip various BVT tests on LXC
A number of BVT tests are not valid for LXC (e.g. migrating a VM), so this patch
ensures they skip if LXC is in use.

Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>
2014-10-16 17:23:04 +05:30
Koushik Das
23f5772c30 Removed 'BugId' tag from tests for fixed bugs 2014-09-08 16:00:08 +05:30
Doug Clark
6220947dbe CLOUDSTACK-7281: Fix error in debug line
Signed-off-by: Santhosh Edukulla <santhosh.edukulla@gmail.com>
2014-08-07 21:00:13 +05:30
Gaurav Aradhye
1e3a689793 CLOUDSTACK-6873: Moved test cases that run only on simulator and those should be run serially to misc folder and also tagged them with required_hardware='simulator only'
Signed-off-by: Santhosh Edukulla <santhosh.edukulla@gmail.com>
2014-08-07 12:49:28 +05:30
Doug Clark
f7c72cdedc test_06_destroy_vm in test/integration/smoke/test_vm_life_cycle.py fails because the expunge parameter is set to true, this also cause tests that execute in test_vm_life_cycle.py after this test to fail.
Signed-off-by: Nitin Mehta <nitin.mehta@citrix.com>
2014-08-05 11:04:26 -07:00
Koushik Das
43dffaad5f Revert "CLOUDSTACK-7107: Disabling failed test case"
This reverts commit 186606a0bf82402e7755cd7998f133023cc96c6c.
2014-07-21 12:05:55 +05:30
Gaurav Aradhye
186606a0bf CLOUDSTACK-7107: Disabling failed test case 2014-07-16 21:36:57 -04:00
santhosh
aab6e1222f Fixed Regression issues mentioned under CLOUDSTACK-6708
Signed-off-by: santhosh <santhosh.edukulla@gmail.com>

Conflicts:

	test/integration/smoke/test_deploy_vm.py
	test/integration/smoke/test_network.py
	test/integration/smoke/test_routers.py
	test/integration/smoke/test_vm_life_cycle.py
2014-07-11 20:49:00 +05:30
Girish Shilamkar
2fedc281b7 Disable testcases 2014-06-29 22:30:56 -07:00
Gaurav Aradhye
0df156c09e CLOUDSTACK-6984: Resolving issues found during simulator run 2014-06-24 20:54:05 +05:30