51 Commits

Author SHA1 Message Date
davidjumani
f0eac35e3d
kvm: Add check if host meets the minimum requirements (#5369)
* kvm: Add check if host meets min req

* Fix typo

* Update serviceConfig.py

* Remove obsessive checks

* Update error message
2021-09-17 10:21:05 +05:30
davidjumani
f17683779c
packaging: Adding SUSE 15 support (#5110)
This PR adds support for SUSE Leap 15.2+ as a KVM hypervisor and Management / Usage server on Cloudstack
Related docs link apache/cloudstack-documentation#224

Co-authored-by: Michael <35783820+mib1185@users.noreply.github.com>
2021-08-19 13:28:54 +05:30
davidjumani
98d3231dbf
Adding support for RHEL8 binary-compatible variants (#5158)
* Adding support for RHEL binary-compatible variants

* Skip ipmi related tests

* Fixing security_groups.py
2021-08-18 10:03:03 +02:00
Pearl Dsilva
14366cdd6c
centos: Mask libvirtd sockets which prevents cloudstack-agent from being setup (#4756)
* Prevent adding --listen parameter when libvirt version > 5.6

* mask libvirtd sockets

* remove unused import

Co-authored-by: Pearl Dsilva <pearl.dsilva@shapeblue.com>
2021-03-11 13:08:09 +05:30
davidjumani
ead9a34b3d
Disabling managing firewall - cloudstack-setup-management (#4239)
* Adding message to ensure ports are open

* Removing configuring iptables

* Fixing merge conflict
2020-09-22 17:46:21 +05:30
Wei Zhou
f38db8ae65
Ubuntu 20.04: restart libvirtd instead of libvirt-bin (#4301) 2020-09-04 12:57:58 +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
ustcweizhou
3729511c37 kvm: Fix three issues with Ubuntu 16.04 hosts (#3227)
* ubuntu16: fix unable to add host if cloudbrX is not configured

while add a ubuntu16.04 host with native eth0 (cloudbrX is not configured),
the operation failed and I got the following error in /var/log/cloudstack/agent/setup.log

```
DEBUG:root:execute:ifconfig eth0
DEBUG:root:[Errno 2] No such file or directory
  File "/usr/lib/python2.7/dist-packages/cloudutils/serviceConfig.py", line 38, in configration
    result = self.config()
  File "/usr/lib/python2.7/dist-packages/cloudutils/serviceConfig.py", line 211, in config
    super(networkConfigUbuntu, self).cfgNetwork()
  File "/usr/lib/python2.7/dist-packages/cloudutils/serviceConfig.py", line 108, in cfgNetwork
    device = self.netcfg.getDefaultNetwork()
  File "/usr/lib/python2.7/dist-packages/cloudutils/networkConfig.py", line 53, in getDefaultNetwork
    pdi = networkConfig.getDevInfo(dev)
  File "/usr/lib/python2.7/dist-packages/cloudutils/networkConfig.py", line 157, in getDevInfo
    elif networkConfig.isBridge(dev) or networkConfig.isOvsBridge(dev):
```

The issue is caused by commit 9c7cd8c2485412bc847b2c2473b962fa01435b24
2017-09-19 16:45 Sigert Goeminne ● CLOUDSTACK-10081: CloudUtils getDevInfo function will now return "bridge" instead o

* ubuntu16: Stop service libvirt-bin.socket while add a host

service libvirt-bin.socket will be started when add a ubuntu 16.04 host
DEBUG:root:execute:sudo /usr/sbin/service libvirt-bin start

However, libvirt-bin service will be broken by it after restarting
Stopping service libvirt-bin.socket will fix the issue.

An example is given as below.

```
root@node32:~# /etc/init.d/libvirt-bin restart
[ ok ] Restarting libvirt-bin (via systemctl): libvirt-bin.service.
root@node32:~# virsh list
error: failed to connect to the hypervisor
error: no valid connection
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory

root@node32:~# systemctl stop libvirt-bin.socket

root@node32:~# /etc/init.d/libvirt-bin restart
[ ok ] Restarting libvirt-bin (via systemctl): libvirt-bin.service.
root@node32:~# virsh list
 Id    Name                           State
----------------------------------------------------

```

* ubuntu16: Diable libvirt default network

By default, libvirt will create default network virbr0 on kvm hypervisors.
If vm uses the same ip range 192.168.122.0/24, there will be some issues.

In some cases, if we run tcpdump inside vm, we will see the ip of kvm hypervisor as source ip.
2019-05-05 13:57:58 +05:30
Sven Vogel
e44fc4af68 add exitcode / distribution detection and remove export CGROUP_DAEMON for RHEL7/CentOS7 (#2896)
* task/add distribution detection, remove export CGROUP_DAEMON='cpu:/virt'

* taks/add exit values

* change exit codes

* split redhat and centos / change ubuntu to /etc/lsb-release file

* turn around centos and rhel, we need first check for centos then rhel

* set variable distro to None
2018-11-07 18:22:20 -02:00
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
ea33a35297
debian: Use only -l for libvirtd default file on debian (#2550)
This fixes #2546

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2018-04-11 14:08:57 +05:30
Boris Schrijver
acd49d801b CLOUDSTACK-9039: Fix paths for logging Ubuntu Management. 2015-11-09 15:50:18 +01:00
Rohit Yadav
1e8d39b12e CLOUDSTACK-8999: Don't override resource if provided by agent.properties
If a custom resource (kvm/libvirt implementation) is defined in agent.properties
don't override with the default, but check and fallback to the default if
resource property not defined

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit 536a8b22c8865dc94281bce6267930a63e03ab77)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-10-28 10:56:36 +05:30
Remi Bergsma
b29ffa2cfe CLOUDSTACK-8443: mention the correct logfile 2015-08-24 15:51:14 +02:00
Remi Bergsma
87fdb521f0 CLOUDSTACK-8443: don't try to fix co-mounted cgroups
This setting works on CentOS 6 / RHEL 6 but does nothing, as
"cpu" cgroup is not mounted. On CentOS 7 / RHEL 7 systemd does
mount cgroups and "cpu" is co-mounted with "cpuacc". Hence, if
we specify "cpu" then this results in an error because it can
only use them both, or none.

By removing the setting, we rely on the default of qemu, which
is:
cgroup_controllers = ["cpu", "devices", "memory", "blkio", "cpuacct", "net_cls"]

Only if they are really mounted, they will be used. So, this will
work on both version 6 and 7.

The 'fix script' didn't work well, as after a reboot you'd still have qemu
throwing errors. Now we can handle the co-mountedcgroups.
2015-08-24 15:49:40 +02:00
Rafael da Fonseca
870e1898eb Use same sudoers config for all distros Cleanup buggy code for sudoers file editing
Signed-off-by: Daan Hoogland <daan@onecht.net>

This closes #332
2015-06-19 16:00:57 +02:00
Rafael da Fonseca
1958a8e9c1 Cleanup awsapi leftovers
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

This closes #328
2015-05-29 19:15:51 +02:00
Erik Weber
451e2ab851 Adding keytool to the list of sudo commands for cloud user to allow certificate creation during startup
Signed-off-by: Hugo Trippaers <htrippaers@schubergphilis.com>
2014-08-01 17:19:46 +02:00
Kishan Kavala
89854de18d CLOUDSTACK-6931: Set hypervisor.type in agent.properties using cloudstack-setup -t option. Default is kvm. 2014-06-19 11:31:23 +05:30
ynojima
ab89eb106f CLOUDSTACK-6816 bugfix: cloudstack-setup-management make /root directory's permission 0777 improperly 2014-05-31 12:54:09 -06:00
Marcus Sorensen
c2e2f6ce63 relax KVM agent setup to allow non-bridge traffic labels
(guest bridges are created on physical device, no need for bridge traffic label)
2013-11-01 18:16:54 -06:00
John Kinsella
45e4d4fc3b Summary: Updated sudoers approved commands for cloud user
Detail: Previously the cloud user has full password-less sudo access.
This commit changes that to only allow access to a specific list of
commands. Been tested in production on ACS 4.0 and 4.2 mangement servers.

BUG-ID: CLOUDSTACK-967
Bugfix-for:
Reviewed-by:
Reported-by:
Signed-off-by: John Kinsella <jlk@stratosec.co> 1382560936 -0700
2013-10-23 13:42:16 -07:00
Edison Su
6489b3bf61 turn off nfs cache 2013-09-25 16:16:25 -07:00
Hiroaki KAWAI
a16b707250 CLOUDSTACK-2327: make cloud-setup-agent ovs aware
Ovs brcompat will be obsolete, so if network.bridge.type was
set to openvswitch, we'll use ovs command explicitly.

Signed-off-by: Hiroaki KAWAI <kawai@stratosphere.co.jp>
2013-05-27 16:30:32 +09:00
Pradeep Soundararajan
a9955f155a Summary: changed the path from cloud to cloudstack.
The change in package script allowed us to create proper tar under rpmbuild/SOURCES directory

The change in the path enabled us to launch the management server properly.

Signed-off-by: Hugo Trippaers <htrippaers@schubergphilis.com>
Committed-by: Hugo Trippaers <htrippaers@schubergphilis.com>
2013-02-07 13:45:30 +01:00
frank
23495c7e26 CloudStack CS-15455 There are no iptable rules configured to open awsapi port (7080) for external world.
resolved fixed

reviewed-by:edison
2012-10-12 14:13:13 -07:00
Chip Childers
da45ae1150 Fixing license headers in the python folder 2012-08-20 11:23:41 -04:00
Tomoe Sugihara
9078550073 Fix the agent path according to 7a0a9231c355fee42c67799abe111edcd79998bb 2012-07-31 22:05:04 +05:30
frank
2f634c0913 Switch to Apache license 2012-04-03 04:50:05 -07:00
frank
5dc82ecb7f Bug 14379 - port 8096 should be closed and disabled by default on CS
status 14739: resolved fixed
2012-03-19 16:35:53 -07:00
Edison Su
f9a62145f0 bug 13647: adding iptables rules failed, sleep and retry
status 13647: resolved fixed
Reviewed-by: Frank
2012-02-15 14:52:23 -08:00
Edison Su
262ad16f4c disable nfs directory cache on kvm host 2012-01-31 14:34:35 -08:00
Edison Su
9c14506043 force vnc server listening on 0.0.0.0 2012-01-25 19:06:03 -08:00
Edison Su
fd759c60df bug 11458: stop cgconfig before start libvirtd, "service cgconfig status" returns "Running" instead of "running", then cloud-setup-agent doesn't stop it
status 11458: resolved fixed
2011-09-15 14:38:04 -07:00
frank
9c660c192f make /root writable in ubuntu 2011-09-12 18:08:43 -07:00
frank
f19e9252a4 use ufw to configure iptable in ubuntu for mgmt server ports 2011-09-12 16:44:20 -07:00
Edison Su
0e3aa3df29 sleep 30 sec if it is the first time to install cloud-agent in case the network is not coming up 2011-08-30 10:35:27 -07:00
Edison Su
66fe12910c delete the default iptable rule 2011-08-03 13:39:52 -07:00
Edison Su
8bcad6960c add rhel6.1 support 2011-07-29 20:05:01 -07:00
Edison Su
a89f7c0866 fix cloud-setup-agent, if selinux is disabled, should return successful, instead of raise an exception 2011-07-18 17:50:07 -07:00
Edison Su
5b4628f651 remove the default FORWARD rule on CentOS 5 2011-07-08 13:51:50 -07:00
Edison Su
8a887c0b77 start agent after template download is done 2011-07-08 13:18:43 -07:00
Edison Su
897952989a bug 10026: running qemu as root
status 10026: resolved fixed
2011-07-08 13:02:38 -07:00
Edison Su
c8d6d51011 fix ubuntu reboot issue, sometimes when you install agent, the init script is not installed into /etc/rc* 2011-07-08 13:02:38 -07:00
Edison Su
9956bdeefc disable apparmor profile is better than disable the whole service 2011-05-27 11:27:15 -04:00
Edison Su
9528b4de4f remove cgroup on ubuntu, as sometimes it hang reboot 2011-05-26 19:03:09 -04:00
Edison Su
82ab4fcde4 localstorage uuid is generated by uuidgen, other than from hostip+localstoragepath 2011-05-26 11:52:28 -04:00
Edison Su
29c510de28 need to insert iptable rules into FORWARD chain instead of append, as on rhel6, there is a reject rule added at the end of FORWARD 2011-05-13 16:05:20 -04:00
Edison Su
99825e738b fix mycloud-setup-agent on 10.04 2011-05-09 15:40:37 -04:00
Edison Su
0b6fe0523d fix setup-managment script 2011-05-09 13:21:34 -04:00