Change in vdsm[master]: [WIP]normalize startup:delete check for vdsm user
by lvroyce@linux.vnet.ibm.com
Royce Lv has uploaded a new change for review.
Change subject: [WIP]normalize startup:delete check for vdsm user
......................................................................
[WIP]normalize startup:delete check for vdsm user
Change-Id: I6eb2c2f3ed9c4b72368716547e43bf839a319824
Signed-off-by:Royce Lv<lvroyce(a)linux.vnet.ibm.com>
---
M vdsm/vdsm
1 file changed, 0 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/11/10711/1
diff --git a/vdsm/vdsm b/vdsm/vdsm
index 3c37b26..a5656b8 100755
--- a/vdsm/vdsm
+++ b/vdsm/vdsm
@@ -154,7 +154,6 @@
if __name__ == '__main__':
restartSuperVdsm()
dropPrivileges()
- __assertVdsmUser()
__assertLogPermission()
parse_args()
run()
--
To view, visit http://gerrit.ovirt.org/10711
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6eb2c2f3ed9c4b72368716547e43bf839a319824
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
11 years, 5 months
Change in vdsm[master]: [WIP]normalize startup: temprary skill supervdsm tests
by lvroyce@linux.vnet.ibm.com
Royce Lv has uploaded a new change for review.
Change subject: [WIP]normalize startup: temprary skill supervdsm tests
......................................................................
[WIP]normalize startup: temprary skill supervdsm tests
To be added back after agreed on this startup proposal.
Change-Id: Ifac75e46778d3f788e904eba3e20e27c6f4f5f8e
Signed-off-by: Royce Lv<lvroyce(a)linux.vnet.ibm.com>
---
M tests/Makefile.am
1 file changed, 0 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/12/10712/1
diff --git a/tests/Makefile.am b/tests/Makefile.am
index afa37a6..d2f64e5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -48,7 +48,6 @@
resourceManagerTests.py \
sslTests.py \
storageMailboxTests.py \
- superVdsmTests.py \
tcTests.py \
vdsClientTests.py \
volumeTests.py \
--
To view, visit http://gerrit.ovirt.org/10712
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifac75e46778d3f788e904eba3e20e27c6f4f5f8e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
11 years, 5 months
Change in vdsm[master]: use qemu-img convert to copy sparse volumes when moving a vm
by ykaplan@redhat.com
Yeela Kaplan has uploaded a new change for review.
Change subject: use qemu-img convert to copy sparse volumes when moving a vm
......................................................................
use qemu-img convert to copy sparse volumes when moving a vm
Previously all volumes were copied with dd, with sparse files this
would result in the destination volume being fully allocated.
Change-Id: I9eedaa41a64502e548e52c10742335abd05301d8
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=748386
Signed-off-by: Yeela Kaplan <ykaplan(a)redhat.com>
---
M vdsm/qemuImg.py
M vdsm/storage/image.py
2 files changed, 41 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/79/10979/1
diff --git a/vdsm/qemuImg.py b/vdsm/qemuImg.py
index 77befcf..297ad53 100644
--- a/vdsm/qemuImg.py
+++ b/vdsm/qemuImg.py
@@ -19,10 +19,11 @@
#
import re
+from storage import misc
from utils import CommandPath, execCmd
_qemuimg = CommandPath("qemu-img",
- "/usr/bin/qemu-img", # Fedora, RHEL
+ "/usr/bin/qemu-img", # Fedora, EL6
)
@@ -98,3 +99,26 @@
if rc != 0:
raise QImgError(rc, out, err)
+
+
+def convert(srcVolPath, dstVolPath, stop, srcFmt=None, dstFmt=None):
+ cmd = [_qemuimg.cmd, "convert", "-t", "none"]
+
+ if srcFmt:
+ cmd.extend(("-f", srcFmt))
+
+ cmd.append(srcVolPath)
+
+ if dstFmt:
+ cmd.extend(("-O", dstFmt))
+
+ cmd.append(dstVolPath)
+
+ (rc, out, err) = misc.watchCmd(cmd, stop=stop,
+ nice=misc.NICENESS.LOW,
+ ioclass=misc.IOCLASS.IDLE)
+
+ if rc != 0:
+ raise QImgError(rc, out, err)
+
+ return (rc, out, err)
diff --git a/vdsm/storage/image.py b/vdsm/storage/image.py
index 4364c38..411b234 100644
--- a/vdsm/storage/image.py
+++ b/vdsm/storage/image.py
@@ -25,6 +25,7 @@
from contextlib import contextmanager
import volume
+from vdsm import qemuImg
from sdc import sdCache
import sd
import misc
@@ -582,8 +583,21 @@
# Do the actual copy
try:
dstVol = destDom.produceVolume(imgUUID=imgUUID, volUUID=srcVol.volUUID)
- srcSize = srcVol.getVolumeSize(bs=1)
- misc.ddWatchCopy(srcVol.getVolumePath(), dstVol.getVolumePath(), vars.task.aborting, size=srcSize)
+ srcFmt = srcVol.getFormat()
+ if srcFmt == volume.RAW_FORMAT:
+ srcFmt = volume.fmt2str(srcFmt)
+ dstFmt = volume.fmt2str(dstVol.getFormat())
+ self.log.debug("start qemu convert")
+ qemuImg.convert(srcVol.getVolumePath(),
+ dstVol.getVolumePath(),
+ vars.task.aborting,
+ srcFmt, dstFmt)
+ else:
+ srcSize = srcVol.getVolumeSize(bs=1)
+ misc.ddWatchCopy(srcVol.getVolumePath(),
+ dstVol.getVolumePath(),
+ vars.task.aborting,
+ size=srcSize)
except se.ActionStopped:
raise
except se.StorageException:
--
To view, visit http://gerrit.ovirt.org/10979
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9eedaa41a64502e548e52c10742335abd05301d8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <ykaplan(a)redhat.com>
11 years, 5 months
Change in vdsm[master]: Remove old-style exception raising (pep3109)
by asegurap@redhat.com
Antoni Segura Puimedon has uploaded a new change for review.
Change subject: Remove old-style exception raising (pep3109)
......................................................................
Remove old-style exception raising (pep3109)
The only exception is when raising with a traceback, for which
there is not a new-style equivalent both Python 2.x.
Change-Id: I1b669cb172eda12b90afb5f124e7935b03f668b4
Signed-off-by: Antoni S. Puimedon <asegurap(a)redhat.com>
---
M vdsm_hooks/faqemu/vdsm-faqemu
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/48/10948/1
diff --git a/vdsm_hooks/faqemu/vdsm-faqemu b/vdsm_hooks/faqemu/vdsm-faqemu
index 85822a9..e165815 100644
--- a/vdsm_hooks/faqemu/vdsm-faqemu
+++ b/vdsm_hooks/faqemu/vdsm-faqemu
@@ -11,7 +11,7 @@
for qemu_bin in qemu_paths:
if os.path.exists(qemu_bin): break
else:
- raise RuntimeError, "QEMU binary not found"
+ raise RuntimeError("QEMU binary not found")
qemu_argv = [ qemu_bin ]
--
To view, visit http://gerrit.ovirt.org/10948
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1b669cb172eda12b90afb5f124e7935b03f668b4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap(a)redhat.com>
11 years, 5 months
Change in vdsm[master]: Extract bonding options building into a separate function.
by wudxw@linux.vnet.ibm.com
Mark Wu has uploaded a new change for review.
Change subject: Extract bonding options building into a separate function.
......................................................................
Extract bonding options building into a separate function.
To make setupNetworks shorter, move the bonding options building code
into a separate function.
Signed-off-by: Mark Wu <wudxw(a)linux.vnet.ibm.com>
Change-Id: I77fefefcefa05f5bd0d7fa2755357d88b7aa615e
---
M vdsm/configNetwork.py
1 file changed, 30 insertions(+), 27 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/85/8885/1
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 3940446..6de38e3 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -1249,6 +1249,30 @@
del bondings[bond]
+def _buildBondOptions(bondName, bondings):
+ logger = logging.getLogger("_buildBondOptions")
+
+ # We need to use the newest host info
+ _ni = netinfo.NetInfo()
+
+ bond = {}
+ if bondings.get(bondName):
+ bond['nics'] = bondings[bondName]['nics']
+ bond['bondingOptions'] = bondings[bondName].get('options', None)
+ elif bondName in _ni.bondings:
+ # We may not receive any information about the bonding device if it is
+ # unchanged. In this case check whether this bond exists on host and
+ # take its parameters.
+ logger.debug("Fetching bond %r info", bondName)
+ existingBond = _ni.bondings[bondName]
+ bond['nics'] = existingBond['slaves']
+ bond['bondingOptions'] = existingBond['cfg'].get('BONDING_OPTS', None)
+ else:
+ raise ConfigNetworkError(ne.ERR_BAD_PARAMS, "No given bonding option, \
+ nor existing bond %s found." % bondName)
+ return bond
+
+
def setupNetworks(networks={}, bondings={}, **options):
"""Add/Edit/Remove configuration for networks and bondings.
@@ -1292,12 +1316,6 @@
_netinfo = netinfo.NetInfo()
configWriter = ConfigWriter()
networksAdded = set()
- # keep set netsWithNewBonds to be able remove
- # a new added network if connectivity check fail.
- # If a new network needs to be created on top of existing bond,
- # we will need to keep the bond on rollback flow,
- # else we will break the new created bond.
- netsWithNewBonds = set()
logger.debug("Setting up network according to configuration: "
"networks:%r, bondings:%r, options:%r" % (networks,
@@ -1327,28 +1345,10 @@
# Check whether bonds should be resized
_editBondings(bondings, configWriter)
- # We need to use the newest host info
- _ni = netinfo.NetInfo()
for network, networkAttrs in networks.iteritems():
d = dict(networkAttrs)
if 'bonding' in d:
- # we may not receive any information
- # about the bonding device if it is unchanged
- # In this case check whether this bond exists
- # on host and take its parameters
- if bondings.get(d['bonding']):
- d['nics'] = bondings[d['bonding']]['nics']
- d['bondingOptions'] = \
- bondings[d['bonding']].get('options', None)
- # we create a new bond
- if network in networksAdded:
- netsWithNewBonds.add(network)
- elif d['bonding'] in _ni.bondings:
- logger.debug("Updating bond %r info", d['bonding'])
- d['nics'] = _ni.bondings[d['bonding']]['slaves']
- d['bondingOptions'] = \
- _ni.bondings[d['bonding']]['cfg'].get(
- 'BONDING_OPTS', None)
+ d.update(_buildBondOptions(d['bonding'], bondings))
else:
d['nics'] = [d.pop('nic')]
d['force'] = force
@@ -1363,8 +1363,11 @@
CONNECTIVITY_TIMEOUT_DEFAULT))):
logger.info('Connectivity check failed, rolling back')
for network in networksAdded:
- delNetwork(network, force=True,
- implicitBonding=network in netsWithNewBonds)
+ # If the new added network was created on top of
+ # existing bond, we need to keep the bond on rollback
+ # flow, else we will break the new created bond.
+ isNew = networkAttrs['bonding'] in bondings
+ delNetwork(network, force=True, implicitBonding=isNew)
raise ConfigNetworkError(ne.ERR_LOST_CONNECTION,
'connectivity check failed')
except:
--
To view, visit http://gerrit.ovirt.org/8885
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I77fefefcefa05f5bd0d7fa2755357d88b7aa615e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mark Wu <wudxw(a)linux.vnet.ibm.com>
11 years, 5 months
Change in vdsm[master]: [WIP]make changes to init script
by lvroyce@linux.vnet.ibm.com
Royce Lv has uploaded a new change for review.
Change subject: [WIP]make changes to init script
......................................................................
[WIP]make changes to init script
Change-Id: I8faed69248ebe56c392fadb9de9dcbd1c67e6264
Signed-off-by: Royce Lv<lvroyce(a)linux.vnet.ibm.com>
---
M tests/Makefile.am
M vdsm.spec.in
M vdsm/Makefile.am
R vdsm/supervdsmServer
M vdsm/vdsmd.init.in
5 files changed, 10 insertions(+), 11 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/97/11197/1
diff --git a/tests/Makefile.am b/tests/Makefile.am
index b61bf50..b9acfa5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -50,7 +50,6 @@
schemaTests.py \
sslTests.py \
storageMailboxTests.py \
- superVdsmTests.py \
tcTests.py \
utilsTests.py \
vdsClientTests.py \
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 632d315..9da8840 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -633,10 +633,10 @@
%{_datadir}/%{vdsm_name}/parted_utils.py*
%{_datadir}/%{vdsm_name}/mkimage.py*
%{_datadir}/%{vdsm_name}/supervdsm.py*
-%{_datadir}/%{vdsm_name}/supervdsmServer.py*
+%{_datadir}/%{vdsm_name}/supervdsmServer
%{_datadir}/%{vdsm_name}/vmChannels.py*
%{_datadir}/%{vdsm_name}/tc.py*
-%{_datadir}/%{vdsm_name}/vdsm
+%{_datadir}/%{vdsm_name}/vdsmServer.py*
%{_datadir}/%{vdsm_name}/vdsm-restore-net-config
%{_datadir}/%{vdsm_name}/vdsm-store-net-config
%{_datadir}/%{vdsm_name}/vm.py*
diff --git a/vdsm/Makefile.am b/vdsm/Makefile.am
index 88b3287..4ea770f 100644
--- a/vdsm/Makefile.am
+++ b/vdsm/Makefile.am
@@ -48,7 +48,7 @@
nwfilter.py \
parted_utils.py \
supervdsm.py \
- supervdsmServer.py \
+ vdsmServer.py \
tc.py \
vdsmDebugPlugin.py \
vmChannels.py \
@@ -99,7 +99,7 @@
get-conf-item \
respawn \
set-conf-item \
- vdsm \
+ supervdsmServer \
vdsm-restore-net-config \
write-net-config
diff --git a/vdsm/supervdsmServer.py b/vdsm/supervdsmServer
similarity index 99%
rename from vdsm/supervdsmServer.py
rename to vdsm/supervdsmServer
index e0f7ab2..a14e9dc 100755
--- a/vdsm/supervdsmServer.py
+++ b/vdsm/supervdsmServer
@@ -1,3 +1,4 @@
+#!/usr/bin/python
# Copyright 2011 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
@@ -417,5 +418,4 @@
if __name__ == '__main__':
vdsmProc = Process(target=startVdsm)
vdsmProc.start()
- sleep(2)
startSvdsm(ADDRESS, vdsmProc)
diff --git a/vdsm/vdsmd.init.in b/vdsm/vdsmd.init.in
index c8223d3..c056c6b 100755
--- a/vdsm/vdsmd.init.in
+++ b/vdsm/vdsmd.init.in
@@ -23,7 +23,7 @@
. @LIBEXECDIR(a)/ovirt_functions.sh
-VDSM_BIN=@VDSMDIR@/vdsm
+SVDSM_BIN=@VDSMDIR@/supervdsmServer
CONF_FILE=@CONFDIR(a)/vdsm.conf
GETCONFITEM=@VDSMDIR@/get-conf-item
prog=vdsm
@@ -190,7 +190,7 @@
test_already_running()
{
if pidofproc -p $RESPAWNPIDFILE >/dev/null || \
- pidofproc -p $PIDFILE $VDSM_BIN >/dev/null; then
+ pidofproc -p $PIDFILE $SVDSM_BIN >/dev/null; then
log_success_msg "$prog: already running"
return 0
fi
@@ -499,7 +499,7 @@
LIBVIRT_LOG_FILTERS=`$GETCONFITEM $CONF_FILE vars libvirt_log_filters "1:libvirt 1:remote"` \
LIBVIRT_LOG_OUTPUTS=`$GETCONFITEM $CONF_FILE vars libvirt_log_outputs "1:file:/var/log/vdsm/libvirt.log"` \
- LC_ALL=C NICELEVEL=$vdsm_nice daemon --user=vdsm @VDSMDIR@/respawn --minlifetime 10 --daemon --masterpid $RESPAWNPIDFILE $VDSM_BIN
+ LC_ALL=C NICELEVEL=$vdsm_nice daemon @VDSMDIR@/respawn --minlifetime 10 --daemon --masterpid $RESPAWNPIDFILE $SVDSM_BIN
RETVAL=$?
[ "$RETVAL" -eq 0 ] && log_success_msg $"$prog start" || log_failure_msg $"$prog start"
[ "$RETVAL" -eq 0 ] && touch /var/lock/subsys/vdsmd
@@ -533,7 +533,7 @@
RETVAL=$?
;;
status)
- pidofproc -p $PIDFILE $VDSM_BIN >/dev/null
+ pidofproc -p $PIDFILE $SVDSM_BIN >/dev/null
RETVAL=$?
if [ "$RETVAL" -eq 0 ]; then
echo "VDS daemon server is running"
@@ -547,7 +547,7 @@
fi
;;
condrestart)
- pidofproc -p $PIDFILE $VDSM_BIN >/dev/null
+ pidofproc -p $PIDFILE $SVDSM_BIN >/dev/null
RETVAL=$?
if [ "$RETVAL" -eq 0 ]; then
$0 stop && $0 start;
--
To view, visit http://gerrit.ovirt.org/11197
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8faed69248ebe56c392fadb9de9dcbd1c67e6264
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
11 years, 5 months
Change in vdsm[master]: tests: Fix parted_utils_tests break on fedora 18
by wudxw@linux.vnet.ibm.com
Mark Wu has uploaded a new change for review.
Change subject: tests: Fix parted_utils_tests break on fedora 18
......................................................................
tests: Fix parted_utils_tests break on fedora 18
parted 3.1 improves its support for loopback devices. The 'model' string
returned by libparted is updated to 'Loopback device'. For more information,
please see:
http://anonscm.debian.org/gitweb/?p=parted/parted.git;a=commit;h=3e35b6
Because another bug of parted.version() on rhel6
(https://bugzilla.redhat.com/show_bug.cgi?format=multiple&id=700383),
we can't use parted.version() to differentiate the parted version.
We could restort to rpm db, but loop device is only used in test code,
so it should be safe to ignore the test of model string.
Change-Id: Ia144353747f9343689a8c105ccf3c7fe691de31e
Signed-off-by: Mark Wu <wudxw(a)linux.vnet.ibm.com>
---
M tests/parted_utils_tests.py
1 file changed, 0 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/37/11137/1
diff --git a/tests/parted_utils_tests.py b/tests/parted_utils_tests.py
index 808d748..ce413d7 100644
--- a/tests/parted_utils_tests.py
+++ b/tests/parted_utils_tests.py
@@ -79,7 +79,6 @@
def _blank_dev_test(self):
info = putils.getDevicePartedInfo(self.devPath)
- self.assertFalse(info['model'])
self.assertTrue(info['sectorSize'] >= 0)
self.assertFalse(info['type'])
self.assertFalse(info['partitions'])
@@ -99,7 +98,6 @@
time.sleep(1) # wait for syncing
info = putils.getDevicePartedInfo(self.devPath)
- self.assertFalse(info['model'])
self.assertTrue(info['sectorSize'] >= 0)
self.assertEquals(info['type'], 'gpt')
self.assertTrue(info['freeSpaceRegions'][0][3] >= FREE_SIZE)
--
To view, visit http://gerrit.ovirt.org/11137
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia144353747f9343689a8c105ccf3c7fe691de31e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mark Wu <wudxw(a)linux.vnet.ibm.com>
11 years, 5 months
Change in vdsm[master]: Revert "tests: Fix parted_utils_tests break on fedora 18"
by wudxw@linux.vnet.ibm.com
Mark Wu has uploaded a new change for review.
Change subject: Revert "tests: Fix parted_utils_tests break on fedora 18"
......................................................................
Revert "tests: Fix parted_utils_tests break on fedora 18"
The commit 51d76e caused a break on rhel6 host because of a bug
in parted.version(). Please see:
https://bugzilla.redhat.com/show_bug.cgi?format=multiple&id=700383
It's fixed in Fedora 14, but not backported to RHEL6. So we have to
find a workaround for the break on Fedora18.
This reverts commit 51d76e04727c2d41371eb207f02a0f84de74a140.
Change-Id: I723edbeb1fc18c0160f4cfd7d1d808fd92acf125
Signed-off-by: Mark Wu <wudxw(a)linux.vnet.ibm.com>
---
M tests/parted_utils_tests.py
1 file changed, 2 insertions(+), 11 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/36/11136/1
diff --git a/tests/parted_utils_tests.py b/tests/parted_utils_tests.py
index b796077..808d748 100644
--- a/tests/parted_utils_tests.py
+++ b/tests/parted_utils_tests.py
@@ -21,7 +21,6 @@
import tempfile
import os
import time
-from distutils.version import StrictVersion
import testValidation
from testrunner import VdsmTestCase as TestCaseBase
@@ -40,14 +39,6 @@
PART_SIZE_MB = 50
FREE_SIZE = 50 * ONE_MB_IN_BYTES
PART_END_SIZE = 47 * ONE_MB_IN_BYTES
-
-# parted 3.1 improves its support for loopback devices. The 'model' string
-# returned by libparted is updated to 'Loopback device'
-parted_version = StrictVersion(putils.parted.version()['libparted'])
-if parted_version >= StrictVersion('3.1'):
- LOOP_DEVICE_MODEL = 'Loopback device'
-else:
- LOOP_DEVICE_MODEL = ''
class PartedUtilsTests(TestCaseBase):
@@ -88,7 +79,7 @@
def _blank_dev_test(self):
info = putils.getDevicePartedInfo(self.devPath)
- self.assertEquals(info['model'], LOOP_DEVICE_MODEL)
+ self.assertFalse(info['model'])
self.assertTrue(info['sectorSize'] >= 0)
self.assertFalse(info['type'])
self.assertFalse(info['partitions'])
@@ -108,7 +99,7 @@
time.sleep(1) # wait for syncing
info = putils.getDevicePartedInfo(self.devPath)
- self.assertEquals(info['model'], LOOP_DEVICE_MODEL)
+ self.assertFalse(info['model'])
self.assertTrue(info['sectorSize'] >= 0)
self.assertEquals(info['type'], 'gpt')
self.assertTrue(info['freeSpaceRegions'][0][3] >= FREE_SIZE)
--
To view, visit http://gerrit.ovirt.org/11136
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I723edbeb1fc18c0160f4cfd7d1d808fd92acf125
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mark Wu <wudxw(a)linux.vnet.ibm.com>
11 years, 5 months
Change in vdsm[master]: Fix inefficiency in getBridgelessNetworks
by asegurap@redhat.com
Antoni Segura Puimedon has uploaded a new change for review.
Change subject: Fix inefficiency in getBridgelessNetworks
......................................................................
Fix inefficiency in getBridgelessNetworks
This commit makes getBridgelessNetworks use the Netinfo instance
networks instead of generating its own. Additionally, it is put in
the style and vicinity of the most semantically similar method of
the class, to improve the module's readability.
Change-Id: I68b5ecf415d4ab49a56019d8875dde57ca29d1fc
Signed-off-by: Antoni S. Puimedon <asegurap(a)redhat.com>
---
M vdsm/netinfo.py
1 file changed, 11 insertions(+), 10 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/71/11071/1
diff --git a/vdsm/netinfo.py b/vdsm/netinfo.py
index 4749708..43a2781 100644
--- a/vdsm/netinfo.py
+++ b/vdsm/netinfo.py
@@ -439,6 +439,17 @@
return chain(self.getBridgelessNetworksForIface(iface),
self.getBridgedNetworksForIface(iface))
+ def getBridgelessNetworks(self):
+ """
+ Get list of bridgeless networks
+
+ :returns: list of network names
+ :rtype: List
+ """
+ for network, netdict in self.networks.iteritems():
+ if not netdict['bridged']:
+ yield network
+
def getBridgelessNetworksForIface(self, iface):
""" Return all bridgeless networks attached to nic/bond """
for network, netdict in self.networks.iteritems():
@@ -494,13 +505,3 @@
lnics.append(port)
return lnics, vlan, bonding
-
- def getBridgelessNetworks(self):
- """
- Get list of birdgeless networks
-
- :returns: list of networks name
- :rtype: List
- """
- return [netname for (netname, net) in networks().iteritems()
- if not 'bridge' in net]
--
To view, visit http://gerrit.ovirt.org/11071
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I68b5ecf415d4ab49a56019d8875dde57ca29d1fc
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap(a)redhat.com>
11 years, 5 months
Change in vdsm[ovirt-3.2]: adding getHardwareInfo API to vdsm
by Douglas Schilling Landgraf
Hello Yaniv Bronhaim,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/11168
to review the following change.
Change subject: adding getHardwareInfo API to vdsm
......................................................................
adding getHardwareInfo API to vdsm
Super vdsm retrieves system info about host hardware
parameters. This info will be shown as part of getHardwareInfo
API call in a structure called HardwareInformation.
This feature currently available only for x86 cpu platfroms, for other
platfroms the api call returns empty dictionary.
Feature-Description:
http://wiki.ovirt.org/wiki/Features/Design/HostHardwareInfo
Change-Id: Ic429ef101fcf9047c4b552405314dc7ba9ba07a0
Signed-off-by: Yaniv Bronhaim <ybronhei(a)redhat.com>
Signed-off-by: Douglas Schilling Landgraf <dougsland(a)redhat.com>
---
M vdsm.spec.in
M vdsm/API.py
M vdsm/BindingXMLRPC.py
M vdsm/Makefile.am
M vdsm/define.py
A vdsm/dmidecodeUtil.py
M vdsm/supervdsmServer.py
M vdsm_api/vdsmapi-schema.json
M vdsm_cli/vdsClient.py
9 files changed, 167 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/68/11168/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 14381e5..5b13419 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -45,6 +45,9 @@
BuildRequires: genisoimage
BuildRequires: openssl
BuildRequires: m2crypto
+%ifarch x86_64
+BuildRequires: python-dmidecode
+%endif
%if 0%{?rhel} == 6
BuildRequires: python-ordereddict
%endif
@@ -77,6 +80,7 @@
Requires: %{name}-xmlrpc = %{version}-%{release}
%ifarch x86_64
+Requires: python-dmidecode
Requires: dmidecode
%endif
@@ -610,6 +614,7 @@
%{_datadir}/%{vdsm_name}/blkid.py*
%{_datadir}/%{vdsm_name}/caps.py*
%{_datadir}/%{vdsm_name}/clientIF.py*
+%{_datadir}/%{vdsm_name}/dmidecodeUtil.py*
%{_datadir}/%{vdsm_name}/API.py*
%{_datadir}/%{vdsm_name}/hooking.py*
%{_datadir}/%{vdsm_name}/hooks.py*
diff --git a/vdsm/API.py b/vdsm/API.py
index a1e3f2c..732f8a3 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -1119,6 +1119,17 @@
return {'status': doneCode, 'info': c}
+ def getHardwareInfo(self):
+ """
+ Report host hardware information
+ """
+ try:
+ hw = supervdsm.getProxy().getHardwareInfo()
+ return {'status': doneCode, 'info': hw}
+ except:
+ self.log.error("failed to retrieve hardware info", exc_info=True)
+ return errCode['hwInfoErr']
+
def getStats(self):
"""
Report host statistics.
diff --git a/vdsm/BindingXMLRPC.py b/vdsm/BindingXMLRPC.py
index 73185b9..f19a8bb 100644
--- a/vdsm/BindingXMLRPC.py
+++ b/vdsm/BindingXMLRPC.py
@@ -288,6 +288,10 @@
ret['info'].update(self.getServerInfo())
return ret
+ def getHardwareInfo(self):
+ api = API.Global()
+ return api.getHardwareInfo()
+
def getStats(self):
api = API.Global()
return api.getStats()
@@ -768,6 +772,7 @@
(self.vmGetMigrationStatus, 'migrateStatus'),
(self.vmMigrationCancel, 'migrateCancel'),
(self.getCapabilities, 'getVdsCapabilities'),
+ (self.getHardwareInfo, 'getVdsHardwareInfo'),
(self.getStats, 'getVdsStats'),
(self.vmGetStats, 'getVmStats'),
(self.getAllVmStats, 'getAllVmStats'),
diff --git a/vdsm/Makefile.am b/vdsm/Makefile.am
index dc0590e..88b3287 100644
--- a/vdsm/Makefile.am
+++ b/vdsm/Makefile.am
@@ -32,6 +32,7 @@
configNetwork.py \
debugPluginClient.py \
dummybr.py \
+ dmidecodeUtil.py \
guestIF.py \
hooking.py \
hooks.py \
diff --git a/vdsm/define.py b/vdsm/define.py
index efebea1..01b0c60 100644
--- a/vdsm/define.py
+++ b/vdsm/define.py
@@ -127,6 +127,9 @@
'updateDevice': {'status':
{'code': 56,
'message': 'Failed to update device'}},
+ 'hwInfoErr': {'status':
+ {'code': 57,
+ 'message': 'Failed to read hardware information'}},
'recovery': {'status':
{'code': 99,
'message':
diff --git a/vdsm/dmidecodeUtil.py b/vdsm/dmidecodeUtil.py
new file mode 100644
index 0000000..eb8d834
--- /dev/null
+++ b/vdsm/dmidecodeUtil.py
@@ -0,0 +1,99 @@
+#
+# Copyright 2012 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+
+import dmidecode
+from vdsm import utils
+
+
+# This function gets dict and returns new dict that includes only string
+# value for each key. Keys in d that their value is a dictionary will be
+# ignored because those keys define a lable for the sub dictionary
+# (and those keys are irrelevant for us in dmidecode output)
+def __leafDict(d):
+ ret = {}
+ for k, v in d.iteritems():
+ if isinstance(v, dict):
+ ret.update(__leafDict(v))
+ else:
+ ret[k] = v
+ return ret
+
+
+(a)utils.memoized
+def getAllDmidecodeInfo():
+ myLeafDict = {}
+ for k in ('system', 'bios', 'cache', 'processor', 'chassis', 'memory'):
+ myLeafDict[k] = __leafDict(getattr(dmidecode, k)())
+ return myLeafDict
+
+
+(a)utils.memoized
+def getHardwareInfoStructure():
+ dmiInfo = getAllDmidecodeInfo()
+ sysStruct = {}
+ for k1, k2 in (('system', 'Manufacturer'),
+ ('system', 'Product Name'),
+ ('system', 'Version'),
+ ('system', 'Serial Number'),
+ ('system', 'UUID'),
+ ('system', 'Family')):
+ sysStruct[(k1 + k2).replace(' ', '')] = dmiInfo[k1][k2]
+
+ return sysStruct
+
+
+def printInfo(d):
+
+ def formatData(data):
+ return '\n'.join(['%s - %s' % (k, v) for k, v in data.iteritems()])
+
+ print(
+ """
+ SYSTEM INFORMATION
+ ==================
+{system}
+
+ BIOS INFORMATION
+ ================
+{bios}
+
+ CACHE INFORMATION
+ =================
+{cache}
+
+ PROCESSOR INFO
+ ==============
+{processor}
+
+ CHASSIS INFO
+ ============
+{chassis}
+
+ MEMORY INFORMATION
+ ==================
+{memory}
+ """.format(
+ system=formatData(d['system']),
+ bios=formatData(d['bios']),
+ cache=formatData(d['cache']),
+ processor=formatData(d['processor']),
+ chassis=formatData(d['chassis']),
+ memory=formatData(d['memory']))
+ )
diff --git a/vdsm/supervdsmServer.py b/vdsm/supervdsmServer.py
index 5effd41..486471c 100755
--- a/vdsm/supervdsmServer.py
+++ b/vdsm/supervdsmServer.py
@@ -17,6 +17,7 @@
# Refer to the README and COPYING files for full details of the license
#
+import platform
import logging
import logging.config
import sys
@@ -38,6 +39,7 @@
_glusterEnabled = False
from parted_utils import getDevicePartedInfo as _getDevicePartedInfo
from md_utils import getMdDeviceUuidMap as _getMdDeviceUuidMap
+
from lsblk import getLsBlk as _getLsBlk
from storage.multipath import getScsiSerial as _getScsiSerial
from storage.iscsi import forceIScsiScan as _forceIScsiScan
@@ -94,6 +96,15 @@
return True
@logDecorator
+ def getHardwareInfo(self, *args, **kwargs):
+ if platform.machine() in ('x86_64', 'i686'):
+ from dmidecodeUtil import getHardwareInfoStructure
+ return getHardwareInfoStructure()
+ else:
+ # not implemented over other architecture
+ return {}
+
+ @logDecorator
def getDevicePartedInfo(self, *args, **kwargs):
return _getDevicePartedInfo(*args, **kwargs)
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index 7c9ef22..f37f550 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -690,6 +690,31 @@
'data': {'release': 'str', 'version': 'str', 'name': 'OSName'}}
##
+# @HardwareInformation:
+#
+# Host hardware fields.
+#
+# @systemManufacturer: Host manufacturer's name
+#
+# @systemProductName: Host's hardware module
+#
+# @systemSerialNumber: Hardware serial number
+#
+# @systemFamily: Processor type
+#
+# @systemUUID: Host's hardware UUID
+#
+# @systemVersion: Host's hardware version
+#
+# Since: 4.10.3
+##
+{'type': 'HardwareInformation',
+ 'data': {'systemManufacturer': 'str',
+ 'systemProductName': 'str', 'systemVersion': 'str',
+ 'systemSerialNumber': 'str', 'systemUUID': 'str',
+ 'systemFamily': 'str'}}
+
+##
# @SoftwarePackage:
#
# An enumeration of aliases for important software components.
diff --git a/vdsm_cli/vdsClient.py b/vdsm_cli/vdsClient.py
index c67e3fe..884dc5d 100644
--- a/vdsm_cli/vdsClient.py
+++ b/vdsm_cli/vdsClient.py
@@ -411,6 +411,9 @@
def do_getCap(self, args):
return self.ExecAndExit(self.s.getVdsCapabilities())
+ def do_getHardware(self, args):
+ return self.ExecAndExit(self.s.getVdsHardwareInfo())
+
def do_getVdsStats(self, args):
return self.ExecAndExit(self.s.getVdsStats())
@@ -1900,6 +1903,10 @@
('',
'Get Capabilities info of the VDS'
)),
+ 'getVdsHardwareInfo': (serv.do_getHardware,
+ ('',
+ 'Get hardware info of the VDS'
+ )),
'getVdsStats': (serv.do_getVdsStats,
('',
'Get Statistics info on the VDS'
--
To view, visit http://gerrit.ovirt.org/11168
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic429ef101fcf9047c4b552405314dc7ba9ba07a0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.2
Gerrit-Owner: Douglas Schilling Landgraf <dougsland(a)redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
11 years, 5 months