Change in vdsm[master]: vm.Vm._getUnderlyingDriveInfo: extract path of gluster disks
by Dan Kenigsberg
Dan Kenigsberg has uploaded a new change for review.
Change subject: vm.Vm._getUnderlyingDriveInfo: extract path of gluster disks
......................................................................
vm.Vm._getUnderlyingDriveInfo: extract path of gluster disks
_getUnderlyingDriveInfo() is broken by design. It has no reliable means
to match Engine-requested devices with libvirt-produced ones. As a
heuristic, it uses the device's as matching key. However, before this
patch, it failed to extract the path from the xml definition of gluster
disks.
Bug-Url: https://bugzilla.redhat.com/1007980
Change-Id: I4459916cab24d735c067a6eb7020d4f43505fc97
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M vdsm/vm.py
1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/06/19906/1
diff --git a/vdsm/vm.py b/vdsm/vm.py
index f09b739..c85dc10 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -4647,7 +4647,8 @@
sources = x.getElementsByTagName('source')
if sources:
devPath = (sources[0].getAttribute('file') or
- sources[0].getAttribute('dev'))
+ sources[0].getAttribute('dev') or
+ sources[0].getAttribute('name'))
else:
devPath = ''
--
To view, visit http://gerrit.ovirt.org/19906
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4459916cab24d735c067a6eb7020d4f43505fc97
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
9 years, 8 months
Change in vdsm[master]: jsonrpc: Create the java bindings and fix bugs
by ybronhei@redhat.com
Yaniv Bronhaim has posted comments on this change.
Change subject: jsonrpc: Create the java bindings and fix bugs
......................................................................
Patch Set 6: Code-Review+1
(1 comment)
+1 only for json python part! I'll recheck on new ps
....................................................
File lib/yajsonrpc/betterAsyncore.py
Line 221: self.ac_in_buffer = ''
Line 222:
Line 223: def _find_prefix_at_end(haystack, needle):
Line 224: l = len(needle) - 1
Line 225: while l and not haystack.endswith(needle[:l]):
while l>0
Line 226: l -= 1
Line 227: return l
Line 228:
Line 229: def handle_write(self, dispatcher):
--
To view, visit http://gerrit.ovirt.org/19497
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: If828355b7efe28fe6a2e784069425fefd2f3f25c
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi(a)redhat.com>
Gerrit-Reviewer: Barak Azulay <bazulay(a)redhat.com>
Gerrit-Reviewer: Eduardo <ewarszaw(a)redhat.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi(a)redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: mooli tayer <mtayer(a)redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
9 years, 8 months
Change in vdsm[master]: vdsm: Refactor out LibvirtVmDevice
by Vinzenz Feenstra
Vinzenz Feenstra has uploaded a new change for review.
Change subject: vdsm: Refactor out LibvirtVmDevice
......................................................................
vdsm: Refactor out LibvirtVmDevice
Removal of the class LibvirtVmDevice
Change-Id: I4e05b948dbe88328f3cd3186df7d12a40eb5e648
Signed-off-by: Vinzenz Feenstra <vfeenstr(a)redhat.com>
---
M vdsm/vm/devices/__init__.py
M vdsm/vm/devices/device.py
2 files changed, 14 insertions(+), 17 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/66/10866/1
diff --git a/vdsm/vm/devices/__init__.py b/vdsm/vm/devices/__init__.py
index 6c5283c..d32030b 100644
--- a/vdsm/vm/devices/__init__.py
+++ b/vdsm/vm/devices/__init__.py
@@ -18,7 +18,7 @@
# Refer to the README and COPYING files for full details of the license
#
-from device import Device, LibvirtVmDevice, GeneralDevice, ControllerDevice,\
+from device import Device, GeneralDevice, ControllerDevice,\
VideoDevice, SoundDevice, NetworkInterfaceDevice, Drive, BalloonDevice,\
WatchdogDevice, SmartCardDevice, RedirDevice, ConsoleDevice
@@ -46,7 +46,6 @@
"CONSOLE_DEVICES",
"SMARTCARD_DEVICES",
"Device",
- "LibvirtVmDevice",
"GeneralDevice",
"ControllerDevice",
"VideoDevice",
diff --git a/vdsm/vm/devices/device.py b/vdsm/vm/devices/device.py
index 8d3b5cc..d8a1f79 100644
--- a/vdsm/vm/devices/device.py
+++ b/vdsm/vm/devices/device.py
@@ -39,8 +39,6 @@
if not a.startswith('__')]
return " ".join(attrs)
-
-class LibvirtVmDevice(Device):
def createXmlElem(self, elemType, deviceType, attributes=[]):
"""
Create domxml device element according to passed in params
@@ -67,7 +65,7 @@
return element
-class GeneralDevice(LibvirtVmDevice):
+class GeneralDevice(Device):
def getXML(self):
"""
@@ -76,7 +74,7 @@
return self.createXmlElem(self.type, self.device, ['address'])
-class ControllerDevice(LibvirtVmDevice):
+class ControllerDevice(Device):
def getXML(self):
"""
@@ -91,7 +89,7 @@
return ctrl
-class VideoDevice(LibvirtVmDevice):
+class VideoDevice(Device):
def getXML(self):
"""
@@ -108,7 +106,7 @@
return video
-class SoundDevice(LibvirtVmDevice):
+class SoundDevice(Device):
def getXML(self):
"""
@@ -119,7 +117,7 @@
return sound
-class NetworkInterfaceDevice(LibvirtVmDevice):
+class NetworkInterfaceDevice(Device):
def __init__(self, conf, log, **kwargs):
# pyLint can't tell that the Device.__init__() will
@@ -130,7 +128,7 @@
kwargs[attr] = 'virtio'
elif attr == 'network' and value == '':
kwargs[attr] = DUMMY_BRIDGE
- LibvirtVmDevice.__init__(self, conf, log, **kwargs)
+ Device.__init__(self, conf, log, **kwargs)
self.sndbufParam = False
self._customize()
@@ -209,7 +207,7 @@
return iface
-class Drive(LibvirtVmDevice):
+class Drive(Device):
VOLWM_CHUNK_MB = config.getint('irs', 'volume_utilization_chunk_mb')
VOLWM_FREE_PCT = 100 - config.getint('irs', 'volume_utilization_percent')
VOLWM_CHUNK_REPLICATE_MULT = 2 # Chunk multiplier during replication
@@ -217,7 +215,7 @@
def __init__(self, conf, log, **kwargs):
if not kwargs.get('serial'):
self.serial = kwargs.get('imageID'[-20:]) or ''
- LibvirtVmDevice.__init__(self, conf, log, **kwargs)
+ Device.__init__(self, conf, log, **kwargs)
# Keep sizes as int
self.reqsize = int(kwargs.get('reqsize', '0')) # Backward compatible
self.truesize = int(kwargs.get('truesize', '0'))
@@ -369,7 +367,7 @@
return diskelem
-class BalloonDevice(LibvirtVmDevice):
+class BalloonDevice(Device):
def getXML(self):
"""
@@ -385,7 +383,7 @@
return m
-class WatchdogDevice(LibvirtVmDevice):
+class WatchdogDevice(Device):
def getXML(self):
"""
Create domxml for a watchdog device.
@@ -401,7 +399,7 @@
return m
-class SmartCardDevice(LibvirtVmDevice):
+class SmartCardDevice(Device):
def getXML(self):
"""
Add smartcard section to domain xml
@@ -416,7 +414,7 @@
return card
-class RedirDevice(LibvirtVmDevice):
+class RedirDevice(Device):
def getXML(self):
"""
Create domxml for a redir device.
@@ -428,7 +426,7 @@
return self.createXmlElem('redirdev', self.device, ['bus', 'address'])
-class ConsoleDevice(LibvirtVmDevice):
+class ConsoleDevice(Device):
def getXML(self):
"""
Create domxml for a console device.
--
To view, visit http://gerrit.ovirt.org/10866
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4e05b948dbe88328f3cd3186df7d12a40eb5e648
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeenstr(a)redhat.com>
9 years, 8 months
Change in vdsm[master]: vdsm: Simplify device map initialization
by Vinzenz Feenstra
Vinzenz Feenstra has uploaded a new change for review.
Change subject: vdsm: Simplify device map initialization
......................................................................
vdsm: Simplify device map initialization
Change-Id: I36b89a0aec6fc1311aba2b9213ee4dc705f43e7e
Signed-off-by: Vinzenz Feenstra <vfeenstr(a)redhat.com>
---
M vdsm/vm/devices/__init__.py
M vdsm/vm/vm.py
2 files changed, 17 insertions(+), 13 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/67/10867/1
diff --git a/vdsm/vm/devices/__init__.py b/vdsm/vm/devices/__init__.py
index d32030b..6b0ed50 100644
--- a/vdsm/vm/devices/__init__.py
+++ b/vdsm/vm/devices/__init__.py
@@ -35,6 +35,20 @@
SMARTCARD_DEVICES = 'smartcard'
+def initDeviceMap():
+ return {
+ DISK_DEVICES: [],
+ NIC_DEVICES: [],
+ SOUND_DEVICES: [],
+ VIDEO_DEVICES: [],
+ CONTROLLER_DEVICES: [],
+ GENERAL_DEVICES: [],
+ BALLOON_DEVICES: [],
+ REDIR_DEVICES: [],
+ WATCHDOG_DEVICES: [],
+ CONSOLE_DEVICES: [],
+ SMARTCARD_DEVICES: []}
+
__all__ = [
"DISK_DEVICES",
"NIC_DEVICES",
diff --git a/vdsm/vm/vm.py b/vdsm/vm/vm.py
index 5f769b5..0302615 100644
--- a/vdsm/vm/vm.py
+++ b/vdsm/vm/vm.py
@@ -48,7 +48,7 @@
REDIR_DEVICES, WATCHDOG_DEVICES, SMARTCARD_DEVICES, CONSOLE_DEVICES
from devices import Drive, NetworkInterfaceDevice, SoundDevice,\
VideoDevice, ControllerDevice, GeneralDevice, BalloonDevice,\
- WatchdogDevice, RedirDevice, ConsoleDevice, SmartCardDevice
+ WatchdogDevice, RedirDevice, ConsoleDevice, SmartCardDevice, initDeviceMap
from vdsm import constants, utils, libvirtconnection
from vdsm.config import config
import guestIF
@@ -156,12 +156,7 @@
self.stopDisksStatsCollection()
self._vmCreationEvent = threading.Event()
self._pathsPreparedEvent = threading.Event()
- self._devices = {DISK_DEVICES: [], NIC_DEVICES: [],
- SOUND_DEVICES: [], VIDEO_DEVICES: [],
- CONTROLLER_DEVICES: [], GENERAL_DEVICES: [],
- BALLOON_DEVICES: [], REDIR_DEVICES: [],
- WATCHDOG_DEVICES: [], CONSOLE_DEVICES: [],
- SMARTCARD_DEVICES: []}
+ self._devices = initDeviceMap()
def _get_lastStatus(self):
PAUSED_STATES = ('Powering down', 'RebootInProgress', 'Up')
@@ -240,12 +235,7 @@
return removables
def getConfDevices(self):
- devices = {DISK_DEVICES: [], NIC_DEVICES: [],
- SOUND_DEVICES: [], VIDEO_DEVICES: [],
- CONTROLLER_DEVICES: [], GENERAL_DEVICES: [],
- BALLOON_DEVICES: [], REDIR_DEVICES: [],
- WATCHDOG_DEVICES: [], CONSOLE_DEVICES: [],
- SMARTCARD_DEVICES: []}
+ devices = initDeviceMap()
for dev in self.conf.get('devices'):
try:
devices[dev['type']].append(dev)
--
To view, visit http://gerrit.ovirt.org/10867
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I36b89a0aec6fc1311aba2b9213ee4dc705f43e7e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeenstr(a)redhat.com>
9 years, 8 months
Change in vdsm[master]: vdsm: Nicer names for methods
by Vinzenz Feenstra
Vinzenz Feenstra has uploaded a new change for review.
Change subject: vdsm: Nicer names for methods
......................................................................
vdsm: Nicer names for methods
Underlying is gone, _pause = _suspend, _cont = _resume
Change-Id: I9614084b812d1da4a5a1b0cc8aedefbd63713f60
Signed-off-by: Vinzenz Feenstra <vfeenstr(a)redhat.com>
---
M vdsm/vm/migration/source_thread.py
M vdsm/vm/vm.py
2 files changed, 47 insertions(+), 47 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/68/10868/1
diff --git a/vdsm/vm/migration/source_thread.py b/vdsm/vm/migration/source_thread.py
index 668e892..8251e48 100644
--- a/vdsm/vm/migration/source_thread.py
+++ b/vdsm/vm/migration/source_thread.py
@@ -222,7 +222,7 @@
'method': self._method,
'dstparams': self._dstparams}
self._vm.saveState()
- self._startUnderlyingMigration()
+ self._startMigration()
self._finishSuccessfully()
except libvirt.libvirtError, e:
if e.get_error_code() == libvirt.VIR_ERR_OPERATION_ABORTED:
@@ -239,7 +239,7 @@
self._recover(str(e))
self.log.error("Failed to migrate", exc_info=True)
- def _startUnderlyingMigration(self):
+ def _startMigration(self):
self._preparingMigrationEvt = True
if self._mode == 'file':
hooks.before_vm_hibernate(self._vm._dom.XMLDesc(0), self._vm.conf)
diff --git a/vdsm/vm/vm.py b/vdsm/vm/vm.py
index 0302615..5fca0f0 100644
--- a/vdsm/vm/vm.py
+++ b/vdsm/vm/vm.py
@@ -128,7 +128,7 @@
self._monitorResponse = 0
self.conf['clientIp'] = ''
self.memCommitted = 0
- self._creationThread = threading.Thread(target=self._startUnderlyingVm)
+ self._creationThread = threading.Thread(target=self._startVm)
if 'migrationDest' in self.conf:
self._lastStatus = 'Migration Destination'
elif 'restoreState' in self.conf:
@@ -452,7 +452,7 @@
memory += config.getint('vars', 'guest_ram_overhead')
self.memCommitted = 2 ** 20 * memory
- def _startUnderlyingVm(self):
+ def _startVm(self):
self.log.debug("Start")
try:
self.memCommit()
@@ -525,7 +525,7 @@
self.startDisksStatsCollection()
def _onQemuDeath(self):
- self.log.info('underlying process disconnected')
+ self.log.info('qemu process disconnected')
# Try release VM resources first, if failed stuck in 'Powering Down'
# state
response = self.releaseVm()
@@ -705,7 +705,7 @@
if self.lastStatus in ('Migration Source', 'Saving State', 'Down'):
self.log.error('cannot cont while %s', self.lastStatus)
return errCode['unexpected']
- self._underlyingCont()
+ self._resume()
if hasattr(self, 'updateGuestCpuRunning'):
self.updateGuestCpuRunning()
self._lastStatus = afterState
@@ -723,7 +723,7 @@
self._acquireCpuLockWithTimeout()
try:
self.conf['pauseCode'] = 'NOERR'
- self._underlyingPause()
+ self._suspend()
if hasattr(self, 'updateGuestCpuRunning'):
self.updateGuestCpuRunning()
self._lastStatus = afterState
@@ -978,21 +978,21 @@
self._guestCpuRunning = (self._dom.info()[0] ==
libvirt.VIR_DOMAIN_RUNNING)
- def _getUnderlyingVmDevicesInfo(self):
+ def _getVmDevicesInfo(self):
"""
- Obtain underlying vm's devices info from libvirt.
+ Obtain vm's devices info from libvirt.
"""
- self._getUnderlyingNetworkInterfaceInfo()
- self._getUnderlyingDriveInfo()
- self._getUnderlyingDisplayPort()
- self._getUnderlyingSoundDeviceInfo()
- self._getUnderlyingVideoDeviceInfo()
- self._getUnderlyingControllerDeviceInfo()
- self._getUnderlyingBalloonDeviceInfo()
- self._getUnderlyingWatchdogDeviceInfo()
- self._getUnderlyingSmartcardDeviceInfo()
+ self._getNetworkInterfaceInfo()
+ self._getDriveInfo()
+ self._getDisplayPort()
+ self._getSoundDeviceInfo()
+ self._getVideoDeviceInfo()
+ self._getControllerDeviceInfo()
+ self._getBalloonDeviceInfo()
+ self._getWatchdogDeviceInfo()
+ self._getSmartcardDeviceInfo()
# Obtain info of all unknown devices. Must be last!
- self._getUnderlyingUnknownDeviceInfo()
+ self._getUnknownDeviceInfo()
def _domDependentInit(self):
if self.destroyed:
@@ -1004,8 +1004,8 @@
pass
raise Exception('destroy() called before Vm started')
- self._getUnderlyingVmInfo()
- self._getUnderlyingVmDevicesInfo()
+ self._getVmInfo()
+ self._getVmDevicesInfo()
#Currently there is no protection agains mirroring a network twice,
for nic in self._devices[NIC_DEVICES]:
@@ -1159,7 +1159,7 @@
self._devices[NIC_DEVICES].append(nic)
self.conf['devices'].append(nicParams)
self.saveState()
- self._getUnderlyingNetworkInterfaceInfo()
+ self._getNetworkInterfaceInfo()
hooks.after_nic_hotplug(nicXml, self.conf)
if hasattr(nic, 'portMirroring'):
@@ -1395,7 +1395,7 @@
self._devices[DISK_DEVICES].append(drive)
self.conf['devices'].append(diskParams)
self.saveState()
- self._getUnderlyingDriveInfo()
+ self._getDriveInfo()
return {'status': doneCode, 'vmList': self.status()}
@@ -1506,11 +1506,11 @@
self.saveState()
self.log.debug("End of migration")
- def _underlyingCont(self):
+ def _resume(self):
hooks.before_vm_cont(self._dom.XMLDesc(0), self.conf)
self._dom.resume()
- def _underlyingPause(self):
+ def _suspend(self):
hooks.before_vm_pause(self._dom.XMLDesc(0), self.conf)
self._dom.suspend()
@@ -2119,7 +2119,7 @@
pass
return pid
- def _getUnderlyingVmInfo(self):
+ def _getVmInfo(self):
self._lastXMLDesc = self._dom.XMLDesc(0)
devxml = _domParseStr(self._lastXMLDesc).childNodes[0]. \
getElementsByTagName('devices')[0]
@@ -2156,7 +2156,7 @@
os.rename(f.name, self._recoveryFile)
_previous(self)
try:
- self._getUnderlyingVmInfo()
+ self._getVmInfo()
except:
# we do not care if _dom suddenly died now
pass
@@ -2388,7 +2388,7 @@
self.saveState()
return {'status': doneCode}
- def _getUnderlyingDeviceAddress(self, devXml):
+ def _getDeviceAddress(self, devXml):
"""
Obtain device's address from libvirt
"""
@@ -2404,7 +2404,7 @@
return address
- def _getUnderlyingUnknownDeviceInfo(self):
+ def _getUnknownDeviceInfo(self):
"""
Obtain unknown devices info from libvirt.
@@ -2428,7 +2428,7 @@
alias = x.getElementsByTagName('alias')[0].getAttribute('name')
if not isKnownDevice(alias):
- address = self._getUnderlyingDeviceAddress(x)
+ address = self._getDeviceAddress(x)
# I general case we assume that device has attribute 'type',
# if it hasn't getAttribute returns ''.
device = x.getAttribute('type')
@@ -2438,7 +2438,7 @@
'address': address}
self.conf['devices'].append(newDev)
- def _getUnderlyingControllerDeviceInfo(self):
+ def _getControllerDeviceInfo(self):
"""
Obtain controller devices info from libvirt.
"""
@@ -2456,7 +2456,7 @@
index = x.getAttribute('index')
# Get controller address
- address = self._getUnderlyingDeviceAddress(x)
+ address = self._getDeviceAddress(x)
# In case the controller has index and/or model, they
# are compared. Currently relevant for USB controllers.
@@ -2485,7 +2485,7 @@
'address': address,
'alias': alias})
- def _getUnderlyingBalloonDeviceInfo(self):
+ def _getBalloonDeviceInfo(self):
"""
Obtain balloon device info from libvirt.
"""
@@ -2497,7 +2497,7 @@
if not x.getElementsByTagName('address'):
continue
- address = self._getUnderlyingDeviceAddress(x)
+ address = self._getDeviceAddress(x)
alias = x.getElementsByTagName('alias')[0].getAttribute('name')
for dev in self._devices[BALLOON_DEVICES]:
@@ -2511,7 +2511,7 @@
dev['address'] = address
dev['alias'] = alias
- def _getUnderlyingSmartcardDeviceInfo(self):
+ def _getSmartcardDeviceInfo(self):
"""
Obtain smartcard device info from libvirt.
"""
@@ -2522,7 +2522,7 @@
if not x.getElementsByTagName('address'):
continue
- address = self._getUnderlyingDeviceAddress(x)
+ address = self._getDeviceAddress(x)
alias = x.getElementsByTagName('alias')[0].getAttribute('name')
for dev in self._devices[SMARTCARD_DEVICES]:
@@ -2536,7 +2536,7 @@
dev['address'] = address
dev['alias'] = alias
- def _getUnderlyingWatchdogDeviceInfo(self):
+ def _getWatchdogDeviceInfo(self):
"""
Obtain watchdog device info from libvirt.
"""
@@ -2547,7 +2547,7 @@
# PCI watchdog has "address" different from ISA watchdog
if x.getElementsByTagName('address'):
- address = self._getUnderlyingDeviceAddress(x)
+ address = self._getDeviceAddress(x)
alias = x.getElementsByTagName('alias')[0].getAttribute('name')
for wd in self._devices[WATCHDOG_DEVICES]:
@@ -2561,7 +2561,7 @@
dev['address'] = address
dev['alias'] = alias
- def _getUnderlyingVideoDeviceInfo(self):
+ def _getVideoDeviceInfo(self):
"""
Obtain video devices info from libvirt.
"""
@@ -2570,7 +2570,7 @@
for x in videosxml:
alias = x.getElementsByTagName('alias')[0].getAttribute('name')
# Get video card address
- address = self._getUnderlyingDeviceAddress(x)
+ address = self._getDeviceAddress(x)
# FIXME. We have an identification problem here.
# Video card device has not unique identifier, except the alias
@@ -2589,7 +2589,7 @@
dev['alias'] = alias
break
- def _getUnderlyingSoundDeviceInfo(self):
+ def _getSoundDeviceInfo(self):
"""
Obtain sound devices info from libvirt.
"""
@@ -2598,7 +2598,7 @@
for x in soundsxml:
alias = x.getElementsByTagName('alias')[0].getAttribute('name')
# Get sound card address
- address = self._getUnderlyingDeviceAddress(x)
+ address = self._getDeviceAddress(x)
# FIXME. We have an identification problem here.
# Sound device has not unique identifier, except the alias
@@ -2617,7 +2617,7 @@
dev['alias'] = alias
break
- def _getUnderlyingDriveInfo(self):
+ def _getDriveInfo(self):
"""
Obtain block devices info from libvirt.
"""
@@ -2648,7 +2648,7 @@
else:
drv = 'raw'
# Get disk address
- address = self._getUnderlyingDeviceAddress(x)
+ address = self._getDeviceAddress(x)
for d in self._devices[DISK_DEVICES]:
if d.path == devPath:
@@ -2682,7 +2682,7 @@
diskDev['bootOrder'] = bootOrder
self.conf['devices'].append(diskDev)
- def _getUnderlyingDisplayPort(self):
+ def _getDisplayPort(self):
"""
Obtain display port info from libvirt.
"""
@@ -2695,7 +2695,7 @@
if port:
self.conf['displaySecurePort'] = port
- def _getUnderlyingNetworkInterfaceInfo(self):
+ def _getNetworkInterfaceInfo(self):
"""
Obtain network interface info from libvirt.
"""
@@ -2727,7 +2727,7 @@
network = network[len(netinfo.LIBVIRT_NET_PREFIX):]
# Get nic address
- address = self._getUnderlyingDeviceAddress(x)
+ address = self._getDeviceAddress(x)
for nic in self._devices[NIC_DEVICES]:
if nic.macAddr.lower() == mac.lower():
nic.name = name
--
To view, visit http://gerrit.ovirt.org/10868
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9614084b812d1da4a5a1b0cc8aedefbd63713f60
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeenstr(a)redhat.com>
9 years, 8 months
Change in vdsm[master]: vdsm: Vm remove unused method _incomingMigrationPending
by Vinzenz Feenstra
Vinzenz Feenstra has uploaded a new change for review.
Change subject: vdsm: Vm remove unused method _incomingMigrationPending
......................................................................
vdsm: Vm remove unused method _incomingMigrationPending
Change-Id: I726a46a1d7dea4461a44414ac5f596222cfbee68
Signed-off-by: Vinzenz Feenstra <vfeenstr(a)redhat.com>
---
M vdsm/vm/vm.py
1 file changed, 0 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/70/10870/1
diff --git a/vdsm/vm/vm.py b/vdsm/vm/vm.py
index 5fca0f0..b2de4d2 100644
--- a/vdsm/vm/vm.py
+++ b/vdsm/vm/vm.py
@@ -501,9 +501,6 @@
self.log.error("The vm start process failed", exc_info=True)
self.setDownStatus(ERROR, str(e))
- def _incomingMigrationPending(self):
- return 'migrationDest' in self.conf or 'restoreState' in self.conf
-
def stopDisksStatsCollection(self):
self._volumesPrepared = False
--
To view, visit http://gerrit.ovirt.org/10870
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I726a46a1d7dea4461a44414ac5f596222cfbee68
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeenstr(a)redhat.com>
9 years, 8 months
Change in vdsm[master]: vdsm: replace self.conf['vmId'] with self.id
by Vinzenz Feenstra
Vinzenz Feenstra has uploaded a new change for review.
Change subject: vdsm: replace self.conf['vmId'] with self.id
......................................................................
vdsm: replace self.conf['vmId'] with self.id
Change-Id: Ie116d8db8d0bf2157bc78be16a03b556443c18ef
Signed-off-by: Vinzenz Feenstra <vfeenstr(a)redhat.com>
---
M vdsm/vm/vm.py
1 file changed, 9 insertions(+), 11 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/44/11744/1
diff --git a/vdsm/vm/vm.py b/vdsm/vm/vm.py
index c366a39..a0d4339 100644
--- a/vdsm/vm/vm.py
+++ b/vdsm/vm/vm.py
@@ -119,11 +119,11 @@
"""
self.conf = {'pid': '0'}
self.conf.update(params)
+ self.id = self.conf['vmId']
self.cif = cif
- self.log = SimpleLogAdapter(self.log, {"vmId": self.conf['vmId']})
+ self.log = SimpleLogAdapter(self.log, {"vmId": self.id})
self.destroyed = False
- self._recoveryFile = constants.P_VDSM_RUN + \
- str(self.conf['vmId']) + '.recovery'
+ self._recoveryFile = constants.P_VDSM_RUN + self.id + '.recovery'
self.user_destroy = False
self._monitorResponse = 0
self.conf['clientIp'] = ''
@@ -137,10 +137,9 @@
self._lastStatus = 'WaitForLaunch'
self._migrationSourceThread = self.MigrationSourceThreadClass(self)
self._kvmEnable = self.conf.get('kvmEnable', 'true')
- self._guestSocketFile = constants.P_VDSM_RUN + self.conf['vmId'] + \
+ self._guestSocketFile = constants.P_VDSM_RUN + self.id + \
'.guest.socket'
self._incomingMigrationFinished = threading.Event()
- self.id = self.conf['vmId']
self._volPrepareLock = threading.Lock()
self._initTimePauseCode = None
self.guestAgent = None
@@ -2202,14 +2201,14 @@
if (e.get_error_code() ==
libvirt.VIR_ERR_OPERATION_FAILED):
self.log.warn("Failed to destroy VM '%s' "
- "gracefully", self.conf['vmId'])
+ "gracefully", self.id)
time.sleep(30)
self._dom.destroy()
except libvirt.libvirtError, e:
if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:
self.log.warning("libvirt domain not found", exc_info=True)
else:
- self.log.warn("VM %s is not running", self.conf['vmId'])
+ self.log.warn("VM %s is not running", self.id)
if not self.cif.mom:
self.cif.ksmMonitor.adjust()
@@ -2228,12 +2227,11 @@
Clean VM from the system
"""
try:
- del self.cif.vmContainer[self.conf['vmId']]
+ del self.cif.vmContainer[self.id]
self.log.debug("Total desktops after destroy of %s is %d",
- self.conf['vmId'], len(self.cif.vmContainer))
+ self.id, len(self.cif.vmContainer))
except Exception:
- self.log.error("Failed to delete VM %s", self.conf['vmId'],
- exc_info=True)
+ self.log.error("Failed to delete VM %s", self.id, exc_info=True)
def destroy(self):
self.log.debug('destroy Called')
--
To view, visit http://gerrit.ovirt.org/11744
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie116d8db8d0bf2157bc78be16a03b556443c18ef
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeenstr(a)redhat.com>
9 years, 8 months
Change in vdsm[master]: vdsm: Remove duplicated variable and class comment
by Vinzenz Feenstra
Vinzenz Feenstra has uploaded a new change for review.
Change subject: vdsm: Remove duplicated variable and class comment
......................................................................
vdsm: Remove duplicated variable and class comment
Change-Id: I1100efe3e14574fce651df6e2b1bf0ddd3130994
Signed-off-by: Vinzenz Feenstra <vfeenstr(a)redhat.com>
---
M vdsm/vm/vm.py
1 file changed, 0 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/45/11745/1
diff --git a/vdsm/vm/vm.py b/vdsm/vm/vm.py
index a0d4339..388d8bc 100644
--- a/vdsm/vm/vm.py
+++ b/vdsm/vm/vm.py
@@ -842,9 +842,6 @@
finally:
self._guestCpuLock.release()
-# class LibvirtVm(Vm):
- MigrationSourceThreadClass = MigrationSourceThread
-
def __init__(self, cif, params):
self._dom = None
self._base_init(self, cif, params)
--
To view, visit http://gerrit.ovirt.org/11745
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1100efe3e14574fce651df6e2b1bf0ddd3130994
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeenstr(a)redhat.com>
9 years, 8 months
Change in vdsm[master]: vdsm: Merge _base_init and __init__
by Vinzenz Feenstra
Vinzenz Feenstra has uploaded a new change for review.
Change subject: vdsm: Merge _base_init and __init__
......................................................................
vdsm: Merge _base_init and __init__
Signed-off-by: Vinzenz Feenstra <vfeenstr(a)redhat.com>
Change-Id: Ic4426942852c8c2c0c950f744e6bae5bfe3aaa2f
---
M vdsm/vm/vm.py
1 file changed, 17 insertions(+), 20 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/46/11746/1
diff --git a/vdsm/vm/vm.py b/vdsm/vm/vm.py
index 388d8bc..0d053ff 100644
--- a/vdsm/vm/vm.py
+++ b/vdsm/vm/vm.py
@@ -108,7 +108,7 @@
_ongoingCreations = threading.BoundedSemaphore(4)
MigrationSourceThreadClass = MigrationSourceThread
- def _base_init(self, cif, params):
+ def __init__(self, cif, params):
"""
Initialize a new VM instance.
@@ -117,6 +117,7 @@
:param params: The VM parameters.
:type params: dict
"""
+ self._dom = None
self.conf = {'pid': '0'}
self.conf.update(params)
self.id = self.conf['vmId']
@@ -156,6 +157,21 @@
self._vmCreationEvent = threading.Event()
self._pathsPreparedEvent = threading.Event()
self._devices = initDeviceMap()
+
+ self._connection = libvirtconnection.get(cif)
+ if 'vmName' not in self.conf:
+ self.conf['vmName'] = 'n%s' % self.id
+ self._guestSocketFile = (constants.P_LIBVIRT_VMCHANNELS +
+ self.conf['vmName'].encode('utf-8') +
+ '.' + _VMCHANNEL_DEVICE_NAME)
+ self._qemuguestSocketFile = (constants.P_LIBVIRT_VMCHANNELS +
+ self.conf['vmName'].encode('utf-8') +
+ '.' + _QEMU_GA_DEVICE_NAME)
+ self._lastXMLDesc = '<domain><uuid>%s</uuid></domain>' % self.id
+ self._devXmlHash = '0'
+ self._released = False
+ self._releaseLock = threading.Lock()
+ self.saveState()
def _get_lastStatus(self):
PAUSED_STATES = ('Powering down', 'RebootInProgress', 'Up')
@@ -841,25 +857,6 @@
raise
finally:
self._guestCpuLock.release()
-
- def __init__(self, cif, params):
- self._dom = None
- self._base_init(self, cif, params)
-
- self._connection = libvirtconnection.get(cif)
- if 'vmName' not in self.conf:
- self.conf['vmName'] = 'n%s' % self.id
- self._guestSocketFile = (constants.P_LIBVIRT_VMCHANNELS +
- self.conf['vmName'].encode('utf-8') +
- '.' + _VMCHANNEL_DEVICE_NAME)
- self._qemuguestSocketFile = (constants.P_LIBVIRT_VMCHANNELS +
- self.conf['vmName'].encode('utf-8') +
- '.' + _QEMU_GA_DEVICE_NAME)
- self._lastXMLDesc = '<domain><uuid>%s</uuid></domain>' % self.id
- self._devXmlHash = '0'
- self._released = False
- self._releaseLock = threading.Lock()
- self.saveState()
def _buildLease(self, domainID, volumeID, leasePath, leaseOffset):
"""
--
To view, visit http://gerrit.ovirt.org/11746
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic4426942852c8c2c0c950f744e6bae5bfe3aaa2f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeenstr(a)redhat.com>
9 years, 8 months
Change in vdsm[master]: vdsm: Simplify the retrieval of device XML objects
by Vinzenz Feenstra
Vinzenz Feenstra has uploaded a new change for review.
Change subject: vdsm: Simplify the retrieval of device XML objects
......................................................................
vdsm: Simplify the retrieval of device XML objects
Signed-off-by: Vinzenz Feenstra <vfeenstr(a)redhat.com>
Change-Id: I9d67e1f675ed5b4a6dfdc4fa0ee1a15487fb0a97
---
M vdsm/vm/vm.py
1 file changed, 20 insertions(+), 29 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/47/11747/1
diff --git a/vdsm/vm/vm.py b/vdsm/vm/vm.py
index 0d053ff..2286e41 100644
--- a/vdsm/vm/vm.py
+++ b/vdsm/vm/vm.py
@@ -2039,7 +2039,7 @@
def setTicket(self, otp, seconds, connAct, params):
graphics = _domParseStr(self._dom.XMLDesc(0)).childNodes[0]. \
- getElementsByTagName('graphics')[0]
+ getElementsByTagName('graphics')
graphics.setAttribute('passwd', otp)
if int(seconds) > 0:
validto = time.strftime('%Y-%m-%dT%H:%M:%S',
@@ -2111,8 +2111,7 @@
def _getVmInfo(self):
self._lastXMLDesc = self._dom.XMLDesc(0)
- devxml = _domParseStr(self._lastXMLDesc).childNodes[0]. \
- getElementsByTagName('devices')[0]
+ devxml = self._getDeviceXml()
self._devXmlHash = str(hash(devxml.toxml()))
return self._lastXMLDesc
@@ -2393,6 +2392,14 @@
return address
+ def _getDeviceXml(self, subDeviceName=None, deviceName='devices'):
+ # TODO use xpath instead of parseString (here and elsewhere)
+ devices = _domParseStr(self._lastXMLDesc).childNodes[0].\
+ getElementsByTagName(deviceName)[0]
+ if subDeviceName:
+ return devices.getElementsByTagName(subDeviceName)
+ return devices
+
def _getUnknownDeviceInfo(self):
"""
Obtain unknown devices info from libvirt.
@@ -2406,8 +2413,7 @@
return True
return False
- devsxml = _domParseStr(self._lastXMLDesc).childNodes[0]. \
- getElementsByTagName('devices')[0]
+ devsxml = self._getDeviceXml()
for x in devsxml.childNodes:
# Ignore empty nodes and devices without address
@@ -2431,9 +2437,7 @@
"""
Obtain controller devices info from libvirt.
"""
- ctrlsxml = _domParseStr(self._lastXMLDesc).childNodes[0]. \
- getElementsByTagName('devices')[0]. \
- getElementsByTagName('controller')
+ ctrlsxml = self._getDeviceXml('controller')
for x in ctrlsxml:
# Ignore controller devices without address
if not x.getElementsByTagName('address'):
@@ -2478,9 +2482,7 @@
"""
Obtain balloon device info from libvirt.
"""
- balloonxml = _domParseStr(self._lastXMLDesc).childNodes[0]. \
- getElementsByTagName('devices')[0]. \
- getElementsByTagName('memballoon')
+ balloonxml = self._getDeviceXml('memballoon')
for x in balloonxml:
# Ignore balloon devices without address.
if not x.getElementsByTagName('address'):
@@ -2504,9 +2506,7 @@
"""
Obtain smartcard device info from libvirt.
"""
- smartcardxml = _domParseStr(self._lastXMLDesc).childNodes[0].\
- getElementsByTagName('devices')[0].\
- getElementsByTagName('smartcard')
+ smartcardxml = self._getDeviceXml('smartcard')
for x in smartcardxml:
if not x.getElementsByTagName('address'):
continue
@@ -2529,9 +2529,7 @@
"""
Obtain watchdog device info from libvirt.
"""
- watchdogxml = _domParseStr(self._lastXMLDesc).childNodes[0]. \
- getElementsByTagName('devices')[0]. \
- getElementsByTagName('watchdog')
+ watchdogxml = self._getDeviceXml('watchdog')
for x in watchdogxml:
# PCI watchdog has "address" different from ISA watchdog
@@ -2554,8 +2552,7 @@
"""
Obtain video devices info from libvirt.
"""
- videosxml = _domParseStr(self._lastXMLDesc).childNodes[0]. \
- getElementsByTagName('devices')[0].getElementsByTagName('video')
+ videosxml = self._getDeviceXml('video')
for x in videosxml:
alias = x.getElementsByTagName('alias')[0].getAttribute('name')
# Get video card address
@@ -2582,8 +2579,7 @@
"""
Obtain sound devices info from libvirt.
"""
- soundsxml = _domParseStr(self._lastXMLDesc).childNodes[0]. \
- getElementsByTagName('devices')[0].getElementsByTagName('sound')
+ soundsxml = self._getDeviceXml('sound')
for x in soundsxml:
alias = x.getElementsByTagName('alias')[0].getAttribute('name')
# Get sound card address
@@ -2610,8 +2606,7 @@
"""
Obtain block devices info from libvirt.
"""
- disksxml = _domParseStr(self._lastXMLDesc).childNodes[0]. \
- getElementsByTagName('devices')[0].getElementsByTagName('disk')
+ disksxml = self._getDeviceXml('disk')
# FIXME! We need to gather as much info as possible from the libvirt.
# In the future we can return this real data to management instead of
# vm's conf
@@ -2675,8 +2670,7 @@
"""
Obtain display port info from libvirt.
"""
- graphics = _domParseStr(self._lastXMLDesc).childNodes[0]. \
- getElementsByTagName('graphics')[0]
+ graphics = self._getDeviceXml(None, 'graphics')
port = graphics.getAttribute('port')
if port:
self.conf['displayPort'] = port
@@ -2688,10 +2682,7 @@
"""
Obtain network interface info from libvirt.
"""
- # TODO use xpath instead of parseString (here and elsewhere)
- ifsxml = _domParseStr(self._lastXMLDesc).childNodes[0]. \
- getElementsByTagName('devices')[0]. \
- getElementsByTagName('interface')
+ ifsxml = self._getDeviceXml('interface')
for x in ifsxml:
devType = x.getAttribute('type')
name = x.getElementsByTagName('target')[0].getAttribute('dev')
--
To view, visit http://gerrit.ovirt.org/11747
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9d67e1f675ed5b4a6dfdc4fa0ee1a15487fb0a97
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeenstr(a)redhat.com>
9 years, 8 months