Change in vdsm[ovirt-3.5-gluster]: gluster:fix NoneType error for some devices does not contain...
by tjeyasin@redhat.com
Hello Piotr Kliczewski, Dan Kenigsberg, Ramesh N,
I'd like you to do a code review. Please visit
https://gerrit.ovirt.org/41466
to review the following change.
Change subject: gluster:fix NoneType error for some devices does not contain sysfsPath
......................................................................
gluster:fix NoneType error for some devices does not contain sysfsPath
Currently devices list returns the list of available disks and
its fs type properly. However it fails for some devices which does
not contain sysfsPath and the dev details become None.
This patch fixes this error by assigning empty dictonary if
the dev is empty or None.
Change-Id: I54efdf3958519e2ae038b527a03e0b57569c2e8f
Signed-off-by: Timothy Asir Jeyasingh <tjeyasin(a)redhat.com>
Reviewed-on: https://gerrit.ovirt.org/41262
Reviewed-by: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Reviewed-by: Ramesh N <rnachimu(a)redhat.com>
Continuous-Integration: Jenkins CI
Reviewed-by: Dan Kenigsberg <danken(a)redhat.com>
---
M vdsm/gluster/storagedev.py
1 file changed, 3 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/66/41466/1
diff --git a/vdsm/gluster/storagedev.py b/vdsm/gluster/storagedev.py
index 0eea52c..583548b 100644
--- a/vdsm/gluster/storagedev.py
+++ b/vdsm/gluster/storagedev.py
@@ -79,10 +79,11 @@
info['model'] = device.type
if device.format:
info['uuid'] = device.format.uuid or ''
+ # lvm vg will not have sysfs path
if hasattr(udev, 'get_device'):
- dev = udev.get_device(device.sysfsPath)
+ dev = udev.get_device(device.sysfsPath) or {}
elif hasattr(udev, 'udev_get_device'):
- dev = udev.udev_get_device(device.sysfsPath)
+ dev = udev.udev_get_device(device.sysfsPath) or {}
else:
dev = {}
info['fsType'] = device.format.type or dev.get('ID_FS_TYPE', '')
--
To view, visit https://gerrit.ovirt.org/41466
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I54efdf3958519e2ae038b527a03e0b57569c2e8f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5-gluster
Gerrit-Owner: Timothy Asir <tjeyasin(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Gerrit-Reviewer: Ramesh N <rnachimu(a)redhat.com>
8 years, 11 months
Change in vdsm[ovirt-3.5]: patch to avoid using upstarts when libvirtd.upstart not exist
by ybronhei@redhat.com
Yaniv Bronhaim has uploaded a new change for review.
Change subject: patch to avoid using upstarts when libvirtd.upstart not exist
......................................................................
patch to avoid using upstarts when libvirtd.upstart not exist
This caused regression in ovirt-node which doesn't include
/usr/share/doc files from libvirt rpm and libvirtd.upstart is installed
as doc file.
Change-Id: I8c6daf8650927e05357a6f4e35312365b0138452
Signed-off-by: Yaniv Bronhaim <ybronhei(a)redhat.com>
---
M lib/vdsm/tool/configurators/libvirt.py
1 file changed, 51 insertions(+), 46 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/73/41573/1
diff --git a/lib/vdsm/tool/configurators/libvirt.py b/lib/vdsm/tool/configurators/libvirt.py
index 8dc9831..4cc83df 100644
--- a/lib/vdsm/tool/configurators/libvirt.py
+++ b/lib/vdsm/tool/configurators/libvirt.py
@@ -50,6 +50,8 @@
class Libvirt(ModuleConfigure):
+ INITCTL = '/sbin/initctl'
+
def getName(self):
return 'libvirt'
@@ -60,7 +62,9 @@
return ["vdsmd", "supervdsmd", "libvirtd"]
def configure(self):
- self._sysvToUpstart()
+ packaged = self._isUpstartAvailable()
+ if packaged is not None:
+ self._sysvToUpstart(packaged)
if utils.isOvirtNode():
if not os.path.exists(constants.P_VDSM_CERT):
@@ -101,12 +105,13 @@
# disabled libvirtd's sysv service. If chkconfig returns 0, it means
# that sysv would run libvirtd. If chkconfig returns 1 or does not
# exist (el7, fedora, debian), all is well.
- if hasattr(service, 'chkconfigList'):
- try:
- if service.chkconfigList('libvirtd'):
- ret = NOT_CONFIGURED
- except service.ServiceNotExistError:
- pass
+ if self._isUpstartAvailable() is not None:
+ if hasattr(service, 'chkconfigList'):
+ try:
+ if service.chkconfigList('libvirtd'):
+ ret = NOT_CONFIGURED
+ except service.ServiceNotExistError:
+ pass
if ret == NOT_SURE:
sys.stdout.write("libvirt is already configured for vdsm\n")
@@ -130,12 +135,7 @@
if cfile['persisted']
]
- def _sysvToUpstart(self):
- """
- On RHEL 6, libvirtd can be started by either SysV init or Upstart.
- We prefer upstart because it respawns libvirtd if libvirtd
- crashed.
- """
+ def _isUpstartAvailable(self):
def iterateLibvirtFiles():
ts = rpm.TransactionSet()
for name in ['libvirt', 'libvirt-daemon']:
@@ -143,8 +143,27 @@
for filename in matches[rpm.RPMTAG_FILENAMES]:
yield filename
+ LIBVIRTD_UPSTART = 'libvirtd.upstart'
+ packaged = None
+ if os.path.isfile(self.INITCTL) and os.access(self.INITCTL, os.X_OK):
+ # libvirtd package does not provide libvirtd.upstart,
+ # this could happen in Ubuntu or other distro,
+ # so continue to use system default init mechanism
+ for fname in iterateLibvirtFiles():
+ if os.path.basename(fname) == LIBVIRTD_UPSTART:
+ packaged = fname
+ break
+
+ return packaged
+
+ def _sysvToUpstart(self, packaged):
+ """
+ On RHEL 6, libvirtd can be started by either SysV init or Upstart.
+ We prefer upstart because it respawns libvirtd if libvirtd
+ crashed.
+ """
def reloadConfiguration():
- rc, out, err = utils.execCmd((INITCTL,
+ rc, out, err = utils.execCmd((self.INITCTL,
"reload-configuration"))
if rc != 0:
sys.stdout.write(out)
@@ -152,41 +171,27 @@
raise InvalidRun(
"Failed to reload upstart configuration.")
- INITCTL = '/sbin/initctl'
- LIBVIRTD_UPSTART = 'libvirtd.upstart'
TARGET = os.path.join(constants.SYSCONF_PATH, "init/libvirtd.conf")
+ if hasattr(service, '_chkconfigDisable'):
+ service._chkconfigDisable('libvirtd')
+ if not os.path.isfile(TARGET):
+ service.service_stop('libvirtd')
+ if (not os.path.isfile(TARGET) or
+ not filecmp.cmp(packaged, TARGET)):
+ oldmod = None
+ if os.path.isfile(TARGET):
+ oldmod = os.stat(TARGET).st_mode
- if os.path.isfile(INITCTL) and os.access(INITCTL, os.X_OK):
- # libvirtd package does not provide libvirtd.upstart,
- # this could happen in Ubuntu or other distro,
- # so continue to use system default init mechanism
- packaged = ''
- for fname in iterateLibvirtFiles():
- if os.path.basename(fname) == LIBVIRTD_UPSTART:
- packaged = fname
- break
+ if utils.isOvirtNode():
+ NodeCfg().unpersist(TARGET)
+ shutil.copyfile(packaged, TARGET)
+ if utils.isOvirtNode():
+ NodeCfg().persist(TARGET)
- if os.path.isfile(packaged):
- if hasattr(service, '_chkconfigDisable'):
- service._chkconfigDisable('libvirtd')
- if not os.path.isfile(TARGET):
- service.service_stop('libvirtd')
- if (not os.path.isfile(TARGET) or
- not filecmp.cmp(packaged, TARGET)):
- oldmod = None
- if os.path.isfile(TARGET):
- oldmod = os.stat(TARGET).st_mode
-
- if utils.isOvirtNode():
- NodeCfg().unpersist(TARGET)
- shutil.copyfile(packaged, TARGET)
- if utils.isOvirtNode():
- NodeCfg().persist(TARGET)
-
- if (oldmod is not None and
- oldmod != os.stat(TARGET).st_mode):
- os.chmod(TARGET, oldmod)
- reloadConfiguration()
+ if (oldmod is not None and
+ oldmod != os.stat(TARGET).st_mode):
+ os.chmod(TARGET, oldmod)
+ reloadConfiguration()
def _isSslConflict(self):
"""
--
To view, visit https://gerrit.ovirt.org/41573
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8c6daf8650927e05357a6f4e35312365b0138452
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Yaniv Bronhaim <ybronhei(a)redhat.com>
8 years, 11 months