Vinzenz Feenstra has uploaded a new change for review.
Change subject: vdsm: Try to reconnect on vmchannel after timeout
......................................................................
vdsm: Try to reconnect on vmchannel after timeout
Once a timeout occurred on the channel the socket connection
might be in a disconnected state. Therefore we're trying to
attempt to connect again on timeout.
Change-Id: I8b9b9418e39558d45c97e9545bc9ecc4935f004e
Bug-Url: https://bugzilla.redhat.com/871616
Signed-off-by: Vinzenz Feenstra <vfeenstr(a)redhat.com>
---
M vdsm/guestIF.py
1 file changed, 7 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/77/11977/1
diff --git a/vdsm/guestIF.py b/vdsm/guestIF.py
index 675b78e..fabbabf 100644
--- a/vdsm/guestIF.py
+++ b/vdsm/guestIF.py
@@ -102,13 +102,17 @@
ret = False
try:
self.log.debug("Attempting connection to %s", self._socketName)
- if self._sock.connect_ex(self._socketName) == 0:
+ ret = self._sock.connect_ex(self._socketName)
+ if ret == 0:
self.log.debug("Connected to %s", self._socketName)
self._messageState = MessageState.NORMAL
self._clearReadBuffer()
self._forward('refresh')
self._stopped = False
ret = True
+ else:
+ self.log.debug("Failed to connect to %s with %d",
+ self._socketName, ret)
except socket.error as err:
self.log.debug("Connection attempt failed: %s", err)
return ret
@@ -268,6 +272,8 @@
if self.guestStatus not in ("Powered down", "RebootInProgress"):
self.log.log(logging.TRACE, "Guest connection timed out")
self.guestStatus = None
+ self.log.debug("Attempting to reconnect to channel after timeout")
+ self._connect()
def _clearReadBuffer(self):
self._buffer = []
--
To view, visit http://gerrit.ovirt.org/11977
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8b9b9418e39558d45c97e9545bc9ecc4935f004e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeenstr(a)redhat.com>
Vinzenz Feenstra has uploaded a new change for review.
Change subject: vdsm: only specify graphics ports as needed for spice
......................................................................
vdsm: only specify graphics ports as needed for spice
When using display 'QXL' we should set only tlsPort for secure connections
OR port for nonsecure connections not both.
If we have both defined, we get unnecessary connections to the host from
the spice clients because it will connect always to nonsecure ports first.
Another side effect is that we will get events for the disconnects of those
connections to the unsecure port which will cause the users who just connected
to the guest OS and having SSO setup to end up on a locked screen because
we react on the disconnect events from the graphics channel. And signal the
guest agent to lock their screen.
This commit solves this issue.
Change-Id: Ifc866259d4cfa95a3b137dce101ce04f215f9f5a
Bug-Url: https://bugzilla.redhat.com/905930
Signed-off-by: Vinzenz Feenstra <vfeenstr(a)redhat.com>
---
M vdsm/libvirtvm.py
1 file changed, 4 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/91/12291/1
diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index e2ada06..107ccb8 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -804,12 +804,11 @@
<target type='virtio' name='com.redhat.spice.0'/>
</channel>
"""
- graphicsAttrs = {'port': self.conf['displayPort'], 'autoport': 'yes'}
+ graphicsAttrs = {}
if self.conf['display'] == 'vnc':
graphicsAttrs['type'] = 'vnc'
elif 'qxl' in self.conf['display']:
graphicsAttrs['type'] = 'spice'
- graphicsAttrs['tlsPort'] = self.conf['displaySecurePort']
if self.conf.get('keyboardLayout'):
graphicsAttrs['keymap'] = self.conf['keyboardLayout']
@@ -821,9 +820,12 @@
if 'qxl' in self.conf['display']:
if self.conf.get('spiceSecureChannels'):
+ graphicsAttrs['tlsPort'] = self.conf['displaySecurePort']
for channel in self.conf['spiceSecureChannels'].split(','):
graphics.appendChildWithArgs('channel', name=channel[1:],
mode='secure')
+ else:
+ graphicsAttrs['port'] = self.conf['displayPort']
vmc = XMLElement('channel', type='spicevmc')
vmc.appendChildWithArgs('target', type='virtio',
--
To view, visit http://gerrit.ovirt.org/12291
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifc866259d4cfa95a3b137dce101ce04f215f9f5a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeenstr(a)redhat.com>
Vinzenz Feenstra has uploaded a new change for review.
Change subject: vdsm: Delay desktop lock until we are sure it was a disconnect
......................................................................
vdsm: Delay desktop lock until we are sure it was a disconnect
This is a hack to mitigate the issue of spice-gtk not respecting the
configured secure channels. Spice-gtk is always connecting first to
a non-secure channel and the server tells the client then to connect
to a secure channel. However as a result of this we're getting events
of false positive disconnects and we need to ensure that we're really
having a disconnected client
This timer is supposed to delay the call to lock the desktop of the
guest. And only lock it, if it there was no new connect.
This is detected by the clientIp being set or not.
Change-Id: I6af5cf868dc9caaa07134b2b296d985f06cf15f2
Signed-off-by: Vinzenz Feenstra <vfeenstr(a)redhat.com>
---
M vdsm/vm.py
1 file changed, 18 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/98/13798/1
diff --git a/vdsm/vm.py b/vdsm/vm.py
index e327207..1f8fbe4 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -49,6 +49,8 @@
CONSOLE_DEVICES = 'console'
SMARTCARD_DEVICES = 'smartcard'
+_DESKTOP_LOCK_TIMEOUT = 2
+
"""
A module containing classes needed for VM communication.
"""
@@ -822,9 +824,24 @@
if clientIp:
self.conf['clientIp'] = clientIp
+ def _timedDesktopLock(self):
+ if not self.conf.get('clientIp', ''):
+ self.guestAgent.desktopLock()
+
def onDisconnect(self, detail=None):
- self.guestAgent.desktopLock()
self.conf['clientIp'] = ''
+ # This is a hack to mitigate the issue of spice-gtk not respecting the
+ # configured secure channels. Spice-gtk is always connecting first to
+ # a non-secure channel and the server tells the client then to connect
+ # to a secure channel. However as a result of this we're getting events
+ # of false positive disconnects and we need to ensure that we're really
+ # having a disconnected client
+ # This timer is supposed to delay the call to lock the desktop of the
+ # guest. And only lock it, if it there was no new connect.
+ # This is detected by the clientIp being set or not.
+ self._desktopLockTimer = threading.Timer(_DESKTOP_LOCK_TIMEOUT,
+ self._timedDesktopLock)
+ self._desktopLockTimer.start()
def _rtcUpdate(self, timeOffset):
self.log.debug('new rtc offset %s', timeOffset)
--
To view, visit http://gerrit.ovirt.org/13798
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6af5cf868dc9caaa07134b2b296d985f06cf15f2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeenstr(a)redhat.com>
Federico Simoncelli has uploaded a new change for review.
Change subject: image: update the volume permissions when needed
......................................................................
image: update the volume permissions when needed
Volumes leaves created in 2.2 did not have the group writeable bit
set. In order to be able to start VMs from old NFS volumes we need
to check (and eventually fix) the group permissions during the volume
preparation.
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=911417
Change-Id: I516d8240840e3aa32bd8074420e331b8dc4e6da7
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
---
M tests/fileUtilTests.py
M vdsm/storage/blockSD.py
M vdsm/storage/fileSD.py
M vdsm/storage/fileUtils.py
M vdsm/storage/fileVolume.py
M vdsm/storage/image.py
M vdsm/storage/sd.py
7 files changed, 50 insertions(+), 18 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/31/13331/1
diff --git a/tests/fileUtilTests.py b/tests/fileUtilTests.py
index 8daeff2..8cdad4c 100644
--- a/tests/fileUtilTests.py
+++ b/tests/fileUtilTests.py
@@ -177,3 +177,24 @@
fileUtils.chown(srcPath, "root", "root")
stat = os.stat(srcPath)
self.assertTrue(stat.st_uid == stat.st_gid == 0)
+
+
+class CopyUserModeToGroupTests(TestCaseBase):
+ MODE_MASK = 0777
+
+ # format: initialMode, expectedMode
+ modesList = [
+ (0770, 0770), (0700, 0770), (0750, 0770), (0650, 0660),
+ ]
+
+ def testCopyUserModeToGroup(self):
+ fd, path = tempfile.mkstemp()
+ try:
+ os.close(fd)
+ for initialMode, expectedMode in self.modesList:
+ os.chmod(path, initialMode)
+ fileUtils.copyUserModeToGroup(path)
+ self.assertEquals(os.stat(path).st_mode & self.MODE_MASK,
+ expectedMode)
+ finally:
+ os.unlink(path)
diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py
index 9809bf4..43b2389 100644
--- a/vdsm/storage/blockSD.py
+++ b/vdsm/storage/blockSD.py
@@ -1001,13 +1001,13 @@
"""
return getAllVolumes(self.sdUUID)
- def activateVolumes(self, volUUIDs):
+ def activateVolumes(self, imgUUID, volUUIDs):
"""
Activate all the volumes listed in volUUIDs
"""
lvm.activateLVs(self.sdUUID, volUUIDs)
- def deactivateVolumes(self, volUUIDs):
+ def deactivateVolumes(self, imgUUID, volUUIDs):
"""
Deactivate all the volumes listed in volUUIDs
"""
diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py
index be2a793..d71ec66 100644
--- a/vdsm/storage/fileSD.py
+++ b/vdsm/storage/fileSD.py
@@ -410,6 +410,16 @@
return dict((k, sd.ImgsPar(tuple(v['imgs']), v['parent']))
for k, v in volumes.iteritems())
+ def activateVolumes(self, imgUUID, volUUIDs):
+ """
+ Activate all the volumes listed in volUUIDs
+ """
+ # Volumes leaves created in 2.2 did not have group writeable bit
+ # set. We have to set it here if we want qemu-kvm to write to old
+ # NFS volumes.
+ vol = self.produceVolume(imgUUID, volUUIDs[-1])
+ self.oop.fileUtils.copyUserModeToGroup(vol.getVolumePath())
+
@classmethod
def format(cls, sdUUID):
"""
diff --git a/vdsm/storage/fileUtils.py b/vdsm/storage/fileUtils.py
index d5e5faf..519c918 100644
--- a/vdsm/storage/fileUtils.py
+++ b/vdsm/storage/fileUtils.py
@@ -409,3 +409,12 @@
os.fsync(fd)
finally:
os.close(fd)
+
+
+def copyUserModeToGroup(path):
+ mode = os.stat(path).st_mode
+ userMode = mode & 0700 # user mode mask
+ newGroupMode = userMode >> 3
+ if (mode & 0070) != newGroupMode: # group mode mask
+ # setting the new group mode masking out the original one
+ os.chmod(path, (mode & 0707) | newGroupMode)
diff --git a/vdsm/storage/fileVolume.py b/vdsm/storage/fileVolume.py
index 01575e0..1c9946b 100644
--- a/vdsm/storage/fileVolume.py
+++ b/vdsm/storage/fileVolume.py
@@ -281,20 +281,12 @@
"""
Make volume accessible as readonly (internal) or readwrite (leaf)
"""
- def copyUserModeToGroup(path):
- # Volumes leaves created in 2.2 did not have group writeable bit
- # set. We have to set it here if we want qemu-kvm to write to old
- # NFS volumes.
- mode = self.oop.os.stat(path).st_mode
- usrmode = (mode & 0700) >> 3
- grpmode = mode & 0070
- if usrmode & grpmode != usrmode:
- mode |= usrmode
- self.oop.os.chmod(path, mode)
-
volPath = self.getVolumePath()
- copyUserModeToGroup(volPath)
+ # Volumes leaves created in 2.2 did not have group writeable bit
+ # set. We have to set it here if we want qemu-kvm to write to old
+ # NFS volumes.
+ self.oop.fileUtils.copyUserModeToGroup(volPath)
if setrw:
self.setrw(rw=rw)
diff --git a/vdsm/storage/image.py b/vdsm/storage/image.py
index 92021ff..ba49b8e 100644
--- a/vdsm/storage/image.py
+++ b/vdsm/storage/image.py
@@ -354,7 +354,7 @@
# Activating the volumes
sdCache.produce(sdUUID).activateVolumes(
- volUUIDs=[vol.volUUID for vol in chain])
+ imgUUID, volUUIDs=[vol.volUUID for vol in chain])
return chain
@@ -363,7 +363,7 @@
# Deactivating the volumes
sdCache.produce(sdUUID).deactivateVolumes(
- volUUIDs=[vol.volUUID for vol in chain])
+ imgUUID, volUUIDs=[vol.volUUID for vol in chain])
# Do not deactivate the template yet (might be in use by an other vm)
# TODO: reference counting to deactivate when unused
diff --git a/vdsm/storage/sd.py b/vdsm/storage/sd.py
index 48ee7d5..c1da6a5 100644
--- a/vdsm/storage/sd.py
+++ b/vdsm/storage/sd.py
@@ -626,13 +626,13 @@
"""
pass
- def activateVolumes(self, volUUIDs):
+ def activateVolumes(self, imgUUID, volUUIDs):
"""
Activate all the volumes listed in volUUIDs
"""
pass
- def deactivateVolumes(self, volUUIDs):
+ def deactivateVolumes(self, imgUUID, volUUIDs):
"""
Deactivate all the volumes listed in volUUIDs
"""
--
To view, visit http://gerrit.ovirt.org/13331
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I516d8240840e3aa32bd8074420e331b8dc4e6da7
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
Petr Šebek has uploaded a new change for review.
Change subject: Bond destroying
......................................................................
Bond destroying
If there is deleted network with bond other than bond[0-4] and no
other network is using that bond, the bond is destroyed. It prevents
accumulation poorly named bonds.
Change-Id: I0cd27f1ff9a62e202c3513e54df5481d1b72ed7c
Bug-Url: https://bugzilla.redhat.com/928442
Signed-off-by: Petr Sebek <psebek(a)redhat.com>
---
M vdsm/configNetwork.py
1 file changed, 4 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/52/13752/1
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 2a85e34..dd362c1 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -516,6 +516,10 @@
def removeBonding(self, bonding):
self._backup(netinfo.NET_CONF_PREF + bonding)
self._removeFile(netinfo.NET_CONF_PREF + bonding)
+ if bonding not in ['bond0', 'bond1', 'bond2', 'bond3', 'bond4']:
+ with open(BONDING_MASTERS, 'w') as f:
+ f.write("-%s\n" % bonding)
+
def removeBridge(self, bridge):
ifdown(bridge)
--
To view, visit http://gerrit.ovirt.org/13752
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0cd27f1ff9a62e202c3513e54df5481d1b72ed7c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Šebek <psebek(a)redhat.com>
Mark Wu has uploaded a new change for review.
Change subject: Use 'ip link' to get different kinds of interfaces
......................................................................
Use 'ip link' to get different kinds of interfaces
It's a little faster than listing the dir '/sys/class/net'
Change-Id: Iecc2300963fe1834defb99f5be92b25c0218cf00
Signed-off-by: Mark Wu <wudxw(a)linux.vnet.ibm.com>
---
M tests/netinfoTests.py
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/68/13668/1
diff --git a/tests/netinfoTests.py b/tests/netinfoTests.py
index 5e0716e..016d68a 100644
--- a/tests/netinfoTests.py
+++ b/tests/netinfoTests.py
@@ -43,12 +43,12 @@
def testSpeedInvalidNic(self):
nicName = 'DUMMYNICDEVNAME'
- self.assertTrue(nicName not in netinfo.nics())
+ self.assertTrue(nicName not in netinfo.getInterfaces()[0])
s = netinfo.speed(nicName)
self.assertEqual(s, 0)
def testSpeedInRange(self):
- for d in netinfo.nics():
+ for d in netinfo.getInterfaces()[0]:
s = netinfo.speed(d)
self.assertFalse(s < 0)
self.assertTrue(s in ETHTOOL_SPEEDS or s == 0)
--
To view, visit http://gerrit.ovirt.org/13668
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iecc2300963fe1834defb99f5be92b25c0218cf00
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mark Wu <wudxw(a)linux.vnet.ibm.com>
Giuseppe Vallarelli has abandoned this change.
Change subject: doc: doc generation fix, another attempt.
......................................................................
Patch Set 1: Abandoned
--
To view, visit http://gerrit.ovirt.org/11661
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: abandon
Gerrit-Change-Id: I76065019f94f332033cb79412e1c1564b5a095fd
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Giuseppe Vallarelli <gvallare(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server