Alon Bar-Lev has uploaded a new change for review.
Change subject: storage: set block schedule elevator using udev
......................................................................
storage: set block schedule elevator using udev
CURRENT IMPLEMENTATION
block schedule elevator is set by bootstrap using modification to kernel
command-lines.
PROBLEMS IN CURRENT IMPLEMENTATION
1. assumption of grub bootloader.
2. assumption of active kernel.
3. assumption of user not override anything.
4. problem to port.
NEW IMPLEMENTATION
Use udev in order to set the block schedule elevator.
User may override behavior using udev rule, no bootloader dependency or
conflict.
The setting is applied also if vdsm is installed manually.
Change-Id: I0a8de1c861bf4570509599b6f47235ed38cc424d
Signed-off-by: Alon Bar-Lev <alonbl(a)redhat.com>
---
M vds_bootstrap/vds_bootstrap.py
M vdsm.spec.in
A vdsm/storage/12-vdsm-elevator.rules
M vdsm/storage/Makefile.am
A vdsm/storage/vdsm-elevator.sh
5 files changed, 31 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/00/8700/1
diff --git a/vds_bootstrap/vds_bootstrap.py b/vds_bootstrap/vds_bootstrap.py
index 867d6f4..9353daf 100755
--- a/vds_bootstrap/vds_bootstrap.py
+++ b/vds_bootstrap/vds_bootstrap.py
@@ -435,7 +435,7 @@
self.message = ''
self.rc = True
- args = ['elevator=deadline']
+ args = []
if rhel6based and not _constantTSC():
args += ['processor.max_cstate=1']
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 4814172..18a3661 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -382,9 +382,13 @@
install -Dm 0755 vdsm/respawn \
%{buildroot}%{_datadir}/%{vdsm_name}/respawn
-# Install the lvm rules
+# Install the udev rules
install -Dm 0644 vdsm/storage/12-vdsm-lvm.rules \
%{buildroot}/lib/udev/rules.d/12-vdsm-lvm.rules
+install -Dm 0644 vdsm/storage/12-vdsm-elevator.rules \
+ %{buildroot}/lib/udev/rules.d/12-vdsm-elevator.rules
+install -Dm 0755 vdsm/storage/vdsm-elevator.sh \
+ %{buildroot}/lib/udev/vdsm-elevator.sh
install -Dm 0644 vdsm/limits.conf \
%{buildroot}/etc/security/limits.d/99-vdsm.conf
@@ -721,6 +725,8 @@
%{_datadir}/%{vdsm_name}/set-conf-item
%{python_sitelib}/sos/plugins/vdsm.py*
/lib/udev/rules.d/12-vdsm-lvm.rules
+/lib/udev/rules.d/12-vdsm-elevator.rules
+/lib/udev/vdsm-elevator.sh
/etc/security/limits.d/99-vdsm.conf
%{_mandir}/man8/vdsmd.8*
%if 0%{?rhel}
diff --git a/vdsm/storage/12-vdsm-elevator.rules b/vdsm/storage/12-vdsm-elevator.rules
new file mode 100644
index 0000000..38a7607
--- /dev/null
+++ b/vdsm/storage/12-vdsm-elevator.rules
@@ -0,0 +1,12 @@
+#
+# Copyright 2012 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.
+#
+
+# Udev rules for elevator setting.
+
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", RUN+="vdsm-elevator.sh deadline"
diff --git a/vdsm/storage/Makefile.am b/vdsm/storage/Makefile.am
index cff09be..5900802 100644
--- a/vdsm/storage/Makefile.am
+++ b/vdsm/storage/Makefile.am
@@ -65,7 +65,9 @@
volume.py
EXTRA_DIST = \
- 12-vdsm-lvm.rules
+ 12-vdsm-lvm.rules \
+ 12-vdsm-elevator.rules \
+ vdsm-elevator.sh
check-local:
PYTHONDONTWRITEBYTECODE=1 $(PYTHON) $(srcdir)/storage_exception.py
diff --git a/vdsm/storage/vdsm-elevator.sh b/vdsm/storage/vdsm-elevator.sh
new file mode 100755
index 0000000..6f2ff85
--- /dev/null
+++ b/vdsm/storage/vdsm-elevator.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+elevator="$1"
+scheduler="/sys/${DEVPATH}/queue/scheduler"
+
+if [ -w "${scheduler}" ]; then
+ echo "${elevator}" > "${scheduler}"
+fi
--
To view, visit http://gerrit.ovirt.org/8700
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0a8de1c861bf4570509599b6f47235ed38cc424d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <alonbl(a)redhat.com>
Saggi Mizrahi has uploaded a new change for review.
Change subject: Have direct file not use the O_DIRECT flag on tmpfs and ramfs
......................................................................
Have direct file not use the O_DIRECT flag on tmpfs and ramfs
tmpfs and ramfs don't support the O_DIRECT flags. This is intentional as
O_DIRECT tells the kernel to bypass the page-cache and those file
systems live solely on the page cache. Since the effect desired by
direct IO is accomplished on these file systems without the flag there
is no reason for the use to test the FS every time before opening a file
for direct access.
The reason we keep the same class instead of falling back to the regular
file object is so we keep the semantics of the DirectFile() class and
the user doesn't have to care that the underlying FS doesn't really
support direct IO.
Change-Id: I7db4136c1a34d960b17312c2c785fc3234b24b92
Signed-off-by: Saggi Mizrahi <smizrahi(a)redhat.com>
---
M vdsm/storage/fileUtils.py
M vdsm/storage/mount.py
2 files changed, 51 insertions(+), 16 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/95/9595/1
diff --git a/vdsm/storage/fileUtils.py b/vdsm/storage/fileUtils.py
index 13a8cfa..e00a004 100644
--- a/vdsm/storage/fileUtils.py
+++ b/vdsm/storage/fileUtils.py
@@ -31,11 +31,12 @@
import ctypes
from contextlib import contextmanager
import subprocess
-
import shutil
-from vdsm import constants
import logging
import errno
+
+from vdsm import constants
+import mount
libc = ctypes.CDLL("libc.so.6", use_errno=True)
log = logging.getLogger('fileUtils')
@@ -184,10 +185,13 @@
log.warning("Dir %s already exists", dirPath)
if mode is not None:
statinfo = os.stat(dirPath)
- if statinfo[stat.ST_MODE] != mode:
+ curMode = statinfo[stat.ST_MODE]
+ if curMode != mode:
raise OSError(errno.EPERM,
- "Existing %s permissions %s are not as requested %s" %
- (dirPath, oct(statinfo[stat.ST_MODE]), oct(mode)))
+ ("Existing %s permissions %s are not as "
+ "requested %s") % (dirPath,
+ oct(curMode),
+ oct(mode)))
def resolveUid(user):
@@ -219,7 +223,7 @@
currentGid = stat.st_gid
if ((uid == currentUid or user == -1) and
- (gid == currentGid or group == -1)):
+ (gid == currentGid or group == -1)):
return True
os.chown(path, uid, gid)
@@ -243,7 +247,14 @@
raise ValueError("Invalid mode parameter")
self._writable = True
- flags = os.O_DIRECT
+ # Memory only file systems don't support direct IO because direct IO
+ # means "skip the page cache" and they are 100% page cahce.
+ vfstype = mount.findMountOfPath(path).getRecord().fs_vfstype
+ if vfstype in ["tmpfs", "ramfs"]:
+ flags = 0
+ else:
+ flags = os.O_DIRECT
+
if "r" in mode:
if "+" in mode:
flags |= os.O_RDWR
diff --git a/vdsm/storage/mount.py b/vdsm/storage/mount.py
index 94cfae0..aaa9eb0 100644
--- a/vdsm/storage/mount.py
+++ b/vdsm/storage/mount.py
@@ -34,14 +34,14 @@
VFS_EXT3 = "ext3"
MountRecord = namedtuple("MountRecord", "fs_spec fs_file fs_vfstype "
- "fs_mntops fs_freq fs_passno")
+ "fs_mntops fs_freq fs_passno")
_RE_ESCAPE = re.compile(r"\\0\d\d")
def _parseFstabLine(line):
(fs_spec, fs_file, fs_vfstype, fs_mntops,
- fs_freq, fs_passno) = line.split()[:6]
+ fs_freq, fs_passno) = line.split()[:6]
fs_mntops = fs_mntops.split(",")
fs_freq = int(fs_freq)
fs_passno = int(fs_passno)
@@ -50,7 +50,7 @@
fs_mntops = [_parseFstabPath(item) for item in fs_mntops]
return MountRecord(fs_spec, fs_file, fs_vfstype, fs_mntops,
- fs_freq, fs_passno)
+ fs_freq, fs_passno)
def _iterateMtab():
@@ -118,7 +118,7 @@
continue
yield MountRecord(realSpec, rec.fs_file, rec.fs_vfstype,
- rec.fs_mntops, rec.fs_freq, rec.fs_passno)
+ rec.fs_mntops, rec.fs_freq, rec.fs_passno)
def iterMounts():
@@ -144,6 +144,30 @@
return Mount(rec.fs_spec, rec.fs_file)
raise OSError(errno.ENOENT, 'Mount target %s not found' % target)
+
+
+def findMountOfPath(path):
+ # TBD: Bind mounts, should we ignore them?
+ # Follow symlinks (if file exists)
+ path = os.path.realpath(path)
+
+ # Make sure using canonical representation
+ path = os.path.normpath(path)
+
+ # Find longest match
+ maxLen = 0
+ mountRec = None
+ for rec in _iterMountRecords():
+ mntPath = os.path.normpath(rec.fs_file)
+ if len(mntPath) > maxLen:
+ if path.startswith(mntPath):
+ maxLen = len(mntPath)
+ mountRec = rec
+
+ if mountRec is None:
+ raise OSError(errno.ENOENT, os.strerror(errno.ENOENT))
+
+ return Mount(mountRec.fs_spec, mountRec.fs_file)
def getMountFromDevice(device):
@@ -195,7 +219,7 @@
if not p.wait(timeout):
p.kill()
raise OSError(errno.ETIMEDOUT,
- "%s operation timed out" % os.path.basename(cmd[0]))
+ "%s operation timed out" % os.path.basename(cmd[0]))
out, err = p.communicate()
rc = p.returncode
@@ -232,9 +256,9 @@
return record
raise OSError(errno.ENOENT,
- "Mount of `%s` at `%s` does not exist" %
- (self.fs_spec, self.fs_file))
+ "Mount of `%s` at `%s` does not exist" %
+ (self.fs_spec, self.fs_file))
def __repr__(self):
- return "<Mount fs_spec='%s' fs_file='%s'>" % \
- (self.fs_spec, self.fs_file)
+ return ("<Mount fs_spec='%s' fs_file='%s'>" %
+ (self.fs_spec, self.fs_file))
--
To view, visit http://gerrit.ovirt.org/9595
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7db4136c1a34d960b17312c2c785fc3234b24b92
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi(a)redhat.com>
Igor Lvovsky has uploaded a new change for review.
Change subject: Remove network.service dependencies from vdsmd.service
......................................................................
Remove network.service dependencies from vdsmd.service
In current vdsm behaviour during network rollback vdsm need to stop network service,
rollback latest network changes and start network service again,
but in host with systemd network service can't be stoped.
According to systemd concept if service required by another service it will be immediately
started again. In such situation vdsm can't revert network changes if needed.
In this patch we just remove network.service dependencies from vdsmd.service.
Anyway vdsm start network service explicitly during vdsm start
Change-Id: I03c9696022490da3204a1d5f9676066712f0653d
Signed-off-by: Igor Lvovsky <ilvovsky(a)redhat.com>
---
M vdsm/vdsmd.service
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/63/9363/1
diff --git a/vdsm/vdsmd.service b/vdsm/vdsmd.service
index fb6d238..6a650f4 100644
--- a/vdsm/vdsmd.service
+++ b/vdsm/vdsmd.service
@@ -1,6 +1,6 @@
[Unit]
Description=Virtual Desktop Server Manager
-Requires=multipathd.service libvirtd.service ntpd.service network.service
+Requires=multipathd.service libvirtd.service ntpd.service
Conflicts=libvirt-guests.service
[Service]
--
To view, visit http://gerrit.ovirt.org/9363
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I03c9696022490da3204a1d5f9676066712f0653d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Igor Lvovsky <ilvovsky(a)redhat.com>