diff --git a/source/python-vsmclient/python-vsmclient.spec b/source/python-vsmclient/python-vsmclient.spec index 79669ab9b..f80dabddc 100644 --- a/source/python-vsmclient/python-vsmclient.spec +++ b/source/python-vsmclient/python-vsmclient.spec @@ -1,6 +1,6 @@ Name: python-vsmclient Version: 2014.12 -Release: 0.9.0%{?dist} +Release: 0.9.1%{?dist} Summary: Python API and CLI for vsm Group: Development/Languages diff --git a/source/vsm-dashboard/vsm-dashboard.spec b/source/vsm-dashboard/vsm-dashboard.spec index 54d789c71..6f6bba097 100644 --- a/source/vsm-dashboard/vsm-dashboard.spec +++ b/source/vsm-dashboard/vsm-dashboard.spec @@ -2,7 +2,7 @@ Name: vsm-dashboard Version: 2014.12 -Release: 0.9.0%{?dist} +Release: 0.9.1%{?dist} Url: http://intel.com/itflex License: Apache 2.0 Group: Development/Languages/Python diff --git a/source/vsm-dashboard/vsm_dashboard/dashboards/vsm/poolsmanagement/form.py b/source/vsm-dashboard/vsm_dashboard/dashboards/vsm/poolsmanagement/form.py index b26fcb505..c2ae2f7f5 100644 --- a/source/vsm-dashboard/vsm_dashboard/dashboards/vsm/poolsmanagement/form.py +++ b/source/vsm-dashboard/vsm_dashboard/dashboards/vsm/poolsmanagement/form.py @@ -217,6 +217,7 @@ class AddCacheTier(forms.SelfHandlingForm): cache_tier_pool = forms.ChoiceField(label=_('Cache Tier Pool')) storage_tier_pool = forms.ChoiceField(label=_('Storage Tier Pool')) cache_mode = forms.ChoiceField(label=_('Cache Mode')) + force_nonempty = forms.BooleanField(label="FORCE NONEMPTY",required=False,initial=False) hit_set_type = forms.ChoiceField(label=_('Hit Set Type')) hit_set_count = forms.CharField(label=_("Hit set count")) hit_set_period_s = forms.CharField(label=_("Hit set period(s)")) @@ -261,6 +262,7 @@ def handle(self, request, data): 'storage_pool_id': data['storage_tier_pool'], 'cache_pool_id': data['cache_tier_pool'], 'cache_mode': data['cache_mode'], + 'force_nonempty': data['force_nonempty'], 'options': { 'hit_set_type': data['hit_set_type'], 'hit_set_count': data['hit_set_count'], diff --git a/source/vsm-dashboard/vsm_dashboard/dashboards/vsm/templates/vsm/flocking/_createuser.html b/source/vsm-dashboard/vsm_dashboard/dashboards/vsm/templates/vsm/flocking/_createuser.html index b0028e256..4c7946267 100644 --- a/source/vsm-dashboard/vsm_dashboard/dashboards/vsm/templates/vsm/flocking/_createuser.html +++ b/source/vsm-dashboard/vsm_dashboard/dashboards/vsm/templates/vsm/flocking/_createuser.html @@ -33,6 +33,7 @@

{% trans "Description" %}:

{% trans "From here you can create a user " %}

+

{% trans "Your user name must be combination of letter,number ,'@', '.' and '_' " %}

{% trans "Your password must be at least 8 characters long, and contain at least one number, one upper case letter, one lower case letter, and one of the special characters !@#$%^&*(){}[]<>?" %}

