Change in vdsm[master]: hsm.py: volUUID is not member of HSM class
by lbednar@redhat.com
Lukas Bednar has uploaded a new change for review.
Change subject: hsm.py: volUUID is not member of HSM class
......................................................................
hsm.py: volUUID is not member of HSM class
Change-Id: I5adc1fb40d54b7a887a4aba44c8884c876d5613a
Signed-off-by: Lukas Bednar <lbednar(a)redhat.com>
---
M vdsm/storage/hsm.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/13/24313/1
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 9420931..41917f3 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -692,7 +692,7 @@
volFormat = volToExtend.getFormat()
if not volToExtend.isLeaf():
- raise se.VolumeNonWritable(self.volUUID)
+ raise se.VolumeNonWritable(volUUID)
if volFormat != volume.COW_FORMAT:
# This method is used only with COW volumes (see docstring),
--
To view, visit http://gerrit.ovirt.org/24313
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5adc1fb40d54b7a887a4aba44c8884c876d5613a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Lukas Bednar <lbednar(a)redhat.com>
9 years, 9 months
Change in vdsm[master]: Makefile.am: create vdsm logs on make install
by Douglas Schilling Landgraf
Douglas Schilling Landgraf has uploaded a new change for review.
Change subject: Makefile.am: create vdsm logs on make install
......................................................................
Makefile.am: create vdsm logs on make install
Currently during the RPM install vdsm creates the below logs files:
/var/log/vdsm/{metadata.log,mom.log,supervdsm.log,vdsm.log}
and we should do the same for non rpm distro.
Change-Id: I7f5dc4ca01fecddc5226255e37b0bab68b8c479f
Signed-off-by: Douglas Schilling Landgraf <dougsland(a)redhat.com>
---
M vdsm/Makefile.am
1 file changed, 4 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/82/23882/1
diff --git a/vdsm/Makefile.am b/vdsm/Makefile.am
index 66b9af5..5e7f2cf 100644
--- a/vdsm/Makefile.am
+++ b/vdsm/Makefile.am
@@ -167,6 +167,10 @@
$(MKDIR_P) $(DESTDIR)$(vdsmlibdir)/upgrade
$(MKDIR_P) $(DESTDIR)$(vdsmbackupdir)
$(MKDIR_P) $(DESTDIR)$(localstatedir)/lib/libvirt/qemu/channels
+ touch $(DESTDIR)$(vdsmlogdir)/{metadata.log,mom.log,supervdsm.log,vdsm.log}
+ chmod 0644 $(DESTDIR)$(vdsmlogdir)/{metadata.log,mom.log,supervdsm.log,vdsm.log}
+ chown $(VDSMUSER):$(VDSMGROUP) $(DESTDIR)$(vdsmlogdir)/{metadata.log,mom.log,vdsm.log}
+ chown root:root $(DESTDIR)$(vdsmlogdir)/supervdsm.log
uninstall-local: \
uninstall-data-dhclient-hooks \
--
To view, visit http://gerrit.ovirt.org/23882
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7f5dc4ca01fecddc5226255e37b0bab68b8c479f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <dougsland(a)redhat.com>
9 years, 9 months
Change in vdsm[master]: sp: improve pool creation error handling
by Federico Simoncelli
Federico Simoncelli has uploaded a new change for review.
Change subject: sp: improve pool creation error handling
......................................................................
sp: improve pool creation error handling
Change-Id: I0cce08e368dec092222c081609d0663d7990ab10
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
---
M vdsm/storage/sp.py
1 file changed, 17 insertions(+), 14 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/18/22818/1
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index 4f4765e..247973c 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -620,27 +620,30 @@
# lock
# TBD: create will receive only master domain and further attaches
# should be done under SPM
-
- # Master domain was already attached (in createMaster),
- # no need to reattach
- for sdUUID in domList:
- # No need to attach the master
- if sdUUID != msdUUID:
- self.attachSD(sdUUID)
+ try:
+ for sdUUID in domList:
+ # Master domain was already attached (in createMaster)
+ if sdUUID != msdUUID:
+ self.attachSD(sdUUID)
+ except Exception:
+ # FIXME: detachSD will fail for the master domain, we need a
+ # special handling (master must be detached from the pool).
+ self.__cleanupDomains(domList, msdUUID, masterVersion)
except Exception:
- self.log.error("Create pool %s canceled ", poolName, exc_info=True)
+ self.log.exception('create pool %s canceled', self.spUUID)
try:
fileUtils.cleanupdir(self.poolPath)
- self.__cleanupDomains(domList, msdUUID, masterVersion)
- except:
- self.log.error("Cleanup failed due to an unexpected error",
- exc_info=True)
+ except Exception:
+ self.log.exception('pool %s cleanup failed', self.spUUID)
raise
finally:
self._setUnsafe()
-
self._releaseTemporaryClusterLock(msdUUID)
- self.stopMonitoringDomains()
+ # stopMonitoringDomains needs masterDomain and the monitoring
+ # domains threads are started only if the master was properly
+ # initialized and set
+ if self.masterDomain:
+ self.stopMonitoringDomains()
return True
--
To view, visit http://gerrit.ovirt.org/22818
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0cce08e368dec092222c081609d0663d7990ab10
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
9 years, 9 months
Change in vdsm[master]: vm: small refactor for _normalizeVdsmImg
by Federico Simoncelli
Federico Simoncelli has uploaded a new change for review.
Change subject: vm: small refactor for _normalizeVdsmImg
......................................................................
vm: small refactor for _normalizeVdsmImg
Change-Id: Ie68292eee4b82fbe8527e3960739979cfe117dfa
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
---
M vdsm/vm.py
1 file changed, 18 insertions(+), 17 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/57/19157/1
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 92d274e..2605f24 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -1779,25 +1779,26 @@
break
return str(idx)
- def _normalizeVdsmImg(self, drv):
- drv['reqsize'] = drv.get('reqsize', '0') # Backward compatible
- if 'device' not in drv:
- drv['device'] = 'disk'
+ def _normalizeVdsmImg(self, drive):
+ drive['device'] = drive.get('device', 'disk') # Disk by default
+ drive['reqsize'] = drive.get('reqsize', '0') # Backward compatible
- if drv['device'] == 'disk':
- res = self.cif.irs.getVolumeSize(drv['domainID'], drv['poolID'],
- drv['imageID'], drv['volumeID'])
- try:
- drv['truesize'] = res['truesize']
- drv['apparentsize'] = res['apparentsize']
- except KeyError:
- self.log.error("Unable to get volume size for %s",
- drv['volumeID'], exc_info=True)
- raise RuntimeError("Volume %s is corrupted or missing" %
- drv['volumeID'])
+ if drive['device'] == 'disk':
+ volInfo = self.cif.irs.getVolumeInfo(
+ drive['domainID'], drive['poolID'], drive['imageID'],
+ drive['volumeID'])
+
+ if volInfo.get('status', {}).get('code', -1):
+ self.log.error(
+ "Unable to get volume info for %s", drive['volumeID'])
+ raise RuntimeError(
+ "Volume %s is corrupted or missing" % drive['volumeID'])
+
+ drive['truesize'] = volInfo['info']['truesize']
+ drive['apparentsize'] = volInfo['info']['apparentsize']
else:
- drv['truesize'] = 0
- drv['apparentsize'] = 0
+ drive['truesize'] = 0
+ drive['apparentsize'] = 0
@classmethod
def _normalizeDriveSharedAttribute(self, drive):
--
To view, visit http://gerrit.ovirt.org/19157
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie68292eee4b82fbe8527e3960739979cfe117dfa
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
9 years, 9 months
Change in vdsm[master]: vmDevices: introduce VmDeviceContainer
by mpoledni@redhat.com
Martin Polednik has uploaded a new change for review.
Change subject: vmDevices: introduce VmDeviceContainer
......................................................................
vmDevices: introduce VmDeviceContainer
EARLY WORK IN PROGRESS: VmDeviceContainer is structure that will allow
us to store devices as a class instances while keeping backwards
compatibility with old self.conf['devices']
Change-Id: I65debd35115da078df0c0cb6f50c57feb984c5a3
Signed-off-by: Martin Polednik <mpoledni(a)redhat.com>
---
M vdsm/vm.py
1 file changed, 33 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/38/21138/1
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 5ae54d7..36cdbb1 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -1727,6 +1727,39 @@
return m
+class VmDeviceContainer(dict):
+ @property
+ def legacy(self):
+ """
+ Return list of device dicts that represents backwards-compatible
+ self.conf['devices']
+
+ [..., {..., 'type': 'disk', ...}, ...]
+ """
+ deviceList = []
+ for key in self.keys():
+ for device in self[key]:
+ # loop through devices __slots__ and return all set attributes
+ deviceList.append(dict((attr, getattr(device, attr))
+ for attr in device.__slots__
+ if hasattr(device, attr)))
+
+ return deviceList
+
+ def restoreLegacy(self, state):
+ """
+ Reconstruct container using old self.conf['devices'] structure of
+
+ [..., {..., 'type': 'disk', ...}, ...]
+ to
+
+ VmDeviceContainer[DISK_DEVICES] =
+ [..., {..., 'type': 'disk', ...}, ...]
+ """
+ for device in state:
+ self[device['type']] = device
+
+
class Vm(object):
"""
Used for abstracting communication between various parts of the
--
To view, visit http://gerrit.ovirt.org/21138
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I65debd35115da078df0c0cb6f50c57feb984c5a3
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpoledni(a)redhat.com>
9 years, 9 months
Change in vdsm[master]: vmDevices: add mechanism to persist vmDevice defaults
by mpoledni@redhat.com
Martin Polednik has uploaded a new change for review.
Change subject: vmDevices: add mechanism to persist vmDevice defaults
......................................................................
vmDevices: add mechanism to persist vmDevice defaults
Multiple vmDevices such as BalloonDevice or watchdogDevice currently
do not persist their defaults in class attributes but rather use them in
XML directly, hiding their existence. This patch aims to change this
behavior by implementing vmDevice._defaults(), which adds the default
attributes to instance directly to enable future persistence of these
classes.
Change-Id: Idc8383cbce78490c8dfab1c253883a06459f1547
Signed-off-by: Martin Polednik <mpoledni(a)redhat.com>
---
M tests/vmTests.py
M vdsm/vm.py
2 files changed, 45 insertions(+), 29 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/66/21066/1
diff --git a/tests/vmTests.py b/tests/vmTests.py
index 1f69f0a..5c813fc 100644
--- a/tests/vmTests.py
+++ b/tests/vmTests.py
@@ -261,7 +261,7 @@
def testWatchdogXML(self):
watchdogXML = '<watchdog action="none" model="i6300esb"/>'
- dev = {'device': 'watchdog', 'type': 'watchdog',
+ dev = {'device': 'watchdog',
'specParams': {'model': 'i6300esb', 'action': 'none'}}
watchdog = vm.WatchdogDevice(self.conf, self.log, **dev)
self.assertXML(watchdog.getXML(), watchdogXML)
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 796735f..36b9598 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -1167,6 +1167,7 @@
class VmDevice(object):
def __init__(self, conf, log, **kwargs):
+ self.specParams = {}
for attr, value in kwargs.iteritems():
try:
setattr(self, attr, value)
@@ -1175,6 +1176,10 @@
self.conf = conf
self.log = log
self._deviceXML = None
+ self._defaults()
+
+ def _defaults(self):
+ pass
def __str__(self):
attrs = [':'.join((a, str(getattr(self, a)))) for a in dir(self)
@@ -1192,10 +1197,13 @@
elemAttrs['type'] = deviceType
for attrName in attributes:
- if not hasattr(self, attrName):
+ if attrName in self.specParams:
+ attr = self.specParams[attrName]
+ elif hasattr(self, attrName):
+ attr = getattr(self, attrName)
+ else:
continue
- attr = getattr(self, attrName)
if isinstance(attr, dict):
element.appendChildWithArgs(attrName, **attr)
else:
@@ -1215,37 +1223,44 @@
class ControllerDevice(VmDevice):
+ def _defaults(self):
+ if self.device == 'virtio-serial':
+ if 'index' not in self.specParams:
+ self.index = '0'
+ if 'ports' not in self.specParams:
+ self.ports = '16'
def getXML(self):
"""
Create domxml for controller device
"""
ctrl = self.createXmlElem('controller', self.device,
- ['index', 'model', 'master', 'address'])
- if self.device == 'virtio-serial':
- ctrl.setAttrs(index='0', ports='16')
+ ['index', 'model', 'master', 'address',
+ 'ports'])
return ctrl
class VideoDevice(VmDevice):
+ def _defaults(self):
+ if 'vram' not in self.specParams:
+ self.specParams['vram'] = '32768'
+ if 'heads' not in self.specParams:
+ self.specParams['heads'] = '1'
def getXML(self):
"""
Create domxml for video device
"""
video = self.createXmlElem('video', None, ['address'])
- sourceAttrs = {'vram': self.specParams.get('vram', '32768'),
- 'heads': self.specParams.get('heads', '1')}
- if 'ram' in self.specParams:
- sourceAttrs['ram'] = self.specParams['ram']
+ model = self.createXmlElem('model', self.device,
+ ['vram', 'heads', 'ram'])
- video.appendChildWithArgs('model', type=self.device, **sourceAttrs)
+ video.appendChild(model)
return video
class SoundDevice(VmDevice):
-
def getXML(self):
"""
Create domxml for sound device
@@ -1256,7 +1271,6 @@
class NetworkInterfaceDevice(VmDevice):
-
def __init__(self, conf, log, **kwargs):
# pyLint can't tell that the Device.__init__() will
# set a nicModel attribute, so modify the kwarg list
@@ -1646,7 +1660,6 @@
class BalloonDevice(VmDevice):
-
def getXML(self):
"""
Create domxml for a memory balloon device.
@@ -1662,11 +1675,11 @@
class WatchdogDevice(VmDevice):
- def __init__(self, *args, **kwargs):
- super(WatchdogDevice, self).__init__(*args, **kwargs)
-
- if not hasattr(self, 'specParams'):
- self.specParams = {}
+ def _defaults(self):
+ if 'model' not in self.specParams:
+ self.specParams['model'] = 'i6300esb'
+ if 'action' not in self.specParams:
+ self.specParams['action'] = 'none'
def getXML(self):
"""
@@ -1677,9 +1690,8 @@
function='0x0'/>
</watchdog>
"""
- m = self.createXmlElem(self.type, None, ['address'])
- m.setAttrs(model=self.specParams.get('model', 'i6300esb'),
- action=self.specParams.get('action', 'none'))
+ m = self.createXmlElem(self.device, None, ['address', 'model',
+ 'action'])
return m
@@ -1692,11 +1704,8 @@
<address ... />
</smartcard>
"""
- card = self.createXmlElem(self.device, None, ['address'])
- sourceAttrs = {'mode': self.specParams['mode']}
- if sourceAttrs['mode'] != 'host':
- sourceAttrs['type'] = self.specParams['type']
- card.setAttrs(**sourceAttrs)
+ card = self.createXmlElem(self.device, None, ['address', 'mode',
+ 'type'])
return card
@@ -1713,6 +1722,12 @@
class ConsoleDevice(VmDevice):
+ def _defaults(self):
+ self.type = 'pty'
+ self.port = '0'
+ self.specParams['type'] = 'virtio'
+ self.specParams['port'] = '0'
+
def getXML(self):
"""
Create domxml for a console device.
@@ -1721,8 +1736,9 @@
<target type='virtio' port='0'/>
</console>
"""
- m = self.createXmlElem('console', 'pty')
- m.appendChildWithArgs('target', type='virtio', port='0')
+ m = self.createXmlElem(self.device, self.type)
+ m.appendChildWithArgs('target', None, type=self.specParams['type'],
+ port=self.specParams['port'])
return m
--
To view, visit http://gerrit.ovirt.org/21066
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idc8383cbce78490c8dfab1c253883a06459f1547
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpoledni(a)redhat.com>
9 years, 9 months
Change in vdsm[master]: gluster: [WIP]Get size information of gluster volume
by avishwan@redhat.com
Aravinda VK has uploaded a new change for review.
Change subject: gluster: [WIP]Get size information of gluster volume
......................................................................
gluster: [WIP]Get size information of gluster volume
Change-Id: I358d4f3bf793ecc1a01e0592d68919d1405f6e19
Signed-off-by: Aravinda VK <avishwan(a)redhat.com>
---
M client/vdsClientGluster.py
M vdsm.spec.in
M vdsm/gluster/Makefile.am
M vdsm/gluster/__init__.py
M vdsm/gluster/api.py
A vdsm/gluster/gfapi.py
6 files changed, 100 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/22/17822/1
diff --git a/client/vdsClientGluster.py b/client/vdsClientGluster.py
index 90af83e..644bfe3 100644
--- a/client/vdsClientGluster.py
+++ b/client/vdsClientGluster.py
@@ -424,6 +424,17 @@
pp.pprint(status)
return status['status']['code'], status['status']['message']
+ def do_glusterVolumeSize(self, args):
+ params = self._eqSplit(args)
+ try:
+ volumeName = params.get('volumeName', '')
+ except:
+ raise ValueError
+
+ status = self.s.glusterVolumeSize(volumeName)
+ pp.pprint(status)
+ return status['status']['code'], status['status']['message']
+
def getGlusterCmdDict(serv):
return \
@@ -705,4 +716,9 @@
'not set'
'(swift, glusterd, smb, memcached)'
)),
+ 'glusterVolumeSize': (
+ serv.do_glusterVolumeSize,
+ ('volumeName=<volume name>',
+ 'Returns total, available and used space status of gluster volume'
+ )),
}
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 21b3565..e49e102 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -1271,6 +1271,7 @@
%doc COPYING
%{_datadir}/%{vdsm_name}/gluster/api.py*
%{_datadir}/%{vdsm_name}/gluster/vdsmapi-gluster-schema.json
+%{_datadir}/%{vdsm_name}/gluster/gfapi.py*
%{_datadir}/%{vdsm_name}/gluster/hooks.py*
%{_datadir}/%{vdsm_name}/gluster/services.py*
%endif
diff --git a/vdsm/gluster/Makefile.am b/vdsm/gluster/Makefile.am
index dd5434d..9c2989f 100644
--- a/vdsm/gluster/Makefile.am
+++ b/vdsm/gluster/Makefile.am
@@ -26,6 +26,7 @@
api.py \
cli.py \
exception.py \
+ gfapi.py \
hooks.py \
hostname.py \
services.py \
diff --git a/vdsm/gluster/__init__.py b/vdsm/gluster/__init__.py
index bec70ea..e5a2fd6 100644
--- a/vdsm/gluster/__init__.py
+++ b/vdsm/gluster/__init__.py
@@ -22,7 +22,7 @@
import tempfile
from functools import wraps
-MODULE_LIST = ('cli', 'hooks', 'services')
+MODULE_LIST = ('cli', 'hooks', 'services', 'gfapi')
def makePublic(func):
diff --git a/vdsm/gluster/api.py b/vdsm/gluster/api.py
index 4bd8308..89546c1 100644
--- a/vdsm/gluster/api.py
+++ b/vdsm/gluster/api.py
@@ -287,6 +287,22 @@
status = self.svdsmProxy.glusterServicesGet(serviceNames)
return {'services': status}
+ @exportAsVerb
+ def volumeSize(self, volumeName, options=None):
+ data = self.svdsmProxy.glusterVolumeStatvfs(volumeName)
+ # f_blocks = Total number of blocks
+ # f_bfree = Total number of blocks free
+ # f_bavail = Total number of blocks available for non root user
+ # total blocks available = f_blocks - (f_bfree - f_bavail)
+ total_blocks_available = data['f_blocks'] - \
+ (data['f_bfree'] - data['f_bavail'])
+ return {
+ 'total': total_blocks_available * data.f_bsize / 1024,
+ 'free': data['f_bavail'] * data['f_bsize'] / 1024,
+ 'used': (total_blocks_available - data['f_bavail']) * \
+ data['f_bsize'] / 1024
+ }
+
def getGlusterMethods(gluster):
l = []
diff --git a/vdsm/gluster/gfapi.py b/vdsm/gluster/gfapi.py
new file mode 100644
index 0000000..abfdabd
--- /dev/null
+++ b/vdsm/gluster/gfapi.py
@@ -0,0 +1,65 @@
+#
+# Copyright 2013 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
+#
+from ctypes import *
+
+# import exception as ge
+from . import makePublic
+
+GLUSTER_VOL_PROTOCAL='tcp'
+GLUSTER_VOL_HOST='localhost'
+GLUSTER_VOL_PORT=24007
+
+class Stat (Structure):
+ _fields_ = [
+ ('f_bsize', c_ulong),
+ ('f_frsize', c_ulong),
+ ('f_blocks', c_ulong),
+ ('f_bfree', c_ulong),
+ ('f_bavail', c_ulong),
+ ('f_files', c_ulong),
+ ('f_ffree', c_ulong),
+ ('f_favail', c_ulong),
+ ('f_fsid', c_ulong),
+ ('f_flag', c_ulong),
+ ('f_namemax', c_ulong),
+ ('__f_spare', c_int * 6),
+ ]
+
+
+api = CDLL("libgfapi.so",RTLD_GLOBAL)
+api.glfs_statvfs.restype = c_int
+api.glfs_statvfs.argtypes = [c_void_p, c_char_p, POINTER(Stat)]
+
+@makePublic
+def volumeStatvfs(volumeId):
+ path = "/"
+ fs = api.glfs_new(volumeId)
+ api.glfs_set_volfile_server(fs,
+ GLUSTER_VOL_PROTOCAL,
+ GLUSTER_VOL_HOST,
+ GLUSTER_VOL_PORT)
+ api.glfs_init(fs)
+
+ x = Stat()
+ rc = api.glfs_statvfs(fs, path, byref(x))
+ statvfsData = {}
+ for k in x._fields_:
+ statvfsData[k[0]] = getattr(x, k[0])
+ return statvfsData
--
To view, visit http://gerrit.ovirt.org/17822
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I358d4f3bf793ecc1a01e0592d68919d1405f6e19
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Aravinda VK <avishwan(a)redhat.com>
9 years, 9 months
Change in vdsm[master]: xmlrpc: Fix connection reset on Python 2.6
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: xmlrpc: Fix connection reset on Python 2.6
......................................................................
xmlrpc: Fix connection reset on Python 2.6
When request is aborted before the reading the entire request, closing the
socket cause the other side to receive connection reset, and loose the response
data. Python 2.7 introduced the shutdown_request method, fixing this issue.
This patch check if SimpleXMLRPCServer has the shutdown_request method, and if
not, do a clean request shutdwon in close_request.
Change-Id: Id77a32bb0d4fff13ee680eade52a2f60e4e808b5
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M lib/vdsm/utils.py
1 file changed, 17 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/26/24026/1
diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py
index 9429308..eeea5d4 100644
--- a/lib/vdsm/utils.py
+++ b/lib/vdsm/utils.py
@@ -158,6 +158,23 @@
logRequests, allow_none, encoding,
bind_and_activate)
+ # Fix for connection reset issue when running on Python 2.6. This happens
+ # when request is aborted before the reading the entire request. Closing
+ # the socket cause the other side to receive connection reset, and loose
+ # the response data. Python 2.7 introduced the shutdown_request method,
+ # fixing this issue. If we run on a version without this method, we will do
+ # a clean shutdown in close_request instead.
+ if not hasattr(SimpleXMLRPCServer, 'shutdown_request'):
+ def close_request(self, request):
+ # From Python 2.7 SocketServer.TCPServer.shutdown_request
+ try:
+ # Explicitly shutdown. socket.close() merely releases the
+ # socket and waits for GC to perform the actual close.
+ request.shutdown(socket.SHUT_WR)
+ except socket.error:
+ pass # Some platforms may raise ENOTCONN here
+ SimpleXMLRPCServer.close_request(self, request)
+
#Threaded version of SimpleXMLRPCServer
class SimpleThreadedXMLRPCServer(SocketServer.ThreadingMixIn,
--
To view, visit http://gerrit.ovirt.org/24026
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id77a32bb0d4fff13ee680eade52a2f60e4e808b5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
9 years, 9 months
Change in vdsm[master]: sp: Remove redundant validation
by sgotliv@redhat.com
Sergey Gotliv has uploaded a new change for review.
Change subject: sp: Remove redundant validation
......................................................................
sp: Remove redundant validation
Before deactivating storage domain we validate that this domain is a
member of the pool. It seems that we performed that validation twice,
first time by calling validatePoolSD and second time by checking in the
list of the pooled domains.
Change-Id: I7bd94c40655c08ace5262d39b3087edc542f94b1
Signed-off-by: Sergey Gotliv <sgotliv(a)redhat.com>
---
M vdsm/storage/sp.py
1 file changed, 1 insertion(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/53/24453/1
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index a020e1e..638dfc7 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -1052,10 +1052,6 @@
self.validatePoolSD(sdUUID)
self.log.info("sdUUID=%s spUUID=%s newMsdUUID=%s", sdUUID, self.spUUID,
newMsdUUID)
- domList = self.getDomains()
-
- if sdUUID not in domList:
- raise se.StorageDomainNotInPool(self.spUUID, sdUUID)
try:
dom = sdCache.produce(sdUUID)
@@ -1095,6 +1091,7 @@
self.log.error("Can't umount masterDir %s for domain "
"%s", masterDir, dom)
+ domList = self.getDomains()
domList[sdUUID] = sd.DOM_ATTACHED_STATUS
self._backend.setDomainsMap(domList)
self.updateMonitoringThreads()
--
To view, visit http://gerrit.ovirt.org/24453
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7bd94c40655c08ace5262d39b3087edc542f94b1
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Sergey Gotliv <sgotliv(a)redhat.com>
9 years, 9 months
Change in vdsm[master]: make check: add a pylint check
by Dan Kenigsberg
Dan Kenigsberg has uploaded a new change for review.
Change subject: make check: add a pylint check
......................................................................
make check: add a pylint check
pylint reports of plenty errors in our code, some of them are only style
issues in our code or code that we use, but some are real.
This patch follows Lukas Bednar suggestion, and starts adding pylint
check gradually. Please add more modules as they are cleaned up.
If pylint slows down you build too much, circumvent it with
make check-local PYLINT=true
Change-Id: Ie03052473caec201aa8ade7929ef1fce5fbc24a4
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M Makefile.am
M configure.ac
M debian/control
A pylint_blacklist
M vdsm.spec.in
5 files changed, 118 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/82/24382/1
diff --git a/Makefile.am b/Makefile.am
index 9b1a3c9..1539459 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -92,6 +92,13 @@
echo "Missing $${i%%.in} in .gitignore"; exit 1; fi; \
done; \
fi;
+ all=`mktemp`; \
+ find * -path './.git' -prune -type f -o \
+ -name '*.py' -o -name '*.py.in' | LC_ALL=C sort > $$all ; \
+ LC_ALL=C comm -2 -3 $$all pylint_blacklist | \
+ xargs $(PYLINT) -E --msg-template=\
+ "{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" ; \
+ rm $$all
all-local: \
vdsm.spec
diff --git a/configure.ac b/configure.ac
index 55879e7..dacb2e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -164,6 +164,11 @@
AC_MSG_WARN([python-pep8 not found])
fi
+AC_PATH_PROG([PYLINT], [pylint])
+if test "x$PYLINT" = "x"; then
+ AC_MSG_WARN([pylint not found])
+fi
+
# Checking for python-devel
AC_PATH_PROG([PYTHON_CONFIG], [python-config])
if test "x$PYTHON_CONFIG" = "x"; then
diff --git a/debian/control b/debian/control
index 45c2b1c..526a9a2 100644
--- a/debian/control
+++ b/debian/control
@@ -15,6 +15,7 @@
pep8,
psmisc (>= 22.6),
pyflakes,
+ pylint,
python (>=2.7.3),
python-dev,
python-cpopen (>= 1.3),
diff --git a/pylint_blacklist b/pylint_blacklist
new file mode 100644
index 0000000..5254349
--- /dev/null
+++ b/pylint_blacklist
@@ -0,0 +1,104 @@
+client/vdsClientGluster.py
+lib/vdsm/SecureXMLRPCServer.py
+lib/vdsm/ipwrapper.py
+lib/vdsm/netinfo.py
+lib/vdsm/tool/configurator.py
+lib/vdsm/tool/load_needed_modules.py.in
+lib/vdsm/tool/service.py
+lib/vdsm/tool/transient.py
+lib/vdsm/tool/upgrade.py
+lib/vdsm/tool/upgrade_300_networks.py
+lib/vdsm/tool/validate_ovirt_certs.py.in
+lib/vdsm/tool/vdsm-id.py
+lib/vdsm/vdscli.py.in
+lib/yajsonrpc/__init__.py
+tests/apiTests.py
+tests/cPopenTests.py
+tests/capsTests.py
+tests/configNetworkTests.py
+tests/fileUtilTests.py
+tests/fileVolumeTests.py
+tests/functional/momTests.py
+tests/functional/networkTests.py
+tests/functional/sosPluginTests.py
+tests/functional/storageTests.py
+tests/functional/supervdsmFuncTests.py
+tests/functional/utils.py
+tests/functional/virtTests.py
+tests/fuserTests.py
+tests/getAllVolumesTests.py
+tests/gluster_cli_tests.py
+tests/guestIFTests.py
+tests/hooksTests.py
+tests/ipwrapperTests.py
+tests/iscsiTests.py
+tests/jsonRpcTests.py
+tests/ksmTests.py
+tests/libvirtconnectionTests.py
+tests/lsblkTests.py
+tests/lvmTests.py
+tests/main.py
+tests/md_utils_tests.py
+tests/miscTests.py
+tests/mkimageTests.py
+tests/monkeypatchTests.py
+tests/mountTests.py
+tests/netconfTests.py
+tests/netconfpersistenceTests.py
+tests/netinfoTests.py
+tests/netmodelsTests.py
+tests/outOfProcessTests.py
+tests/parted_utils_tests.py
+tests/permutationTests.py
+tests/persistentDictTests.py
+tests/remoteFileHandlerTests.py
+tests/resourceManagerTests.py
+tests/schemaTests.py
+tests/sslTests.py
+tests/storageMailboxTests.py
+tests/tcTests.py
+tests/transportWrapperTests.py
+tests/utilsTests.py
+tests/vdsClientTests.py
+tests/vmTests.py
+tests/volumeTests.py
+vdsm/BindingXMLRPC.py
+vdsm/caps.py
+vdsm/clientIF.py
+vdsm/configNetwork.py
+vdsm/debugPluginClient.py
+vdsm/gluster/api.py
+vdsm/gluster/cli.py
+vdsm/gluster/hooks.py
+vdsm/gluster/services.py
+vdsm/gluster/tasks.py
+vdsm/guestIF.py
+vdsm/mkimage.py
+vdsm/momIF.py
+vdsm/netconf/ifcfg.py
+vdsm/netconf/iproute2.py
+vdsm/netmodels.py
+vdsm/sos/vdsm.py.in
+vdsm/sourceRoute.py
+vdsm/sourceRouteThread.py
+vdsm/storage/blockSD.py
+vdsm/storage/blockVolume.py
+vdsm/storage/fileSD.py
+vdsm/storage/fileVolume.py
+vdsm/storage/glusterSD.py
+vdsm/storage/glusterVolume.py
+vdsm/storage/hsm.py
+vdsm/storage/iscsi.py
+vdsm/storage/localFsSD.py
+vdsm/storage/misc.py
+vdsm/storage/nfsSD.py
+vdsm/storage/resourceManager.py
+vdsm/storage/sd.py
+vdsm/storage/sp.py
+vdsm/storage/storageServer.py
+vdsm/storage/volume.py
+vdsm/supervdsm.py
+vdsm/vm.py
+vdsm/vmChannels.py
+vdsm_reg/engine.py.in
+vdsm_reg/register-to-engine.py
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 7eff7c1..268a98e 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -94,6 +94,7 @@
%if !0%{?rhel}
BuildRequires: pyflakes
+BuildRequires: pylint
BuildRequires: python-pep8
%endif
--
To view, visit http://gerrit.ovirt.org/24382
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie03052473caec201aa8ade7929ef1fce5fbc24a4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
9 years, 9 months