[NEW PATCH] Related to BZ#732416 - Remove volume.qemuCommit() (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/879
commit c0fcb397a75d4632505a3118cca86ec9e3e2aa33
Author: Eduardo Warszawski <ewarszaw(a)redhat.com>
Date: Tue Aug 30 19:31:07 2011 +0300
Related to BZ#732416 - Remove volume.qemuCommit()
Change-Id: Iba5bae9efa9aa13efe4f9598c2f93c61dc55e0a6
diff --git a/vdsm/storage/volume.py b/vdsm/storage/volume.py
index 50850fa..d50204b 100644
--- a/vdsm/storage/volume.py
+++ b/vdsm/storage/volume.py
@@ -18,7 +18,6 @@
# Refer to the README and COPYING files for full details of the license
#
-from config import config
import os.path
import logging
import time
@@ -103,7 +102,6 @@ def name2type(name):
class Volume:
- idle = config.getfloat('irs', 'idle')
log = logging.getLogger('Storage.Volume')
def __init__(self, repoPath, sdUUID, imgUUID, volUUID):
@@ -880,21 +878,6 @@ def baseAsyncTasksRollback(proc):
vars.task.pushRecovery(task.Recovery(name, "volume", "Volume", "killProcRollback",
[str(proc.pid), str(misc.getProcCtime(proc.pid))]))
-def qemuCommit(src, fmt, idle, stop):
- """
- Merge single snapshot from 'successor (snapshot)' to its backing file.
- """
- log.debug('(qemuCommit): MERGE %s START' % (src))
-
- cwd = os.path.dirname(src)
- cmd = constants.CMD_LOWPRIO + [constants.EXT_QEMUIMG, "commit",
- "-t", "none", "-f", fmt2str(fmt), src]
- (rc, out, err) = misc.watchCmd(cmd, stop=stop, sudo=False, cwd=cwd,
- recoveryCallback=baseAsyncTasksRollback)
-
- log.debug('(qemuCommit): MERGE %s DONE' % (src))
- return (rc, out, err)
-
def qemuRebase(src, srcFormat, backingFile, backingFormat, unsafe, stop, rollback):
"""
Rebase the 'src' volume on top of the new 'backingFile' with new 'backingFormat'
11 years, 9 months
[NEW PATCH] Related to BZ#732416 - Remove idle param in volume.qemuRebase() (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/878
commit 8a3545355270e33e81bae4e0bdbafefb4e992734
Author: Eduardo Warszawski <ewarszaw(a)redhat.com>
Date: Mon Aug 29 19:30:41 2011 +0300
Related to BZ#732416 - Remove idle param in volume.qemuRebase()
Change-Id: I54f1f6c86250b1723093a43252baefd4308cfbfa
diff --git a/vdsm/storage/volume.py b/vdsm/storage/volume.py
index 7dce885..50850fa 100644
--- a/vdsm/storage/volume.py
+++ b/vdsm/storage/volume.py
@@ -173,9 +173,9 @@ class Volume:
try:
(rc, out, err) = qemuRebase(vol.getVolumePath(), vol.getFormat(),
- os.path.join('..', srcImg, srcParent),
- int(dstFormat), misc.parseBool(unsafe),
- vol.idle, vars.task.aborting, False)
+ os.path.join('..', srcImg, srcParent),
+ int(dstFormat), misc.parseBool(unsafe),
+ vars.task.aborting, False)
if rc:
raise se.MergeVolumeRollbackError(srcVol)
@@ -205,7 +205,7 @@ class Volume:
str(pvol.getFormat()), pvol.volUUID, str(True)]))
(rc, out, err) = qemuRebase(self.getVolumePath(), self.getFormat(), backingVolPath,
- backingFormat, unsafe, self.idle, vars.task.aborting, rollback)
+ backingFormat, unsafe, vars.task.aborting, rollback)
if rc:
raise se.MergeSnapshotsError(self.volUUID)
self.setParent(backingVol)
@@ -895,7 +895,7 @@ def qemuCommit(src, fmt, idle, stop):
log.debug('(qemuCommit): MERGE %s DONE' % (src))
return (rc, out, err)
-def qemuRebase(src, srcFormat, backingFile, backingFormat, unsafe, idle, stop, rollback):
+def qemuRebase(src, srcFormat, backingFile, backingFormat, unsafe, stop, rollback):
"""
Rebase the 'src' volume on top of the new 'backingFile' with new 'backingFormat'
"""
11 years, 9 months
[NEW PATCH] Related to BZ#732416 - Remove unused idle param in volume.qemuConvert() (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/877
commit a547ab95725ebfe9f2f9365eeae3e1543b366d2f
Author: Eduardo Warszawski <ewarszaw(a)redhat.com>
Date: Mon Aug 29 19:20:44 2011 +0300
Related to BZ#732416 - Remove unused idle param in volume.qemuConvert()
Change-Id: Ib11545298238d40795f098d60bc14e3d10ac7677
diff --git a/vdsm/storage/image.py b/vdsm/storage/image.py
index 8e86fdc..5c6b114 100644
--- a/vdsm/storage/image.py
+++ b/vdsm/storage/image.py
@@ -803,7 +803,7 @@ class Image:
try:
(rc, out, err) = volume.qemuConvert(volParams['path'], dstPath,
- volParams['volFormat'], dstVolFormat, self.idle, vars.task.aborting,
+ volParams['volFormat'], dstVolFormat, vars.task.aborting,
size=srcVol.getVolumeSize(bs=1), dstvolType=dstVol.getType())
if rc:
raise se.StorageException("rc: %s, err: %s" % (rc, err))
@@ -1053,7 +1053,7 @@ class Image:
# Step 2: Convert successor to new volume
# qemu-img convert -f qcow2 successor -O raw newUUID
(rc, out, err) = volume.qemuConvert(srcVolParams['path'], newVol.getVolumePath(),
- srcVolParams['volFormat'], volParams['volFormat'], self.idle, vars.task.aborting,
+ srcVolParams['volFormat'], volParams['volFormat'], vars.task.aborting,
size=volParams['apparentsize'], dstvolType=newVol.getType())
if rc:
raise se.MergeSnapshotsError(newUUID)
diff --git a/vdsm/storage/volume.py b/vdsm/storage/volume.py
index aa3f4ae..7dce885 100644
--- a/vdsm/storage/volume.py
+++ b/vdsm/storage/volume.py
@@ -921,7 +921,7 @@ def qemuRebase(src, srcFormat, backingFile, backingFormat, unsafe, idle, stop, r
return (rc, out, err)
-def qemuConvert(src, dst, src_fmt, dst_fmt, idle, stop, size, dstvolType):
+def qemuConvert(src, dst, src_fmt, dst_fmt, stop, size, dstvolType):
"""
Convert the 'src' image (or chain of images) into a new single 'dst'
"""
11 years, 9 months
[NEW PATCH] Don't override the rpm topdir macro settings (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/826
commit 5c6e574aeff58e75121ed6e75acc37de7636acac
Author: Federico Simoncelli <fsimonce(a)redhat.com>
Date: Wed Aug 17 13:37:28 2011 +0000
Don't override the rpm topdir macro settings
Change-Id: Ia84386fb980745107c7d664900effcbc0bb2d18e
diff --git a/Makefile.am b/Makefile.am
index f51e595..35d18aa 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,10 +19,7 @@ dist-hook:
.PHONY: srpm rpm
srpm: dist
- $(MKDIR_P) $(RPMTOP)/{RPMS,SRPMS,SOURCES,BUILD}
- rpmbuild -ts \
- --define="_topdir $(RPMTOP)" \
- --define="_sourcedir $(PWD)" $(DIST_ARCHIVES)
+ rpmbuild -ts $(DIST_ARCHIVES)
rpm: dist
- rpmbuild --define="_topdir $(RPMTOP)" -ta $(DIST_ARCHIVES)
+ rpmbuild -ta $(DIST_ARCHIVES)
11 years, 9 months
[NEW PATCH] A new JSON-based protocol with the guest's agent. (via gerrit-bot)
by ghammer@redhat.com
New patch submitted by Gal Hammer (ghammer(a)redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/807
commit 9408893fbb8937250e93df8fa99a5d4b22d713bc
Author: Gal Hammer <ghammer(a)redhat.com>
Date: Wed Aug 10 13:26:31 2011 +0300
A new JSON-based protocol with the guest's agent.
Change-Id: Ie6096b326cc58879c8f63b72e32586657fffeca0
diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index c5169a4..27eb973 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -269,7 +269,6 @@ class clientIF:
(self.desktopLogin, 'desktopLogin'),
(self.desktopLogoff, 'desktopLogoff'),
(self.desktopLock, 'desktopLock'),
- (self.sendHcCmdToDesktop, 'sendHcCmdToDesktop'),
(self.hibernate, 'hibernate'),
(self.monitorCommand, 'monitorCommand'),
(self.addNetwork, 'addNetwork'),
@@ -815,20 +814,6 @@ class clientIF:
else:
return errCode['nonresp']
- def sendHcCmdToDesktop (self, vmId, message):
- """
- Send a command to the guest agent (depricated).
- """
- try:
- vm = self.vmContainer[vmId]
- except KeyError:
- return errCode['noVM']
- vm.guestAgent.sendHcCmdToDesktop(message)
- if vm.guestAgent.isResponsive():
- return {'status': doneCode}
- else:
- return errCode['nonresp']
-
# take a rough estimate on how much free mem is available for new vm
# memTotal = memFree + memCached + mem_used_by_non_qemu + resident .
# simply returning (memFree + memCached) is not good enough, as the
diff --git a/vdsm/guestIF.py b/vdsm/guestIF.py
index a648dec..8ccf15b 100644
--- a/vdsm/guestIF.py
+++ b/vdsm/guestIF.py
@@ -2,6 +2,7 @@ import traceback, logging, threading
import time
import socket
import struct
+import json
from config import config
import utils
import constants
@@ -23,36 +24,6 @@ def _filterXmlChars(u):
return ''.join([maskRestricted(c) for c in u])
-
-class guestMType:
- powerup=1
- powerdown=2
- heartbeat=3
- guestName=4
- guestOs=5
- IPAddresses=6
- lastSessionMessage=7
- userInfo=8
- newApp=9
- flushApps=10
- sessionLock=12
- sessionUnlock=13
- sessionLogoff=14
- sessionLogon=15
- agentCmd = 16 # obsolete
- agentUninstalled = 17
- sessionStartup = 18
- sessionShutdown = 19
-
-class protocolMtype:
- register, unregister, forward = range(1, 4)
- error = 0x80000001
-
-
-headerLength = 3
-wordSize = 4
-headerLengthBytes = headerLength * wordSize
-
class GuestAgent (threading.Thread):
def __init__(self, socketName, log, user='Unknown', ips='', connect=True):
self.log = log
@@ -64,12 +35,6 @@ class GuestAgent (threading.Thread):
'session': 'Unknown', 'appsList': []}
self._agentTimestamp = 0
- # A temporary storage to hold the guest's application list during an
- # update from the guest. Will be obselete if a new virtual channel
- # (that can handle large messages) will be implemented and used.
- self._tempAppsList = []
- self._firstAppsList = True
-
threading.Thread.__init__(self)
if connect:
self.start()
@@ -88,109 +53,66 @@ class GuestAgent (threading.Thread):
time.sleep(1)
return False
- #The protocol envelope:
- #DWORD(32Bit) - ChannelID
- #DWORD(32Bit) - Action/Cmd
- # 1 - Register (to receive ChannelID events)
- # 2 - UnRegister (from ChannelID events)
- # 3 - Forward Message to channel
- # 0x80000001 - Error UnknownChannel
- #DWORD(32Bit) MessageLength(In Bytes)
- #message payload
- # Simple protocol at this point. Just a single byte
- # with enumeration of the event
- # 1 - PowerUp
- # 2 - PowerDown
- # 3 - HeartBeat
+ def _forward(self, cmd, args = {}):
+ args['__name__'] = cmd
+ message = (json.dumps(args) + '\n').encode('utf8')
+ self._sock.send(message)
+ self.log.log(logging.TRACE, 'sent %s', message)
- CHANNEL = 1
- def _forward(self, s):
- lens = len(s)
- t = struct.pack('>III%ds' % lens, self.CHANNEL,
- protocolMtype.forward, headerLengthBytes + lens, s)
- self._sock.send(t)
- self.log.log(logging.TRACE, 'sent %s', repr(t))
-
- def _parseHeader(self, header):
- channel, messageType, length = struct.unpack('>III', header)
- if channel != self.CHANNEL:
- self.log.error("Illegal channel id %d" % (channel))
- return 0
- if messageType != protocolMtype.forward:
- self.log.error("Unexpected message type " + str((channel, messageType, length)))
- return 0
- return length - headerLengthBytes
-
- def _parseBody(self, body):
- guestMessage, = struct.unpack('>I', body[:4])
- body = body[4:]
- self.log.log(logging.TRACE, 'guest message %s body %s',
- guestMessage, body)
+ def _handleMessage(self, message, args):
+ self.log.log(logging.TRACE, "Guest's message %s: %s", message, args)
if self.guestStatus == None:
self.guestStatus = 'Running'
- if guestMessage == guestMType.heartbeat:
+ if message == 'heartbeat':
self.guestStatus = 'Running'
- self.guestInfo['memUsage'] = int(body.strip())
- elif guestMessage == guestMType.powerup:
+ self.guestInfo['memUsage'] = int(args['free-ram'])
+ elif message == 'power-up':
self.guestStatus = 'Running'
- elif guestMessage == guestMType.powerdown:
+ elif message == 'power-down': # XXX: message is not send.
self.guestStatus = 'Powered down'
if self.guestInfo['username'] not in 'None': #in case powerdown event hit before logoff
self.guestInfo['lastUser'] = '' + self.guestInfo['username']
self.guestInfo['username'] = 'None'
self.guestInfo['lastLogout'] = time.time()
- elif guestMessage == guestMType.guestName:
- self.guestInfo['guestName'] = _filterXmlChars(unicode(body, 'utf8'))
- elif guestMessage == guestMType.guestOs:
- self.guestInfo['guestOs'] = _filterXmlChars(unicode(body, 'utf8'))
- elif guestMessage == guestMType.IPAddresses:
- guestIPs = body.strip().split()
- self.log.debug(str(guestIPs))
- self.guestInfo['guestIPs'] = _filterXmlChars(' '.join(guestIPs))
- elif guestMessage == guestMType.lastSessionMessage:
- lastSessionMessage = body
- self.log.debug(lastSessionMessage)
- if 'Logoff' in lastSessionMessage:
- self.guestInfo['lastUser'] = '' + self.guestInfo['username']
- self.guestInfo['username'] = 'None'
- self.guestInfo['lastLogout'] = time.time()
- elif guestMessage == guestMType.flushApps:
- if self._tempAppsList == self.guestInfo['appsList'] == []:
- self._firstAppsList = True
- else:
- self._firstAppsList = False
- self.guestInfo['appsList'] = self._tempAppsList
- self._tempAppsList = []
- elif guestMessage == guestMType.newApp:
- app = _filterXmlChars(unicode(body, 'utf8').strip())
- if app not in self._tempAppsList:
- self._tempAppsList.append(app)
- if self._firstAppsList:
- self.guestInfo['appsList'] = self._tempAppsList
- elif guestMessage == guestMType.userInfo:
- self.log.debug(body)
- currentUser = _filterXmlChars(unicode(body, 'utf8'))
+ elif message == 'host-name':
+ self.guestInfo['guestName'] = _filterXmlChars(args['name'])
+ elif message == 'os-version':
+ self.guestInfo['guestOs'] = _filterXmlChars(args['version'])
+ elif message == 'network-interfaces':
+ ips = ''
+ for iface in args['interfaces']:
+ ips += iface['inet'] + ' '
+ self.guestInfo['guestIPs'] = _filterXmlChars(ips)
+ elif message == 'applications':
+ apps = []
+ for app in args['applications']:
+ apps.append(_filterXmlChars(app))
+ self.guestInfo['appsList'] = apps
+ elif message == 'active-user':
+ currentUser = _filterXmlChars(args['name'])
if (currentUser != self.guestInfo['username']) and not (currentUser=='Unknown' and self.guestInfo['username']=='None'):
self.guestInfo['username'] = currentUser
self.guestInfo['lastLogin'] = time.time()
self.log.debug(repr(self.guestInfo['username']))
- elif guestMessage == guestMType.sessionLogon:
+ elif message == 'session-logon':
self.guestInfo['session'] = "UserLoggedOn"
- elif guestMessage == guestMType.sessionLock:
+ elif message == 'session-locked':
self.guestInfo['session'] = "Locked"
- elif guestMessage == guestMType.sessionUnlock:
+ elif message == 'session-unlock':
self.guestInfo['session'] = "Active"
- elif guestMessage == guestMType.sessionLogoff:
+ elif message == 'session-logoff':
self.guestInfo['session'] = "LoggedOff"
- elif guestMessage == guestMType.agentUninstalled:
+ elif message == 'uninstalled':
self.log.debug("RHEV agent was uninstalled.")
self.guestInfo['appsList'] = []
- elif guestMessage == guestMType.sessionStartup:
+ elif message == 'session-startup':
self.log.debug("Guest system is started or restarted.")
- elif guestMessage == guestMType.sessionShutdown:
+ elif message == 'session-shutdown':
self.log.debug("Guest system shuts down.")
+ elif message == 'disks-usage':
+ self.log.debug("Ignoring disks usages information...")
else:
- self.log.error('Unknown message type %s', guestMessage)
+ self.log.error('Unknown message type %s', message)
def stop (self):
self._stopped = True
@@ -220,7 +142,7 @@ class GuestAgent (threading.Thread):
def desktopLock(self):
try:
self.log.debug("desktopLock called")
- self._forward("lock screen")
+ self._forward("lock-screen")
except:
self.log.error(traceback.format_exc())
@@ -231,70 +153,77 @@ class GuestAgent (threading.Thread):
username = user + '@' + domain
else:
username = user
- username = username.encode('utf-8')
- password = password.encode('utf-8')
- s = struct.pack('>6sI%ds%ds' % (len(username), len(password) + 1),
- 'login', len(username), username, password)
- self._forward(s)
+ self._forward('login', { 'username' : username, "password" : password })
except:
self.log.error(traceback.format_exc())
def desktopLogoff (self, force):
try:
self.log.debug("desktopLogoff called")
- self._forward('log off')
+ self._forward('log-off')
except:
self.log.error(traceback.format_exc())
- def sendHcCmdToDesktop (self, cmd):
+ def desktopShutdown (self, timeout, msg):
try:
- self.log.debug("sendHcCmdToDesktop('%s')"%(cmd))
- self._forward(str(cmd))
+ self.log.debug("desktopShutdown called")
+ self._forward('shutdown', { 'timeout' : timeout, 'message' : msg })
except:
self.log.error(traceback.format_exc())
+ def _onChannelTimeout(self):
+ self.guestInfo['memUsage'] = 0
+ if self.guestStatus not in ("Powered down", "RebootInProgress"):
+ self.log.log(logging.TRACE, "Guest connection timed out")
+ self.guestStatus = None
+
READSIZE = 2**16
def _readBuffer(self):
- while not self._stopped:
- try:
- s = self._sock.recv(self.READSIZE)
- if s:
- self._buffer += s
- self._agentTimestamp = time.time()
- break
+ try:
+ s = self._sock.recv(self.READSIZE)
+ if s:
+ self._buffer += s
+ else:
time.sleep(1)
- except socket.timeout:
- # TODO move these specific bits out of here
- self.guestInfo['memUsage'] = 0
- if self.guestStatus not in ("Powered down", "RebootInProgress"):
- self.log.log(logging.TRACE, "Guest connection timed out")
- self.guestStatus = None
-
- def _readMessage(self):
- msg = None
- if len(self._buffer) >= headerLengthBytes:
- msglen = self._parseHeader(self._buffer[:headerLengthBytes])
- if len(self._buffer) >= headerLengthBytes + msglen:
- msg = self._buffer[headerLengthBytes:headerLengthBytes + msglen]
- self._buffer = self._buffer[headerLengthBytes + msglen:]
- return msg
-
- def _parseMessages(self):
- s = self._readMessage()
- while not self._stopped and s:
- self._parseBody(s)
- s = self._readMessage()
+ except socket.timeout:
+ self._onChannelTimeout()
+
+ def _readLine(self):
+ newline = self._buffer.find('\n')
+ while not self._stopped and newline < 0:
+ self._readBuffer()
+ newline = self._buffer.find('\n')
+ if newline >= 0:
+ newline += 1 # include the EOL char.
+ line = self._buffer[:newline]
+ self._buffer = self._buffer[newline:]
+ else:
+ line = None
+ return line
+
+ def _parseLine(self, line):
+ try:
+ args = json.loads(line.decode('utf8'))
+ name = args['__name__']
+ del args['__name__']
+ except:
+ self.log.exception("Error parsing: %s" % (line))
+ name = None
+ args = None
+ return (name, args)
def run(self):
self._stopped = False
try:
if not self._connect():
return
- self.sendHcCmdToDesktop('refresh')
+ self._forward('refresh')
self._buffer = ''
while not self._stopped:
- self._readBuffer()
- self._parseMessages()
+ (message, args) = self._parseLine(self._readLine())
+ if message:
+ self._agentTimestamp = time.time()
+ self._handleMessage(message, args)
except:
if not self._stopped:
self.log.error("Unexpected exception: " + traceback.format_exc())
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 941ea0a..ab88375 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -667,8 +667,7 @@ class Vm(object):
self._guestEventTime = now
self._guestEvent = 'Powering down'
self.log.debug('guestAgent shutdown called')
- guest_message = 'shutdown,' + timeout + ',' + message
- self.guestAgent.sendHcCmdToDesktop(guest_message)
+ self.guestAgent.desktopShutdown(timeout, message)
agent_timeout = int(timeout) + config.getint('vars', 'sys_shutdown_timeout')
timer = threading.Timer(agent_timeout, self._timedShutdown)
timer.start()
11 years, 9 months
[NEW PATCH] BZ#726970 iscsiadm: Return an appropriate error code to ISCSI_ERR_LOGIN_AUTH_FAILED (via gerrit-bot)
by David Naori
New patch submitted by David Naori (dnaori(a)redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/772
commit c2356c2f91d9652476c02a28477542e933d42737
Author: David Naori <dnaori(a)redhat.com>
Date: Mon Aug 1 15:32:08 2011 -0400
BZ#726970 iscsiadm: Return an appropriate error code to ISCSI_ERR_LOGIN_AUTH_FAILED
Change-Id: I2fa16bad0661ff06470e00e62bce27d98ed01f84
diff --git a/vdsm/storage/iscsi.py b/vdsm/storage/iscsi.py
index 1d5bf90..70697dc 100644
--- a/vdsm/storage/iscsi.py
+++ b/vdsm/storage/iscsi.py
@@ -246,6 +246,7 @@ discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768
# iscsiadm exit statuses
ISCSI_ERR_SESS_EXISTS = 15
+ISCSI_ERR_LOGIN_AUTH_FAILED = 24
log = logging.getLogger('Storage.iScsi')
@@ -472,7 +473,9 @@ def addiSCSINode(ip, port, iqn, tpgt, initiator, username=None, password=None):
# Finally instruct the iscsi initiator to login to the target
cmd = cmdt + ["-l", "-p", portal]
rc = misc.execCmd(cmd)[0]
- if rc not in (0, ISCSI_ERR_SESS_EXISTS):
+ if rc == ISCSI_ERR_LOGIN_AUTH_FAILED:
+ raise se.iSCSILoginAuthError(portal)
+ elif rc not in (0, ISCSI_ERR_SESS_EXISTS):
raise se.iSCSILoginError(portal)
except se.StorageException:
diff --git a/vdsm/storage/storage_exception.py b/vdsm/storage/storage_exception.py
index 1496bbc..8067189 100644
--- a/vdsm/storage/storage_exception.py
+++ b/vdsm/storage/storage_exception.py
@@ -913,6 +913,9 @@ class iSCSIDiscoveryError(StorageServeriSCSIError):
def __init__(self, portal, err):
self.value = "portal=%s, err=%s" % (portal, err)
+class iSCSILoginAuthError(StorageServeriSCSIError):
+ code = 476
+ message = "Failed to login to iSCSI node due to authorization failure"
#################################################
# LVM related Exceptions
#################################################
11 years, 9 months
[NEW PATCH] BZ#733909 - get SPM id from lease instead of metadata (via gerrit-bot)
by smizrahi@redhat.com
New patch submitted by Saggi Mizrahi (smizrahi(a)redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/860
commit 9b85e68f8d39beb981f2204644313d6c4e3b1a54
Author: Saggi Mizrahi <smizrahi(a)redhat.com>
Date: Mon Aug 29 09:40:09 2011 +0300
BZ#733909 - get SPM id from lease instead of metadata
Metadata is cached and expensive to read and giving stale values to
management might cause undesired behaviour. This will cause VDSM to read
the spm owner directly from the lease which is safer and less expensive
then reading from metadata. Some places still rely on the metadata.
Those places either care about the metadata more then the actual value
or, like spmStart, must check consistency of both and use uncached
metadata anyways.
Change-Id: I582ae24aa843ad33e48a4cdd1e51b059355d132f
diff --git a/vdsm/storage/safelease.py b/vdsm/storage/safelease.py
index 107d304..814b5b5 100644
--- a/vdsm/storage/safelease.py
+++ b/vdsm/storage/safelease.py
@@ -26,8 +26,12 @@ import constants
import storage_exception as se
import threading
import logging
+import fileUtils
MAX_HOST_ID = 250
+ID_LEN = 16
+TIMESTAMP_LEN = 16
+TAG_LEN = ID_LEN + TIMESTAMP_LEN
class ClusterLock(object):
log = logging.getLogger("ClusterLock")
@@ -65,6 +69,19 @@ class ClusterLock(object):
self._leaseFailRetry = leaseFailRetry
self._ioOpTimeoutSec = ioOpTimeoutSec
+ def readTag(self):
+ with fileUtils.DirectFile(self._leaseFile, "dr") as f:
+ #Read 512 because you can't read less with direct io
+ tag = f.read(512)
+ try:
+ owner = int(tag[:ID_LEN])
+ except ValueError:
+ # When lease is free the tag is ------FREE-----
+ owner = -1
+ stamp = int(tag[ID_LEN:TAG_LEN], 16)
+
+ return owner, stamp
+
def acquire(self, hostID):
leaseTimeMs = self._leaseTimeSec * 1000
ioOpTimeoutMs = self._ioOpTimeoutSec * 1000
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index 4fbf95f..056021e 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -495,6 +495,9 @@ class StoragePool:
finally:
self.id = None
+ def getClusterLockOwner(self):
+ self.log.warn("DASDASDASDASDASD %d", self.getMasterDomain()._clusterLock.readTag()[1])
+ return self.getMasterDomain()._clusterLock.readTag()[0]
def copyPoolMD(self, prevMd, newMD):
prevPoolMD = self._getPoolMD(prevMd)
@@ -1023,7 +1026,7 @@ class StoragePool:
info['domains'] = domainListEncoder(self.getDomains())
info['name'] = self.getDescription()
info['lver'] = self.getMetaParam(PMDK_LVER)
- info['spm_id'] = self.getMetaParam(PMDK_SPM_ID)
+ info['spm_id'] = self.getClusterLockOwner()
info['master_uuid'] = msdInfo['uuid']
info['master_ver'] = self.getMasterVersion()
info['version'] = str(self.getVersion())
@@ -1271,7 +1274,7 @@ class StoragePool:
try:
masterdomain = self.getMasterDomain()
self.invalidateMetadata()
- spmId = self.getMetaParam(PMDK_SPM_ID)
+ spmId = self.getClusterLockOwner()
domains = self.getDomains(activeOnly=True)
for dom in domains:
diff --git a/vdsm/storage/spm.py b/vdsm/storage/spm.py
index ae55e44..286fca0 100644
--- a/vdsm/storage/spm.py
+++ b/vdsm/storage/spm.py
@@ -720,7 +720,7 @@ class SPM:
pool = hsm.HSM.getPool(spUUID)
try:
lver = pool.getMetaParam(sp.PMDK_LVER)
- spmId = pool.getMetaParam(sp.PMDK_SPM_ID)
+ spmId = pool.getClusterLockOwner()
except se.LogicalVolumeRefreshError:
# This happens when we cannot read the MD LV
raise se.CannotRetrieveSpmStatus()
11 years, 9 months
[NEW PATCH] BZ#728958 Don't check read delay when domain was not produced (via gerrit-bot)
by smizrahi@redhat.com
New patch submitted by Saggi Mizrahi (smizrahi(a)redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/801
commit 3649330e9f69d7dcc89c7660c2d876b30acd0749
Author: Saggi Mizrahi <smizrahi(a)redhat.com>
Date: Mon Aug 8 16:54:11 2011 +0300
BZ#728958 Don't check read delay when domain was not produced
Change-Id: Idb9a0d62299136cd8011f0e550373900b04ec3af
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index 4df9efc..385d860 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -104,6 +104,12 @@ class StatsThread(threading.Thread):
delay = 0
try:
+ # If we couldn't retrieve the domain object there is something
+ # wrong with the domain. No need to log because is was logged
+ # when the produce() failed
+ if self._domain is None:
+ continue
+
# This is handled seperatly because in case of this kind
# of failure we don't want to print stack trace
delay = self._domain.getReadDelay()
11 years, 9 months
[NEW PATCH] BZ#731598 Use the correct port in waitRouteRestore (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/830
commit 74eb4246985a3466eff012ae5f899b4eb4d8f759
Author: Federico Simoncelli <fsimonce(a)redhat.com>
Date: Thu Aug 18 12:29:59 2011 +0000
BZ#731598 Use the correct port in waitRouteRestore
Change-Id: Iaef8d5305a6c4eeab53a622a7693261e9b9cb8e1
diff --git a/vds_bootstrap/vds_bootstrap.py b/vds_bootstrap/vds_bootstrap.py
index 7929f36..f00cca0 100755
--- a/vds_bootstrap/vds_bootstrap.py
+++ b/vds_bootstrap/vds_bootstrap.py
@@ -552,15 +552,17 @@ gpgcheck=0
self._xmlOutput('CreateConf', self.status, None, None, self.message)
return self.rc
- def _addNetwork(self, vdcName):
+ def _addNetwork(self, vdcName, vdcPort):
fReturn = True
#add rhevm bridge
try:
fReturn = deployUtil.makeBridge(vdcName, VDSM_DIR)
if fReturn: #save current config by removing the undo files:
+ vdcUrl = "http://%s:%s" % (
+ vdcName, str(vdcPort) if vdcPort else "80")
try:
- if not deployUtil.waitRouteRestore(60, vdcName):
+ if not deployUtil.waitRouteRestore(60, vdcUrl)
fReturn = False
self.message = "No route to VDC. Check switch/router settings and try registration again"
logging.error(self.message)
@@ -604,7 +606,7 @@ gpgcheck=0
logging.error(self.message)
#Do not set rc to allow changes from rhev-m.
else:
- self._addNetwork(url)
+ self._addNetwork(url, port)
self._xmlOutput('SetNetworking', self.status, None, None, self.message)
return self.rc
11 years, 9 months
[NEW PATCH] Related BZ#729249: bootstrap: no need to install DEVEL_PACKAGES (via gerrit-bot)
by Dan Kenigsberg
New patch submitted by Dan Kenigsberg (danken(a)redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/828
commit 4a9686af7d79228c63223b5617fda74ac87fc8fa
Author: Dan Kenigsberg <danken(a)redhat.com>
Date: Wed Aug 17 22:24:37 2011 +0300
Related BZ#729249: bootstrap: no need to install DEVEL_PACKAGES
Bootstrap takes too long. Some of this time is wasted on installing
pacakges we do not really need any more.
Change-Id: I1394b513fd401fb3f3ef1a750176b51bc344ab08
diff --git a/vds_bootstrap/vds_bootstrap.py b/vds_bootstrap/vds_bootstrap.py
index 6a06852..2d086ef 100755
--- a/vds_bootstrap/vds_bootstrap.py
+++ b/vds_bootstrap/vds_bootstrap.py
@@ -77,8 +77,7 @@ REQ_PACK = ('SDL.x86_64','bridge-utils.x86_64','mesa-libGLU.x86_64',
'openssl.x86_64','m2crypto.x86_64','rsync.x86_64')
if rhel6based:
- DEVEL_PACK = ('gdb','tcpdump','strace','ltrace','sysstat','ntp',
- 'vim-common','vim-enhanced', 'systemtap-runtime')
+ DEVEL_PACK = ()
VDS_PACK = ('qemu-kvm', 'qemu-kvm-tools', VDSM_NAME, VDSM_NAME+'-cli',
'libjpeg', 'spice-server', 'pixman',
'seabios', 'qemu-img', 'fence-agents')
11 years, 9 months