Change in vdsm[master]: network: devices: properly initialize attributes
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: network: devices: properly initialize attributes
......................................................................
network: devices: properly initialize attributes
The `name' attribute used to be added to devices only after the
device data was refreshed from libvirt.
This can lead to AttributeErrors if a VM starts (very) slowly.
Furthermore, is good practice to initialize all the device
object attributes in __init__.
Change-Id: I21ef87a9524cbfe752e6cc0f7d1d9f6139c61dfb
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vmdevices/network.py
1 file changed, 1 insertion(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/72/65772/1
diff --git a/vdsm/virt/vmdevices/network.py b/vdsm/virt/vmdevices/network.py
index 7628f06..618c34d 100644
--- a/vdsm/virt/vmdevices/network.py
+++ b/vdsm/virt/vmdevices/network.py
@@ -48,6 +48,7 @@
kwargs[attr] = net_api.DUMMY_BRIDGE
super(Interface, self).__init__(conf, log, **kwargs)
self.sndbufParam = False
+ self.name = ""
self.is_hostdevice = self.device == hwclass.HOSTDEV
self.vlanId = self.specParams.get('vlanid')
self._customize()
--
To view, visit https://gerrit.ovirt.org/65772
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I21ef87a9524cbfe752e6cc0f7d1d9f6139c61dfb
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
6 years, 6 months
Change in vdsm[master]: py3: take Queue from six.moves
by Code Review
From Dan Kenigsberg <danken(a)redhat.com>:
Dan Kenigsberg has uploaded a new change for review.
Change subject: py3: take Queue from six.moves
......................................................................
py3: take Queue from six.moves
Affected modules are still not complient with Python 3, but this cleanup
is simple and takes us one tiny step forward.
Change-Id: I7c3e547b0d87de56bf65cccb633db5da7f63565f
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M tests/storage_monitor_test.py
M vdsm/storage/resourceManager.py
M vdsm/storage/storage_mailbox.py
M vdsm/storage/threadPool.py
4 files changed, 12 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/98/66698/1
diff --git a/tests/storage_monitor_test.py b/tests/storage_monitor_test.py
index 8f72402..4ae2d29 100644
--- a/tests/storage_monitor_test.py
+++ b/tests/storage_monitor_test.py
@@ -18,12 +18,13 @@
# Refer to the README and COPYING files for full details of the license
#
-import Queue
import logging
import threading
import time
from contextlib import contextmanager
+
+from six.moves.queue import Queue, Empty
from vdsm.storage import exception as se
@@ -181,13 +182,13 @@
self.thread = thread
self.event = event
self.checker = checker
- self.queue = Queue.Queue()
+ self.queue = Queue()
self.thread.cycleCallback = self._callback
def wait_for_cycle(self):
try:
self.queue.get(True, CYCLE_TIMEOUT)
- except Queue.Empty:
+ except Empty:
raise RuntimeError("Timeout waiting for monitor cycle")
def _callback(self):
diff --git a/vdsm/storage/resourceManager.py b/vdsm/storage/resourceManager.py
index 20aa06c..413b936 100644
--- a/vdsm/storage/resourceManager.py
+++ b/vdsm/storage/resourceManager.py
@@ -25,7 +25,8 @@
from functools import partial
from contextlib import nested
from uuid import uuid4
-from Queue import Queue
+
+from six.moves.queue import Queue
from vdsm.logUtils import SimpleLogAdapter
from vdsm import concurrent
diff --git a/vdsm/storage/storage_mailbox.py b/vdsm/storage/storage_mailbox.py
index 0d240fe..4853285 100644
--- a/vdsm/storage/storage_mailbox.py
+++ b/vdsm/storage/storage_mailbox.py
@@ -22,11 +22,12 @@
import errno
import time
import threading
-import Queue
import struct
import logging
import uuid
+
+from six.moves.queue import Queue, Empty
from vdsm.config import config
from vdsm.storage import misc
@@ -185,7 +186,7 @@
self._poolID = str(poolID)
self._monitorInterval = monitorInterval
self._spmStorageDir = config.get('irs', 'repository')
- self._queue = Queue.Queue(-1)
+ self._queue = Queue(-1)
# *** IMPORTANT NOTE: The SPM's inbox is the HSMs' outbox and vice
# versa *** #
self._inbox = os.path.join(self._spmStorageDir, self._poolID,
@@ -455,7 +456,7 @@
self._handleMessage(message)
message = None
sendMail = True
- except Queue.Empty:
+ except Empty:
pass
if self._stop:
@@ -472,7 +473,7 @@
self._handleMessage(message)
message = None
sendMail = True
- except Queue.Empty:
+ except Empty:
empty = True
if self._flush:
diff --git a/vdsm/storage/threadPool.py b/vdsm/storage/threadPool.py
index e2ecf74..ae1d8b0 100644
--- a/vdsm/storage/threadPool.py
+++ b/vdsm/storage/threadPool.py
@@ -11,7 +11,7 @@
import logging
import threading
-from Queue import Queue, Empty
+from six.moves.queue import Queue, Empty
from time import sleep
from vdsm import concurrent
--
To view, visit https://gerrit.ovirt.org/66698
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7c3e547b0d87de56bf65cccb633db5da7f63565f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
6 years, 6 months
Change in vdsm[master]: vm_migrate_hook: skip interface handling for customized VMs
by Code Review
From Dan Kenigsberg <danken(a)redhat.com>:
Dan Kenigsberg has posted comments on this change.
Change subject: vm_migrate_hook: skip interface handling for customized VMs
......................................................................
Patch Set 2: Code-Review-1
--
To view, visit https://gerrit.ovirt.org/67455
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Icd52d076ceb563ce965bdd90d850868bb6580e3d
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phoracek(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Edward Haas <edwardh(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki <mmirecki(a)redhat.com>
Gerrit-Reviewer: Petr Horáček <phoracek(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
Gerrit-HasComments: No
6 years, 6 months
Change in vdsm[master]: vm_migrate_hook: skip interface handling for customized VMs
by Code Review
From Dan Kenigsberg <danken(a)redhat.com>:
Dan Kenigsberg has posted comments on this change.
Change subject: vm_migrate_hook: skip interface handling for customized VMs
......................................................................
Patch Set 2:
Please limit this to the approved list of custom properties.
We agreed to accept openstack, vmfex, macspoof
--
To view, visit https://gerrit.ovirt.org/67455
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Icd52d076ceb563ce965bdd90d850868bb6580e3d
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phoracek(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Edward Haas <edwardh(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki <mmirecki(a)redhat.com>
Gerrit-Reviewer: Petr Horáček <phoracek(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
Gerrit-HasComments: No
6 years, 6 months
Change in vdsm[master]: python: change python scripts to python2
by Code Review
From Dan Kenigsberg <danken(a)redhat.com>:
Dan Kenigsberg has submitted this change and it was merged.
Change subject: python: change python scripts to python2
......................................................................
python: change python scripts to python2
starting from fc25, python3 will be default, and
/usr/bin/python path will point to python3.
All interpreter paths in python scripts were changed
to python2.
This is a quick fix in order to ensure the scripts will
continue to run without errors.
All scripts should be py3 compatible in the future.
Signed-off-by: Irit Goihman <igoihman(a)redhat.com>
Change-Id: Ie8eaefe5f7e0831c362546733a2fa9301b7f9ad6
---
M build-aux/vercmp
M contrib/refmt
M contrib/repoplot
M contrib/runvm
M init/daemonAdapter
M init/wait_for_ipv4s
M lib/vdsm/tool/dummybr.py
M lib/vdsm/tool/nwfilter.py
M tests/alignmentScanTests.py
M tests/hooksTests.py
M tests/tests_child.py
M vdsm-tool/vdsm-tool
M vdsm/get-conf-item
M vdsm/set-conf-item
M vdsm/storage/curl-img-wrap
M vdsm/storage/fc-scan
M vdsm/supervdsmServer
M vdsm/vdsm
M vdsm/vdsm-restore-net-config
M vdsm_hooks/checkimages/before_vm_start.py
M vdsm_hooks/checkips/checkips_utils.py
M vdsm_hooks/checkips/checkipsd
M vdsm_hooks/extnet/extnet_vnic.py
M vdsm_hooks/fakesriov/after_get_caps.py
M vdsm_hooks/fakesriov/after_hostdev_list_by_caps.py
M vdsm_hooks/fakevmstats/after_get_all_vm_stats.py
M vdsm_hooks/faqemu/after_get_caps.py
M vdsm_hooks/faqemu/before_vm_start.py
M vdsm_hooks/floppy/before_vm_migrate_source.py
M vdsm_hooks/floppy/before_vm_start.py
M vdsm_hooks/hostusb/after_vm_destroy.py
M vdsm_hooks/hostusb/before_vm_migrate_source.py
M vdsm_hooks/hostusb/before_vm_start.py
M vdsm_hooks/httpsisoboot/before_vm_start.py
M vdsm_hooks/hugepages/after_vm_destroy.py
M vdsm_hooks/hugepages/before_vm_migrate_destination.py
M vdsm_hooks/hugepages/before_vm_start.py
M vdsm_hooks/ipv6/ipv6.py
M vdsm_hooks/isolatedprivatevlan/before_vm_start.py
M vdsm_hooks/macspoof/before_vm_start.py
M vdsm_hooks/nestedvt/before_vm_start.py
M vdsm_hooks/numa/before_vm_start.py
M vdsm_hooks/openstacknet/after_device_create.py
M vdsm_hooks/openstacknet/after_device_destroy.py
M vdsm_hooks/openstacknet/after_vm_start.py
M vdsm_hooks/openstacknet/before_device_create.py
M vdsm_hooks/openstacknet/before_device_migrate_destination.py
M vdsm_hooks/openstacknet/openstacknet_utils.py
M vdsm_hooks/ovs/ovs_after_get_caps.py
M vdsm_hooks/ovs/ovs_after_get_stats.py
M vdsm_hooks/ovs/ovs_after_network_setup.py
M vdsm_hooks/ovs/ovs_after_network_setup_fail.py
M vdsm_hooks/ovs/ovs_before_device_create.py
M vdsm_hooks/ovs/ovs_before_network_setup.py
M vdsm_hooks/pincpu/before_vm_start.py
M vdsm_hooks/promisc/after_vm_start.py
M vdsm_hooks/promisc/before_vm_destroy.py
M vdsm_hooks/qemucmdline/before_vm_start.py
M vdsm_hooks/qos/before_vm_start.py
M vdsm_hooks/scratchpad/after_vm_destroy.py
M vdsm_hooks/scratchpad/before_vm_migrate_source.py
M vdsm_hooks/scratchpad/before_vm_start.py
M vdsm_hooks/smbios/before_vm_start.py
M vdsm_hooks/spiceoptions/before_vm_start.py
M vdsm_hooks/vhostmd/after_vm_destroy.py
M vdsm_hooks/vhostmd/before_vm_start.py
M vdsm_hooks/vmdisk/before_vm_start.py
M vdsm_hooks/vmfex/before_vm_migrate_destination.py
M vdsm_hooks/vmfex/before_vm_start.py
M vdsm_hooks/vmfex_dev/vmfex_vnic.py
70 files changed, 70 insertions(+), 70 deletions(-)
Approvals:
Yaniv Bronhaim: Looks good to me, but someone else must approve
Jenkins CI: Passed CI tests
Irit Goihman: Verified
Dan Kenigsberg: Looks good to me, approved
--
To view, visit https://gerrit.ovirt.org/67502
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie8eaefe5f7e0831c362546733a2fa9301b7f9ad6
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Irit Goihman <igoihman(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Irit Goihman <igoihman(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
6 years, 6 months
Change in vdsm[master]: python: change python scripts to python2
by Code Review
From Dan Kenigsberg <danken(a)redhat.com>:
Dan Kenigsberg has posted comments on this change.
Change subject: python: change python scripts to python2
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit https://gerrit.ovirt.org/67502
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ie8eaefe5f7e0831c362546733a2fa9301b7f9ad6
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Irit Goihman <igoihman(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Irit Goihman <igoihman(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
Gerrit-HasComments: No
6 years, 6 months
Change in vdsm[master]: contrib: Simple jsonrpc client
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: contrib: Simple jsonrpc client
......................................................................
contrib: Simple jsonrpc client
This is a simple jsonrpc client for communicating with the jsonrpc
server from the command line.
Arguments
method one of the mehtods described in json schema
params optionl json object with message parameters
Examples
Calling method without arguements:
# jsonrpc Host.getVMList
{
"jsonrpc": "2.0",
"id": "0e043d83-294a-4d31-b1b6-6dc2f2747494",
"result": [
"b3f6fa00-b315-4ad4-8108-f73da817b5c5"
]
}
Calling method with arguements:
# jsonrpc VM.getStats '{"vmID": "b3f6fa00-b315-4ad4-8108-f73da817b5c5"}'
{
"jsonrpc": "2.0",
"id": "cefd25a3-6250-4123-8a56-d7047899e19e",
"result": [
{
"status": "Down",
"exitMessage": "Admin shut down from the engine",
"vmId": "b3f6fa00-b315-4ad4-8108-f73da817b5c5",
"exitReason": 6,
"timeOffset": "0",
"exitCode": 0
}
]
}
Requires stomp.py library:
https://pypi.python.org/pypi/stomp.py
Change-Id: Ia6273eabf6f3601602659d1e4e748d8025ae8084
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
A contrib/jsonrpc
1 file changed, 104 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/81/35181/1
diff --git a/contrib/jsonrpc b/contrib/jsonrpc
new file mode 100755
index 0000000..3080193
--- /dev/null
+++ b/contrib/jsonrpc
@@ -0,0 +1,104 @@
+#!/usr/bin/python
+#
+# Copyright 2014 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+"""
+jsonrpc-cli - Vdsm jsonrpc client
+"""
+
+import json
+import os
+import signal
+import sys
+import time
+import uuid
+import optparse
+
+import stomp
+
+# Copied from lib/vdsm/vdscli.py
+PKIDIR = '/etc/pki/vdsm'
+KEYFILE = os.path.join(PKIDIR, 'keys/vdsmkey.pem')
+CERTFILE = os.path.join(PKIDIR, 'certs/vdsmcert.pem')
+CACERT = os.path.join(PKIDIR, 'certs/cacert.pem')
+
+PORT = 54321
+DESTINATION = "/queue/_local/vdsm/requests"
+
+
+class Listener(stomp.ConnectionListener):
+
+ def on_error(self, headers, message):
+ print 'Error: %s' % message
+ terminate()
+
+ def on_message(self, headers, message):
+ msg = json.loads(message)
+ print json.dumps(msg, indent=4)
+ terminate()
+
+
+def main(args):
+ parser = option_parser()
+ options, args = parser.parse_args(args)
+ if not args:
+ parser.error("method required")
+
+ msg = {
+ "id": str(uuid.uuid4()),
+ "jsonrpc": "2.0",
+ "method": args[0]
+ }
+
+ if len(args) > 1:
+ msg["params"] = json.loads(args[1])
+
+ conn = stomp.Connection10(
+ host_and_ports=((options.host, PORT),),
+ use_ssl=True,
+ ssl_key_file=KEYFILE,
+ ssl_cert_file=CERTFILE,
+ ssl_ca_certs=CACERT)
+
+ conn.set_listener("", Listener())
+ conn.start()
+ conn.send(body=json.dumps(msg), destination=DESTINATION)
+
+ try:
+ signal.pause()
+ except KeyboardInterrupt:
+ pass
+
+ conn.disconnect()
+
+
+def option_parser():
+ parser = optparse.OptionParser(usage='%prog [options] method [params]')
+ parser.add_option("-a", "--host", dest="host",
+ help="host address (default localhost)")
+ parser.set_defaults(host="localhost")
+ return parser
+
+
+def terminate():
+ os.kill(os.getpid(), signal.SIGINT)
+
+
+if __name__ == "__main__":
+ main(sys.argv[1:])
--
To view, visit http://gerrit.ovirt.org/35181
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia6273eabf6f3601602659d1e4e748d8025ae8084
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
6 years, 6 months
Change in vdsm[master]: python: change python scripts to python2
by Code Review
From Yaniv Bronhaim <ybronhei(a)redhat.com>:
Yaniv Bronhaim has posted comments on this change.
Change subject: python: change python scripts to python2
......................................................................
Patch Set 1: Code-Review+1
--
To view, visit https://gerrit.ovirt.org/67502
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ie8eaefe5f7e0831c362546733a2fa9301b7f9ad6
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Irit Goihman <igoihman(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Irit Goihman <igoihman(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
Gerrit-HasComments: No
6 years, 6 months
Change in vdsm[master]: cleanup: remove persist/unpersist calls for legacy node
by Douglas Schilling Landgraf
Douglas Schilling Landgraf has uploaded a new change for review.
Change subject: cleanup: remove persist/unpersist calls for legacy node
......................................................................
cleanup: remove persist/unpersist calls for legacy node
This patch removes all related to unpersist and persist
calls exclusive for oVirt Node Legacy. oVirt Node Next doesn't
require such approach.
Change-Id: I1cca0cfa0e2254a5a8af6b3591ffe47689410415
Signed-off-by: Douglas Schilling Landgraf <dougsland(a)redhat.com>
---
M lib/vdsm/network/configurators/ifcfg.py
M lib/vdsm/tool/configfile.py
M lib/vdsm/tool/configurators/certificates.py
M lib/vdsm/tool/configurators/libvirt.py
M lib/vdsm/tool/configurators/multipath.py
M lib/vdsm/tool/configurators/passwd.py
M lib/vdsm/tool/register.py
M lib/vdsm/tool/upgrade.py
M lib/vdsm/tool/validate_ovirt_certs.py.in
M lib/vdsm/utils.py
M tests/toolTests.py
M vdsm.spec.in
M vdsm/Makefile.am
D vdsm/ovirt_functions.sh
M vdsm/vdsm-store-net-config.in
M vdsm_hooks/Makefile.am
M vdsm_hooks/fcoe/fcoe_before_network_setup.py
D vdsm_hooks/persist-vdsm-hooks.in
D vdsm_hooks/unpersist-vdsm-hook
19 files changed, 9 insertions(+), 219 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/15/63715/1
diff --git a/lib/vdsm/network/configurators/ifcfg.py b/lib/vdsm/network/configurators/ifcfg.py
index 2302ae1..0555034 100644
--- a/lib/vdsm/network/configurators/ifcfg.py
+++ b/lib/vdsm/network/configurators/ifcfg.py
@@ -55,9 +55,6 @@
from vdsm.network.netinfo.cache import ifaceUsed
from vdsm.network.netlink import waitfor
-if utils.isOvirtNode():
- from ovirt.node.utils import fs as node_fs
-
from . import Configurator, getEthtoolOpts
from ..errors import ConfigNetworkError, ERR_FAILED_IFUP
from ..models import Nic, Bridge
@@ -297,10 +294,7 @@
@staticmethod
def _removeFile(filename):
"""Remove file (directly or using oVirt node's library)"""
- if utils.isOvirtNode():
- node_fs.Config().delete(filename) # unpersists and shreds the file
- else:
- utils.rmFile(filename)
+ utils.rmFile(filename)
logging.debug("Removed file %s", filename)
def createLibvirtNetwork(self, network, bridged=True, iface=None,
@@ -512,10 +506,6 @@
except:
logging.debug('ignoring restorecon error in case '
'SElinux is disabled', exc_info=True)
-
- # make sure that ifcfg files are always persisted by the node
- if self.unifiedPersistence and utils.isOvirtNode():
- node_fs.Config().persist(fileName)
def _createConfFile(self, conf, name, ipv4, ipv6, mtu, nameservers,
**kwargs):
diff --git a/lib/vdsm/tool/configfile.py b/lib/vdsm/tool/configfile.py
index 0c49b19..bad0759 100644
--- a/lib/vdsm/tool/configfile.py
+++ b/lib/vdsm/tool/configfile.py
@@ -175,9 +175,7 @@
if self._entries:
self._writeEntries(f, oldentries)
- utils.unpersist(self._filename)
os.rename(tname, self._filename)
- utils.persist(self._filename)
if self._oldmod != os.stat(self._filename).st_mode:
os.chmod(self._filename, self._oldmod)
diff --git a/lib/vdsm/tool/configurators/certificates.py b/lib/vdsm/tool/configurators/certificates.py
index 0462b4d..edc96b3 100644
--- a/lib/vdsm/tool/configurators/certificates.py
+++ b/lib/vdsm/tool/configurators/certificates.py
@@ -23,10 +23,8 @@
from vdsm.config import config
from . import YES, NO
-from vdsm.tool.validate_ovirt_certs import validate_ovirt_certs
from vdsm.constants import P_VDSM_EXEC, SYSCONF_PATH
from vdsm.commands import execCmd
-from vdsm.utils import isOvirtNode
PKI_DIR = os.path.join(SYSCONF_PATH, 'pki/vdsm')
CA_FILE = os.path.join(PKI_DIR, 'certs/cacert.pem')
@@ -59,8 +57,6 @@
def configure():
_exec_vdsm_gencerts()
- if isOvirtNode():
- validate_ovirt_certs()
def isconfigured():
diff --git a/lib/vdsm/tool/configurators/libvirt.py b/lib/vdsm/tool/configurators/libvirt.py
index 40d4958..94c5da2 100644
--- a/lib/vdsm/tool/configurators/libvirt.py
+++ b/lib/vdsm/tool/configurators/libvirt.py
@@ -27,12 +27,8 @@
from . import InvalidRun, NO, MAYBE
from . certificates import CA_FILE, CERT_FILE, KEY_FILE
from vdsm.tool.configfile import ConfigFile, ParserWrapper
-from vdsm.tool.validate_ovirt_certs import validate_ovirt_certs
from vdsm import utils
from vdsm import constants
-
-if utils.isOvirtNode():
- from ovirt.node.utils.fs import Config as NodeCfg
requires = frozenset(('certificates',))
@@ -45,12 +41,6 @@
def configure():
- if utils.isOvirtNode():
- if not os.path.exists(constants.P_VDSM_CERT):
- raise InvalidRun(
- "vdsm: Missing certificate, vdsm not registered")
- validate_ovirt_certs()
-
# Remove a previous configuration (if present)
removeConf()
@@ -193,14 +183,11 @@
"""
delete a file if it exists.
"""
- if utils.isOvirtNode():
- NodeCfg().delete(content['path'])
- else:
- try:
- os.unlink(content['path'])
- except OSError as e:
- if e.errno != errno.ENOENT:
- raise
+ try:
+ os.unlink(content['path'])
+ except OSError as e:
+ if e.errno != errno.ENOENT:
+ raise
def _removeSection(path):
diff --git a/lib/vdsm/tool/configurators/multipath.py b/lib/vdsm/tool/configurators/multipath.py
index 00ec558..a402cda 100644
--- a/lib/vdsm/tool/configurators/multipath.py
+++ b/lib/vdsm/tool/configurators/multipath.py
@@ -112,7 +112,6 @@
backup = _CONF_FILE + '.' + time.strftime("%Y%m%d%H%M")
shutil.copyfile(_CONF_FILE, backup)
sys.stdout.write("Backup previous multipath.conf to %r\n" % backup)
- utils.persist(backup)
with tempfile.NamedTemporaryFile(
mode="wb",
@@ -125,15 +124,10 @@
if selinux.is_selinux_enabled():
selinux.restorecon(f.name)
os.chmod(f.name, 0o644)
- # On ovirt node multipath.conf is a bind mount and rename will fail
- # if we do not unpersist first, making this non-atomic.
- utils.unpersist(_CONF_FILE)
os.rename(f.name, _CONF_FILE)
except:
os.unlink(f.name)
raise
-
- utils.persist(_CONF_FILE)
# Flush all unused multipath device maps
commands.execCmd([constants.EXT_MULTIPATH, "-F"])
diff --git a/lib/vdsm/tool/configurators/passwd.py b/lib/vdsm/tool/configurators/passwd.py
index 62830df..b75228e 100644
--- a/lib/vdsm/tool/configurators/passwd.py
+++ b/lib/vdsm/tool/configurators/passwd.py
@@ -51,10 +51,6 @@
rc, _, err = commands.execCmd(script, data=libvirt_password())
if rc != 0:
raise RuntimeError("Set password failed: %s" % (err,))
- if utils.isOvirtNode():
- # It seems that all /etc/libvirt folder is persisted in node,
- # but better to persist the db file explicitly
- utils.persist(_LIBVIRT_SASLDB)
def removeConf():
diff --git a/lib/vdsm/tool/register.py b/lib/vdsm/tool/register.py
index d0ae207..ea74bec 100644
--- a/lib/vdsm/tool/register.py
+++ b/lib/vdsm/tool/register.py
@@ -266,18 +266,11 @@
__VDSM_ID = "/etc/vdsm/vdsm.id"
if self.vdsm_uuid and os.path.exists(__VDSM_ID):
- if utils.isOvirtNode():
- from ovirt.node.utils.fs import Config
- Config().unpersist(__VDSM_ID)
os.unlink(__VDSM_ID)
if not os.path.exists(__VDSM_ID):
with open(__VDSM_ID, 'w') as f:
f.write(self.uuid)
-
- if utils.isOvirtNode():
- from ovirt.node.utils.fs import Config
- Config().persist(__VDSM_ID)
self.logger.info("Host UUID: {u}".format(u=self.uuid))
@@ -294,9 +287,6 @@
if not os.path.exists(self.ca_dir):
os.makedirs(self.ca_dir, 0o755)
self._silent_restorecon(self.ca_dir)
- if utils.isOvirtNode():
- from ovirt.node.utils.fs import Config
- Config().persist(self.ca_dir)
res = self._execute_http_request(self.url_CA,
cert_validation=False)
@@ -328,10 +318,6 @@
self.logger.info("Calculated fingerprint: {f}".format(
f=self.fprint))
- if utils.isOvirtNode():
- from ovirt.node.utils.fs import Config
- Config().persist(self.ca_engine)
-
def download_ssh(self):
"""
Download ssh authorized keys and save it in the node
@@ -345,9 +331,6 @@
if not os.path.exists(_auth_keys_dir):
os.makedirs(_auth_keys_dir, 0o700)
self._silent_restorecon(_auth_keys_dir)
- if utils.isOvirtNode():
- from ovirt.node.utils.fs import Config
- Config().persist(_auth_keys_dir)
os.chown(_auth_keys_dir, _uid, _uid)
res = self._execute_http_request(self.url_ssh_key)
@@ -368,9 +351,6 @@
os.chown(_auth_keys, _uid, _uid)
os.unlink(f.name)
- if utils.isOvirtNode():
- from ovirt.node.utils.fs import Config
- Config().persist(_auth_keys)
def execute_registration(self):
"""
diff --git a/lib/vdsm/tool/upgrade.py b/lib/vdsm/tool/upgrade.py
index 4bc904c..291ef13 100644
--- a/lib/vdsm/tool/upgrade.py
+++ b/lib/vdsm/tool/upgrade.py
@@ -46,7 +46,6 @@
except (OSError, IOError):
_get_upgrade_log().exception("Failed to seal upgrade %s", upgrade.name)
else:
- utils.persist(seal_file)
_get_upgrade_log().debug("Upgrade %s successfully performed",
upgrade.name)
diff --git a/lib/vdsm/tool/validate_ovirt_certs.py.in b/lib/vdsm/tool/validate_ovirt_certs.py.in
index 53726d0..1e6a370 100644
--- a/lib/vdsm/tool/validate_ovirt_certs.py.in
+++ b/lib/vdsm/tool/validate_ovirt_certs.py.in
@@ -25,11 +25,6 @@
from . import expose, ExtraArgsError
from ..commands import execCmd
-try:
- from ovirtnode import ovirtfunctions
-except ImportError:
- pass
-
EX_OPENSSL = '@OPENSSL_PATH@'
@@ -60,8 +55,6 @@
if not is_our_cafile(PATH_CACERT):
for f in os.listdir(PATH_CERT):
if is_our_cafile(PATH_CERT + f):
- ovirtfunctions.ovirt_safe_delete_config(PATH_CACERT)
shutil.copy(PATH_CERT + f, PATH_CACERT)
os.chown(PATH_CACERT, uid, gid)
- ovirtfunctions.ovirt_store_config(PATH_CACERT)
break
diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py
index 0ff1a3c..5401654 100644
--- a/lib/vdsm/utils.py
+++ b/lib/vdsm/utils.py
@@ -597,12 +597,6 @@
zombiereaper.autoReapPID(self._proc.pid)
-@memoized
-def isOvirtNode():
- return (os.path.exists('/etc/rhev-hypervisor-release') or
- bool(glob.glob('/etc/ovirt-node-*-release')))
-
-
def anyFnmatch(name, patterns):
"""Returns True if any element in the patterns iterable fnmatches name."""
return any(fnmatch(name, pattern) for pattern in patterns)
diff --git a/tests/toolTests.py b/tests/toolTests.py
index e14bb53..ab741e2 100644
--- a/tests/toolTests.py
+++ b/tests/toolTests.py
@@ -334,11 +334,6 @@
libvirt,
'FILES',
FakeFiles
- ),
- (
- utils,
- 'isOvirtNode',
- lambda: False
)
])
diff --git a/vdsm.spec.in b/vdsm.spec.in
index b9ec875..4d5caf1 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -957,9 +957,6 @@
%{_sysconfdir}/libvirt/hooks/qemu
%{_libexecdir}/%{vdsm_name}/curl-img-wrap
%{_libexecdir}/%{vdsm_name}/fc-scan
-%{_libexecdir}/%{vdsm_name}/persist-vdsm-hooks
-%{_libexecdir}/%{vdsm_name}/unpersist-vdsm-hook
-%{_libexecdir}/%{vdsm_name}/ovirt_functions.sh
%{_libexecdir}/%{vdsm_name}/vdsm-gencerts.sh
%{_libexecdir}/%{vdsm_name}/vdsmd_init_common.sh
%{_libexecdir}/%{vdsm_name}/vm_migrate_hook.py*
diff --git a/vdsm/Makefile.am b/vdsm/Makefile.am
index 8b535b6..fd38601 100644
--- a/vdsm/Makefile.am
+++ b/vdsm/Makefile.am
@@ -32,9 +32,6 @@
sitecustomize.py \
$(NULL)
-dist_vdsmexec_SCRIPTS = \
- ovirt_functions.sh
-
nodist_vdsmexec_SCRIPTS = \
vdsm-gencerts.sh \
$(NULL)
diff --git a/vdsm/ovirt_functions.sh b/vdsm/ovirt_functions.sh
deleted file mode 100644
index 12f6864..0000000
--- a/vdsm/ovirt_functions.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh
-#
-# Copyright 2006-2010 Red Hat, Inc. and/or its affiliates.
-#
-# Licensed to you under the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version. See the files README and
-# LICENSE_GPL_v2 which accompany this distribution.
-#
-
-isOvirtNode() {
- [ "$(echo /etc/ovirt-node-*-release)" != "/etc/ovirt-node-*-release" ] || \
- [ -f /etc/rhev-hypervisor-release ]
-}
-
-# execute a function if called as a script, e.g.
-# vdsm-bash-functions isOvirtNode
-
-if [ "$(basename -- "$0")" = "vdsm-bash-functions" ]; then
- "$@"
-fi
diff --git a/vdsm/vdsm-store-net-config.in b/vdsm/vdsm-store-net-config.in
index 76822ee..3292f84 100755
--- a/vdsm/vdsm-store-net-config.in
+++ b/vdsm/vdsm-store-net-config.in
@@ -16,33 +16,10 @@
PERSISTENCE=$1
-ifcfg_node_persist() {
- for f in "$NET_CONF_BACK_DIR"/*;
- do
- [ ! -f "$f" ] && continue
- bf=`basename "$f"`
- if [ -f "$NET_CONF_DIR/$bf" ];
- then
- ovirt_store_config "$NET_CONF_DIR/$bf"
- else
- ovirt_safe_delete_config "$NET_CONF_DIR/$bf"
- fi
- rm "$NET_CONF_BACK_DIR/$bf"
- done
-}
-
ifcfg_nonnode_persist() {
# Remove the backed up configuration files thus marking the ones under
# /etc/sysconfig as "safe".
rm -rf "$NET_CONF_BACK_DIR"/*
-}
-
-unified_node_persist() {
- unified_nonnode_persist
-
- # oVirt node ovirt_store_config puts the dir in persistent storage and
- # bind mounts it in the original place. So that's all we really need to do.
- ovirt_store_config "$PERS_CONF_PATH"
}
unified_nonnode_persist() {
@@ -67,21 +44,8 @@
}
-if isOvirtNode
-then
- # for node, persist the changed configuration files
-
- . /usr/libexec/ovirt-functions
-
- if [ "$PERSISTENCE" == "unified" ]; then
- unified_node_persist
- else
- ifcfg_node_persist
- fi
+if [ "$PERSISTENCE" == "unified" ]; then
+ unified_nonnode_persist
else
- if [ "$PERSISTENCE" == "unified" ]; then
- unified_nonnode_persist
- else
- ifcfg_nonnode_persist
- fi
+ ifcfg_nonnode_persist
fi
diff --git a/vdsm_hooks/Makefile.am b/vdsm_hooks/Makefile.am
index 8cbfca1..04728ad 100644
--- a/vdsm_hooks/Makefile.am
+++ b/vdsm_hooks/Makefile.am
@@ -64,18 +64,9 @@
$(NULL)
endif
-dist_vdsmexec_SCRIPTS = \
- unpersist-vdsm-hook
-
-nodist_vdsmexec_SCRIPTS = \
- persist-vdsm-hooks
-
CLEANFILES = \
config.log \
$(nodist_vdsmexec_SCRIPTS)
-
-EXTRA_DIST = \
- persist-vdsm-hooks.in
VDSMHOOKS = \
before_device_create \
diff --git a/vdsm_hooks/fcoe/fcoe_before_network_setup.py b/vdsm_hooks/fcoe/fcoe_before_network_setup.py
index c507c07..e786254 100755
--- a/vdsm_hooks/fcoe/fcoe_before_network_setup.py
+++ b/vdsm_hooks/fcoe/fcoe_before_network_setup.py
@@ -86,7 +86,6 @@
outfile.write(CONFFILE_HEADER + "\n")
for name, value in six.iteritems(config):
outfile.write('%s="%s"\n' % (name, value))
- utils.persist(filename)
def _unconfigure(interface):
@@ -95,7 +94,6 @@
"""
filename = _get_config_name(interface)
if os.path.exists(filename):
- utils.unpersist(filename)
utils.rmFile(filename)
diff --git a/vdsm_hooks/persist-vdsm-hooks.in b/vdsm_hooks/persist-vdsm-hooks.in
deleted file mode 100644
index e7423fb..0000000
--- a/vdsm_hooks/persist-vdsm-hooks.in
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/bash
-#
-# Copyright 2009-2010 Red Hat, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# Description: Persist all VDSM hooks
-#
-
-. @LIBEXECDIR(a)/ovirt_functions.sh
-
-HOOKS_DIR=/usr/libexec/vdsm/hooks
-
-if isOvirtNode
-then
- . /usr/libexec/ovirt-functions
- for hook in "$HOOKS_DIR"/*/*
- do
- if [[ -f "$hook" ]]
- then
- ovirt_store_config "$hook"
- fi
- done
-else
- echo "Host is not RHEV-Hypervisor"
- exit 1
-fi
diff --git a/vdsm_hooks/unpersist-vdsm-hook b/vdsm_hooks/unpersist-vdsm-hook
deleted file mode 100755
index af5af27..0000000
--- a/vdsm_hooks/unpersist-vdsm-hook
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash
-#
-# Copyright 2009-2010 Red Hat, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# Description: Unpersist VDSM Hook
-# Input: VDSM Hook file full path
-#
-
-HOOKS_DIR=/usr/libexec/vdsm/hooks
-HOOK_TO_UNPERSIST="$1"
-
-if [[ -z "$HOOK_TO_UNPERSIST" ]]; then
- echo "usage: $0 hook_file"
- exit 1
-fi
-
-if [[ -f /etc/rhev-hypervisor-release ]]
-then
- . /usr/libexec/ovirt-functions
- if [[ "$HOOK_TO_UNPERSIST" =~ ^"$HOOKS_DIR" ]]
- then
- # try to unpersist files only
- if [[ -f "$HOOK_TO_UNPERSIST" ]]
- then
- ovirt_safe_delete_config "$HOOK_TO_UNPERSIST"
- fi
- fi
-else
- echo "Host is not RHEV-Hypervisor"
- exit 1
-fi
--
To view, visit https://gerrit.ovirt.org/63715
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1cca0cfa0e2254a5a8af6b3591ffe47689410415
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <dougsland(a)redhat.com>
6 years, 6 months
Change in vdsm[master]: tests: Avoid global state modification using forked
by Code Review
From Dan Kenigsberg <danken(a)redhat.com>:
Dan Kenigsberg has posted comments on this change.
Change subject: tests: Avoid global state modification using forked
......................................................................
Patch Set 1: -Code-Review
(1 comment)
https://gerrit.ovirt.org/#/c/67338/1/tests/moduleloader_test.py
File tests/moduleloader_test.py:
Line 39: for f in files:
Line 40: utils.touchFile(os.path.join(path, f))
Line 41: utils.touchFile(os.path.join(path, '__init__.py'))
Line 42: sys.path.append(os.path.dirname(path))
Line 43: yield importlib.import_module(os.path.basename(path))
> You don't need to monkey patch if you run in another process, this is compl
Do you suggest to run all tests (everywhere, not just this module) in a subprocess?
Line 44:
Line 45: @permutations(
Line 46: [(('a.py', 'b.py'), ('a', 'b')),
Line 47: (('a.py', 'b.py', 'a.pyc', 'a.pyioas'), ('a', 'b')),
--
To view, visit https://gerrit.ovirt.org/67338
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I2130bcf39918c3c70ed9f8eb9c436c5c8f9c6c09
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Irit Goihman <igoihman(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
Gerrit-HasComments: Yes
6 years, 6 months