Francesco Romani has uploaded a new change for review.
Change subject: vm: remove obfuscated use of errCode
......................................................................
vm: remove obfuscated use of errCode
_changeBlockDev used to return error code in a funny
convoluted way. This patch simplifies it using a plain
unsurprising errCode usage, with no changes in the final
output.
Change-Id: I5944a3ac9433fa3c85879f4a16b5b6730c2b50b6
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 1 insertion(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/67/38267/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 3f194b0..cd90ae1 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -3741,9 +3741,7 @@
except Exception:
self.log.debug("updateDeviceFlags failed", exc_info=True)
self.cif.teardownVolumePath(drivespec)
- return {'status': {'code': errCode['changeDisk']['status']['code'],
- 'message': errCode['changeDisk']['status']
- ['message']}}
+ return errCode['changeDisk']
if vmDev in self.conf:
self.cif.teardownVolumePath(self.conf[vmDev])
--
To view, visit https://gerrit.ovirt.org/38267
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5944a3ac9433fa3c85879f4a16b5b6730c2b50b6
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Timothy Asir has uploaded a new change for review.
Change subject: moved metadatasize as an optional param for pv create in lvm module
......................................................................
moved metadatasize as an optional param for pv create in lvm module
Specifying the metadata area using metadatasize is not a
mantatory its just an option to pvcreate command.
There are some situations like when a volume group contains
many physical volumes, having many redundant copies of
metadata (on every physical volume) is inefficient.
Change-Id: I00f161c0d6996219553c556125a97a01d69a4be3
Signed-off-by: Timothy Asir <tjeyasin(a)redhat.com>
---
M vdsm/storage/lvm.py
1 file changed, 4 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/88/38188/1
diff --git a/vdsm/storage/lvm.py b/vdsm/storage/lvm.py
index aa3c04b..2a85e39 100644
--- a/vdsm/storage/lvm.py
+++ b/vdsm/storage/lvm.py
@@ -692,7 +692,7 @@
return pv
-def _createpv(devices, metadataSize, options=tuple()):
+def _createpv(devices, metadataSize=0, options=tuple()):
"""
Size for pvcreate should be with units k|m|g
pvcreate on a dev that is already a PV but not in a VG returns rc = 0.
@@ -702,8 +702,9 @@
cmd = ["pvcreate"]
if options:
cmd.extend(options)
- cmd.extend(("--metadatasize", metadatasize, "--metadatacopies", "2",
- "--metadataignore", "y"))
+ if metadataSize:
+ cmd.extend(("--metadatasize", metadatasize, "--metadatacopies", "2",
+ "--metadataignore", "y"))
cmd.extend(devices)
rc, out, err = _lvminfo.cmd(cmd, devices)
return rc, out, err
--
To view, visit https://gerrit.ovirt.org/38188
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I00f161c0d6996219553c556125a97a01d69a4be3
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Timothy Asir <tjeyasin(a)redhat.com>
Adam Litke has uploaded a new change for review.
Change subject: qemu-img: Handle image end offset on different lines of output
......................................................................
qemu-img: Handle image end offset on different lines of output
Current code assumes that qemu-img check output will place the image end
offset in the second line of output but it can appear later:
$ sudo qemu-img check
/rhev/data-center/.../41b2b944-77f0-40d5-a681-c63e0dbb7482
No errors were found on the image.
70088/98304 = 71.30% allocated, 0.17% fragmented, 0.00% compressed clusters
Image end offset: 4594466816
Update the scanner so it can find it on any line from the second until
the end of output.
Change-Id: Id6610baf1702c9075d8512bdb1da0e05527a0060
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1196072
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M lib/vdsm/qemuimg.py
M tests/qemuimgTests.py
2 files changed, 51 insertions(+), 11 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/38/38438/1
diff --git a/lib/vdsm/qemuimg.py b/lib/vdsm/qemuimg.py
index 2aa130a..61d67bc 100644
--- a/lib/vdsm/qemuimg.py
+++ b/lib/vdsm/qemuimg.py
@@ -50,7 +50,11 @@
'offset': re.compile("^Image end offset: (?P<value>\d+)$"),
}
-INFO_OPTFIELDS_STARTIDX = 4 # qemu-img info optional fields start in this line
+# The first row of qemu-img info output where optional fields may appear
+_INFO_OPTFIELDS_STARTIDX = 4
+
+# The first row of qemu-img check output where the 'offset' may appear
+_CHECK_OPTFIELDS_STARTIDX = 1
class _RegexSearchError(Exception):
@@ -97,7 +101,7 @@
raise QImgError(rc, out, err, "unable to parse qemu-img info output")
# Scan for optional fields in the output
- row = INFO_OPTFIELDS_STARTIDX
+ row = _INFO_OPTFIELDS_STARTIDX
for field, filterFn in (('clustersize', int), ('backingfile', str)):
try:
info[field] = filterFn(__iregexSearch(field, out[row]))
@@ -179,15 +183,18 @@
# FIXME: handle different error codes and raise errors accordingly
if rc != 0:
raise QImgError(rc, out, err)
- try:
- check = {
- 'offset': int(__iregexSearch("offset", out[1]))
- }
- # TODO: Add requires for qemu supporting offset and print exc_info
- except:
- raise QImgError(rc, out, err, "unable to parse qemu-img check output")
-
- return check
+ # Scan for 'offset' in the output
+ for row in range(_CHECK_OPTFIELDS_STARTIDX, len(out)):
+ try:
+ check = {
+ 'offset': int(__iregexSearch("offset", out[row]))
+ }
+ return check
+ except _RegexSearchError:
+ pass
+ except:
+ break
+ raise QImgError(rc, out, err, "unable to parse qemu-img check output")
def convert(srcImage, dstImage, stop, srcFormat=None, dstFormat=None):
diff --git a/tests/qemuimgTests.py b/tests/qemuimgTests.py
index ce7cb76..0ffbab5 100644
--- a/tests/qemuimgTests.py
+++ b/tests/qemuimgTests.py
@@ -174,3 +174,36 @@
with FakeExecCmd(qcow2_compat_supported, create_qcow2_compat):
qemuimg.create('image', format='qcow2')
+
+
+class CheckTests(TestCaseBase):
+
+ def test_offset_with_stats(self):
+ def call(cmd, **kw):
+ out = ["No errors were found on the image.",
+ "65157/98304 = 66.28% allocated, 0.00% fragmented, 0.00% "
+ "compressed clusters",
+ "Image end offset: 4271243264"]
+ return 0, out, []
+
+ with FakeExecCmd(call):
+ check = qemuimg.check('unused')
+ self.assertEquals(4271243264, check['offset'])
+
+ def test_offset_without_stats(self):
+ def call(cmd, **kw):
+ out = ["No errors were found on the image.",
+ "Image end offset: 4271243264"]
+ return 0, out, []
+
+ with FakeExecCmd(call):
+ check = qemuimg.check('unused')
+ self.assertEquals(4271243264, check['offset'])
+
+ def test_offset_no_match(self):
+ def call(cmd, **kw):
+ out = ["All your base are belong to us."]
+ return 0, out, []
+
+ with FakeExecCmd(call):
+ self.assertRaises(qemuimg.QImgError, qemuimg.check, 'unused')
--
To view, visit https://gerrit.ovirt.org/38438
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id6610baf1702c9075d8512bdb1da0e05527a0060
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
Hello Nir Soffer, Dan Kenigsberg, Francesco Romani,
I'd like you to do a code review. Please visit
https://gerrit.ovirt.org/38437
to review the following change.
Change subject: Live Merge: Update drive.format after active layer merge
......................................................................
Live Merge: Update drive.format after active layer merge
A merge of the active layer can change the drive format from cow -> raw
if a snapshot was merged into a raw backing file. In that case we must
correct the VM Drive metadata to ensure the drive is handled properly
after the merge has finished.
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1198512
Change-Id: Ieb64bbfe798a27896442a173b7dac41cebc92543
Signed-off-by: Adam Litke <alitke(a)redhat.com>
Reviewed-on: http://gerrit.ovirt.org/36923
Reviewed-by: Francesco Romani <fromani(a)redhat.com>
Reviewed-by: Nir Soffer <nsoffer(a)redhat.com>
Reviewed-by: Dan Kenigsberg <danken(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 11 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/37/38437/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 16f8212..904c8e1 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -5986,15 +5986,25 @@
return
volumeID = volumes[-1]
+ res = self.cif.irs.getVolumeInfo(drive.domainID, drive.poolID,
+ drive.imageID, volumeID)
+ if res['status']['code'] != 0:
+ self.log.error("Unable to get info of volume %s (domain: %s image:"
+ " %s)", volumeID, drive.domainID, drive.imageID)
+ raise RuntimeError("Unable to get volume info")
+ driveFormat = res['info']['format'].lower()
+
# Sync this VM's data strctures. Ugh, we're storing the same info in
# two places so we need to change it twice.
device = self._lookupConfByPath(drive['path'])
if drive.volumeID != volumeID:
# If the active layer changed:
- # Update the disk path, volumeID, and volumeInfo members
+ # Update the disk path, volumeID, volumeInfo, and format members
volInfo = getVolumeInfo(device, volumeID)
+
# Path must be set with the value being used by libvirt
device['path'] = drive.path = volInfo['path'] = activePath
+ device['format'] = drive.format = driveFormat
device['volumeID'] = drive.volumeID = volumeID
device['volumeInfo'] = drive.volumeInfo = volInfo
for v in device['volumeChain']:
--
To view, visit https://gerrit.ovirt.org/38437
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieb64bbfe798a27896442a173b7dac41cebc92543
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Hello Nir Soffer, Federico Simoncelli,
I'd like you to do a code review. Please visit
https://gerrit.ovirt.org/38413
to review the following change.
Change subject: qemu-img: check/use "-T src_cache" option in convert/rebase when available
......................................................................
qemu-img: check/use "-T src_cache" option in convert/rebase when available
"qemu-img" is used for operations like disk move or snapshot delete.
This process reads data using the hypervisor page cache. As this data might
be hotter than any VM memory the system starts swapping out memory pages of
the running VMs.
vdsm already uses "-t none" option to avoid cache for output image. Now
"qemu-img" introduced a new "-T src_cache" to avoid cache for the
input image (bz#1116558).
This patch is testing if qemu-img has the new "-T src_cache" option available
for convert and rebase commands and using it with "-T none" when true.
Change-Id: Iab9c2abb22814c2660cd05180537db9e35a34636
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1138690
Signed-off-by: Amador Pahim <apahim(a)redhat.com>
Reviewed-on: http://gerrit.ovirt.org/36308
Reviewed-by: Nir Soffer <nsoffer(a)redhat.com>
Reviewed-by: Federico Simoncelli <fsimonce(a)redhat.com>
---
M lib/vdsm/qemuimg.py
1 file changed, 29 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/13/38413/1
diff --git a/lib/vdsm/qemuimg.py b/lib/vdsm/qemuimg.py
index 2aa130a..90e5e0f 100644
--- a/lib/vdsm/qemuimg.py
+++ b/lib/vdsm/qemuimg.py
@@ -193,6 +193,9 @@
def convert(srcImage, dstImage, stop, srcFormat=None, dstFormat=None):
cmd = [_qemuimg.cmd, "convert", "-t", "none"]
+ if _supports_src_cache('convert'):
+ cmd.extend(("-T", "none"))
+
if srcFormat:
cmd.extend(("-f", srcFormat))
@@ -231,6 +234,9 @@
stop=None):
cmd = [_qemuimg.cmd, "rebase", "-t", "none"]
+ if _supports_src_cache('rebase'):
+ cmd.extend(("-T", "none"))
+
if unsafe:
cmd.extend(("-u",))
@@ -249,3 +255,26 @@
if rc != 0:
raise QImgError(rc, out, err)
+
+
+# Testing capabilities
+
+(a)utils.memoized
+def _supports_src_cache(command):
+ """
+ The "-T" option specifies the cache mode that should be used with the
+ source file. This will check if "-T" option is available, aiming to set it
+ to "none", avoiding the use of cache memory (BZ#1138690).
+ """
+ # REQUIRED_FOR: FEDORA 20 (no qemu-img with -T support)
+ cmd = [_qemuimg.cmd, "--help"]
+ rc, out, err = utils.execCmd(cmd, raw=True)
+
+ # REQUIRED_FOR: EL6 (--help returns 1)
+ if rc not in (0, 1):
+ raise QImgError(rc, out, err)
+
+ # Line to match:
+ # convert [-c] [-p] [-q] [-n] [-f fmt] [-t cache] [-T src_cache]...
+ pattern = r"\n +%s .*\[-T src_cache\]" % command
+ return re.search(pattern, out) is not None
--
To view, visit https://gerrit.ovirt.org/38413
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iab9c2abb22814c2660cd05180537db9e35a34636
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Amador Pahim <apahim(a)redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Hello Nir Soffer, Federico Simoncelli,
I'd like you to do a code review. Please visit
https://gerrit.ovirt.org/38434
to review the following change.
Change subject: qemu-img: check/use "-T src_cache" option in convert/rebase when available
......................................................................
qemu-img: check/use "-T src_cache" option in convert/rebase when available
"qemu-img" is used for operations like disk move or snapshot delete.
This process reads data using the hypervisor page cache. As this data might
be hotter than any VM memory the system starts swapping out memory pages of
the running VMs.
vdsm already uses "-t none" option to avoid cache for output image. Now
"qemu-img" introduced a new "-T src_cache" to avoid cache for the
input image (bz#1116558).
This patch is testing if qemu-img has the new "-T src_cache" option available
for convert and rebase commands and using it with "-T none" when true.
Change-Id: I6e07f182e880f79055e53ef47aa28ddcf9659c45
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1138690
Signed-off-by: Amador Pahim <apahim(a)redhat.com>
Reviewed-on: http://gerrit.ovirt.org/36308
Reviewed-by: Nir Soffer <nsoffer(a)redhat.com>
Reviewed-by: Federico Simoncelli <fsimonce(a)redhat.com>
Signed-off-by: Amador Pahim <apahim(a)redhat.com>
---
M lib/vdsm/qemuimg.py
1 file changed, 29 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/34/38434/1
diff --git a/lib/vdsm/qemuimg.py b/lib/vdsm/qemuimg.py
index 2aa130a..90e5e0f 100644
--- a/lib/vdsm/qemuimg.py
+++ b/lib/vdsm/qemuimg.py
@@ -193,6 +193,9 @@
def convert(srcImage, dstImage, stop, srcFormat=None, dstFormat=None):
cmd = [_qemuimg.cmd, "convert", "-t", "none"]
+ if _supports_src_cache('convert'):
+ cmd.extend(("-T", "none"))
+
if srcFormat:
cmd.extend(("-f", srcFormat))
@@ -231,6 +234,9 @@
stop=None):
cmd = [_qemuimg.cmd, "rebase", "-t", "none"]
+ if _supports_src_cache('rebase'):
+ cmd.extend(("-T", "none"))
+
if unsafe:
cmd.extend(("-u",))
@@ -249,3 +255,26 @@
if rc != 0:
raise QImgError(rc, out, err)
+
+
+# Testing capabilities
+
+(a)utils.memoized
+def _supports_src_cache(command):
+ """
+ The "-T" option specifies the cache mode that should be used with the
+ source file. This will check if "-T" option is available, aiming to set it
+ to "none", avoiding the use of cache memory (BZ#1138690).
+ """
+ # REQUIRED_FOR: FEDORA 20 (no qemu-img with -T support)
+ cmd = [_qemuimg.cmd, "--help"]
+ rc, out, err = utils.execCmd(cmd, raw=True)
+
+ # REQUIRED_FOR: EL6 (--help returns 1)
+ if rc not in (0, 1):
+ raise QImgError(rc, out, err)
+
+ # Line to match:
+ # convert [-c] [-p] [-q] [-n] [-f fmt] [-t cache] [-T src_cache]...
+ pattern = r"\n +%s .*\[-T src_cache\]" % command
+ return re.search(pattern, out) is not None
--
To view, visit https://gerrit.ovirt.org/38434
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6e07f182e880f79055e53ef47aa28ddcf9659c45
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Amador Pahim <apahim(a)redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>