From nobody Sat Apr 20 07:45:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of ovirt.org designates 66.187.230.42 as permitted sender) client-ip=66.187.230.42; envelope-from=kimchi-devel-bounces@ovirt.org; helo=lists.ovirt.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of ovirt.org designates 66.187.230.42 as permitted sender) smtp.mailfrom=kimchi-devel-bounces@ovirt.org; Return-Path: Received: from lists.ovirt.org (lists.phx.ovirt.org [66.187.230.42]) by mx.zohomail.com with SMTPS id 1493744411267904.2341361061285; Tue, 2 May 2017 10:00:11 -0700 (PDT) Received: from lists.phx.ovirt.org (localhost [127.0.0.1]) by lists.ovirt.org (Postfix) with ESMTP id C0CEE820705; Tue, 2 May 2017 17:00:09 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lists.ovirt.org (Postfix) with ESMTPS id D80938206EF for ; Tue, 2 May 2017 16:59:38 +0000 (UTC) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v42Gt35m073132 for ; Tue, 2 May 2017 12:59:38 -0400 Received: from e24smtp04.br.ibm.com (e24smtp04.br.ibm.com [32.104.18.25]) by mx0a-001b2d01.pphosted.com with ESMTP id 2a6wtqgv94-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 02 May 2017 12:59:38 -0400 Received: from localhost by e24smtp04.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 2 May 2017 13:59:33 -0300 Received: from d24relay02.br.ibm.com (9.18.232.42) by e24smtp04.br.ibm.com (10.172.0.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 2 May 2017 13:59:30 -0300 Received: from d24av01.br.ibm.com (d24av01.br.ibm.com [9.8.31.91]) by d24relay02.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v42GxTKs15794646 for ; Tue, 2 May 2017 13:59:29 -0300 Received: from d24av01.br.ibm.com (localhost [127.0.0.1]) by d24av01.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v42GxTuH015002 for ; Tue, 2 May 2017 13:59:29 -0300 Received: from alinefm-TP440.br.ibm.com (alinefm-TP440.br.ibm.com [9.18.239.173]) by d24av01.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v42GxTlR014999 for ; Tue, 2 May 2017 13:59:29 -0300 X-Original-To: kimchi-devel@ovirt.org From: Aline Manera To: Kimchi Devel Date: Tue, 2 May 2017 13:59:28 -0300 X-Mailer: git-send-email 2.9.3 X-TM-AS-MML: disable x-cbid: 17050216-0028-0000-0000-000001B04311 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17050216-0029-0000-0000-000014B061C3 Message-Id: <20170502165928.27313-1-alinefm@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-05-02_11:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=29 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1705020094 Subject: [Kimchi-devel] [PATCH] [Kimchi] Remove federation feature from Kimchi as it is now on Wok X-BeenThere: kimchi-devel@ovirt.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: kimchi-devel-bounces@ovirt.org Errors-To: kimchi-devel-bounces@ovirt.org X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Aline Manera Reviewed-by: Daniel Barboza --- control/peers.py | 28 ---------- docs/API.md | 10 ---- docs/README-federation.md | 60 -------------------- kimchi.conf | 4 -- model/config.py | 8 +-- model/peers.py | 74 ------------------------ root.py | 8 --- tests/test_config.py.in | 3 +- tests/test_rest.py | 6 +- ui/js/kimchi.peers.js | 140 ------------------------------------------= ---- ui/js/src/kimchi.main.js | 3 - ui/pages/i18n.json.tmpl | 7 +-- 12 files changed, 7 insertions(+), 344 deletions(-) delete mode 100644 control/peers.py delete mode 100644 docs/README-federation.md delete mode 100644 model/peers.py delete mode 100644 ui/js/kimchi.peers.js diff --git a/control/peers.py b/control/peers.py deleted file mode 100644 index 5eaacdd..0000000 --- a/control/peers.py +++ /dev/null @@ -1,28 +0,0 @@ -# -# Project Kimchi -# -# Copyright IBM Corp, 2015-2017 -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-130= 1 USA - -from wok.control.base import SimpleCollection -from wok.control.utils import UrlSubNode - - -@UrlSubNode("peers", True) -class Peers(SimpleCollection): - def __init__(self, model): - super(Peers, self).__init__(model) - self.admin_methods =3D ['GET'] diff --git a/docs/API.md b/docs/API.md index 3ecc7a0..1f67879 100644 --- a/docs/API.md +++ b/docs/API.md @@ -820,7 +820,6 @@ Contains information about Kimchi configuration. **Methods:** =20 * **GET**: Retrieve configuration information - * federation: True if federation feature is enabled, False otherwise. * version: The version of the kimchi service * **POST**: *See Configuration Actions* =20 @@ -1052,15 +1051,6 @@ List of available groups. * free: Amount of free space in the volume group. * size: Total size of the volume group. =20 -### Collection: Peers - -**URI:** /plugins/kimchi/peers - -**Methods:** - -* **GET**: Return the list of Kimchi peers in the same network - (It uses openSLP for discovering) - ### Simple Collection: OVSBridges =20 **URI:** /plugins/kimchi/ovsbridges diff --git a/docs/README-federation.md b/docs/README-federation.md deleted file mode 100644 index 3554757..0000000 --- a/docs/README-federation.md +++ /dev/null @@ -1,60 +0,0 @@ -Kimchi Project - Federation Feature -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D - -Federation feature is a Kimchi mechanism to discover Wok peers in the same -network. It uses openSLP tool (http://www.openslp.org/) to register and fi= nd Wok -servers. - -By default this feature is disabled on Wok as it is not critical for KVM -virtualization and requires additional software installation. - -To enable it, do the following: - -1. Install openslp and openslp-server rpm packages, - or install slpd and slptool deb packages. - -2. openSLP uses port 427 (UDP) and port 427 (TCP) so make sure to open tho= se - ports in your firewall configuration - - For system using firewalld, do: - sudo firewall-cmd --permanent --add-port=3D427/udp - sudo firewall-cmd --permanent --add-port=3D427/tcp - sudo firewall-cmd --reload - - For openSUSE systems, do: - sudo /sbin/SuSEfirewall2 open EXT TCP 427 - sudo /sbin/SuSEfirewall2 open EXT UDP 427 - - For system using iptables, do: - sudo iptables -A INPUT -p tcp --dport 427 -j ACCEPT - sudo iptables -A INPUT -p udp --dport 427 -j ACCEPT - -3. In addition to the openSLP ports, you also need to allow multicast in t= he - firewall configuration - - For system using firewalld, do: - sudo firewall-cmd --direct --add-rule ipv4 filter INPUT 0 -s -= j ACCEPT - - For openSUSE systems, do: - Add the subnet to the trusted networks listed on FW_TRUSTED_NETS in - /etc/sysconfig/SuSEfirewall2 file. - Make sure to restart /sbin/SuSEfirewall2 after modifying /etc/sysconfig= /SuSEfirewall2 - - For system using iptables, do: - sudo iptables -A INPUT -s -j ACCEPT - -4. Start slpd service and make sure it is up while running Wok - sudo service slpd start - -5. Enable federation on Wok by editing the /etc/wok/plugins.d/kimchi.conf = file: - - federation =3D True - -6. Then start Wok service - sudo service wokd start - -The Wok server will be registered on openSLP on server starting up and will -be found by other Wok peers (with federation feature enabled) in the same -network. - -Enjoy! diff --git a/kimchi.conf b/kimchi.conf index 97a14bd..5e85e2b 100644 --- a/kimchi.conf +++ b/kimchi.conf @@ -3,9 +3,5 @@ enable =3D True =20 [kimchi] -# Federation feature: register Wok server on openSLP and discover peers -# in the same network. Check README-federation for more details. -federation =3D False - # Automatically create ISO pool on server start up create_iso_pool =3D True diff --git a/model/config.py b/model/config.py index 78cdaeb..1db9afb 100644 --- a/model/config.py +++ b/model/config.py @@ -1,7 +1,7 @@ # # Project Kimchi # -# Copyright IBM Corp, 2015-2016 +# Copyright IBM Corp, 2015-2017 # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -24,7 +24,7 @@ from wok.basemodel import Singleton from wok.exception import NotFoundError from wok.utils import run_command, wok_log =20 -from wok.plugins.kimchi.config import config, find_qemu_binary +from wok.plugins.kimchi.config import find_qemu_binary from wok.plugins.kimchi.config import get_kimchi_version from wok.plugins.kimchi.distroloader import DistroLoader from wok.plugins.kimchi.model.featuretests import FeatureTests @@ -39,9 +39,7 @@ class ConfigModel(object): pass =20 def lookup(self, name): - kconfig =3D config.get('kimchi', {}) - return {'federation': kconfig.get('federation', False), - 'version': get_kimchi_version()} + return {'version': get_kimchi_version()} =20 =20 class CapabilitiesModel(object): diff --git a/model/peers.py b/model/peers.py deleted file mode 100644 index 0a4ee4b..0000000 --- a/model/peers.py +++ /dev/null @@ -1,74 +0,0 @@ -# -# Project Kimchi -# -# Copyright IBM Corp, 2015-2017 -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-130= 1 USA - -import cherrypy -import re -import socket - -from wok.config import config as wok_config -from wok.utils import run_command, wok_log - -from wok.plugins.kimchi.config import config - - -class PeersModel(object): - def __init__(self, **kargs): - # check federation feature is enabled on Kimchi server - if not config.get('kimchi', {}).get('federation', False): - return - - # register server on openslp - hostname =3D socket.getfqdn() - port =3D wok_config.get("server", "proxy_port") - self.url =3D hostname + ":" + port - - cmd =3D ["slptool", "register", - "service:wokd://%s" % self.url] - out, error, ret =3D run_command(cmd) - if out and len(out) !=3D 0: - wok_log.error("Unable to register server on openSLP." - " Details: %s" % out) - cherrypy.engine.subscribe('exit', self._peer_deregister) - - def _peer_deregister(self): - cmd =3D ["slptool", "deregister", - "service:wokd://%s" % self.url] - out, error, ret =3D run_command(cmd) - if out and len(out) !=3D 0: - wok_log.error("Unable to deregister server on openSLP." - " Details: %s" % out) - - def get_list(self): - # check federation feature is enabled on Kimchi server - if not config.get('kimchi', {}).get('federation', False): - return [] - - cmd =3D ["slptool", "findsrvs", "service:wokd"] - out, error, ret =3D run_command(cmd) - if ret !=3D 0: - return [] - - peers =3D [] - for server in out.strip().split("\n"): - match =3D re.match("service:wokd://(.*?),.*", server) - peer =3D match.group(1) - if peer !=3D self.url: - peers.append("https://" + peer) - - return peers diff --git a/root.py b/root.py index 4f131e7..d42e787 100644 --- a/root.py +++ b/root.py @@ -72,14 +72,6 @@ class Kimchi(WokRoot): self.domain =3D 'kimchi' self.messages =3D messages =20 - self.extends =3D { - "/plugins/gingerbase": { - "host-dashboard.html": "/plugins/kimchi/js/kimchi.peers.js" - } - } - - self.depends =3D ['gingerbase'] - # Some paths or URI's present in the objectstore have changed after # Kimchi 2.0.0 release. Check here if an upgrade in the schema and= data # are necessary. diff --git a/tests/test_config.py.in b/tests/test_config.py.in index 135097b..dd47130 100644 --- a/tests/test_config.py.in +++ b/tests/test_config.py.in @@ -80,8 +80,7 @@ class ConfigTests(unittest.TestCase): 'enable': True }, 'kimchi': { - 'federation': False, - 'create_iso_pool': True, + 'create_iso_pool': True }, '/': { 'tools.trailing_slash.on': False, diff --git a/tests/test_rest.py b/tests/test_rest.py index 852e4bd..f808478 100644 --- a/tests/test_rest.py +++ b/tests/test_rest.py @@ -1529,7 +1529,7 @@ class RestTests(unittest.TestCase): def test_config(self): resp =3D self.request('/plugins/kimchi/config').read() conf =3D json.loads(resp) - keys =3D ["federation", "version"] + keys =3D ["version"] self.assertEquals(keys, sorted(conf.keys())) =20 def test_capabilities(self): @@ -1541,10 +1541,6 @@ class RestTests(unittest.TestCase): u'mem_hotplug_support', u'libvirtd_running'] self.assertEquals(sorted(keys), sorted(conf.keys())) =20 - def test_peers(self): - resp =3D self.request('/plugins/kimchi/peers').read() - self.assertEquals([], json.loads(resp)) - def test_distros(self): resp =3D self.request('/plugins/kimchi/config/distros').read() distros =3D json.loads(resp) diff --git a/ui/js/kimchi.peers.js b/ui/js/kimchi.peers.js deleted file mode 100644 index 8b1a18d..0000000 --- a/ui/js/kimchi.peers.js +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Project Kimchi - * - * Copyright IBM Corp, 2016 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -var kimchi =3D { - - getPeers: function(suc, err) { - wok.requestJSON({ - url: 'plugins/kimchi/peers', - type: 'GET', - contentType: 'application/json', - dataType: 'json', - resend: true, - success: suc, - error: err ? err : function(data) { - wok.message.error(data.responseJSON.reason); - } - }); - }, - - initPeers: function() { - - var peersAccordion =3D "
" + - "

" + - "" + - "" + - ""+i18n['KC= HPEERS0001M']+"" + - "" + - "

" + - "
" + - "
" + - "
" + - "
" + - "" + - "" + - "" + - "" + - "" + - "" + - "
" + i18n['KCHPEERS0001M'] + "
" + - "
" + - "
" + - "
" + - "
" + - "
" + - "
" + - "
" + i18n['WOKGRD6001M'] = + "
" + - "
" + - "
" + - "
" + - "
" + - "
"; - - var peersDatatableTable; - var peers =3D new Array(); - - $('#peers-container > .container').append(peersAccordion); - - var peersDatatable =3D function(nwConfigDataSet) { - peersDatatableTable =3D $('#peers-list').DataTable({ - "processing": true, - "data": peers, - "language": { - "emptyTable": i18n['WOKSETT0010M'] - }, - "order": [], - "paging": false, - "dom": '<"row"<"col-sm-12"t>>', - "scrollY": "269px", - "scrollCollapse": true, - "columnDefs": [{ - "targets": 0, - "searchable": false, - "orderable": false, - "width": "100%", - "className": "tabular-data", - "render": function(data, type, full, meta) { - return '' + data + ''; - } - }], - "initComplete": function(settings, json) { - $('#peers-content-area > .wok-mask').addClass('hidden'= ); - } - }); - }; - - var getPeers =3D function() { - kimchi.getPeers(function(result) { - peers.length =3D 0; - for (var i =3D 0; i < result.length; i++) { - var tempArr =3D []; - tempArr.push(result[i]); - peers.push(tempArr); - } - peersDatatable(peers); - }, function(err) { - wok.message.error(err.responseJSON.reason, '#peers-alert-c= ontainer', true); - }); - }; - getPeers(); - - }, - - getConfig: function(suc, err, done) { - done =3D typeof done !=3D=3D 'undefined' ? done : function() {}; - wok.requestJSON({ - url: "plugins/kimchi/config", - type: "GET", - contentType: "application/json", - dataType: "json", - success: suc, - error: err, - complete: done - }); - } -} - -$(document).ready(function() { - // Peers check - kimchi.getConfig(function(config) { - if (config.federation) { - $("#host-content-container").after('
'); - kimchi.initPeers(); - } - }); -}); diff --git a/ui/js/src/kimchi.main.js b/ui/js/src/kimchi.main.js index 47531ae..89df799 100644 --- a/ui/js/src/kimchi.main.js +++ b/ui/js/src/kimchi.main.js @@ -19,9 +19,6 @@ kimchi.config =3D undefined; kimchi.getConfig(function(result) { kimchi.config =3D result; - - if(kimchi.config.federation =3D=3D true) - $('#peers').removeClass('hide-content'); }, function() { kimchi.config =3D {} }); diff --git a/ui/pages/i18n.json.tmpl b/ui/pages/i18n.json.tmpl index 4510921..d44d4bd 100644 --- a/ui/pages/i18n.json.tmpl +++ b/ui/pages/i18n.json.tmpl @@ -1,7 +1,7 @@ #* * Project Kimchi * - * Copyright IBM Corp, 2014-2016 + * Copyright IBM Corp, 2014-2017 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -154,8 +154,5 @@ "KCHVMSTOR0007M": "$_("qed")", "KCHVMSTOR0008M": "$_("raw")", "KCHVMSTOR0009M": "$_("vmdk")", - "KCHVMSTOR0010M": "$_("vpc")", - - - "KCHPEERS0001M": "$_("Peers")" + "KCHVMSTOR0010M": "$_("vpc")" } --=20 2.9.3 _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel