[NEW PATCH] Update the rpm pre scriptlet (via gerrit-bot)
by Federico Simoncelli
New patch submitted by Federico Simoncelli (fsimonce(a)redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/911
commit b3f9679f6866a091e3f65a406a73a0ca9121db2d
Author: Federico Simoncelli <fsimonce(a)redhat.com>
Date: Wed Sep 7 12:12:57 2011 +0000
Update the rpm pre scriptlet
Change-Id: I8effe06b95b008eafff63a75a16f0518788bd9af
diff --git a/vdsm.spec.in b/vdsm.spec.in
index f1a3473..d2a7411 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -63,8 +63,9 @@ make check
%{__rm} -rf %{buildroot}
%pre
-getent passwd vdsm > /dev/null || /usr/sbin/useradd -u 36 -g kvm -o -r vdsm -c "RHEV node manager" -d / -s /sbin/nologin
-/usr/sbin/usermod -a -G qemu vdsm
+useradd -r -u 36 -g kvm -d /var/lib/vdsm \
+ -s /sbin/nologin -c "Node Virtualization Manager" vdsm
+usermod -a -G qemu vdsm
%post
tmp_sudoers=$(mktemp)
11 years, 5 months
[NEW PATCH] [WIP] Use vdsm-tool to check sudoers (via gerrit-bot)
by Federico Simoncelli
New patch submitted by Federico Simoncelli (fsimonce(a)redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/912
commit d72bbaa261fbb5c026641742cec5d81160fb91b6
Author: Federico Simoncelli <fsimonce(a)redhat.com>
Date: Wed Sep 7 14:41:01 2011 +0000
[WIP] Use vdsm-tool to check sudoers
Change-Id: I6b1bd8b9b9307d867661dd5df698ce7ecc6b4843
diff --git a/vdsm.spec.in b/vdsm.spec.in
index d2a7411..2f3f66a 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -68,26 +68,7 @@ useradd -r -u 36 -g kvm -d /var/lib/vdsm \
usermod -a -G qemu vdsm
%post
-tmp_sudoers=$(mktemp)
-cp -a /etc/sudoers $tmp_sudoers
-/bin/sed -i -e "/# vdsm/,/# end vdsm/d" $tmp_sudoers
-
-if ! grep -q "^#includedir /etc/sudoers.d" "$tmp_sudoers";
-then
- cat >> $tmp_sudoers <<EOF
-# vdsm customizations
-#include /etc/sudoers.d/50_vdsm
-# end vdsm customizations
-EOF
-fi
-
-if outerr=$(/usr/sbin/visudo -c -f $tmp_sudoers 2>&1) ; then
- /bin/cp -a $tmp_sudoers /etc/sudoers
-else
- echo "Failed to add vdsm section to /etc/sudoers" 1>&2
- echo "$outerr" 1>&2
-fi
-rm -f $tmp_sudoers
+vdsm-tool check-sudoers
# vdsm is intentionally on by default.
/sbin/chkconfig --add vdsmd
@@ -229,6 +210,7 @@ machines without running real guests.
%dir %{_libexecdir}/%{vdsm_name}
%dir %{_datadir}/%{vdsm_name}
%dir %{_datadir}/%{vdsm_name}/storage
+%{_sbindir}/vdsm-tool
%{_datadir}/%{vdsm_name}/define.py*
%{_datadir}/%{vdsm_name}/clientIF.py*
%{_datadir}/%{vdsm_name}/caps.py*
diff --git a/vdsm/Makefile.am b/vdsm/Makefile.am
index 98d4b81..d139db9 100644
--- a/vdsm/Makefile.am
+++ b/vdsm/Makefile.am
@@ -36,6 +36,9 @@ dist_vdsm_DATA = \
vdsmDebugPlugin.py \
vm.py
+dist_sbin_SCRIPTS = \
+ vdsm-tool
+
dist_vdsm_SCRIPTS = \
addNetwork \
delNetwork \
diff --git a/vdsm/vdsm-tool b/vdsm/vdsm-tool
new file mode 100644
index 0000000..d7a3cf8
--- /dev/null
+++ b/vdsm/vdsm-tool
@@ -0,0 +1,113 @@
+#!/usr/bin/python
+# Copyright 2011 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
+#
+
+import os
+import sys
+import re
+import getopt
+
+SUDOERS_FILE="/etc/sudoers"
+SUDOERS_LOCK="/etc/sudoers.tmp"
+
+PATTERN_INCLUDEDIR = "^#includedir\s+/etc/sudoers.d"
+PATTERN_VDSMFILE = "^#include\s+/etc/sudoers.d/50_vdsm"
+
+class SudoersLock(object):
+ def __init__(self):
+ self.fd = None
+ self.activate = False
+
+ def __enter__(self):
+ self.fd = os.open(SUDOERS_LOCK, os.O_CREAT|os.O_WRONLY|os.O_EXCL)
+ os.chmod(SUDOERS_LOCK, 288)
+ return self
+
+ def __exit__(self, exc_type, exc_value, traceback):
+ os.close(self.fd)
+
+ if not self.activate:
+ os.unlink(SUDOERS_LOCK)
+ else:
+ ret = os.system("visudo -q -c -f '%s'" % SUDOERS_LOCK)
+ if ret != 0:
+ raise RuntimeError("Check for the new sudoers failed")
+ os.rename(SUDOERS_LOCK, SUDOERS_FILE)
+
+ def write(self, buf):
+ os.write(self.fd, buf)
+
+def check_sudoers():
+ with SudoersLock() as sudoers_lock:
+ with file(SUDOERS_FILE) as sudoers_file:
+ sudoers = sudoers_file.read()
+
+ if re.search(PATTERN_INCLUDEDIR, sudoers, re.MULTILINE):
+ return True
+
+ if re.search(PATTERN_VDSMFILE, sudoers, re.MULTILINE):
+ return True
+
+ sudoers_lock.write(sudoers)
+ sudoers_lock.write("\n"
+ "# Node Virtualization Manager\n"
+ "#include /etc/sudoers.d/50_vdsm\n")
+ sudoers_lock.activate = True
+
+commands = {
+ 'check-sudoers': (check_sudoers, "adjust sudoers file for vdsm")
+}
+
+def usage_and_exit(exit_code):
+ print "Usage: %s [options] <command>\n" % sys.argv[0]
+
+ print "Valid options:"
+ print " -h, --help\n"
+
+ print "Valid commands:"
+ for cmd, info in commands.items():
+ print " %-20s %s" % (cmd, info[1])
+
+ print
+ sys.exit(exit_code)
+
+def main():
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], "h", ["help"])
+ except getopt.GetoptError, err:
+ usage_and_exit(1)
+
+ if len(args) < 1:
+ usage_and_exit(1)
+
+ cmd = args[0]
+
+ if cmd not in commands.keys():
+ usage_and_exit(1)
+
+ try:
+ commands[cmd][0]()
+ except Exception, e:
+ print "Error:", e
+ sys.exit(1)
+
+if __name__ == "__main__":
+ main()
+
+# vim: set et ts=4 :
11 years, 5 months
[NEW PATCH] [WIP] Use vdsm-tool to set libvirt password (via gerrit-bot)
by Federico Simoncelli
New patch submitted by Federico Simoncelli (fsimonce(a)redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/921
commit cfd565a2657a96c798e4a823206ebd72fd169920
Author: Federico Simoncelli <fsimonce(a)redhat.com>
Date: Thu Sep 8 10:49:00 2011 +0000
[WIP] Use vdsm-tool to set libvirt password
Change-Id: I952fe699f0110d173f0941713560125654edeac5
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 0aeeda4..871d93b 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -69,25 +69,11 @@ make check
%post
/usr/sbin/vdsm-tool install-sudoers
+/usr/sbin/vdsm-tool install-libvirtpass
# vdsm is intentionally on by default.
/sbin/chkconfig --add vdsmd
-# create vdsm "secret" password for libvirt, if none exists
-pfile=/etc/pki/%{vdsm_name}/keys/libvirt_password
-if [[ ! -f "$pfile" ]];
-then
- umask 077
- echo -n shibboleth > "$pfile"
- /bin/chown vdsm:kvm "$pfile"
- new_pwd=1
-fi
-if ! /usr/sbin/sasldblistusers2 -f /etc/libvirt/passwd.db 2>- | \
- /bin/grep -q '^vdsm@rhevh\b' || [[ -n "$new_pwd" ]] ;
-then
- /usr/sbin/saslpasswd2 -p -a libvirt vdsm@rhevh < "$pfile"
-fi
-
%preun
if [ "$1" -eq 0 ]
then
diff --git a/vdsm/vdsm-tool b/vdsm/vdsm-tool
index 615fe25..6841fdf 100755
--- a/vdsm/vdsm-tool
+++ b/vdsm/vdsm-tool
@@ -22,10 +22,15 @@ import os
import sys
import re
import getopt
+import subprocess
SUDOERS_FILE = "/etc/sudoers"
SUDOERS_LOCK = "/etc/sudoers.tmp"
+LIBVIRTPASS_DEFAULT = "shibboleth"
+LIBVIRTPASS_FILE = "/etc/pki/vdsm/keys/libvirt_password"
+LIBVIRTAUTH_FILE = "/etc/libvirt/passwd.db"
+
PATTERN_INCLUDEDIR = "^#includedir\s+/etc/sudoers.d"
PATTERN_VDSMFILE = "^#include\s+/etc/sudoers.d/50_vdsm"
@@ -73,8 +78,27 @@ def install_sudoers():
"#include /etc/sudoers.d/50_vdsm\n")
sudoers_lock.activate = True
+def install_libvirtpass():
+ if os.path.exists(LIBVIRTPASS_FILE):
+ return
+
+ fd = open_lock(LIBVIRTPASS_FILE)
+ try:
+ os.write(fd, LIBVIRTPASS_DEFAULT)
+ finally:
+ os.close(fd)
+
+ saslpw = subprocess.Popen(["saslpasswd2", "-p", "-a", "libvirt",
+ "vdsm@rhevh"], stdin=subprocess.PIPE)
+ saslpw.communicate(LIBVIRTPASS_DEFAULT)
+
+ ret = saslpw.wait()
+ if (ret != 0):
+ raise RuntimeError("Unable to set libvirt password")
+
commands = {
'install-sudoers': (install_sudoers, "adjust sudoers file for vdsm"),
+ 'install-libvirtpass': (install_libvirtpass, "add a password to access libvirt"),
}
def usage_and_exit(exit_code):
11 years, 5 months
[NEW PATCH] Related BZ#720385 - Report disk latency (read , write & flush ) for each storage device. (via gerrit-bot)
by Igor Lvovsky
New patch submitted by Igor Lvovsky (ilvovsky(a)redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/935
commit 21cfe4c8c08191908142fcfa98346f811fd90739
Author: Igor Lvovsky <ilvovsky(a)redhat.com>
Date: Wed Sep 14 16:37:36 2011 +0300
Related BZ#720385 - Report disk latency (read , write & flush ) for each storage device.
This patch temporary return zeros instead of real latency values.
The real values will be returned when libvirt will support python binding for virDomainQemuMonitor command.
Change-Id: Id0d3d4869bcf35ed4d2ff72a5e1ef7aa21fe3455
diff --git a/vdsm/config.py b/vdsm/config.py
index 217b58c..7ad29d9 100644
--- a/vdsm/config.py
+++ b/vdsm/config.py
@@ -80,6 +80,8 @@ config.set('vars', 'vm_sample_cpu_interval', '15')
config.set('vars', 'vm_sample_cpu_window', '2')
config.set('vars', 'vm_sample_disk_interval', '60')
config.set('vars', 'vm_sample_disk_window', '2')
+config.set('vars', 'vm_sample_disk_latency_interval', '60')
+config.set('vars', 'vm_sample_disk_latency_window', '2')
config.set('vars', 'vm_sample_net_interval', '5')
config.set('vars', 'vm_sample_net_window', '2')
diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index 221589b..4b1fb8b 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -56,12 +56,15 @@ class VmStatsThread(utils.AdvancedStatsThread):
self.sampleDisk = utils.AdvancedStatsFunction(self._sampleDisk,
config.getint('vars', 'vm_sample_disk_interval'),
config.getint('vars', 'vm_sample_disk_window'))
+ self.sampleDiskLatency = utils.AdvancedStatsFunction(self._sampleDiskLatency,
+ config.getint('vars', 'vm_sample_disk_latency_interval'),
+ config.getint('vars', 'vm_sample_disk_latency_window'))
self.sampleNet = utils.AdvancedStatsFunction(self._sampleNet,
config.getint('vars', 'vm_sample_net_interval'),
config.getint('vars', 'vm_sample_net_window'))
- self.addStatsFunction(self.highWrite, self.updateVolumes,
- self.sampleCpu, self.sampleDisk, self.sampleNet)
+ self.addStatsFunction(self.highWrite, self.updateVolumes, self.sampleCpu,
+ self.sampleDisk, self.sampleDiskLatency, self.sampleNet)
def _highWrite(self):
if self._vm._incomingMigrationPending():
@@ -107,6 +110,17 @@ class VmStatsThread(utils.AdvancedStatsThread):
diskSamples[vmDrive.name] = self._vm._dom.blockStats(vmDrive.name)
return diskSamples
+ def _sampleDiskLatency(self):
+ if not self._vm._volumesPrepared:
+ # Avoid queries from storage during recovery process
+ return
+
+ diskLatency = {}
+ for vmDrive in self._vm._drives:
+ # Will be done by virDomainQemuMonitor
+ diskLatency[vmDrive.name] = ()
+ return diskLatency
+
def _sampleNet(self):
netSamples = {}
for vmIface in self._vm.interfaces.keys():
@@ -175,6 +189,22 @@ class VmStatsThread(utils.AdvancedStatsThread):
stats[dName] = dStats
+ def _getDiskLatency(self, stats):
+ sInfo, eInfo, sampleInterval = self.sampleDiskLatency.getStats()
+
+ for vmDrive in self._vm._drives:
+ dName = vmDrive.name
+
+ dLatency = {'readLatency': '0.00',
+ 'writeLatency': '0.00',}
+ try:
+ dLatency['readLatency'] = '0.00'
+ dLatency['writeLatency'] = '0.00'
+ except (KeyError, TypeError):
+ self._log.debug("Disk latency not available")
+
+ stats[dName].update(dLatency)
+
def get(self):
stats = {}
@@ -187,6 +217,7 @@ class VmStatsThread(utils.AdvancedStatsThread):
self._getCpuStats(stats)
self._getNetworkStats(stats)
self._getDiskStats(stats)
+ self._getDiskLatency(stats)
return stats
11 years, 5 months
[NEW PATCH] BZ#736301 - Don't fail lvm.getVGbyUUID() if unredable VGs found. (via gerrit-bot)
by ewarszaw@redhat.com
New patch submitted by Eduardo Warszawski (ewarszaw(a)redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/930
commit e945109a87795cef5c32150b574228c31fc6aea7
Author: Eduardo Warszawski <ewarszaw(a)redhat.com>
Date: Tue Sep 13 10:39:31 2011 +0300
BZ#736301 - Don't fail lvm.getVGbyUUID() if unredable VGs found.
Change-Id: Ief82082ebb3cfb6731dc9c7905f2844c60a7f425
diff --git a/vdsm/storage/lvm.py b/vdsm/storage/lvm.py
index 9bf8533..257616d 100644
--- a/vdsm/storage/lvm.py
+++ b/vdsm/storage/lvm.py
@@ -820,12 +820,18 @@ def getVG(vgName):
def getAllVGs():
return _lvminfo.getAllVgs() #returns list
-
+# TODO: lvm VG UUID should not be exposed.
+# Remove this function when hsm.public_createVG is removed.
def getVGbyUUID(vgUUID):
# cycle through all the VGs until the one with the given UUID found
for vg in getAllVGs():
- if vg.uuid == vgUUID:
- return vg
+ try:
+ if vg.uuid == vgUUID:
+ return vg
+ except AttributeError, e:
+ # An unreloadable VG found but may be we are not looking for it.
+ log.debug("%s" % e.message, exc_info=True)
+ continue
# If not cry loudly
raise se.VolumeGroupDoesNotExist("vg_uuid: %s" % vgUUID)
11 years, 5 months
[PATCH] fileSD: Fix remotePath in SD metadata (V3)
by agl@us.ibm.com
Changes since V2:
- Rename mountToRemotePath() to getRealPath() and define it in each child
class.
Changes since V1:
- Derive the remotePath from self.mountpoint instead of using the metadata
The current method for gathering a LOCALFS Storage Domain's remotePath
property does not work because these domains are connected with a symlink,
not a mount. Fix up the current code so that it handles links and
mountpoints.
In the code I have noticed some sentiments that path information should be
removed from the storage domain metadata. I strongly disagree with this
idea. The path is a critical piece of information. End users will care a
lot about the path because it is where their images are located. This
informaton is also useful for calling connectStorageServer() and
disconnectStorageServer().
Signed-off-by: Adam Litke <agl(a)us.ibm.com>
---
vdsm/storage/fileSD.py | 16 ++++++++--------
vdsm/storage/localFsSD.py | 3 +++
vdsm/storage/nfsSD.py | 6 ++++++
3 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py
index 35f7ab3..5058b89 100644
--- a/vdsm/storage/fileSD.py
+++ b/vdsm/storage/fileSD.py
@@ -24,7 +24,6 @@ import logging
import glob
import sd
-import fileUtils
import storage_exception as se
import fileVolume
import image
@@ -224,6 +223,13 @@ class FileStorageDomain(sd.StorageDomain):
def getRemotePath(self):
return self.remotePath
+ def getRealPath(self):
+ """
+ Return the actual path to the underlying storage.
+ This function needs to be overloaded by the child classes.
+ """
+ return ""
+
def getInfo(self):
"""
Get storage domain info
@@ -232,13 +238,7 @@ class FileStorageDomain(sd.StorageDomain):
# First call parent getInfo() - it fills in all the common details
info = sd.StorageDomain.getInfo(self)
# Now add fileSD specific data
- info['remotePath'] = ''
- mounts = fileUtils.getMounts()
- for mount in mounts:
- if self.mountpoint == mount[1]:
- info['remotePath'] = mount[0]
- break
-
+ info['remotePath'] = self.getRealPath()
return info
def getStats(self):
diff --git a/vdsm/storage/localFsSD.py b/vdsm/storage/localFsSD.py
index 6a61979..e07426e 100644
--- a/vdsm/storage/localFsSD.py
+++ b/vdsm/storage/localFsSD.py
@@ -93,5 +93,8 @@ class LocalFsStorageDomain(fileSD.FileStorageDomain):
raise se.StorageDomainDoesNotExist(sdUUID)
+ def getRealPath(self):
+ return os.readlink(self.mountpoint)
+
def findDomain(sdUUID):
return LocalFsStorageDomain(LocalFsStorageDomain.findDomainPath(sdUUID))
diff --git a/vdsm/storage/nfsSD.py b/vdsm/storage/nfsSD.py
index 51dc31f..d4b2759 100644
--- a/vdsm/storage/nfsSD.py
+++ b/vdsm/storage/nfsSD.py
@@ -138,6 +138,12 @@ class NfsStorageDomain(fileSD.FileStorageDomain):
raise se.StorageDomainDoesNotExist(sdUUID)
+ def getRealPath(self):
+ for mount in fileUtils.getMounts():
+ if self.mountpoint == mount[1]:
+ return mount[0]
+ return ""
+
def findDomain(sdUUID):
return NfsStorageDomain(NfsStorageDomain.findDomainPath(sdUUID))
--
1.7.6
--
Adam Litke <agl(a)us.ibm.com>
IBM Linux Technology Center
11 years, 5 months
fileSD: Fix remotePath in SD metadata (V2)
by agl@us.ibm.com
Changes since V1:
- Derive the remotePath from self.mountpoint instead of using the metadata
The current method for gathering a LOCALFS Storage Domain's remotePath property
does not work because these domains are connected with a symlink, not a mount.
Fix up the current code so that it handles links and mountpoints.
In the code I have noticed some sentiments that path information should be
removed from the storage domain metadata. I strongly disagree with this idea.
The path is a critical piece of information. End users will care a lot about
the path because it is where their images are located. This informaton is also
useful for calling connectStorageServer() and disconnectStorageServer().
Signed-off-by: Adam Litke <agl(a)us.ibm.com>
diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py
index 35f7ab3..e904bfe 100644
--- a/vdsm/storage/fileSD.py
+++ b/vdsm/storage/fileSD.py
@@ -38,7 +38,9 @@ import time
REMOTE_PATH = "REMOTE_PATH"
FILE_SD_MD_FIELDS = sd.SD_MD_FIELDS.copy()
-# TBD: Do we really need this key?
+# Do we really need this key?
+# Answer: Yes. The path is an important part of the SD metadata and is useful
+# information for end-users. It can also be used to manage storage connections.
FILE_SD_MD_FIELDS[REMOTE_PATH] = (str, str)
def getDomUuidFromMetafilePath(metafile):
@@ -224,6 +226,19 @@ class FileStorageDomain(sd.StorageDomain):
def getRemotePath(self):
return self.remotePath
+ def mountToRemotePath(self):
+ """
+ Get the remote path based on the storage mountpoint.
+ Handle symlinks and mounts.
+ """
+ if os.path.islink(self.mountpoint):
+ return os.readlink(self.mountpoint)
+ elif os.path.isdir(self.mountpoint):
+ for mount in fileUtils.getMounts():
+ if self.mountpoint == mount[1]:
+ return mount[0]
+ return ''
+
def getInfo(self):
"""
Get storage domain info
@@ -232,13 +247,7 @@ class FileStorageDomain(sd.StorageDomain):
# First call parent getInfo() - it fills in all the common details
info = sd.StorageDomain.getInfo(self)
# Now add fileSD specific data
- info['remotePath'] = ''
- mounts = fileUtils.getMounts()
- for mount in mounts:
- if self.mountpoint == mount[1]:
- info['remotePath'] = mount[0]
- break
-
+ info['remotePath'] = self.mountToRemotePath()
return info
def getStats(self):
--
Adam Litke <agl(a)us.ibm.com>
IBM Linux Technology Center
11 years, 6 months
[NEW PATCH] [WIP] BZ#732980 Handle 4K block size LUN properly (via gerrit-bot)
by Federico Simoncelli
New patch submitted by Federico Simoncelli (fsimonce(a)redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/855
commit 00475aaf5591a23cf5c3215dd9c659503bc3d979
Author: Federico Simoncelli <fsimonce(a)redhat.com>
Date: Fri Aug 26 15:16:15 2011 +0000
[WIP] BZ#732980 Handle 4K block size LUN properly
Change-Id: If303fac85a29bed7b989b0b6302fc4c83075f500
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index f83316c..c7b3288 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -757,6 +757,7 @@ class HSM:
'devtype': dev.get("devtype", ""),
'pathstatus': dev.get("paths", []),
'pathlist': dev.get("connections", []),
+ 'blocksize': dev.get("blocksize", ""),
'partitioned': partitioned}
for path in devInfo["pathstatus"]:
path["lun"] = path["hbtl"].lun
@@ -838,14 +839,20 @@ class HSM:
knowndevs = list(multipath.getMPDevNamesIter())
devices = []
devSizes = []
+ devBlkSz = set()
for dev in devlist:
if dev in knowndevs:
devices.append(dev)
devSizes.append(multipath.getDeviceSize(devicemapper.getDmId(dev)))
+ devBlkSz.add(multipath.getDeviceBlockSizes(devicemapper.getDmId(dev)))
else:
raise se.InvalidPhysDev(dev)
+ # Block size check
+ if len(devBlkSz) != 1:
+ raise se.VolumeGroupBlockSizeError("VG devices must have the same block size")
+
#Minimal size check
size = sum(devSizes)
if size < MINIMALVGSIZE:
diff --git a/vdsm/storage/multipath.py b/vdsm/storage/multipath.py
index 269e0e3..6a026c9 100644
--- a/vdsm/storage/multipath.py
+++ b/vdsm/storage/multipath.py
@@ -226,6 +226,7 @@ def pathListIter(filterGuids=None):
"vendor" : "",
"product" :"",
"fwrev" : "",
+ "blocksize" : "",
}
@@ -252,6 +253,13 @@ def pathListIter(filterGuids=None):
except Exception:
log.warn("Problem getting fwrev from device `%s`", slave, exc_info=True)
+ if not devInfo["blocksize"]:
+ try:
+ logBlkSize, phyBlkSize = getDeviceBlockSizes(slave)
+ devInfo["blocksize"] = "%i:%i" % (logBlkSize, phyBlkSize)
+ except Exception:
+ log.warn("Problem getting blocksize from device `%s`", slave, exc_info=True)
+
pathInfo = {}
pathInfo["physdev"] = slave
pathInfo["state"] = pathStatuses.get(slave, "failed")
diff --git a/vdsm/storage/storage_exception.py b/vdsm/storage/storage_exception.py
index 421737b..2b6c586 100644
--- a/vdsm/storage/storage_exception.py
+++ b/vdsm/storage/storage_exception.py
@@ -999,6 +999,10 @@ class VolumeGroupReplaceTagError(StorageException):
code = 516
message = "Replace Volume Group tag error"
+class VolumeGroupBlockSizeError(StorageException):
+ code = 517
+ message = "Volume Group block size error"
+
class CannotCreateLogicalVolume(StorageException):
code = 550
message = "Cannot create Logical Volume"
11 years, 6 months
Change in vdsm[master]: Don't use a list to calculate VG size
by Dan Kenigsberg
Dan Kenigsberg has submitted this change and it was merged.
Change subject: Don't use a list to calculate VG size
......................................................................
Don't use a list to calculate VG size
Change-Id: Ief2a3e69f94c99b11c9027901fc5a34577c3452f
---
M vdsm/storage/hsm.py
1 file changed, 3 insertions(+), 4 deletions(-)
Approvals:
Dan Kenigsberg: Verified; Looks good to me, approved
--
To view, visit http://gerrit.usersys.redhat.com/967
To unsubscribe, visit http://gerrit.usersys.redhat.com/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ief2a3e69f94c99b11c9027901fc5a34577c3452f
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce(a)redhat.com>
Gerrit-Reviewer: Igor Lvovsky <ilvovsky(a)redhat.com>
Gerrit-Reviewer: Yotam Oron <yoron(a)redhat.com>
11 years, 6 months