Change in vdsm[master]: vdsm: move balloon logic out of buildConfDevices
by mpoledni@redhat.com
Martin Polednik has uploaded a new change for review.
Change subject: vdsm: move balloon logic out of buildConfDevices
......................................................................
vdsm: move balloon logic out of buildConfDevices
Encapsulates empty balloon creation logic outside of
buildConfDevices to improve code readability
Change-Id: I6d77c1bbd7bdf760c8dda35d0ce6b70af51326bd
Signed-off-by: Martin Polednik <mpoledni(a)redhat.com>
---
M vdsm/vm.py
1 file changed, 15 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/21/19321/1
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 92d274e..618dd8f 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -1928,15 +1928,24 @@
# Preserve old behavior. Since libvirt add a memory balloon device
# to all guests, we need to specifically request not to add it.
- if len(devices[BALLOON_DEVICES]) == 0:
- devices[BALLOON_DEVICES].append({
- 'type': BALLOON_DEVICES,
- 'device': 'memballoon',
- 'specParams': {
- 'model': 'none'}})
+ self._normalizeBalloonDevice(devices[BALLOON_DEVICES])
return devices
+ def _normalizeBalloonDevice(self, balloonDevices):
+ EMPTY_BALLOON = {'type': BALLOON_DEVICES,
+ 'device': 'memballoon',
+ 'specParams': {
+ 'model': 'none'}}
+
+ # Avoid overriding the saved balloon target value on recovery.
+ if 'recover' not in self.conf:
+ for dev in balloonDevices:
+ dev['target'] = int(self.conf.get('memSize')) * 1024
+
+ if len(balloonDevices) == 0:
+ balloonDevices.append(EMPTY_BALLOON)
+
def getConfController(self):
"""
Normalize controller device.
--
To view, visit http://gerrit.ovirt.org/19321
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6d77c1bbd7bdf760c8dda35d0ce6b70af51326bd
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpoledni(a)redhat.com>
9 years, 11 months
Change in vdsm[master]: tests: prevent hook validation decorator from leaving script...
by Nir Soffer
Nir Soffer has posted comments on this change.
Change subject: tests: prevent hook validation decorator from leaving scripts installed
......................................................................
Patch Set 7:
(1 comment)
....................................................
File lib/vdsm/utils.py
Line 130: logging.warning("Directory: %s already removed", directoryToRemove)
Line 131: else:
Line 132: logging.error("Removing directory: %s failed", directoryToRemove,
Line 133: exc_info=True)
Line 134: raise
If you raise, why not let the caller handle this and log its own error?
I would write this as:
try:
shutil.rmtree(path)
except OSError as e:
if e.errno != errno.ENOENT:
raise
Line 135:
Line 136: IPXMLRPCRequestHandler = SimpleXMLRPCRequestHandler
Line 137:
Line 138:
--
To view, visit http://gerrit.ovirt.org/20310
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I138c3eab77ea6d35d6a997049940923026e06d96
Gerrit-PatchSet: 7
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Miguel Angel Ajo Pelayo <miguelangel(a)ajo.es>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Miguel Angel Ajo Pelayo <miguelangel(a)ajo.es>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
9 years, 11 months
Change in vdsm[master]: tests: prevent hook validation decorator from leaving script...
by Nir Soffer
Nir Soffer has posted comments on this change.
Change subject: tests: prevent hook validation decorator from leaving scripts installed
......................................................................
Patch Set 6:
(1 comment)
....................................................
File lib/vdsm/utils.py
Line 129: if e.errno == errno.ENOENT:
Line 130: logging.warning("Directory: %s already removed", directoryToRemove)
Line 131: else:
Line 132: logging.error("Removing directory: %s failed", directoryToRemove,
Line 133: exc_info=True)
It also apply, but it is out of the scope of this patch.
Line 134:
Line 135:
Line 136: IPXMLRPCRequestHandler = SimpleXMLRPCRequestHandler
Line 137:
--
To view, visit http://gerrit.ovirt.org/20310
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I138c3eab77ea6d35d6a997049940923026e06d96
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Miguel Angel Ajo Pelayo <miguelangel(a)ajo.es>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Miguel Angel Ajo Pelayo <miguelangel(a)ajo.es>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
9 years, 11 months
Change in vdsm[master]: tests: prevent hook validation decorator from leaving script...
by Nir Soffer
Nir Soffer has posted comments on this change.
Change subject: tests: prevent hook validation decorator from leaving scripts installed
......................................................................
Patch Set 6:
(1 comment)
....................................................
File lib/vdsm/utils.py
Line 129: if e.errno == errno.ENOENT:
Line 130: logging.warning("Directory: %s already removed", directoryToRemove)
Line 131: else:
Line 132: logging.error("Removing directory: %s failed", directoryToRemove,
Line 133: exc_info=True)
Also if we assume that the directory was removed, why log a warning about it? This just fill the logs with bogus warnings. A debug message would be better here.
Line 134:
Line 135:
Line 136: IPXMLRPCRequestHandler = SimpleXMLRPCRequestHandler
Line 137:
--
To view, visit http://gerrit.ovirt.org/20310
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I138c3eab77ea6d35d6a997049940923026e06d96
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Miguel Angel Ajo Pelayo <miguelangel(a)ajo.es>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Miguel Angel Ajo Pelayo <miguelangel(a)ajo.es>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
9 years, 11 months
Change in vdsm[master]: tests: prevent hook validation decorator from leaving script...
by Nir Soffer
Nir Soffer has posted comments on this change.
Change subject: tests: prevent hook validation decorator from leaving scripts installed
......................................................................
Patch Set 6:
(1 comment)
....................................................
File lib/vdsm/utils.py
Line 129: if e.errno == errno.ENOENT:
Line 130: logging.warning("Directory: %s already removed", directoryToRemove)
Line 131: else:
Line 132: logging.error("Removing directory: %s failed", directoryToRemove,
Line 133: exc_info=True)
Is it common that we want to ignore errors when removing directories?
I think it will be safer to ignore only the ENOENT error by default, and let the caller handle other errors.
Line 134:
Line 135:
Line 136: IPXMLRPCRequestHandler = SimpleXMLRPCRequestHandler
Line 137:
--
To view, visit http://gerrit.ovirt.org/20310
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I138c3eab77ea6d35d6a997049940923026e06d96
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Miguel Angel Ajo Pelayo <miguelangel(a)ajo.es>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Miguel Angel Ajo Pelayo <miguelangel(a)ajo.es>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
9 years, 11 months