{% endblock %} diff --git a/source/vsm-dashboard/vsm_dashboard/dashboards/vsm/usermgmt/forms.py b/source/vsm-dashboard/vsm_dashboard/dashboards/vsm/usermgmt/forms.py index 1857ffdf8..37b455d6e 100644 --- a/source/vsm-dashboard/vsm_dashboard/dashboards/vsm/usermgmt/forms.py +++ b/source/vsm-dashboard/vsm_dashboard/dashboards/vsm/usermgmt/forms.py @@ -103,7 +103,7 @@ def handle(self, request, data): LOG.error(api.keystone.user_get(request, ret.id)) messages.success(request, - _('Successfully created storage pool: %s') + _('Successfully created user: %s') % data['name']) return ret except: diff --git a/source/vsm-deploy/server_manifest b/source/vsm-deploy/server_manifest index 0667b4b1c..9e4c176b1 100755 --- a/source/vsm-deploy/server_manifest +++ b/source/vsm-deploy/server_manifest @@ -177,6 +177,10 @@ class ManifestChecker(object): if line.startswith('#'): continue + if find_it and line.find('[') != -1 and line.find(']') != -1: + print line + break + if len(line) < 2: print 'Small line, skiped' continue @@ -187,9 +191,6 @@ class ManifestChecker(object): find_it = True continue - if find_it and line.find('[') != -1 and line.find(']') != -1: - print line - break if find_it: lines.append(line) @@ -285,6 +286,7 @@ class ManifestChecker(object): print ip_list print self._lan_list if self.__in_lan(ip): + self.__is_address_ok(ip) ip_in_lan_cnt = ip_in_lan_cnt + 1 if ip_in_lan_cnt != len(self._lan_list): @@ -302,7 +304,7 @@ class ManifestChecker(object): if cnt == 'n': error(info_list) - self.__is_address_ok(ip) + #self.elf.__is_address_ok(ip) def format_to_json(self): return json.dumps(self._info, sort_keys=True, indent=2) diff --git a/source/vsm-deploy/tools/etc/vsm/prepools/server/ceph b/source/vsm-deploy/tools/etc/vsm/prepools/server/ceph index bf8b777bc..34548f179 100755 --- a/source/vsm-deploy/tools/etc/vsm/prepools/server/ceph +++ b/source/vsm-deploy/tools/etc/vsm/prepools/server/ceph @@ -18,8 +18,8 @@ function _create_pool() { local pool_name=$1 - local temp_pool=${pool_name:4} - local cnt=`ceph osd lspools| grep $temp_pool | wc -l` + #local temp_pool=${pool_name:4} + local cnt=`ceph osd lspools| grep $pool_name | wc -l` if [[ $cnt -eq 0 ]]; then rados mkpool $pool_name fi diff --git a/source/vsm-deploy/tools/etc/vsm/prepools/server/cinder-multiple b/source/vsm-deploy/tools/etc/vsm/prepools/server/cinder-multiple index 84c12e76f..2b62e98be 100755 --- a/source/vsm-deploy/tools/etc/vsm/prepools/server/cinder-multiple +++ b/source/vsm-deploy/tools/etc/vsm/prepools/server/cinder-multiple @@ -84,6 +84,7 @@ function create_multiple_cinder() { mkdir -p $TOPDIR/files/cinder/ cp -rf /etc/ceph/ceph.conf $TOPDIR/files/cinder/ + sed -i "s,keyring = /etc/ceph/keyring.admin,,g" $TOPDIR/files/cinder/ceph.conf mv $file $TOPDIR/files/cinder/ cat <<"EOF">>$TOPDIR/files/cinder/ceph.conf diff --git a/source/vsm-deploy/tools/etc/vsm/prepools/server/cinder-single b/source/vsm-deploy/tools/etc/vsm/prepools/server/cinder-single index 70e7135f5..529808356 100755 --- a/source/vsm-deploy/tools/etc/vsm/prepools/server/cinder-single +++ b/source/vsm-deploy/tools/etc/vsm/prepools/server/cinder-single @@ -51,6 +51,7 @@ function create_cinder() { mkdir -p $TOPDIR/files/cinder/ cp -rf /etc/ceph/ceph.conf $TOPDIR/files/cinder/ + sed -i "s,keyring = /etc/ceph/keyring.admin,,g" $TOPDIR/files/cinder/ceph.conf mv $file $TOPDIR/files/cinder/ cat <<"EOF">>$TOPDIR/files/cinder/ceph.conf diff --git a/source/vsm-deploy/tools/etc/vsm/prepools/server/glance b/source/vsm-deploy/tools/etc/vsm/prepools/server/glance index 6e75b5f7f..6382dd5f1 100755 --- a/source/vsm-deploy/tools/etc/vsm/prepools/server/glance +++ b/source/vsm-deploy/tools/etc/vsm/prepools/server/glance @@ -36,6 +36,7 @@ function create_glance() { mkdir -p $TOPDIR/files/glance/ cp -rf /etc/ceph/ceph.conf $TOPDIR/files/glance/ + sed -i "s,keyring = /etc/ceph/keyring.admin,,g" $TOPDIR/files/glance/ceph.conf mv $file $TOPDIR/files/glance/ cat <<"EOF">>$TOPDIR/files/glance/ceph.conf diff --git a/source/vsm-deploy/tools/etc/vsm/prepools/server/nova b/source/vsm-deploy/tools/etc/vsm/prepools/server/nova index e037fcf83..7d8595ce9 100755 --- a/source/vsm-deploy/tools/etc/vsm/prepools/server/nova +++ b/source/vsm-deploy/tools/etc/vsm/prepools/server/nova @@ -20,6 +20,7 @@ function create_nova() { mkdir -p $TOPDIR/files/nova/ cp -rf $TOPDIR/files/cinder/cinder.keyring $TOPDIR/files/nova/nova.keyring cp -rf /etc/ceph/ceph.conf $TOPDIR/files/nova/ + sed -i "s,keyring = /etc/ceph/keyring.admin,,g" $TOPDIR/files/nova/ceph.conf cat <<"EOF">>$TOPDIR/files/nova/ceph.conf [%AUTH_CINDER_USER%] diff --git a/source/vsm-deploy/tools/etc/vsm/prepools/server/tarfile b/source/vsm-deploy/tools/etc/vsm/prepools/server/tarfile index 983809431..f7cccaa77 100755 --- a/source/vsm-deploy/tools/etc/vsm/prepools/server/tarfile +++ b/source/vsm-deploy/tools/etc/vsm/prepools/server/tarfile @@ -23,6 +23,7 @@ function gen_tar_file() { TEMP=`mktemp`; rm -rf $TEMP; mkdir -p $TEMP/prepools cp -rf /etc/vsm/prepools/* $TEMP/prepools/ cp -rf /etc/ceph/ceph.conf $TEMP/prepools/lib/ + sed -i "s,keyring = /etc/ceph/keyring.admin,,g" $TEMP/prepools/lib/ceph.conf cd $TEMP/prepools cat <<"EOF" > localrc diff --git a/source/vsm-deploy/vsm-deploy.spec b/source/vsm-deploy/vsm-deploy.spec index dc93cf7ed..b5b54e765 100755 --- a/source/vsm-deploy/vsm-deploy.spec +++ b/source/vsm-deploy/vsm-deploy.spec @@ -2,7 +2,7 @@ Name: vsm-deploy Version: 2014.12 -Release: 0.9.0%{?dist} +Release: 0.9.1%{?dist} Summary: VSM-Deploy Group: Deploy/VSM diff --git a/source/vsm/bin/refresh-cluster-status b/source/vsm/bin/refresh-cluster-status new file mode 100755 index 000000000..64cc7696e --- /dev/null +++ b/source/vsm/bin/refresh-cluster-status @@ -0,0 +1,25 @@ +#!/bin/env python +# vim: tabstop=4 shiftwidth=4 softtabstop=4 +from vsmclient.v1 import client as vsm_client + +# load vsm config +CONF_FILE = "/etc/vsmdeploy/deployrc" +conf_str = open(CONF_FILE, "r").read() +CONF_DICT = dict([x.strip().split("=",1) for x in conf_str.split("\n") if "=" in x]) + +vsmclient = None + +def get_vsmclient(): + global vsmclient + if not vsmclient: + vsmclient = vsm_client.Client('vsm', + CONF_DICT['KEYSTONE_VSM_SERVICE_PASSWORD'], + 'service', + "http://%s:5000/v2.0" % CONF_DICT['VSM_HOST'], + ) + return vsmclient + +def cluster_refresh(): + return get_vsmclient().clusters.refresh() + +cluster_refresh() diff --git a/source/vsm/bin/refresh-osd-status b/source/vsm/bin/refresh-osd-status new file mode 100755 index 000000000..6b989607c --- /dev/null +++ b/source/vsm/bin/refresh-osd-status @@ -0,0 +1,25 @@ +#!/bin/env python +# vim: tabstop=4 shiftwidth=4 softtabstop=4 +from vsmclient.v1 import client as vsm_client + +# load vsm config +CONF_FILE = "/etc/vsmdeploy/deployrc" +conf_str = open(CONF_FILE, "r").read() +CONF_DICT = dict([x.strip().split("=",1) for x in conf_str.split("\n") if "=" in x]) + +vsmclient = None + +def get_vsmclient(): + global vsmclient + if not vsmclient: + vsmclient = vsm_client.Client('vsm', + CONF_DICT['KEYSTONE_VSM_SERVICE_PASSWORD'], + 'service', + "http://%s:5000/v2.0" % CONF_DICT['VSM_HOST'], + ) + return vsmclient + +def osd_refresh(): + return get_vsmclient().osds.refresh() + +osd_refresh() diff --git a/source/vsm/bin/server_manifest b/source/vsm/bin/server_manifest index 0667b4b1c..9e4c176b1 100755 --- a/source/vsm/bin/server_manifest +++ b/source/vsm/bin/server_manifest @@ -177,6 +177,10 @@ class ManifestChecker(object): if line.startswith('#'): continue + if find_it and line.find('[') != -1 and line.find(']') != -1: + print line + break + if len(line) < 2: print 'Small line, skiped' continue @@ -187,9 +191,6 @@ class ManifestChecker(object): find_it = True continue - if find_it and line.find('[') != -1 and line.find(']') != -1: - print line - break if find_it: lines.append(line) @@ -285,6 +286,7 @@ class ManifestChecker(object): print ip_list print self._lan_list if self.__in_lan(ip): + self.__is_address_ok(ip) ip_in_lan_cnt = ip_in_lan_cnt + 1 if ip_in_lan_cnt != len(self._lan_list): @@ -302,7 +304,7 @@ class ManifestChecker(object): if cnt == 'n': error(info_list) - self.__is_address_ok(ip) + #self.elf.__is_address_ok(ip) def format_to_json(self): return json.dumps(self._info, sort_keys=True, indent=2) diff --git a/source/vsm/etc/vsm/prepools/files/cinder/ceph.conf b/source/vsm/etc/vsm/prepools/files/cinder/ceph.conf index 67e11ef55..793d8de81 100755 --- a/source/vsm/etc/vsm/prepools/files/cinder/ceph.conf +++ b/source/vsm/etc/vsm/prepools/files/cinder/ceph.conf @@ -1,6 +1,5 @@ [global] auth supported = cephx -keyring = /etc/ceph/keyring.admin max open files = 131072 [mds] diff --git a/source/vsm/etc/vsm/prepools/files/glance/ceph.conf b/source/vsm/etc/vsm/prepools/files/glance/ceph.conf index b21ca4988..5e08f0bad 100755 --- a/source/vsm/etc/vsm/prepools/files/glance/ceph.conf +++ b/source/vsm/etc/vsm/prepools/files/glance/ceph.conf @@ -1,6 +1,5 @@ [global] auth supported = cephx -keyring = /etc/ceph/keyring.admin max open files = 131072 [mds] diff --git a/source/vsm/etc/vsm/prepools/files/nova/ceph.conf b/source/vsm/etc/vsm/prepools/files/nova/ceph.conf index cf7ac9048..e3da60001 100755 --- a/source/vsm/etc/vsm/prepools/files/nova/ceph.conf +++ b/source/vsm/etc/vsm/prepools/files/nova/ceph.conf @@ -1,6 +1,5 @@ [global] auth supported = cephx -keyring = /etc/ceph/keyring.admin max open files = 131072 [mds] diff --git a/source/vsm/etc/vsm/prepools/lib/ceph.conf b/source/vsm/etc/vsm/prepools/lib/ceph.conf index fe51a9ef9..651bc26f5 100755 --- a/source/vsm/etc/vsm/prepools/lib/ceph.conf +++ b/source/vsm/etc/vsm/prepools/lib/ceph.conf @@ -1,6 +1,5 @@ [global] auth supported = cephx -keyring = /etc/ceph/keyring.admin max open files = 131072 [mds] diff --git a/source/vsm/etc/vsm/prepools/lib/cinder-multiple b/source/vsm/etc/vsm/prepools/lib/cinder-multiple index db71d268c..945d10f34 100755 --- a/source/vsm/etc/vsm/prepools/lib/cinder-multiple +++ b/source/vsm/etc/vsm/prepools/lib/cinder-multiple @@ -148,7 +148,9 @@ function _del_other_multiple_section() { if [[ $cnt -gt 0 ]]; then sec_name=${n//[/ } sec_name=${sec_name//]/ } - openstack-config --del /etc/cinder/cinder.conf $sec_name + if [[ `echo $sec_name | grep vsm | wc -l` -gt 0 ]]; then + openstack-config --del /etc/cinder/cinder.conf $sec_name + fi fi done openstack-config --del /etc/cinder/cinder.conf DEFAULT enabled_backends diff --git a/source/vsm/etc/vsm/prepools/lib/cinder-single b/source/vsm/etc/vsm/prepools/lib/cinder-single index 6196a2664..7b6b15749 100755 --- a/source/vsm/etc/vsm/prepools/lib/cinder-single +++ b/source/vsm/etc/vsm/prepools/lib/cinder-single @@ -32,7 +32,9 @@ function _del_other_section() { if [[ $cnt -gt 0 ]]; then sec_name=${n//[/ } sec_name=${sec_name//]/ } - openstack-config --del /etc/cinder/cinder.conf $sec_name + if [[ `echo $sec_name | grep vsm | wc -l` -gt 0 ]]; then + openstack-config --del /etc/cinder/cinder.conf $sec_name + fi fi done openstack-config --del /etc/cinder/cinder.conf DEFAULT enabled_backends diff --git a/source/vsm/etc/vsm/prepools/server/ceph b/source/vsm/etc/vsm/prepools/server/ceph index bf8b777bc..34548f179 100755 --- a/source/vsm/etc/vsm/prepools/server/ceph +++ b/source/vsm/etc/vsm/prepools/server/ceph @@ -18,8 +18,8 @@ function _create_pool() { local pool_name=$1 - local temp_pool=${pool_name:4} - local cnt=`ceph osd lspools| grep $temp_pool | wc -l` + #local temp_pool=${pool_name:4} + local cnt=`ceph osd lspools| grep $pool_name | wc -l` if [[ $cnt -eq 0 ]]; then rados mkpool $pool_name fi diff --git a/source/vsm/vsm.spec b/source/vsm/vsm.spec index 5e139a6e4..506e3f537 100644 --- a/source/vsm/vsm.spec +++ b/source/vsm/vsm.spec @@ -2,7 +2,7 @@ Name: vsm Version: 2014.12 -Release: 0.9.0%{?dist} +Release: 0.9.1%{?dist} Summary: VSM Group: Storage/System @@ -184,6 +184,8 @@ install -p -D -m 755 bin/vsm-backup %{buildroot}%{_bindir}/vsm-backup install -p -D -m 755 bin/vsm-restore %{buildroot}%{_bindir}/vsm-restore install -p -D -m 755 bin/cluster_manifest %{buildroot}%{_usr}/local/bin/cluster_manifest install -p -D -m 755 bin/server_manifest %{buildroot}%{_usr}/local/bin/server_manifest +install -p -D -m 755 bin/refresh-osd-status %{buildroot}%{_usr}/local/bin/refresh-osd-status +install -p -D -m 755 bin/refresh-cluster-status %{buildroot}%{_usr}/local/bin/refresh-cluster-status install -p -D -m 755 bin/getip %{buildroot}%{_usr}/local/bin/getip @@ -262,6 +264,8 @@ exit 0 %config(noreplace) %attr(-, root, vsm) %{_usr}/local/bin/getip %config(noreplace) %attr(-, root, vsm) %{_usr}/local/bin/cluster_manifest %config(noreplace) %attr(-, root, vsm) %{_usr}/local/bin/server_manifest +%config(noreplace) %attr(-, root, vsm) %{_usr}/local/bin/refresh-osd-status +%config(noreplace) %attr(-, root, vsm) %{_usr}/local/bin/refresh-cluster-status #----------------------------- # Prepools #----------------------------- diff --git a/source/vsm/vsm/agent/cephconfigparser.py b/source/vsm/vsm/agent/cephconfigparser.py index cc00e27c1..aeb3da380 100644 --- a/source/vsm/vsm/agent/cephconfigparser.py +++ b/source/vsm/vsm/agent/cephconfigparser.py @@ -321,7 +321,7 @@ def add_global(self, # In order to support lower version of vsm. # We set keyring path here. # keyring = /etc/ceph/keyring.admin - #self._parser.set('global', 'keyring', '/etc/ceph/keyring.admin') + self._parser.set('global', 'keyring', '/etc/ceph/keyring.admin') # Have to setup fsid. self._parser.set('global', 'fsid', str(uuid.uuid1())) @@ -335,7 +335,7 @@ def add_mds_header(self, keyring='false'): #mds data = /var/lib/ceph/mds/ceph-$id #keyring = /var/lib/ceph/mds/ceph-$id/keyring self._parser.set('mds', 'mds data', '/var/lib/ceph/mds/ceph-$id') - #self._parser.set('mds', 'keyring', '/var/lib/ceph/mds/ceph-$id/keyring') + self._parser.set('mds', 'keyring', '/var/lib/ceph/mds/ceph-$id/keyring') self._parser.set('mds', 'mds standby replay', keyring) def add_mon_header(self, clock_drift=200): @@ -407,7 +407,7 @@ def add_osd_header(self, self._parser.set('osd', 'osd data', osd_data) # NOTE add keyring to support lower version of OSD. # keyring = /etc/ceph/keyring.$name - #self._parser.set('osd', 'keyring', '/etc/ceph/keyring.$name') + self._parser.set('osd', 'keyring', '/etc/ceph/keyring.$name') self._parser.set('osd', 'osd mkfs type', osd_type) mount_option = utils.get_fs_options(osd_type)[1] self._parser.set('osd', 'osd mount options %s' % osd_type, mount_option) diff --git a/source/vsm/vsm/agent/driver.py b/source/vsm/vsm/agent/driver.py index 78ad0b3d1..5449562d4 100644 --- a/source/vsm/vsm/agent/driver.py +++ b/source/vsm/vsm/agent/driver.py @@ -133,7 +133,9 @@ def create_storage_pool(self, context, body): utils.execute('ceph', 'osd', 'setcrushmap', '-i', FLAGS.crushmap_bin, \ run_as_root=True) utils.execute('ceph', 'osd', 'pool', 'create', pool_name, \ - pg_num, pg_num, 'replicated', str(ruleset), run_as_root=True) + pg_num, pg_num, 'replicated', run_as_root=True) + utils.execute('ceph', 'osd', 'pool', 'set', pool_name, + 'crush_ruleset', ruleset, run_as_root=True) res = True else: LOG.error("Failed while writing crushmap!") @@ -155,7 +157,7 @@ def create_storage_pool(self, context, body): #set quota if body.get('enable_quota', False): max_bytes = 1024 * 1024 * 1024 * int(body.get('quota', 0)) - utils.execute('ceph', 'osd', 'pool', 'set-quota', 'max_bytes', max_bytes,\ + utils.execute('ceph', 'osd', 'pool', 'set-quota', pool_name, 'max_bytes', max_bytes,\ run_as_root=True) #update db pool_list = self.get_pool_status() @@ -172,7 +174,7 @@ def create_storage_pool(self, context, body): 'crash_replay_interval': pool.get('crash_replay_interval'), 'ec_status': pool.get('erasure_code_profile'), 'replica_storage_group': replica_storage_group if replica_storage_group else None, - 'quota': body['quota'] if body.get('quota') else 0 + 'quota': body.get('quota') } values['created_by'] = body.get('created_by') values['cluster_id'] = body.get('cluster_id') @@ -194,7 +196,7 @@ def present_storage_pools(self, context, info): for pinfo in pool_infos: pool_type = pinfo['type'] + "-" + pinfo['name'] # We use "vsm-" key words to delete unused pools to openstack. - temp_str = "vsm-" + pinfo['name'] + "," + pool_type + temp_str = pinfo['name'] + "," + pool_type pools_str = pools_str + " " + temp_str LOG.info('pools_str = %s' % pools_str) @@ -1851,8 +1853,12 @@ def add_cache_tier(self, context, body): LOG.info("add cache tier start") LOG.info("storage pool %s cache pool %s " % (storage_pool_name, cache_pool_name)) - utils.execute("ceph", "osd", "tier", "add", storage_pool_name, \ - cache_pool_name, run_as_root=True) + if body.get("force_nonempty"): + utils.execute("ceph", "osd", "tier", "add", storage_pool_name, \ + cache_pool_name, "--force-nonempty", run_as_root=True) + else: + utils.execute("ceph", "osd", "tier", "add", storage_pool_name, \ + cache_pool_name, run_as_root=True) utils.execute("ceph", "osd", "tier", "cache-mode", cache_pool_name, \ cache_mode, run_as_root=True) if cache_mode == "writeback": @@ -2324,36 +2330,44 @@ def _generate_rule(self, context, zone_tag): for storage_group in sorted_storage_groups: storage_group_name = storage_group["name"] rule_id = storage_group["rule_id"] - if storage_group_name.find("value_") == -1: - string = "" - string = string + "\nrule " + storage_group_name + " {\n" - string = string + " ruleset " + str(rule_id) + "\n" - string = string + sting_common - string = string + " step take " + storage_group_name + "\n" - string = string + string_choose - self._write_to_crushmap(string) - else: - string = "" - string = string + "\nrule " + storage_group_name + " {\n" - string = string + " ruleset " + str(rule_id) + "\n" - string = string + " type replicated\n min_size 0\n" - string = string + " max_size 10\n" - string = string + " step take " + storage_group_name + "\n" - - if zone_tag: - string = string + " step chooseleaf firstn 1 type zone\n" - else: - string = string + " step chooseleaf firstn 1 type host\n" - string = string + " step emit\n" - string = string + " step take " + \ - storage_group_name.replace('value_', '') + "\n" + string = "" + string = string + "\nrule " + storage_group_name + " {\n" + string = string + " ruleset " + str(rule_id) + "\n" + string = string + sting_common + string = string + " step take " + storage_group_name + "\n" + string = string + string_choose + self._write_to_crushmap(string) - if zone_tag: - string = string + " step chooseleaf firstn -1 type zone\n" - else: - string = string + " step chooseleaf firstn -1 type host\n" - string = string + " step emit\n}\n" - self._write_to_crushmap(string) + #if storage_group_name.find("value_") == -1: + # string = "" + # string = string + "\nrule " + storage_group_name + " {\n" + # string = string + " ruleset " + str(rule_id) + "\n" + # string = string + sting_common + # string = string + " step take " + storage_group_name + "\n" + # string = string + string_choose + # self._write_to_crushmap(string) + #else: + # string = "" + # string = string + "\nrule " + storage_group_name + " {\n" + # string = string + " ruleset " + str(rule_id) + "\n" + # string = string + " type replicated\n min_size 0\n" + # string = string + " max_size 10\n" + # string = string + " step take " + storage_group_name + "\n" + + # if zone_tag: + # string = string + " step chooseleaf firstn 1 type zone\n" + # else: + # string = string + " step chooseleaf firstn 1 type host\n" + # string = string + " step emit\n" + # string = string + " step take " + \ + # storage_group_name.replace('value_', '') + "\n" + + # if zone_tag: + # string = string + " step chooseleaf firstn -1 type zone\n" + # else: + # string = string + " step chooseleaf firstn -1 type host\n" + # string = string + " step emit\n}\n" + # self._write_to_crushmap(string) return True def _gen_rule(self): diff --git a/source/vsm/vsm/agent/manager.py b/source/vsm/vsm/agent/manager.py index 2723f9280..60eb551b1 100644 --- a/source/vsm/vsm/agent/manager.py +++ b/source/vsm/vsm/agent/manager.py @@ -395,7 +395,7 @@ def init_host(self): except: LOG.info('Can not load ceph.conf now.') def _update_ceph_period(): - while True: + for i in range(1): try: self.update_ceph_status(self._context) time.sleep(10) @@ -750,13 +750,13 @@ def _get_osd_id(self, host=FLAGS.host): def prepare_osds(self, context, server_list): for ser in server_list: - utils.execute('ceph', 'osd', 'crush', - 'add-bucket', ser['host'], - 'host', run_as_root=True) + #utils.execute('ceph', 'osd', 'crush', + # 'add-bucket', ser['host'], + # 'host', run_as_root=True) - utils.execute('ceph', 'osd', 'crush', - 'move', ser['host'], - 'root=default', run_as_root=True) + #utils.execute('ceph', 'osd', 'crush', + # 'move', ser['host'], + # 'root=default', run_as_root=True) for osd in self._get_osd_id(ser['host']): LOG.info('osd = %s for %s' % (osd, ser['host'])) utils.execute('ceph', @@ -1131,7 +1131,8 @@ def update_pool_usage(self, context): LOG.info('pool %s does not exist in the existing pool list.' % pid) #@require_active_host - @periodic_task(run_immediately=True, service_topic=FLAGS.agent_topic) + @periodic_task(run_immediately=True, service_topic=FLAGS.agent_topic, + spacing=_get_interval_time('ceph_status')) def update_mon_health(self, context): ceph_status = self.ceph_driver.get_ceph_status() LOG.debug(ceph_status) @@ -1210,8 +1211,7 @@ def update_summary(self, context, sum_type=None): if typ.find('cluster') != -1: db.summary_update(context, cluster_id, 'ceph', val) - @periodic_task(spacing=FLAGS.server_ping_time,\ - service_topic=FLAGS.agent_topic) + @periodic_task(service_topic=FLAGS.agent_topic, spacing=FLAGS.server_ping_time) def update_server_status(self, context): """Update server status in every 5 seconds.""" def _try_connect(host): @@ -1314,6 +1314,7 @@ def update_node_datetime(self, context): except exception.ExeCmdError, e: LOG.error("%s:%s" % (e.code, e.message)) + @periodic_task(service_topic=FLAGS.agent_topic, spacing=_get_interval_time('ceph_status')) def update_ceph_status(self, context): all_pool = db.pool_get_all(context) if len(all_pool) < 1: diff --git a/source/vsm/vsm/agent/rpcapi.py b/source/vsm/vsm/agent/rpcapi.py index 6fd152d09..95de9bf57 100644 --- a/source/vsm/vsm/agent/rpcapi.py +++ b/source/vsm/vsm/agent/rpcapi.py @@ -349,15 +349,18 @@ def update_ceph_conf(self, context, host): def start_monitor(self, context, host): topic = rpc.queue_get_for(context, self.topic, host) - return self.call(context, self.make_msg('start_monitor'), topic) + return self.call(context, self.make_msg('start_monitor'), topic, + version='1.0', timeout=6000) def start_mds(self, context, host): topic = rpc.queue_get_for(context, self.topic, host) - return self.call(context, self.make_msg('start_mds'), topic) + return self.call(context, self.make_msg('start_mds'), topic, + version='1.0', timeout=6000) def start_osd(self, context, host): topic = rpc.queue_get_for(context, self.topic, host) - return self.call(context, self.make_msg('start_osd'), topic) + return self.call(context, self.make_msg('start_osd'), topic, + version='1.0', timeout=6000) def inital_ceph_osd_db_conf(self, context, server_list, host): topic = rpc.queue_get_for(context, self.topic, host) @@ -378,7 +381,8 @@ def mkcephfs(self, context, host): def stop_mds(self, context, host): topic = rpc.queue_get_for(context, self.topic, host) - return self.call(context, self.make_msg('stop_mds'), topic) + return self.call(context, self.make_msg('stop_mds'), topic, + version='1.0', timeout=6000) def health_status(self, context, host): topic = rpc.queue_get_for(context, self.topic, host) @@ -389,20 +393,23 @@ def write_monitor_keyring(self, context, monitor_keyring, host): return self.call(context, self.make_msg('write_monitor_keyring', monitor_keyring=monitor_keyring), - topic) + topic, + version='1.0', timeout=6000) def track_monitors(self, context, host): topic = rpc.queue_get_for(context, self.topic, host) res = self.call(context, self.make_msg('track_monitors'), - topic) + topic, + version='1.0', timeout=6000) return res def create_keyring(self, context, host): topic = rpc.queue_get_for(context, self.topic, host) res = self.call(context, self.make_msg('create_keyring'), - topic) + topic, + version='1.0', timeout=6000) return res def prepare_osds(self, context, server_list, host): @@ -410,7 +417,8 @@ def prepare_osds(self, context, server_list, host): res = self.call(context, self.make_msg('prepare_osds', server_list=server_list), - topic) + topic, + version='1.0', timeout=6000) return res def add_cache_tier(self, context, body, host): @@ -418,11 +426,13 @@ def add_cache_tier(self, context, body, host): res = self.call(context, self.make_msg('add_cache_tier', body=body), - topic) + topic, + version='1.0', timeout=6000) def remove_cache_tier(self, context, body, host): topic = rpc.queue_get_for(context, self.topic, host) res = self.call(context, self.make_msg('remove_cache_tier', body=body), - topic) + topic, + version='1.0', timeout=6000) diff --git a/source/vsm/vsm/manifest/parser.py b/source/vsm/vsm/manifest/parser.py index 45599d2b0..566ed2874 100644 --- a/source/vsm/vsm/manifest/parser.py +++ b/source/vsm/vsm/manifest/parser.py @@ -564,7 +564,7 @@ def _format_cluster_manifest_to_json(self): self._dict_insert_settings_c() self._dict_insert_cache_tier_defaults_c() self._dict_insert_ec_profiles_c() - self._dict_insert_periodic_parameters_c() + #self._dict_insert_periodic_parameters_c() self._trans_between_db() return self._map