Change in vdsm[master]: Move start_needed_srv and shutdown_conflicting_srv to vdsm-t...
by wenyi@linux.vnet.ibm.com
Wenyi Gao has uploaded a new change for review.
Change subject: Move start_needed_srv and shutdown_conflicting_srv to vdsm-tool
......................................................................
Move start_needed_srv and shutdown_conflicting_srv to vdsm-tool
Change-Id: I54eca4b2cc3a17e9819a0188e5dc4c8bd28161da
Signed-off-by: Wenyi Gao <wenyi(a)linux.vnet.ibm.com>
---
M .gitignore
M vdsm-tool/Makefile.am
A vdsm-tool/base.py
A vdsm-tool/needed_service.py.in
M vdsm.spec.in
M vdsm/vdsmd.init.in
6 files changed, 145 insertions(+), 42 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/59/8759/1
diff --git a/.gitignore b/.gitignore
index 49a78ef..f9c26d4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,6 +41,7 @@
vdsm/vdsmd.8
vdsm/vdsmd.init
vdsm-tool/load_needed_modules.py
+vdsm-tool/needed_service.py
vdsm-tool/validate_ovirt_certs.py
vdsm_cli/vdsClient
vdsm_cli/vdscli.py
diff --git a/vdsm-tool/Makefile.am b/vdsm-tool/Makefile.am
index 997e339..0ed3226 100644
--- a/vdsm-tool/Makefile.am
+++ b/vdsm-tool/Makefile.am
@@ -27,7 +27,9 @@
dist_vdsmtool_DATA = \
__init__.py \
+ base.py \
load_needed_modules.py \
+ needed_service.py \
passwd.py \
validate_ovirt_certs.py \
$(NULL)
diff --git a/vdsm-tool/base.py b/vdsm-tool/base.py
new file mode 100644
index 0000000..9ded9a1
--- /dev/null
+++ b/vdsm-tool/base.py
@@ -0,0 +1,77 @@
+# Copyright IBM, Corp. 2012
+#
+# 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 subprocess
+
+
+def exec_command(argv):
+ """
+ This function executes a given shell command.
+ """
+ try:
+ p = subprocess.Popen(argv, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ out, err = p.communicate()
+ rc = p.returncode
+ except:
+ raise Exception('Failed to execute "%s"', ' '.join(argv),
+ exc_info=True)
+
+ return (rc, out, err)
+
+
+def call_init_function(function, *args, **kwargs):
+ """
+ Call a function from /etc/init.d/functions.
+ """
+ allowed_init_function = ['success', 'failure', 'pidofproc',
+ 'killproc', 'daemon']
+ rc = -1
+ srccmd = 'SYSTEMCTL_SKIP_REDIRECT=true source /etc/init.d/functions;'
+
+ if function not in allowed_init_function:
+ print('Illegal function "%s"', function)
+ return rc
+
+ tmpcmd = function + ' '.join('%s=%s' % item for item in kwargs.iteritems())
+ tmpcmd += ' ' + ' '.join(args)
+ # Only allow to execute one shell command.
+ if any(c in tmpcmd for c in (';', '&&', '||')):
+ print('Illegal function parameters "%s"', tmpcmd)
+ return rc
+
+ cmd = srccmd + tmpcmd
+ try:
+ rc = subprocess.call([cmd], shell=True)
+ except:
+ raise Exception('Failed to execute "%s"', cmd, exc_info=True)
+
+ return rc
+
+
+def print_msg(msg, success=True):
+ """
+ Print message followed by a color string "[ OK ]" or "[Failed]".
+ """
+ print msg,
+ if success:
+ call_init_function('success')
+ else:
+ call_init_function('failure')
+ print
diff --git a/vdsm-tool/needed_service.py.in b/vdsm-tool/needed_service.py.in
new file mode 100644
index 0000000..5266408
--- /dev/null
+++ b/vdsm-tool/needed_service.py.in
@@ -0,0 +1,61 @@
+# Copyright IBM, Corp. 2012
+#
+# 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 os
+
+from vdsm import constants
+from vdsm.tool.base import exec_command, print_msg
+from vdsm.tool import expose
+
+EX_CHKCONFIG = '@CHKCONFIG_PATH@'
+EX_SERVICE = constants.EXT_SERVICE
+
+
+@expose('shutdown-conflicting-srv')
+def shutdown_conflicting_srv():
+ """
+ Shutdown conflicting service
+ """
+ srv = 'libvirt-guests'
+ exec_command([EX_CHKCONFIG, srv, 'off'])
+ rc = exec_command([EX_SERVICE, srv, 'status'])[0]
+ if rc == 0:
+ if os.path.exists('/var/lock/subsys/libvirt-guests'):
+ os.unlink('/var/lock/subsys/libvirt-guests')
+ else:
+ exec_command([EX_SERVICE, srv, 'stop'])
+ return 0
+
+
+@expose('start-needed-srv')
+def start_needed_srv():
+ """
+ Start needed service
+ """
+ services = ['iscsid', 'multipathd', 'ntpd', 'wdmd', 'sanlock']
+ for srv in services:
+ rc = exec_command([EX_SERVICE, srv, 'status'])[0]
+ if rc != 0:
+ print 'Starting %s...' % srv
+ rc = exec_command([EX_SERVICE, srv, 'start'])[0]
+ if rc != 0:
+ print_msg('vdsm: Dependent %s failed to start' % srv, False)
+ return rc
+ exec_command([EX_SERVICE, 'iscsid', 'force-start'])
+ return 0
diff --git a/vdsm.spec.in b/vdsm.spec.in
index f61a36a..dc7ee24 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -771,6 +771,8 @@
%{python_sitearch}/%{vdsm_name}/tool/passwd.py*
%{python_sitearch}/%{vdsm_name}/tool/validate_ovirt_certs.py*
%{python_sitearch}/%{vdsm_name}/tool/load_needed_modules.py*
+%{python_sitearch}/%{vdsm_name}/tool/needed_service.py*
+%{python_sitearch}/%{vdsm_name}/tool/base.py*
%files tests
%doc %{_datadir}/%{vdsm_name}/tests/README
diff --git a/vdsm/vdsmd.init.in b/vdsm/vdsmd.init.in
index 2b9ad11..35fb05e 100755
--- a/vdsm/vdsmd.init.in
+++ b/vdsm/vdsmd.init.in
@@ -32,8 +32,6 @@
CORE_DUMP_PATH=/var/log/core/core.%p.%t.dump
DOM_METADATA_BACKUP_DIR=/var/log/vdsm/backup
CORE_PATTERN=/proc/sys/kernel/core_pattern
-NEEDED_SERVICES="iscsid multipathd ntpd wdmd sanlock"
-CONFLICTING_SERVICES="libvirt-guests"
LCONF=/etc/libvirt/libvirtd.conf
QCONF=/etc/libvirt/qemu.conf
@@ -130,49 +128,11 @@
fi
}
-shutdown_conflicting_srv() {
- local srv
-
- for srv in $CONFLICTING_SERVICES
- do
- /sbin/chkconfig $srv off
- if /sbin/service $srv status > /dev/null 2>&1;
- then
- if [ "$srv" == "libvirt-guests" ]; then
- /bin/rm -f /var/lock/subsys/libvirt-guests
- else
- /sbin/service $srv stop
- fi
- fi
- done
- return 0
-}
libvirt_should_use_upstart() {
[[ -x /sbin/initctl ]]
}
-start_needed_srv() {
- local srv
- local ret_val
-
- for srv in $NEEDED_SERVICES
- do
- if ! /sbin/service $srv status > /dev/null 2>&1;
- then
- echo "Starting $srv..."
- /sbin/service $srv start
- ret_val=$?
- if [ $ret_val -ne 0 ]
- then
- log_failure_msg "$prog: Dependent $srv failed to start"
- return $ret_val
- fi
- fi
- done
-
- /sbin/service iscsid force-start
-}
test_lo() {
if ! LC_ALL=C /sbin/ifconfig lo | /bin/grep -q UP;
@@ -428,7 +388,7 @@
local ret_val
python @VDSMDIR(a)/hooks.pyc before_vdsm_start
- shutdown_conflicting_srv && stop_libvirtd_sysv
+ /usr/bin/vdsm-tool shutdown-conflicting-srv && stop_libvirtd_sysv
if ! @LIBEXECDIR(a)/vdsm-gencerts.sh --check; then
echo -n $"Configuring a self-signed VDSM host certificate: "
@@ -443,7 +403,7 @@
return $ret_val
fi
- start_needed_srv && start_libvirtd
+ /usr/bin/vdsm-tool start-needed-srv && start_libvirtd
ret_val=$?
if [ $ret_val -ne 0 ]
then
--
To view, visit http://gerrit.ovirt.org/8759
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I54eca4b2cc3a17e9819a0188e5dc4c8bd28161da
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Wenyi Gao <wenyi(a)linux.vnet.ibm.com>
10 years, 7 months
Change in vdsm[master]: minimalistic (incomplete) test for mkimage.py with fail for ...
by josef.pacula@gmail.com
Josef Pacula has uploaded a new change for review.
Change subject: minimalistic (incomplete) test for mkimage.py with fail for non-64base data
......................................................................
minimalistic (incomplete) test for mkimage.py with fail for non-64base data
Change-Id: I1a7656359beb5d116ad1919e237fe084a1208d71
Signed-off-by: Josef Pacula <josef.pacula(a)gmail.com>
---
M tests/Makefile.am
A tests/mkimageTests.py
M vdsm/mkimage.py
3 files changed, 20 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/75/6275/1
--
To view, visit http://gerrit.ovirt.org/6275
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1a7656359beb5d116ad1919e237fe084a1208d71
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Josef Pacula <josef.pacula(a)gmail.com>
10 years, 8 months
Change in vdsm[master]: Packaging: make the auto build scripts suitable for running ...
by zhshzhou@linux.vnet.ibm.com
Zhou Zheng Sheng has uploaded a new change for review.
Change subject: Packaging: make the auto build scripts suitable for running in Jenkins
......................................................................
Packaging: make the auto build scripts suitable for running in Jenkins
1. Add a "--local" option to autobuild.sh to generate rpms in the
./rpmbuild . When runs in Jenkins, it's better to do everything under
the current working dir.
2. When checking pep8, ignore .py files generated from .py.in, because
this kind of files may contain generated long lines. When built in
Jenkins, the working path can be very long, so generated files under
./builder may contain constants for a long path.
Change-Id: I470a7eca71d6d28ef76521a2759b485b5a5cab6f
Signed-off-by: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
---
M .gitignore
M Makefile.am
M autobuild.sh
3 files changed, 27 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/38/11238/1
diff --git a/.gitignore b/.gitignore
index d36ed82..b8eb409 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,10 +15,12 @@
build-aux/install-sh
build-aux/missing
build-aux/py-compile
+builder
config.log
config.status
configure
results.log
+rpmbuild
tests/run_tests.sh
tests/run_tests_local.sh
vdsm-*.tar.gz
diff --git a/Makefile.am b/Makefile.am
index 48bdc5e..ba6df2a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -61,19 +61,27 @@
vdsm_reg \
$(NULL)
-PEP8_BLACKLIST = config.py,constants.py
+PEP8_BLACKLIST =
check-local:
find . -path './.git' -prune -type f -o \
-name '*.py' -o -name '*.py.in' | xargs $(PYFLAKES)
- $(PEP8) --exclude="$(PEP8_BLACKLIST)" --filename '*.py,*.py.in' \
- $(PEP8_WHITELIST)
- @if test -f .gitignore; then \
+ PEP8_EXCLUDE="$(PEP8_BLACKLIST)" ; \
+ if test -f .gitignore; then \
for i in `git ls-files \*.in`; do \
if ! grep -q -x $${i%%.in} .gitignore; then \
echo "Missing $${i%%.in} in .gitignore"; exit 1; fi; \
done; \
- fi;
+ PEP8_EXCLUDE+=`find . -path './.git' -prune -type f -o -name "*.py" | \
+ while read PYFILE; do \
+ if [ -f "$$PYFILE.in" ]; then \
+ printf ,\`basename "$$PYFILE"\`; \
+ fi; \
+ done`; \
+ fi; \
+ PEP8_EXCLUDE=$${PEP8_EXCLUDE#,} ; \
+ $(PEP8) --exclude="$$PEP8_EXCLUDE" --filename '*.py,*.py.in' \
+ $(PEP8_WHITELIST)
all-local: \
vdsm.spec
diff --git a/autobuild.sh b/autobuild.sh
index c7a592c..cb74f86 100755
--- a/autobuild.sh
+++ b/autobuild.sh
@@ -3,6 +3,16 @@
set -e
set -v
+if [ "$1" == "--local" ]; then
+ # --prefix needs absolute directory name
+ BUILDERDIR="$(pwd)/builder"
+ RPMTOPDIR="$(pwd)/rpmbuild"
+ shift
+else
+ BUILDERDIR="$HOME/builder"
+ RPMTOPDIR="$HOME/rpmbuild"
+fi
+
# Make things clean.
test -n "$1" && RESULTS=$1 || RESULTS=results.log
@@ -10,7 +20,7 @@
test -f Makefile && make -k distclean || :
-./autogen.sh --prefix="$AUTOBUILD_INSTALL_ROOT"
+./autogen.sh --prefix="$BUILDERDIR"
# If the MAKEFLAGS envvar does not yet include a -j option,
# add -jN where N depends on the number of processors.
@@ -50,5 +60,6 @@
NOSE_EXCLUDE=.* rpmbuild --nodeps \
--define "extra_release $EXTRA_RELEASE" \
--define "_sourcedir `pwd`" \
+ --define "_topdir $RPMTOPDIR" \
-ba --clean vdsm.spec
fi
--
To view, visit http://gerrit.ovirt.org/11238
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I470a7eca71d6d28ef76521a2759b485b5a5cab6f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
10 years, 8 months
Change in vdsm[master]: Make getRepoStats() a hsm method.
by ewarszaw@redhat.com
Eduardo has uploaded a new change for review.
Change subject: Make getRepoStats() a hsm method.
......................................................................
Make getRepoStats() a hsm method.
Making repoStats pool independent.
Change-Id: I0273611a23f29b5c6be0354a4c6b2d6526a9b574
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/hsm.py
M vdsm/storage/sp.py
2 files changed, 101 insertions(+), 99 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/73/14673/1
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 9a44795..d3e1beb 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -2473,7 +2473,15 @@
vars.task.setDefaultException(
se.StoragePoolActionError("spUUID=%s" % spUUID))
vars.task.getSharedLock(STORAGE, spUUID)
- return self.getPool(spUUID).getInfo()
+ pool = self.getPool(spUUID)
+ poolInfo = pool.getInfo()
+ doms = pool.getDomains()
+ domInfo = self._getDomsStats(pool.monitorDomains, doms)
+ for sdUUID in doms.iterkeys():
+ if domInfo[sdUUID]['isoprefix']:
+ poolInfo['isoprefix'] = domInfo[sdUUID]['isoprefix']
+
+ return dict(info=poolInfo, dominfo=domInfo)
@public
def createStorageDomain(self, storageType, sdUUID, domainName,
@@ -3466,6 +3474,92 @@
pool._upgradePool(targetDomVersion)
return {"upgradeStatus": "started"}
+ def _getDomsStats(self, domainMonitor, doms):
+ domInfo = {}
+ repoStats = self._getRepoStats(domainMonitor)
+
+ for sdUUID, sdStatus in doms:
+ # Return statistics for active domains only
+ domInfo[sdUUID] = {'status': sdStatus, 'alerts': []}
+
+ if sdStatus != sd.DOM_ACTIVE_STATUS or sdUUID not in repoStats:
+ continue
+
+ domInfo[sdUUID]['version'] = repoStats[sdUUID]['result']['version']
+
+ # For unreachable domains repoStats will return disktotal and
+ # diskfree as None.
+ if (repoStats[sdUUID]['disktotal'] is not None
+ and repoStats[sdUUID]['diskfree'] is not None):
+ domInfo[sdUUID]['disktotal'] = repoStats[sdUUID]['disktotal']
+ domInfo[sdUUID]['diskfree'] = repoStats[sdUUID]['diskfree']
+
+ if not repoStats[sdUUID]['mdavalid']:
+ domInfo[sdUUID]['alerts'].append({
+ 'code': se.SmallVgMetadata.code,
+ 'message': se.SmallVgMetadata.message,
+ })
+ self.log.warning("VG %s's metadata size too small %s",
+ sdUUID, repoStats[sdUUID]['mdasize'])
+
+ if not repoStats[sdUUID]['mdathreshold']:
+ domInfo[sdUUID]['alerts'].append({
+ 'code': se.VgMetadataCriticallyFull.code,
+ 'message': se.VgMetadataCriticallyFull.message,
+ })
+ self.log.warning("VG %s's metadata size exceeded critical "
+ "size: mdasize=%s mdafree=%s", sdUUID,
+ repoStats[sdUUID]['mdasize'],
+ repoStats[sdUUID]['mdafree'])
+ return domInfo
+
+ def _getRepoStats(self, domainMonitor):
+ repoStats = {}
+ statsGenTime = time.time()
+
+ for sdUUID in domainMonitor.monitoredDomains:
+ domStatus = domainMonitor.getStatus(sdUUID)
+
+ if domStatus.error is None:
+ code = 0
+ elif isinstance(domStatus.error, se.StorageException):
+ code = domStatus.error.code
+ else:
+ code = se.StorageException.code
+
+ disktotal, diskfree = domStatus.diskUtilization
+ vgmdtotal, vgmdfree = domStatus.vgMdUtilization
+ lastcheck = '%.1f' % (statsGenTime - domStatus.lastCheck)
+
+ repoStats[sdUUID] = {
+ 'finish': domStatus.lastCheck,
+
+ 'result': {
+ 'code': code,
+ 'lastCheck': lastcheck,
+ 'delay': str(domStatus.readDelay),
+ 'valid': (domStatus.error is None),
+ 'version': domStatus.version,
+ },
+
+ 'disktotal': disktotal,
+ 'diskfree': diskfree,
+
+ 'mdavalid': domStatus.vgMdHasEnoughFreeSpace,
+ 'mdathreshold': domStatus.vgMdFreeBelowThreashold,
+ 'mdasize': vgmdtotal,
+ 'mdafree': vgmdfree,
+
+ 'masterValidate': {
+ 'mount': domStatus.masterMounted,
+ 'valid': domStatus.masterValid
+ },
+
+ 'isoprefix': domStatus.isoPrefix,
+ }
+
+ return repoStats
+
@public
def repoStats(self, options=None):
"""
@@ -3478,7 +3572,7 @@
result = {}
for p in self.pools.values():
- repo_stats = p.getRepoStats()
+ repo_stats = self._getRepoStats(p.domainMonitor)
for d in repo_stats:
result[d] = repo_stats[d]['result']
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index 19d1b0a..12b50e2 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -19,7 +19,6 @@
#
import os
-import time
from glob import iglob, glob
import logging
import threading
@@ -1413,66 +1412,16 @@
return self.getMetaParam(PMDK_SPM_ID)
@unsecured
- def getRepoStats(self):
- #FIXME : this should actually be built in HSM
- repoStats = {}
- statsGenTime = time.time()
-
- for sdUUID in self.domainMonitor.monitoredDomains:
- domStatus = self.domainMonitor.getStatus(sdUUID)
-
- if domStatus.error is None:
- code = 0
- elif isinstance(domStatus.error, se.StorageException):
- code = domStatus.error.code
- else:
- code = se.StorageException.code
-
- disktotal, diskfree = domStatus.diskUtilization
- vgmdtotal, vgmdfree = domStatus.vgMdUtilization
- lastcheck = '%.1f' % (statsGenTime - domStatus.lastCheck)
-
- repoStats[sdUUID] = {
- 'finish': domStatus.lastCheck,
-
- 'result': {
- 'code': code,
- 'lastCheck': lastcheck,
- 'delay': str(domStatus.readDelay),
- 'valid': (domStatus.error is None),
- 'version': domStatus.version,
- },
-
- 'disktotal': disktotal,
- 'diskfree': diskfree,
-
- 'mdavalid': domStatus.vgMdHasEnoughFreeSpace,
- 'mdathreshold': domStatus.vgMdFreeBelowThreashold,
- 'mdasize': vgmdtotal,
- 'mdafree': vgmdfree,
-
- 'masterValidate': {
- 'mount': domStatus.masterMounted,
- 'valid': domStatus.masterValid
- },
-
- 'isoprefix': domStatus.isoPrefix,
- }
-
- return repoStats
-
- @unsecured
def getInfo(self):
"""
Get storage pool info.
"""
- msdUUID = self.masterDomain.sdUUID
-
try:
msdInfo = self.masterDomain.getInfo()
except Exception:
self.log.error("Couldn't read from master domain", exc_info=True)
- raise se.StoragePoolMasterNotFound(self.spUUID, msdUUID)
+ raise se.StoragePoolMasterNotFound(self.spUUID,
+ self.masterDomain.sdUUID)
try:
pmd = self._getPoolMD(self.masterDomain)
@@ -1484,57 +1433,16 @@
'type': msdInfo['type'],
'name': pmd[PMDK_POOL_DESCRIPTION],
'domains': domainListEncoder(pmd[PMDK_DOMAINS].iteritems()),
- 'master_uuid': msdUUID,
+ 'master_uuid': self.masterDomain.sdUUID,
'master_ver': pmd[PMDK_MASTER_VER],
'lver': pmd[PMDK_LVER],
'spm_id': pmd[PMDK_SPM_ID],
'pool_status': 'uninitialized',
'version': str(msdInfo['version']),
'isoprefix': '',
+ 'pool_status': 'connected',
}
-
- domInfo = {}
- repoStats = self.getRepoStats()
-
- for sdUUID, sdStatus in pmd[PMDK_DOMAINS].iteritems():
- # Return statistics for active domains only
- domInfo[sdUUID] = {'status': sdStatus, 'alerts': []}
-
- if sdStatus != sd.DOM_ACTIVE_STATUS or sdUUID not in repoStats:
- continue
-
- if repoStats[sdUUID]['isoprefix']:
- poolInfo['isoprefix'] = repoStats[sdUUID]['isoprefix']
-
- domInfo[sdUUID]['version'] = repoStats[sdUUID]['result']['version']
-
- # For unreachable domains repoStats will return disktotal and
- # diskfree as None.
- if (repoStats[sdUUID]['disktotal'] is not None
- and repoStats[sdUUID]['diskfree'] is not None):
- domInfo[sdUUID]['disktotal'] = repoStats[sdUUID]['disktotal']
- domInfo[sdUUID]['diskfree'] = repoStats[sdUUID]['diskfree']
-
- if not repoStats[sdUUID]['mdavalid']:
- domInfo[sdUUID]['alerts'].append({
- 'code': se.SmallVgMetadata.code,
- 'message': se.SmallVgMetadata.message,
- })
- self.log.warning("VG %s's metadata size too small %s",
- sdUUID, repoStats[sdUUID]['mdasize'])
-
- if not repoStats[sdUUID]['mdathreshold']:
- domInfo[sdUUID]['alerts'].append({
- 'code': se.VgMetadataCriticallyFull.code,
- 'message': se.VgMetadataCriticallyFull.message,
- })
- self.log.warning("VG %s's metadata size exceeded critical "
- "size: mdasize=%s mdafree=%s", sdUUID,
- repoStats[sdUUID]['mdasize'],
- repoStats[sdUUID]['mdafree'])
-
- poolInfo["pool_status"] = "connected"
- return dict(info=poolInfo, dominfo=domInfo)
+ return poolInfo
@unsecured
def getIsoDomain(self):
--
To view, visit http://gerrit.ovirt.org/14673
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0273611a23f29b5c6be0354a4c6b2d6526a9b574
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
10 years, 8 months
Change in vdsm[master]: Logging: config logging in new process of remoteFileHandler
by zhshzhou@linux.vnet.ibm.com
Zhou Zheng Sheng has uploaded a new change for review.
Change subject: Logging: config logging in new process of remoteFileHandler
......................................................................
Logging: config logging in new process of remoteFileHandler
When new process of Python is started by PoolHandler.__init__() to run
remoteFileHandler.py, the logging configurations are lost. This patch
sets the configuration for new process of remoteFileHandler.py correctly.
This patch deals with the logging problem described in the following bug
report in the last paragraph of the "Additional info" section.
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=875678
Change-Id: I1b3b9e2837d632c7532fcd8f7306ed50b0865b5c
Signed-off-by: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
---
M vdsm/storage/remoteFileHandler.py
1 file changed, 7 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/82/9182/1
diff --git a/vdsm/storage/remoteFileHandler.py b/vdsm/storage/remoteFileHandler.py
index edf8e68..34de3ef 100644
--- a/vdsm/storage/remoteFileHandler.py
+++ b/vdsm/storage/remoteFileHandler.py
@@ -32,6 +32,13 @@
from contextlib import contextmanager
from threading import Thread
+from vdsm import constants
+
+if __name__ == "__main__":
+ from logging import config as lconfig
+ loggerConfFile = constants.P_VDSM_CONF + 'logger.conf'
+ lconfig.fileConfig(loggerConfFile)
+
import misc
import fileUtils
--
To view, visit http://gerrit.ovirt.org/9182
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1b3b9e2837d632c7532fcd8f7306ed50b0865b5c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
10 years, 8 months
Change in vdsm[master]: Read pool metadata once in StoragePool.getInfo()
by ewarszaw@redhat.com
Eduardo has uploaded a new change for review.
Change subject: Read pool metadata once in StoragePool.getInfo()
......................................................................
Read pool metadata once in StoragePool.getInfo()
The behavioural change of spm_id should be safe since
StoragePool.getInfo() call in hsm.getStoragePoolInfo() is under
the (shared) pool lock making startSpm block in this host when
the info is retrieved.
Making repoStats pool independent.
Change-Id: I41a79662a4bd01fc310aa5554c38a16f3f8ba546
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/sp.py
1 file changed, 15 insertions(+), 13 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/72/14672/1
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index ed79808..19d1b0a 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -1475,26 +1475,28 @@
raise se.StoragePoolMasterNotFound(self.spUUID, msdUUID)
try:
- poolInfo = {
- 'type': msdInfo['type'],
- 'name': self.getDescription(),
- 'domains': domainListEncoder(self.getDomains()),
- 'master_uuid': msdUUID,
- 'master_ver': self.getMasterVersion(),
- 'lver': self.getMetaParam(PMDK_LVER),
- 'spm_id': self.getSpmId(),
- 'pool_status': 'uninitialized',
- 'version': str(self.getVersion()),
- 'isoprefix': '',
- }
+ pmd = self._getPoolMD(self.masterDomain)
except Exception:
self.log.error("Pool metadata error", exc_info=True)
raise se.StoragePoolActionError(self.spUUID)
+ poolInfo = {
+ 'type': msdInfo['type'],
+ 'name': pmd[PMDK_POOL_DESCRIPTION],
+ 'domains': domainListEncoder(pmd[PMDK_DOMAINS].iteritems()),
+ 'master_uuid': msdUUID,
+ 'master_ver': pmd[PMDK_MASTER_VER],
+ 'lver': pmd[PMDK_LVER],
+ 'spm_id': pmd[PMDK_SPM_ID],
+ 'pool_status': 'uninitialized',
+ 'version': str(msdInfo['version']),
+ 'isoprefix': '',
+ }
+
domInfo = {}
repoStats = self.getRepoStats()
- for sdUUID, sdStatus in self.getDomains().iteritems():
+ for sdUUID, sdStatus in pmd[PMDK_DOMAINS].iteritems():
# Return statistics for active domains only
domInfo[sdUUID] = {'status': sdStatus, 'alerts': []}
--
To view, visit http://gerrit.ovirt.org/14672
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I41a79662a4bd01fc310aa5554c38a16f3f8ba546
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
10 years, 8 months
Change in vdsm[master]: Fix getStorageDomainInfo() logic.
by ewarszaw@redhat.com
Eduardo has uploaded a new change for review.
Change subject: Fix getStorageDomainInfo() logic.
......................................................................
Fix getStorageDomainInfo() logic.
Making repoStats pool independent.
Change-Id: I8b0b2ad3dca19cf203d937c1a9f6a12ab0f1095f
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/hsm.py
1 file changed, 18 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/71/14671/1
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index c90ea07..9a44795 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -2664,17 +2664,26 @@
# BC) so it's not that horrible. In any case please
# remove this when we can stop supporting this API.
info.update({'lver': -1, 'spm_id': -1, 'master_ver': 0})
- if dom.getDomainRole() == sd.MASTER_DOMAIN:
- # make sure it's THE master
+ if info['role'] == sd.MASTER_DOMAIN:
try:
- pool = self.getPool(dom.getPools()[0])
- if pool.masterDomain.sdUUID == sdUUID:
- poolInfo = pool.getInfo()
- for key in ['lver', 'spm_id', 'master_ver']:
- info[key] = poolInfo['info'][key]
+ pool = self.getPool(info['pool'][0])
+ except IndexError:
+ self.log.error("Domain %s is marked as master but is not "
+ "attached to any pool", sdUUID, exc_info=True)
except se.StoragePoolUnknown:
- # Its pool is not connected
- pass
+ self.log.error("Domain %s, marked as master, is attached to "
+ "pool %s but this host is connected to pool %s",
+ sdUUID, pool.spUUID)
+ else:
+ # make sure it's THE master of this pool
+ if pool.masterDomain.sdUUID != sdUUID:
+ self.log.error("Domain %s is marked as master but actual "
+ "master is %s",
+ sdUUID, pool.masterDomain.sdUUID)
+ else:
+ poolInfo = pool.getInfo()
+ for key in ('lver', 'spm_id', 'master_ver'):
+ info[key] = poolInfo['info'][key]
return dict(info=info)
--
To view, visit http://gerrit.ovirt.org/14671
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8b0b2ad3dca19cf203d937c1a9f6a12ab0f1095f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
10 years, 8 months
Change in vdsm[master]: vdsm: Refactor out LibvirtVmDevice
by Vinzenz Feenstra
Vinzenz Feenstra has uploaded a new change for review.
Change subject: vdsm: Refactor out LibvirtVmDevice
......................................................................
vdsm: Refactor out LibvirtVmDevice
Removal of the class LibvirtVmDevice
Change-Id: I4e05b948dbe88328f3cd3186df7d12a40eb5e648
Signed-off-by: Vinzenz Feenstra <vfeenstr(a)redhat.com>
---
M vdsm/vm/devices/__init__.py
M vdsm/vm/devices/device.py
2 files changed, 14 insertions(+), 17 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/66/10866/1
diff --git a/vdsm/vm/devices/__init__.py b/vdsm/vm/devices/__init__.py
index 6c5283c..d32030b 100644
--- a/vdsm/vm/devices/__init__.py
+++ b/vdsm/vm/devices/__init__.py
@@ -18,7 +18,7 @@
# Refer to the README and COPYING files for full details of the license
#
-from device import Device, LibvirtVmDevice, GeneralDevice, ControllerDevice,\
+from device import Device, GeneralDevice, ControllerDevice,\
VideoDevice, SoundDevice, NetworkInterfaceDevice, Drive, BalloonDevice,\
WatchdogDevice, SmartCardDevice, RedirDevice, ConsoleDevice
@@ -46,7 +46,6 @@
"CONSOLE_DEVICES",
"SMARTCARD_DEVICES",
"Device",
- "LibvirtVmDevice",
"GeneralDevice",
"ControllerDevice",
"VideoDevice",
diff --git a/vdsm/vm/devices/device.py b/vdsm/vm/devices/device.py
index 8d3b5cc..d8a1f79 100644
--- a/vdsm/vm/devices/device.py
+++ b/vdsm/vm/devices/device.py
@@ -39,8 +39,6 @@
if not a.startswith('__')]
return " ".join(attrs)
-
-class LibvirtVmDevice(Device):
def createXmlElem(self, elemType, deviceType, attributes=[]):
"""
Create domxml device element according to passed in params
@@ -67,7 +65,7 @@
return element
-class GeneralDevice(LibvirtVmDevice):
+class GeneralDevice(Device):
def getXML(self):
"""
@@ -76,7 +74,7 @@
return self.createXmlElem(self.type, self.device, ['address'])
-class ControllerDevice(LibvirtVmDevice):
+class ControllerDevice(Device):
def getXML(self):
"""
@@ -91,7 +89,7 @@
return ctrl
-class VideoDevice(LibvirtVmDevice):
+class VideoDevice(Device):
def getXML(self):
"""
@@ -108,7 +106,7 @@
return video
-class SoundDevice(LibvirtVmDevice):
+class SoundDevice(Device):
def getXML(self):
"""
@@ -119,7 +117,7 @@
return sound
-class NetworkInterfaceDevice(LibvirtVmDevice):
+class NetworkInterfaceDevice(Device):
def __init__(self, conf, log, **kwargs):
# pyLint can't tell that the Device.__init__() will
@@ -130,7 +128,7 @@
kwargs[attr] = 'virtio'
elif attr == 'network' and value == '':
kwargs[attr] = DUMMY_BRIDGE
- LibvirtVmDevice.__init__(self, conf, log, **kwargs)
+ Device.__init__(self, conf, log, **kwargs)
self.sndbufParam = False
self._customize()
@@ -209,7 +207,7 @@
return iface
-class Drive(LibvirtVmDevice):
+class Drive(Device):
VOLWM_CHUNK_MB = config.getint('irs', 'volume_utilization_chunk_mb')
VOLWM_FREE_PCT = 100 - config.getint('irs', 'volume_utilization_percent')
VOLWM_CHUNK_REPLICATE_MULT = 2 # Chunk multiplier during replication
@@ -217,7 +215,7 @@
def __init__(self, conf, log, **kwargs):
if not kwargs.get('serial'):
self.serial = kwargs.get('imageID'[-20:]) or ''
- LibvirtVmDevice.__init__(self, conf, log, **kwargs)
+ Device.__init__(self, conf, log, **kwargs)
# Keep sizes as int
self.reqsize = int(kwargs.get('reqsize', '0')) # Backward compatible
self.truesize = int(kwargs.get('truesize', '0'))
@@ -369,7 +367,7 @@
return diskelem
-class BalloonDevice(LibvirtVmDevice):
+class BalloonDevice(Device):
def getXML(self):
"""
@@ -385,7 +383,7 @@
return m
-class WatchdogDevice(LibvirtVmDevice):
+class WatchdogDevice(Device):
def getXML(self):
"""
Create domxml for a watchdog device.
@@ -401,7 +399,7 @@
return m
-class SmartCardDevice(LibvirtVmDevice):
+class SmartCardDevice(Device):
def getXML(self):
"""
Add smartcard section to domain xml
@@ -416,7 +414,7 @@
return card
-class RedirDevice(LibvirtVmDevice):
+class RedirDevice(Device):
def getXML(self):
"""
Create domxml for a redir device.
@@ -428,7 +426,7 @@
return self.createXmlElem('redirdev', self.device, ['bus', 'address'])
-class ConsoleDevice(LibvirtVmDevice):
+class ConsoleDevice(Device):
def getXML(self):
"""
Create domxml for a console device.
--
To view, visit http://gerrit.ovirt.org/10866
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4e05b948dbe88328f3cd3186df7d12a40eb5e648
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeenstr(a)redhat.com>
10 years, 8 months
Change in vdsm[master]: vdsm: Simplify device map initialization
by Vinzenz Feenstra
Vinzenz Feenstra has uploaded a new change for review.
Change subject: vdsm: Simplify device map initialization
......................................................................
vdsm: Simplify device map initialization
Change-Id: I36b89a0aec6fc1311aba2b9213ee4dc705f43e7e
Signed-off-by: Vinzenz Feenstra <vfeenstr(a)redhat.com>
---
M vdsm/vm/devices/__init__.py
M vdsm/vm/vm.py
2 files changed, 17 insertions(+), 13 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/67/10867/1
diff --git a/vdsm/vm/devices/__init__.py b/vdsm/vm/devices/__init__.py
index d32030b..6b0ed50 100644
--- a/vdsm/vm/devices/__init__.py
+++ b/vdsm/vm/devices/__init__.py
@@ -35,6 +35,20 @@
SMARTCARD_DEVICES = 'smartcard'
+def initDeviceMap():
+ return {
+ DISK_DEVICES: [],
+ NIC_DEVICES: [],
+ SOUND_DEVICES: [],
+ VIDEO_DEVICES: [],
+ CONTROLLER_DEVICES: [],
+ GENERAL_DEVICES: [],
+ BALLOON_DEVICES: [],
+ REDIR_DEVICES: [],
+ WATCHDOG_DEVICES: [],
+ CONSOLE_DEVICES: [],
+ SMARTCARD_DEVICES: []}
+
__all__ = [
"DISK_DEVICES",
"NIC_DEVICES",
diff --git a/vdsm/vm/vm.py b/vdsm/vm/vm.py
index 5f769b5..0302615 100644
--- a/vdsm/vm/vm.py
+++ b/vdsm/vm/vm.py
@@ -48,7 +48,7 @@
REDIR_DEVICES, WATCHDOG_DEVICES, SMARTCARD_DEVICES, CONSOLE_DEVICES
from devices import Drive, NetworkInterfaceDevice, SoundDevice,\
VideoDevice, ControllerDevice, GeneralDevice, BalloonDevice,\
- WatchdogDevice, RedirDevice, ConsoleDevice, SmartCardDevice
+ WatchdogDevice, RedirDevice, ConsoleDevice, SmartCardDevice, initDeviceMap
from vdsm import constants, utils, libvirtconnection
from vdsm.config import config
import guestIF
@@ -156,12 +156,7 @@
self.stopDisksStatsCollection()
self._vmCreationEvent = threading.Event()
self._pathsPreparedEvent = threading.Event()
- self._devices = {DISK_DEVICES: [], NIC_DEVICES: [],
- SOUND_DEVICES: [], VIDEO_DEVICES: [],
- CONTROLLER_DEVICES: [], GENERAL_DEVICES: [],
- BALLOON_DEVICES: [], REDIR_DEVICES: [],
- WATCHDOG_DEVICES: [], CONSOLE_DEVICES: [],
- SMARTCARD_DEVICES: []}
+ self._devices = initDeviceMap()
def _get_lastStatus(self):
PAUSED_STATES = ('Powering down', 'RebootInProgress', 'Up')
@@ -240,12 +235,7 @@
return removables
def getConfDevices(self):
- devices = {DISK_DEVICES: [], NIC_DEVICES: [],
- SOUND_DEVICES: [], VIDEO_DEVICES: [],
- CONTROLLER_DEVICES: [], GENERAL_DEVICES: [],
- BALLOON_DEVICES: [], REDIR_DEVICES: [],
- WATCHDOG_DEVICES: [], CONSOLE_DEVICES: [],
- SMARTCARD_DEVICES: []}
+ devices = initDeviceMap()
for dev in self.conf.get('devices'):
try:
devices[dev['type']].append(dev)
--
To view, visit http://gerrit.ovirt.org/10867
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I36b89a0aec6fc1311aba2b9213ee4dc705f43e7e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeenstr(a)redhat.com>
10 years, 8 months
Change in vdsm[master]: vdsm: Nicer names for methods
by Vinzenz Feenstra
Vinzenz Feenstra has uploaded a new change for review.
Change subject: vdsm: Nicer names for methods
......................................................................
vdsm: Nicer names for methods
Underlying is gone, _pause = _suspend, _cont = _resume
Change-Id: I9614084b812d1da4a5a1b0cc8aedefbd63713f60
Signed-off-by: Vinzenz Feenstra <vfeenstr(a)redhat.com>
---
M vdsm/vm/migration/source_thread.py
M vdsm/vm/vm.py
2 files changed, 47 insertions(+), 47 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/68/10868/1
diff --git a/vdsm/vm/migration/source_thread.py b/vdsm/vm/migration/source_thread.py
index 668e892..8251e48 100644
--- a/vdsm/vm/migration/source_thread.py
+++ b/vdsm/vm/migration/source_thread.py
@@ -222,7 +222,7 @@
'method': self._method,
'dstparams': self._dstparams}
self._vm.saveState()
- self._startUnderlyingMigration()
+ self._startMigration()
self._finishSuccessfully()
except libvirt.libvirtError, e:
if e.get_error_code() == libvirt.VIR_ERR_OPERATION_ABORTED:
@@ -239,7 +239,7 @@
self._recover(str(e))
self.log.error("Failed to migrate", exc_info=True)
- def _startUnderlyingMigration(self):
+ def _startMigration(self):
self._preparingMigrationEvt = True
if self._mode == 'file':
hooks.before_vm_hibernate(self._vm._dom.XMLDesc(0), self._vm.conf)
diff --git a/vdsm/vm/vm.py b/vdsm/vm/vm.py
index 0302615..5fca0f0 100644
--- a/vdsm/vm/vm.py
+++ b/vdsm/vm/vm.py
@@ -128,7 +128,7 @@
self._monitorResponse = 0
self.conf['clientIp'] = ''
self.memCommitted = 0
- self._creationThread = threading.Thread(target=self._startUnderlyingVm)
+ self._creationThread = threading.Thread(target=self._startVm)
if 'migrationDest' in self.conf:
self._lastStatus = 'Migration Destination'
elif 'restoreState' in self.conf:
@@ -452,7 +452,7 @@
memory += config.getint('vars', 'guest_ram_overhead')
self.memCommitted = 2 ** 20 * memory
- def _startUnderlyingVm(self):
+ def _startVm(self):
self.log.debug("Start")
try:
self.memCommit()
@@ -525,7 +525,7 @@
self.startDisksStatsCollection()
def _onQemuDeath(self):
- self.log.info('underlying process disconnected')
+ self.log.info('qemu process disconnected')
# Try release VM resources first, if failed stuck in 'Powering Down'
# state
response = self.releaseVm()
@@ -705,7 +705,7 @@
if self.lastStatus in ('Migration Source', 'Saving State', 'Down'):
self.log.error('cannot cont while %s', self.lastStatus)
return errCode['unexpected']
- self._underlyingCont()
+ self._resume()
if hasattr(self, 'updateGuestCpuRunning'):
self.updateGuestCpuRunning()
self._lastStatus = afterState
@@ -723,7 +723,7 @@
self._acquireCpuLockWithTimeout()
try:
self.conf['pauseCode'] = 'NOERR'
- self._underlyingPause()
+ self._suspend()
if hasattr(self, 'updateGuestCpuRunning'):
self.updateGuestCpuRunning()
self._lastStatus = afterState
@@ -978,21 +978,21 @@
self._guestCpuRunning = (self._dom.info()[0] ==
libvirt.VIR_DOMAIN_RUNNING)
- def _getUnderlyingVmDevicesInfo(self):
+ def _getVmDevicesInfo(self):
"""
- Obtain underlying vm's devices info from libvirt.
+ Obtain vm's devices info from libvirt.
"""
- self._getUnderlyingNetworkInterfaceInfo()
- self._getUnderlyingDriveInfo()
- self._getUnderlyingDisplayPort()
- self._getUnderlyingSoundDeviceInfo()
- self._getUnderlyingVideoDeviceInfo()
- self._getUnderlyingControllerDeviceInfo()
- self._getUnderlyingBalloonDeviceInfo()
- self._getUnderlyingWatchdogDeviceInfo()
- self._getUnderlyingSmartcardDeviceInfo()
+ self._getNetworkInterfaceInfo()
+ self._getDriveInfo()
+ self._getDisplayPort()
+ self._getSoundDeviceInfo()
+ self._getVideoDeviceInfo()
+ self._getControllerDeviceInfo()
+ self._getBalloonDeviceInfo()
+ self._getWatchdogDeviceInfo()
+ self._getSmartcardDeviceInfo()
# Obtain info of all unknown devices. Must be last!
- self._getUnderlyingUnknownDeviceInfo()
+ self._getUnknownDeviceInfo()
def _domDependentInit(self):
if self.destroyed:
@@ -1004,8 +1004,8 @@
pass
raise Exception('destroy() called before Vm started')
- self._getUnderlyingVmInfo()
- self._getUnderlyingVmDevicesInfo()
+ self._getVmInfo()
+ self._getVmDevicesInfo()
#Currently there is no protection agains mirroring a network twice,
for nic in self._devices[NIC_DEVICES]:
@@ -1159,7 +1159,7 @@
self._devices[NIC_DEVICES].append(nic)
self.conf['devices'].append(nicParams)
self.saveState()
- self._getUnderlyingNetworkInterfaceInfo()
+ self._getNetworkInterfaceInfo()
hooks.after_nic_hotplug(nicXml, self.conf)
if hasattr(nic, 'portMirroring'):
@@ -1395,7 +1395,7 @@
self._devices[DISK_DEVICES].append(drive)
self.conf['devices'].append(diskParams)
self.saveState()
- self._getUnderlyingDriveInfo()
+ self._getDriveInfo()
return {'status': doneCode, 'vmList': self.status()}
@@ -1506,11 +1506,11 @@
self.saveState()
self.log.debug("End of migration")
- def _underlyingCont(self):
+ def _resume(self):
hooks.before_vm_cont(self._dom.XMLDesc(0), self.conf)
self._dom.resume()
- def _underlyingPause(self):
+ def _suspend(self):
hooks.before_vm_pause(self._dom.XMLDesc(0), self.conf)
self._dom.suspend()
@@ -2119,7 +2119,7 @@
pass
return pid
- def _getUnderlyingVmInfo(self):
+ def _getVmInfo(self):
self._lastXMLDesc = self._dom.XMLDesc(0)
devxml = _domParseStr(self._lastXMLDesc).childNodes[0]. \
getElementsByTagName('devices')[0]
@@ -2156,7 +2156,7 @@
os.rename(f.name, self._recoveryFile)
_previous(self)
try:
- self._getUnderlyingVmInfo()
+ self._getVmInfo()
except:
# we do not care if _dom suddenly died now
pass
@@ -2388,7 +2388,7 @@
self.saveState()
return {'status': doneCode}
- def _getUnderlyingDeviceAddress(self, devXml):
+ def _getDeviceAddress(self, devXml):
"""
Obtain device's address from libvirt
"""
@@ -2404,7 +2404,7 @@
return address
- def _getUnderlyingUnknownDeviceInfo(self):
+ def _getUnknownDeviceInfo(self):
"""
Obtain unknown devices info from libvirt.
@@ -2428,7 +2428,7 @@
alias = x.getElementsByTagName('alias')[0].getAttribute('name')
if not isKnownDevice(alias):
- address = self._getUnderlyingDeviceAddress(x)
+ address = self._getDeviceAddress(x)
# I general case we assume that device has attribute 'type',
# if it hasn't getAttribute returns ''.
device = x.getAttribute('type')
@@ -2438,7 +2438,7 @@
'address': address}
self.conf['devices'].append(newDev)
- def _getUnderlyingControllerDeviceInfo(self):
+ def _getControllerDeviceInfo(self):
"""
Obtain controller devices info from libvirt.
"""
@@ -2456,7 +2456,7 @@
index = x.getAttribute('index')
# Get controller address
- address = self._getUnderlyingDeviceAddress(x)
+ address = self._getDeviceAddress(x)
# In case the controller has index and/or model, they
# are compared. Currently relevant for USB controllers.
@@ -2485,7 +2485,7 @@
'address': address,
'alias': alias})
- def _getUnderlyingBalloonDeviceInfo(self):
+ def _getBalloonDeviceInfo(self):
"""
Obtain balloon device info from libvirt.
"""
@@ -2497,7 +2497,7 @@
if not x.getElementsByTagName('address'):
continue
- address = self._getUnderlyingDeviceAddress(x)
+ address = self._getDeviceAddress(x)
alias = x.getElementsByTagName('alias')[0].getAttribute('name')
for dev in self._devices[BALLOON_DEVICES]:
@@ -2511,7 +2511,7 @@
dev['address'] = address
dev['alias'] = alias
- def _getUnderlyingSmartcardDeviceInfo(self):
+ def _getSmartcardDeviceInfo(self):
"""
Obtain smartcard device info from libvirt.
"""
@@ -2522,7 +2522,7 @@
if not x.getElementsByTagName('address'):
continue
- address = self._getUnderlyingDeviceAddress(x)
+ address = self._getDeviceAddress(x)
alias = x.getElementsByTagName('alias')[0].getAttribute('name')
for dev in self._devices[SMARTCARD_DEVICES]:
@@ -2536,7 +2536,7 @@
dev['address'] = address
dev['alias'] = alias
- def _getUnderlyingWatchdogDeviceInfo(self):
+ def _getWatchdogDeviceInfo(self):
"""
Obtain watchdog device info from libvirt.
"""
@@ -2547,7 +2547,7 @@
# PCI watchdog has "address" different from ISA watchdog
if x.getElementsByTagName('address'):
- address = self._getUnderlyingDeviceAddress(x)
+ address = self._getDeviceAddress(x)
alias = x.getElementsByTagName('alias')[0].getAttribute('name')
for wd in self._devices[WATCHDOG_DEVICES]:
@@ -2561,7 +2561,7 @@
dev['address'] = address
dev['alias'] = alias
- def _getUnderlyingVideoDeviceInfo(self):
+ def _getVideoDeviceInfo(self):
"""
Obtain video devices info from libvirt.
"""
@@ -2570,7 +2570,7 @@
for x in videosxml:
alias = x.getElementsByTagName('alias')[0].getAttribute('name')
# Get video card address
- address = self._getUnderlyingDeviceAddress(x)
+ address = self._getDeviceAddress(x)
# FIXME. We have an identification problem here.
# Video card device has not unique identifier, except the alias
@@ -2589,7 +2589,7 @@
dev['alias'] = alias
break
- def _getUnderlyingSoundDeviceInfo(self):
+ def _getSoundDeviceInfo(self):
"""
Obtain sound devices info from libvirt.
"""
@@ -2598,7 +2598,7 @@
for x in soundsxml:
alias = x.getElementsByTagName('alias')[0].getAttribute('name')
# Get sound card address
- address = self._getUnderlyingDeviceAddress(x)
+ address = self._getDeviceAddress(x)
# FIXME. We have an identification problem here.
# Sound device has not unique identifier, except the alias
@@ -2617,7 +2617,7 @@
dev['alias'] = alias
break
- def _getUnderlyingDriveInfo(self):
+ def _getDriveInfo(self):
"""
Obtain block devices info from libvirt.
"""
@@ -2648,7 +2648,7 @@
else:
drv = 'raw'
# Get disk address
- address = self._getUnderlyingDeviceAddress(x)
+ address = self._getDeviceAddress(x)
for d in self._devices[DISK_DEVICES]:
if d.path == devPath:
@@ -2682,7 +2682,7 @@
diskDev['bootOrder'] = bootOrder
self.conf['devices'].append(diskDev)
- def _getUnderlyingDisplayPort(self):
+ def _getDisplayPort(self):
"""
Obtain display port info from libvirt.
"""
@@ -2695,7 +2695,7 @@
if port:
self.conf['displaySecurePort'] = port
- def _getUnderlyingNetworkInterfaceInfo(self):
+ def _getNetworkInterfaceInfo(self):
"""
Obtain network interface info from libvirt.
"""
@@ -2727,7 +2727,7 @@
network = network[len(netinfo.LIBVIRT_NET_PREFIX):]
# Get nic address
- address = self._getUnderlyingDeviceAddress(x)
+ address = self._getDeviceAddress(x)
for nic in self._devices[NIC_DEVICES]:
if nic.macAddr.lower() == mac.lower():
nic.name = name
--
To view, visit http://gerrit.ovirt.org/10868
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9614084b812d1da4a5a1b0cc8aedefbd63713f60
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeenstr(a)redhat.com>
10 years, 8 months