Change in vdsm[master]: osinfo: refactor package_versions function

2016-10-22 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: osinfo: refactor package_versions function
..


Patch Set 6:

* Update Tracker::IGNORE, no bug url/s found

-- 
To view, visit https://gerrit.ovirt.org/54546
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I36e9a605bea5ec6b823eaca4d7669c5060122fcd
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Jenkins CI RO
Gerrit-Reviewer: Martin Polednik 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: osinfo: refactor package_versions function

2016-10-22 Thread Jenkins CI RO
Jenkins CI RO has abandoned this change.

Change subject: osinfo: refactor package_versions function
..


Abandoned

Abandoned due to no activity - please restore if still relevant

-- 
To view, visit https://gerrit.ovirt.org/54546
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: abandon
Gerrit-Change-Id: I36e9a605bea5ec6b823eaca4d7669c5060122fcd
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Jenkins CI RO
Gerrit-Reviewer: Martin Polednik 
Gerrit-Reviewer: gerrit-hooks 
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: osinfo: refactor package_versions function

2016-03-21 Thread fromani
Francesco Romani has posted comments on this change.

Change subject: osinfo: refactor package_versions function
..


Patch Set 5: Code-Review+1

(1 comment)

looks fine

https://gerrit.ovirt.org/#/c/54546/5/lib/vdsm/osinfo.py
File lib/vdsm/osinfo.py:

Line 129: if osname == OSName.RHEVH or osname == OSName.OVIRT:
Line 130: version, release_name = 
_parse_node_version('/etc/default/version')
Line 131: elif osname == OSName.DEBIAN:
Line 132: version = linecache.getline('/etc/debian_version', 
1).strip('\n')
Line 133: release_name = ''  # Debian just has a version entry
this change is unneeded, but I don't mind this time. If you have to resubmit, 
please drop it.
Line 134: else:
Line 135: if osname == OSName.POWERKVM:
Line 136: release_path = '/etc/ibm_powerkvm-release'
Line 137: else:


-- 
To view, visit https://gerrit.ovirt.org/54546
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I36e9a605bea5ec6b823eaca4d7669c5060122fcd
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Martin Polednik 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: osinfo: refactor package_versions function

2016-03-19 Thread mpolednik
Martin Polednik has posted comments on this change.

Change subject: osinfo: refactor package_versions function
..


Patch Set 5: Verified+1

-- 
To view, visit https://gerrit.ovirt.org/54546
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I36e9a605bea5ec6b823eaca4d7669c5060122fcd
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Martin Polednik 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: osinfo: refactor package_versions function

2016-03-19 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: osinfo: refactor package_versions function
..


Patch Set 5:

* Update tracker: IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' 
and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 
'ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])

-- 
To view, visit https://gerrit.ovirt.org/54546
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I36e9a605bea5ec6b823eaca4d7669c5060122fcd
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Martin Polednik 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: osinfo: refactor package_versions function

2016-03-15 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: osinfo: refactor package_versions function
..


Patch Set 4:

* Update tracker: IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' 
and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 
'ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])

-- 
To view, visit https://gerrit.ovirt.org/54546
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I36e9a605bea5ec6b823eaca4d7669c5060122fcd
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Martin Polednik 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: osinfo: refactor package_versions function

2016-03-15 Thread mpolednik
Martin Polednik has posted comments on this change.

Change subject: osinfo: refactor package_versions function
..


Patch Set 3: Verified+1

-- 
To view, visit https://gerrit.ovirt.org/54546
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I36e9a605bea5ec6b823eaca4d7669c5060122fcd
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Martin Polednik 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: osinfo: refactor package_versions function

2016-03-14 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: osinfo: refactor package_versions function
..


Patch Set 3:

* Update tracker: IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' 
and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 
'ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])

-- 
To view, visit https://gerrit.ovirt.org/54546
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I36e9a605bea5ec6b823eaca4d7669c5060122fcd
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: osinfo: refactor package_versions function

2016-03-11 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: osinfo: refactor package_versions function
..


Patch Set 2:

* Update tracker: IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' 
and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 
'ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])

-- 
To view, visit https://gerrit.ovirt.org/54546
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I36e9a605bea5ec6b823eaca4d7669c5060122fcd
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: osinfo: refactor package_versions function

2016-03-09 Thread fromani
Francesco Romani has posted comments on this change.

Change subject: osinfo: refactor package_versions function
..


Patch Set 1: Code-Review-1

(1 comment)

partial review, mostly OK

https://gerrit.ovirt.org/#/c/54546/1/lib/vdsm/osinfo.py
File lib/vdsm/osinfo.py:

Line 153: 
Line 154: 
Line 155: def package_versions():
Line 156: pkgs = {}
Line 157: pkgs.update(_packages_kernel())
maybe just

pkgs = _packages_kernel()

?

