From 7d4210dcff27f503e22755e3c798b26e96a81f86 Mon Sep 17 00:00:00 2001 From: Sachidananda Urs Date: Fri, 9 Sep 2016 15:57:41 +0530 Subject: [PATCH 1/5] Add example for glusterd slice --- examples/glusterd-slice.conf | 23 +++++++++++++++++++++++ examples/hc.conf | 1 + 2 files changed, 24 insertions(+) create mode 100644 examples/glusterd-slice.conf diff --git a/examples/glusterd-slice.conf b/examples/glusterd-slice.conf new file mode 100644 index 00000000..2061cb9f --- /dev/null +++ b/examples/glusterd-slice.conf @@ -0,0 +1,23 @@ +[hosts] +10.70.37.47 +10.70.37.147 + +# when slice_setup=yes is set for service glusterd, the following +# additional changes are done. +# +# Creates a file /etc/systemd/system/glusterd.service.d/99-cpu.conf with +# [Service] +# CPUAccounting=yes +# Slice=glusterfs.slice +# +# Creates a file /etc/systemd/system/glusterfs.slice with contents +# [Slice] +# CPUQuota=400% +# +# And runs: +# systemctl daemon-reload + +[service] +action=start +service=glusterd +slice_setup=yes diff --git a/examples/hc.conf b/examples/hc.conf index 1a1a9b46..9b59d233 100644 --- a/examples/hc.conf +++ b/examples/hc.conf @@ -123,6 +123,7 @@ vgname=RHGS_vg1 poolname=lvthinpool cache_lv=lvcache cache_lvsize=5GB +# cachemode=writeback [service3] action=stop From 51383982e06f4ac226050f1aac585fa29db15178 Mon Sep 17 00:00:00 2001 From: Sachidananda Urs Date: Fri, 9 Sep 2016 16:03:28 +0530 Subject: [PATCH 2/5] Add examples to illustrate enabling ssl on GlusterFS volumes --- examples/ssl-on-existing-vol.conf | 21 +++++++++++++++++++++ examples/ssl_enable.conf | 27 +++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 examples/ssl-on-existing-vol.conf create mode 100644 examples/ssl_enable.conf diff --git a/examples/ssl-on-existing-vol.conf b/examples/ssl-on-existing-vol.conf new file mode 100644 index 00000000..5147dcc5 --- /dev/null +++ b/examples/ssl-on-existing-vol.conf @@ -0,0 +1,21 @@ +[hosts] +10.70.37.147 +10.70.37.47 + +# This is important. Clients have to be unmounted before setting up SSL +[clients1] +action=unmount +hosts=10.70.37.173,10.70.37.107 +client_mount_points=/mnt/data + +[volume] +action=enable-ssl +volname=ssl +ssl_clients=10.70.37.107,10.70.37.173 + +[clients2] +action=mount +hosts=10.70.37.173,10.70.37.107 +volname=ssl +fstype=glusterfs +client_mount_points=/mnt/data diff --git a/examples/ssl_enable.conf b/examples/ssl_enable.conf new file mode 100644 index 00000000..70bd8328 --- /dev/null +++ b/examples/ssl_enable.conf @@ -0,0 +1,27 @@ +[hosts] +10.70.37.147 +10.70.37.47 + +[backend-setup] +devices=/dev/vdb +vgs=vg1 +pools=pool1 +lvs=lv1 +mountpoints=/mnt/brick + +[volume] +action=create +volname=ssl +transport=tcp +replica_count=2 +force=yes +enable_ssl=yes +ssl_clients=10.70.37.107,10.70.37.173 +brick_dirs=/data/1 + +[clients] +action=mount +hosts=10.70.37.173,10.70.37.107 +volname=ssl +fstype=glusterfs +client_mount_points=/mnt/data From 793974db7e3bf524d9152ae0d071af6d738daedb Mon Sep 17 00:00:00 2001 From: Sachidananda Urs Date: Fri, 9 Sep 2016 16:09:13 +0530 Subject: [PATCH 3/5] Fix errors in samba example config --- examples/enable-samba.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/enable-samba.conf b/examples/enable-samba.conf index a4792129..c695e78f 100644 --- a/examples/enable-samba.conf +++ b/examples/enable-samba.conf @@ -13,5 +13,4 @@ action=smb-setup volname=samba1 force=yes smb_username=smbuser -smb_password=smbuser smb_mountpoint=/mnt/smb From b63b932fa9512fba8647d22defdb325a1c2357df Mon Sep 17 00:00:00 2001 From: Sachidananda Urs Date: Wed, 14 Sep 2016 18:27:30 +0530 Subject: [PATCH 4/5] Fix a security concern, don't copy files to /tmp --- playbooks/georep_common_public_key.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/playbooks/georep_common_public_key.yml b/playbooks/georep_common_public_key.yml index b62c5674..f149f11e 100644 --- a/playbooks/georep_common_public_key.yml +++ b/playbooks/georep_common_public_key.yml @@ -9,12 +9,12 @@ - name: Copy the public key to the local fetch: src=~/.ssh/id_rsa.pub - dest=/tmp/id_rsa.tmp + dest="{{ base_dir }}"/id_rsa.tmp flat=yes - name: Copying local key to slave node - local_action: shell cat /tmp/id_rsa.tmp | ssh "{{user}}"@{{ item }} "cat >> ~/.ssh/authorized_keys" + local_action: shell cat "{{ base_dir }}"/id_rsa.tmp | ssh "{{user}}"@{{ item }} "cat >> ~/.ssh/authorized_keys" with_items: "{{ groups['georep_slave'] }}" - name: Deleting temporal files - local_action: file path=/tmp/id_rsa.tmp state=absent + local_action: file path="{{ base_dir }}"/id_rsa.tmp state=absent From 94eb2f757d50322df57ff9e0dfff8c080e1d8d17 Mon Sep 17 00:00:00 2001 From: Sachidananda Urs Date: Wed, 14 Sep 2016 18:48:51 +0530 Subject: [PATCH 5/5] Fix the stripe_unit and stripe_width options in mkfs.xfs --- gdeploycore/backend_setup.py | 15 ++++++++++++++- gdeployfeatures/lv/lv.py | 20 +++++++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/gdeploycore/backend_setup.py b/gdeploycore/backend_setup.py index b09eb9a0..235c93a7 100644 --- a/gdeploycore/backend_setup.py +++ b/gdeploycore/backend_setup.py @@ -325,7 +325,20 @@ def write_lvol_names(self): zip(self.vgs, self.lvs)] if lvols: self.section_dict['lvols'] = lvols - self.section_dict['opts'] = "-f -K -i size=512 -d sw=10,su=128k -n size=8192" + # If RAID data is provided use it to set the stripe_width and + # stripe_unit_size from the config. + disktype = self.config_get_options('disktype', False) + if disktype: + sw = self.config_get_options('diskcount', True) + su = self.config_get_options('stripesize', False) + if not su: + # No stripe size given assuming 256 + su = 256 + self.section_dict['opts'] = "-f -K -i size=512 -d sw=%s,su=%sk\ + -n size=8192"%(sw[0],su[0]) + else: + self.section_dict['opts'] = "-f -K -i size=512 -n size=8192" + self.section_dict['fstype'] = "xfs" Global.logger.info("Creating %s filesystem on %s with options %s"\ %(self.section_dict['fstype'], diff --git a/gdeployfeatures/lv/lv.py b/gdeployfeatures/lv/lv.py index 9a342f0d..bd085fb2 100644 --- a/gdeployfeatures/lv/lv.py +++ b/gdeployfeatures/lv/lv.py @@ -112,7 +112,25 @@ def get_mount_data(section_dict, devices, vgnames): if section_dict.get('mkfs-opts'): section_dict['opts'] = section_dict['mkfs-opts'] elif fstype == 'xfs': - section_dict['opts'] = "-f -K -i size=512 -d sw=10,su=128k -n size=8192" + # If RAID data is provided use it to set the stripe_width and + # stripe_unit_size from the config. + disktype = helpers.config_get_options('disktype', False) + if disktype: + sw = helpers.config_get_options('diskcount', True) + su = helpers.config_get_options('stripesize', False) + if not su: + # No stripe size given assuming 256 + su = 256 + section_dict['opts'] = "-f -K -i size=512 -d sw=%s,su=%sk\ + -n size=8192"%(sw[0],su[0]) + else: + section_dict['opts'] = "-f -K -i size=512 -n size=8192" + + Global.logger.info("Creating %s filesystem on %s with options %s"\ + %(section_dict['fstype'], + section_dict['lvols'], + section_dict['opts'])) + mountpoint = helpers.listify(section_dict.get('mount')) if not mountpoint: