Shahar Havivi has uploaded a new change for review.
Change subject: RFE: Report downtime for each live migration
......................................................................
RFE: Report downtime for each live migration
vm.py getStat() is called when migration is done and from Engine
initiative.
There is no need to call libvirts domain getStats twice, only when
Engine initiate the call.
Change-Id: I2ff421c489ef24869502bd80461018f0aca2144d
Bug-Url: https://bugzilla.redhat.com/970711
Signed-off-by: Shahar Havivi <shaharh(a)redhat.com>
---
M vdsm/rpc/Bridge.py
M vdsm/virt/migration.py
M vdsm/virt/vm.py
3 files changed, 16 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/03/40103/1
diff --git a/vdsm/rpc/Bridge.py b/vdsm/rpc/Bridge.py
index bad8f1b..0484669 100644
--- a/vdsm/rpc/Bridge.py
+++ b/vdsm/rpc/Bridge.py
@@ -384,6 +384,13 @@
return {'params': ret['params'], 'migrationPort': ret['migrationPort']}
+def VM_getMigrationStatus_Ret(ret):
+ """
+ Return status of the Migration, progress and downtime if available
+ """
+ return ret
+
+
def Volume_getsize_Ret(ret):
"""
Merge the two sizes into a single dictionary result.
@@ -471,6 +478,7 @@
'VM_hotunplugNic': {'ret': 'vmList'},
'VM_mergeStatus': {'ret': 'mergeStatus'},
'VM_migrationCreate': {'ret': VM_migrationCreate_Ret},
+ 'VM_getMigrationStatus': {'ret': VM_getMigrationStatus_Ret},
'VM_pause': {'ret': VM_running_state_change_Ret},
'VM_setCpuTunePeriod': {'ret': 'taskStatus'},
'VM_setCpuTuneQuota': {'ret': 'taskStatus'},
diff --git a/vdsm/virt/migration.py b/vdsm/virt/migration.py
index f76fac2..8a31552 100644
--- a/vdsm/virt/migration.py
+++ b/vdsm/virt/migration.py
@@ -90,7 +90,7 @@
def hibernating(self):
return self._mode == MODE_FILE
- def getStat(self):
+ def getStat(self, useDowntime=False):
"""
Get the status of the migration.
"""
@@ -98,9 +98,11 @@
# fetch migration status from the monitor thread
self.status['progress'] = self._monitorThread.progress
- stat = self._vm._dom.jobStats(libvirt.VIR_DOMAIN_JOB_STATS_COMPLETED)
- if 'downtime' in stat:
- self.status['downtime'] = stat['downtime']
+ if useDowntime:
+ stat = self._vm._dom.jobStats(libvirt.
+ VIR_DOMAIN_JOB_STATS_COMPLETED)
+ if 'downtime' in stat:
+ self.status['downtime'] = stat['downtime']
return self.status
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 2690c6e..bdb488b 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1718,7 +1718,7 @@
'disks': {}}
if 'pauseCode' in self.conf:
stats['pauseCode'] = self.conf['pauseCode']
- if self.isMigrating():
+ if self.isMigrating() and self.migrateStatus().has_key('progress'):
stats['migrationProgress'] = self.migrateStatus()['progress']
decStats = {}
@@ -1868,7 +1868,7 @@
self._guestCpuLock.release()
def migrateStatus(self):
- return self._migrationSourceThread.getStat()
+ return self._migrationSourceThread.getStat(useDowntime=True)
def migrateCancel(self):
self._acquireCpuLockWithTimeout()
--
To view, visit https://gerrit.ovirt.org/40103
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2ff421c489ef24869502bd80461018f0aca2144d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Shahar Havivi <shavivi(a)redhat.com>
Shmuel Leib Melamud has uploaded a new change for review.
Change subject: vm: Detect RNG device by type
......................................................................
vm: Detect RNG device by type
In Vm._getUnderlyingRngDeviceInfo() method the RNG device must be
detected in self.conf['devices'] list by 'type' attribute, not 'device'.
See VmInfoBuilder.buildVmRngDevice() in the Engine for reference.
Change-Id: I31a1c38eec5be96e298e0f1dd5a7598c2212cb21
Signed-off-by: Shmuel Melamud <smelamud(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/95/40095/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 331cfcd..464d4aa 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -4198,7 +4198,7 @@
break
for dev in self.conf['devices']:
- if dev['device'] == hwclass.RNG and \
+ if dev['type'] == hwclass.RNG and \
caps.RNG_SOURCES[dev['specParams']['source']] == \
source and 'alias' not in dev:
dev['address'] = address
--
To view, visit https://gerrit.ovirt.org/40095
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I31a1c38eec5be96e298e0f1dd5a7598c2212cb21
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Shmuel Leib Melamud <smelamud(a)redhat.com>
Francesco Romani has uploaded a new change for review.
Change subject: sampling: less verbose debug in _getInterfaceStats
......................................................................
sampling: less verbose debug in _getInterfaceStats
HostStatsThread._getInterfaceStats needs, among other
things, to compute network tx/rx rate.
To help troubleshoot rate miscalculation, there is
a debug log which shows all the samples used for
computation.
The problem here is that the log cycles over the
internal samples. We want to use SampleWindow
in HostStatsThread to reduce code duplication,
but SampleWindow doesn't give access to samples yet.
To move further, we drop this detailed log for the time
being. Future patches may want to reintroduce it
on top of (enhanced) SampleWindow.
Change-Id: I0a6063c9ac6f9f477a03881e32d0c3821038092f
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/sampling.py
1 file changed, 1 insertion(+), 7 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/24/40424/1
diff --git a/vdsm/virt/sampling.py b/vdsm/virt/sampling.py
index f5640d0..8878120 100644
--- a/vdsm/virt/sampling.py
+++ b/vdsm/virt/sampling.py
@@ -710,13 +710,7 @@
if txRate > 100 or rxRate > 100:
txRate = min(txRate, 100.0)
rxRate = min(rxRate, 100.0)
- self._log.debug('Rate above 100%%. DEBUG: ifid %s interval: '
- '%s thisRx %s thisTx %s samples %s', ifid,
- interval, thisRx, thisTx,
- [(hs.timestamp, hs.interfaces[ifid].rx,
- hs.interfaces[ifid].tx)
- for hs in self._samples if
- ifid in hs.interfaces])
+ self._log.debug('Rate above 100%%.')
iface = hs1.interfaces[ifid]
stats['network'][ifid] = {'name': ifid, 'speed': str(ifrate),
'rxDropped': str(iface.rxDropped),
--
To view, visit https://gerrit.ovirt.org/40424
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0a6063c9ac6f9f477a03881e32d0c3821038092f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Nir Soffer has uploaded a new change for review.
Change subject: vm: Support replication to different storage type
......................................................................
vm: Support replication to different storage type
When monitoring replicated drive, we must use hybrid approach; For
block-based drive, we get the required extend info from libvirt. For
file-based drives, libvirt cannot report the physical size of the drive,
so we get it from the replica using irs.getVolumeSize().
When extending replicated drive, we extend the drive or the replica
only if they are block-based.
Change-Id: I70eb93082af81fe54268ee0133d1252c0d537ca8
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 35 insertions(+), 8 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/85/40185/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 163ab86..3c59c8b 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1303,7 +1303,7 @@
continue
try:
- capacity, alloc, physical = self._dom.blockInfo(drive.path, 0)
+ capacity, alloc, physical = self._getExtendInfo(drive)
except libvirt.libvirtError as e:
self.log.error("Unable to get watermarks for drive %s: %s",
drive.name, e)
@@ -1312,6 +1312,27 @@
ret.append((drive, drive.volumeID, capacity, alloc, physical))
return ret
+
+ def _getExtendInfo(self, drive):
+ """
+ Return extension info for a chunked drive
+ """
+ capacity, alloc, physical = self._dom.blockInfo(drive.path, 0)
+
+ # Libvirt reports watermarks only for the source drive, but for
+ # file-based drives it reports the same alloc and physical, which
+ # breaks our extend logic. Since drive is chunked, we must have a
+ # disk-based replica, so we get the physical size from the replica.
+
+ if not drive.blockDev:
+ replica = drive.diskReplicate
+ volsize = self._getVolumeSize(replica["domainID"],
+ replica["poolID"],
+ replica["imageID"],
+ replica["volumeID"])
+ physical = volsize.apparentsize
+
+ return capacity, alloc, physical
def _shouldExtendVolume(self, drive, volumeID, capacity, alloc, physical):
nextPhysSize = drive.getNextVolumeSize(physical, capacity)
@@ -1374,7 +1395,11 @@
"""
newSize = vmDrive.getNextVolumeSize(curSize, capacity)
- if hasattr(vmDrive, 'diskReplicate'):
+ # If drive is replicated to a block device, we extend first the
+ # replica, and handle drive later in __afterReplicaExtension.
+
+ replica = getattr(vmDrive, 'diskReplicate', {})
+ if replica.get('diskType') == DISK_TYPE.BLOCK:
self.__extendDriveReplica(vmDrive, newSize)
else:
self.__extendDriveVolume(vmDrive, volumeID, newSize)
@@ -1406,10 +1431,12 @@
def __afterReplicaExtension(self, volInfo):
self.__verifyVolumeExtension(volInfo)
vmDrive = self._findDriveByName(volInfo['name'])
- self.log.debug("Requesting extension for the original drive: %s "
- "(domainID: %s, volumeID: %s)",
- vmDrive.name, vmDrive.domainID, vmDrive.volumeID)
- self.__extendDriveVolume(vmDrive, vmDrive.volumeID, volInfo['newSize'])
+ if vmDrive.blockDev:
+ self.log.debug("Requesting extension for the original drive: %s "
+ "(domainID: %s, volumeID: %s)",
+ vmDrive.name, vmDrive.domainID, vmDrive.volumeID)
+ self.__extendDriveVolume(vmDrive, vmDrive.volumeID,
+ volInfo['newSize'])
def __extendDriveVolume(self, vmDrive, volumeID, newSize):
volInfo = {
@@ -3464,7 +3491,7 @@
if drive.chunked:
try:
- capacity, alloc, physical = self._dom.blockInfo(drive.path, 0)
+ capacity, alloc, physical = self._getExtendInfo(drive)
self.extendDriveVolume(drive, drive.volumeID, physical,
capacity)
except Exception:
@@ -4880,7 +4907,7 @@
# plus a bit more to accomodate additional writes to 'top' during the
# live merge operation.
if drive.chunked:
- capacity, alloc, physical = self._dom.blockInfo(drive.path, 0)
+ capacity, alloc, physical = self._getExtendInfo(drive)
self.extendDriveVolume(drive, baseVolUUID, topSize, capacity)
# Trigger the collection of stats before returning so that callers
--
To view, visit https://gerrit.ovirt.org/40185
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I70eb93082af81fe54268ee0133d1252c0d537ca8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Nir Soffer has uploaded a new change for review.
Change subject: virt: Consider drive replica in Drive.chunked
......................................................................
virt: Consider drive replica in Drive.chunked
When monitoring drive high watermark, it is not enough to check if the
drive is chunked, since we may replicate a non-chunked drive to chunked
replica, and the replica needs to be extended.
Drive high watermark code will check now the watermark also on
non-chunked drives, if they are being replicated to chunked storage.
Change-Id: Iadf19fa3262e356ee87c92357b8d90aff7dc0356
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M tests/vmStorageTests.py
M vdsm/virt/vmdevices/storage.py
2 files changed, 36 insertions(+), 16 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/84/40184/1
diff --git a/tests/vmStorageTests.py b/tests/vmStorageTests.py
index 5cd9d54..d454e83 100644
--- a/tests/vmStorageTests.py
+++ b/tests/vmStorageTests.py
@@ -193,17 +193,6 @@
self.assertXMLEqual(drive.getReplicaXML().toxml(), xml)
-def replica(diskType):
- return {
- "cache": "none",
- "device": "disk",
- "diskType": diskType,
- "format": "cow",
- "path": "/path/to/replica",
- "propagateErrors": "off",
- }
-
-
@expandPermutations
class DriveValidation(VdsmTestCase):
@@ -328,10 +317,23 @@
('lun', True, 'raw', False),
('disk', True, 'cow', True),
])
- def test_chunked(self, device, blockDev, format, chunked):
+ def test_drive(self, device, blockDev, format, chunked):
conf = drive_config(device=device, format=format)
drive = Drive({}, self.log, **conf)
drive._blockDev = blockDev
+ self.assertEqual(drive.chunked, chunked)
+
+ @permutations([
+ # replica diskType, replica format, chunked
+ (DISK_TYPE.FILE, 'raw', False),
+ (DISK_TYPE.FILE, 'cow', False),
+ (DISK_TYPE.BLOCK, 'raw', False),
+ (DISK_TYPE.BLOCK, 'cow', True),
+ ])
+ def test_replica(self, diskType, format, chunked):
+ conf = drive_config(diskReplicate=replica(diskType, format=format))
+ drive = Drive({}, self.log, **conf)
+ drive._blockDev = False
self.assertEqual(drive.chunked, chunked)
@@ -378,3 +380,14 @@
}
conf.update(kw)
return conf
+
+
+def replica(diskType, format="cow"):
+ return {
+ "cache": "none",
+ "device": "disk",
+ "diskType": diskType,
+ "format": format,
+ "path": "/path/to/replica",
+ "propagateErrors": "off",
+ }
diff --git a/vdsm/virt/vmdevices/storage.py b/vdsm/virt/vmdevices/storage.py
index 9f3f547..641d2bc 100644
--- a/vdsm/virt/vmdevices/storage.py
+++ b/vdsm/virt/vmdevices/storage.py
@@ -172,13 +172,20 @@
@property
def chunked(self):
"""
- Return True if drive is using chunks and may require extending.
+ Return True if drive or its replica are using chunks and may require
+ extending.
If a drive is chunked, current drive write watermark and
- Drive.volExtensionChunk is used to detect if a drive should be
- extended, and getNextVolumeSize to find the new size.
+ Drive.volExtensionChunk is used to detect if a drive or its replica
+ should be extended, and getNextVolumeSize to find the new size.
"""
- return self.blockDev and self.format == "cow"
+ if self.blockDev and self.format == "cow":
+ return True
+
+ replica = getattr(self, "diskReplicate", {})
+
+ return (replica.get("diskType") == DISK_TYPE.BLOCK and
+ replica.get("format") == "cow")
@property
def networkDev(self):
--
To view, visit https://gerrit.ovirt.org/40184
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iadf19fa3262e356ee87c92357b8d90aff7dc0356
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>