Or perhaps you have a different reason to write it the way you did?
Line 158: 
Line 159: if _release() in (OSName.RHEVH,
Line 160:   OSName.OVIRT,
Line 161:   OSName.FEDORA,


-- 
To view, visit https://gerrit.ovirt.org/54546
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I36e9a605bea5ec6b823eaca4d7669c5060122fcd
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: osinfo: refactor package_versions function

2016-03-09 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: osinfo: refactor package_versions function
..


Patch Set 1:

* Update tracker: IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' 
and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 
'ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])

-- 
To view, visit https://gerrit.ovirt.org/54546
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I36e9a605bea5ec6b823eaca4d7669c5060122fcd
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: osinfo: refactor package_versions function

2016-03-09 Thread mpolednik
Martin Polednik has uploaded a new change for review.

Change subject: osinfo: refactor package_versions function
..

osinfo: refactor package_versions function

package_versions function is a large function that handles different
packaging systems (rpm, deb and kernel version). This patch splits it
into 3 helpers for each system, and only keeping the main function as
orchestrator of those.

Change-Id: I36e9a605bea5ec6b823eaca4d7669c5060122fcd
Signed-off-by: Martin Polednik 
---
M lib/vdsm/osinfo.py
1 file changed, 93 insertions(+), 69 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/46/54546/1

diff --git a/lib/vdsm/osinfo.py b/lib/vdsm/osinfo.py
index 5edc8e0..9792b45 100644
--- a/lib/vdsm/osinfo.py
+++ b/lib/vdsm/osinfo.py
@@ -127,8 +127,8 @@
 if osname == OSName.RHEVH or osname == OSName.OVIRT:
 version, release_name = _parse_node_version('/etc/default/version')
 elif osname == OSName.DEBIAN:
-version = linecache.getline('/etc/debian_version', 1).strip("\n")
-release_name = ""  # Debian just has a version entry
+version = linecache.getline('/etc/debian_version', 1).strip('\n')
+release_name = ''  # Debian just has a version entry
 else:
 if osname == OSName.POWERKVM:
 release_path = '/etc/ibm_powerkvm-release'
@@ -153,83 +153,107 @@
 
 
 def package_versions():
-def kernelDict():
-try:
-ret = os.uname()
-ver, rel = ret[2].split('-', 1)
-except Exception:
-logging.error('kernel release not found', exc_info=True)
-ver, rel = '0', '0'
-try:
-t = ret[3].split()[2:]
-del t[4]  # Delete timezone
-t = time.mktime(time.strptime(' '.join(t)))
-except Exception:
-logging.error('kernel build time not found', exc_info=True)
-t = '0'
-return dict(version=ver, release=rel, buildtime=t)
+pkgs = {}
+pkgs.update(_packages_kernel())
 
-pkgs = {'kernel': kernelDict()}
-
-if _release() in (OSName.RHEVH, OSName.OVIRT, OSName.FEDORA, OSName.RHEL,
+if _release() in (OSName.RHEVH,
+  OSName.OVIRT,
+  OSName.FEDORA,
+  OSName.RHEL,
   OSName.POWERKVM):
-KEY_PACKAGES = {
-'glusterfs-cli': ('glusterfs-cli',),
-'librbd1': ('librbd1',),
-'libvirt': ('libvirt', 'libvirt-daemon-kvm'),
-'mom': ('mom',),
-'qemu-img': ('qemu-img', 'qemu-img-rhev', 'qemu-img-ev'),
-'qemu-kvm': ('qemu-kvm', 'qemu-kvm-rhev', 'qemu-kvm-ev'),
-'spice-server': ('spice-server',),
-'vdsm': ('vdsm',),
-}
+pkgs.update(_packages_rpm())
+elif _release() == OSName.DEBIAN and python_apt:
+pkgs.update(_packages_apt())
 
-if glusterEnabled:
-KEY_PACKAGES.update(GLUSTER_RPM_PACKAGES)
+return pkgs
 
+
+def _packages_apt():
+key_packages = {
+'glusterfs-cli': 'glusterfs-cli',
+'librbd1': 'librbd1',
+'libvirt': 'libvirt0',
+'mom': 'mom',
+'qemu-img': 'qemu-utils',
+'qemu-kvm': 'qemu-kvm',
+'spice-server': 'libspice-server1',
+'vdsm': 'vdsmd',
+}
+
+if glusterEnabled:
+key_packages.update(GLUSTER_DEB_PACKAGES)
+
+key_package_versions = {}
+
+cache = apt.Cache()
+
+for pkg in key_packages:
 try:
-ts = rpm.TransactionSet()
-
-for pkg, names in KEY_PACKAGES.iteritems():
-try:
-mi = itertools.chain(*[ts.dbMatch('name', name)
-   for name in names]).next()
-except StopIteration:
-logging.debug("rpm package %s not found",
-  KEY_PACKAGES[pkg])
-else:
-pkgs[pkg] = {
-'version': mi['version'],
-'release': mi['release'],
-'buildtime': mi['buildtime'],
-}
+deb_pkg = key_packages[pkg]
+ver = cache[deb_pkg].installed.version
+# Debian just offers a version
+key_package_versions[pkg] = dict(version=ver,
+ release='',
+ buildtime='')
 except Exception:
 logging.error('', exc_info=True)
 
-elif _release() == OSName.DEBIAN and python_apt:
-KEY_PACKAGES = {
-'glusterfs-cli': 'glusterfs-cli',
-'librbd1': 'librbd1',
-'libvirt': 'libvirt0',
-'mom': 'mom',
-'qemu-img': 'qemu-utils',
-'qemu-kvm': 'qemu-kvm',
-'spice-server': 'libspice-server1',
-