Change in vdsm[master]: No need to call receive if send is timeout
by shuming@linux.vnet.ibm.com
Shu Ming has uploaded a new change for review.
Change subject: No need to call receive if send is timeout
......................................................................
No need to call receive if send is timeout
In callCrabRPCFunction(), the request packet is sent to the crab server first
and then wait for the response packet from the crab server. When the
request packet is not sent correctly, there is no need to wait for the response
packet back. So raising exception after the send operation is timeout.
Change-Id: Ib233b24d108a986d2f9e07a66f2a8f7d8cfb221a
Signed-off-by: Shu Ming <shuming(a)linux.vnet.ibm.com>
---
M vdsm/storage/remoteFileHandler.py
1 file changed, 8 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/59/7759/1
diff --git a/vdsm/storage/remoteFileHandler.py b/vdsm/storage/remoteFileHandler.py
index 622ea5d..6995c39 100644
--- a/vdsm/storage/remoteFileHandler.py
+++ b/vdsm/storage/remoteFileHandler.py
@@ -173,8 +173,13 @@
def callCrabRPCFunction(self, timeout, name, *args, **kwargs):
request = pickle.dumps((name, args, kwargs))
- self._sendAll(pack(LENGTH_STRUCT_FMT, len(request)), timeout)
- self._sendAll(request, timeout)
+ try:
+ self._sendAll(pack(LENGTH_STRUCT_FMT, len(request)), timeout)
+ self._sendAll(request, timeout)
+ except:
+ self.log.warn("Problem with handler send, treating as timeout",
+ exc_info=True)
+ raise Timeout()
try:
rawLength = self._recvAll(LENGTH_STRUCT_LENGTH, timeout)
@@ -184,7 +189,7 @@
except:
# If for some reason the connection drops\gets out of sync we treat
# it as a timeout so we only have one error path
- self.log.warn("Problem with handler, treating as timeout",
+ self.log.warn("Problem with handler receive, treating as timeout",
exc_info=True)
raise Timeout()
--
To view, visit http://gerrit.ovirt.org/7759
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib233b24d108a986d2f9e07a66f2a8f7d8cfb221a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Shu Ming <shuming(a)linux.vnet.ibm.com>
9 years, 9 months
Change in vdsm[master]: [WIP]extend setPolicy to support mom multi-policy
by lvroyce@linux.vnet.ibm.com
Royce Lv has uploaded a new change for review.
Change subject: [WIP]extend setPolicy to support mom multi-policy
......................................................................
[WIP]extend setPolicy to support mom multi-policy
set all policies at a single str brings difficulty to
enable and disable a single policy.
extend the setPolicy from str to policyDict.
Depend on mom implementation to be ready.
Change-Id: I94e601a8b1cb30d43005918dbee7d83c64f7f19b
Signed-off-by: Royce Lv<lvroyce(a)linux.vnet.ibm.com>
---
M tests/functional/momTests.py
M vdsm/API.py
M vdsm/BindingXMLRPC.py
M vdsm/momIF.py
M vdsm_api/vdsmapi-schema.json
M vdsm_cli/vdsClient.py
6 files changed, 22 insertions(+), 12 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/52/9152/1
diff --git a/tests/functional/momTests.py b/tests/functional/momTests.py
index 1981e05..30da052 100644
--- a/tests/functional/momTests.py
+++ b/tests/functional/momTests.py
@@ -44,8 +44,9 @@
(Host.Control "ksm_run" %d)
(Host.Control "ksm_pages_to_scan" %d)""" % \
(run, pages_to_scan)
+ testPolicyDict = {"ksm": testPolicyStr}
s = vdscli.connect()
- r = s.setMOMPolicy(testPolicyStr)
+ r = s.setMOMPolicy(testPolicyDict)
self.assertEqual(r['status']['code'], 0, str(r))
# Wait for the policy taking effect
@@ -54,3 +55,10 @@
hostStats = s.getVdsStats()['info']
self.assertEqual(bool(run), hostStats['ksmState'])
self.assertEqual(pages_to_scan, hostStats['ksmPages'])
+
+ def testMultiPolicy(self):
+ testPolicyDict = {"10_test": "(+1 1)", "20_test": "(-1 1)"}
+
+ s = vdscli.connect()
+ r = s.setMOMPolicy(testPolicyDict)
+ self.assertEqual(r['status']['code'], 0, str(r))
diff --git a/vdsm/API.py b/vdsm/API.py
index 896767c..7c1dad9 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -1329,9 +1329,11 @@
def getAllTasks(self):
return self._irs.getAllTasks()
- def setMOMPolicy(self, policy):
+ def setMOMPolicy(self, policyDict):
try:
- self._cif.mom.setPolicy(policy)
+ for policyName, policyStr in policyDict.iteritems():
+ self._cif.mom.setPolicyItem(policyName, policyStr)
+
return dict(status=doneCode)
except:
return errCode['momErr']
diff --git a/vdsm/BindingXMLRPC.py b/vdsm/BindingXMLRPC.py
index b833cf3..de35a3f 100644
--- a/vdsm/BindingXMLRPC.py
+++ b/vdsm/BindingXMLRPC.py
@@ -376,9 +376,9 @@
api = API.Global()
return api.setLogLevel(level)
- def setMOMPolicy(self, policy):
+ def setMOMPolicy(self, policyDict):
api = API.Global()
- return api.setMOMPolicy(policy)
+ return api.setMOMPolicy(policyDict)
def domainActivate(self, sdUUID, spUUID, options=None):
domain = API.StorageDomain(sdUUID, spUUID)
diff --git a/vdsm/momIF.py b/vdsm/momIF.py
index 827e9e4..c95d5fc 100644
--- a/vdsm/momIF.py
+++ b/vdsm/momIF.py
@@ -47,9 +47,9 @@
ret['ksmCpu'] = stats['ksmd_cpu_usage']
return ret
- def setPolicy(self, policyStr):
+ def setPolicyItem(self, policyName, policyStr):
# mom.setPolicy will raise an exception on failure.
- self._mom.setPolicy(policyStr)
+ self._mom.setNamedPolicy(policyName, policyStr)
def stop(self):
if self._mom is not None:
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index 5f0b391..03bc7c1 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -444,12 +444,12 @@
#
# Set MOM policy for different level of overcommitments.
#
-# @policy: MOM policy string.
+# @policyDict: MOM policy dictionary.
#
# Since: 4.10.0
##
{'command': {'class': 'Host', 'name': 'setMOMPolicy'},
- 'data': {'policy': 'str'}}
+ 'data': {'policyDict': 'StringMap'}}
##
# @TaskDetails:
diff --git a/vdsm_cli/vdsClient.py b/vdsm_cli/vdsClient.py
index 8cb78ed..b65ecd7 100644
--- a/vdsm_cli/vdsClient.py
+++ b/vdsm_cli/vdsClient.py
@@ -1387,8 +1387,8 @@
return stats['status']['code'], stats['status']['message']
return 0, ''
- def do_setMOMPolicy(self, policyFile):
- stats = self.s.setMOMPolicy(policyFile)
+ def do_setMOMPolicy(self, policyDict):
+ stats = self.s.setMOMPolicy(policyDict)
if stats['status']['code']:
return stats['status']['code'], stats['status']['message']
return 0, ''
@@ -2207,7 +2207,7 @@
' level (10=DEBUG, 50=CRITICAL'
)),
'setMOMPolicy': (serv.do_setMOMPolicy,
- ('<policyfile>', 'set MOM policy')),
+ ('<policyDict>', 'set MOM policy')),
'deleteImage': (serv.deleteImage,
('<sdUUID> <spUUID> <imgUUID> [<postZero>] [<force>]',
'Delete Image folder with all volumes.',
--
To view, visit http://gerrit.ovirt.org/9152
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I94e601a8b1cb30d43005918dbee7d83c64f7f19b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
9 years, 9 months
Change in vdsm[master]: make misc.pgrep for general usage
by lvroyce@linux.vnet.ibm.com
Royce Lv has uploaded a new change for review.
Change subject: make misc.pgrep for general usage
......................................................................
make misc.pgrep for general usage
pgrep now just grep specific named process,
Make it accept other params(e.g.ppid, state, etc)
for general usage.
Change-Id: I2034b04a4787d2f222cb98dfe3ffcdbb2a94ebb8
Signed-off-by: Royce Lv<lvroyce(a)linux.vnet.ibm.com>
---
M tests/miscTests.py
M vdsm/storage/misc.py
2 files changed, 21 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/33/11033/1
diff --git a/tests/miscTests.py b/tests/miscTests.py
index a949a09..885b913 100644
--- a/tests/miscTests.py
+++ b/tests/miscTests.py
@@ -63,7 +63,7 @@
class PgrepTests(TestCaseBase):
- def test(self):
+ def testGrepName(self):
sleepProcs = []
for i in range(3):
sleepProcs.append(misc.execCmd([EXT_SLEEP, "3"], sync=False,
@@ -78,6 +78,21 @@
proc.kill()
proc.wait()
+ def testGrepPpid(self):
+ sleepProcs = []
+ for i in range(3):
+ sleepProcs.append(misc.execCmd([EXT_SLEEP, "3"], sync=False,
+ sudo=False))
+
+ pids = misc.pgrep(os.getpid(), 'ppid')
+ for proc in sleepProcs:
+ self.assertTrue(proc.pid in pids, "pid %d was not located by pgrep"
+ % proc.pid)
+
+ for proc in sleepProcs:
+ proc.kill()
+ proc.wait()
+
class GetCmdArgsTests(TestCaseBase):
def test(self):
diff --git a/vdsm/storage/misc.py b/vdsm/storage/misc.py
index 5ec13e4..2438335 100644
--- a/vdsm/storage/misc.py
+++ b/vdsm/storage/misc.py
@@ -1109,8 +1109,10 @@
yield int(pid)
-def pgrep(name):
+def pgrep(statValue, statKey='name'):
res = []
+ statMap = {'name': 1, 'state': 2, 'ppid': 3}
+ statIndex = statMap.get(statKey, 1)
for pid in iteratePids():
try:
pid = int(pid)
@@ -1118,8 +1120,8 @@
continue
try:
- procName = utils.pidStat(pid)[1]
- if procName == name:
+ watchedStat = utils.pidStat(pid)[statIndex]
+ if watchedStat == statValue:
res.append(pid)
except (OSError, IOError):
continue
--
To view, visit http://gerrit.ovirt.org/11033
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2034b04a4787d2f222cb98dfe3ffcdbb2a94ebb8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
9 years, 9 months
Change in vdsm[master]: move get-conf-item to vdsm-tool
by shaohef@linux.vnet.ibm.com
ShaoHe Feng has uploaded a new change for review.
Change subject: move get-conf-item to vdsm-tool
......................................................................
move get-conf-item to vdsm-tool
many items in init scripts and spec file.
move the complexity from out of the init scripts and spec file and
into vdsm-tool
Change-Id: I5c64de097bbaea6a8cf862b43243377e10e00391
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
M vdsm-tool/Makefile.am
A vdsm-tool/vdsm_conf_item.py.in
M vdsm.spec.in
M vdsm/vdsmd.init.in
4 files changed, 86 insertions(+), 11 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/95/7695/1
diff --git a/vdsm-tool/Makefile.am b/vdsm-tool/Makefile.am
index 6ec0198..dcbf7e1 100644
--- a/vdsm-tool/Makefile.am
+++ b/vdsm-tool/Makefile.am
@@ -23,9 +23,11 @@
vdsm-tool
EXTRA_DIST = \
- validate_ovirt_certs.py.in
+ validate_ovirt_certs.py.in \
+ vdsm_conf_item.py.in
dist_vdsmtool_DATA = \
__init__.py \
passwd.py \
- validate_ovirt_certs.py
\ No newline at end of file
+ validate_ovirt_certs.py \
+ vdsm_conf_item.py
diff --git a/vdsm-tool/vdsm_conf_item.py.in b/vdsm-tool/vdsm_conf_item.py.in
new file mode 100644
index 0000000..ed268ff
--- /dev/null
+++ b/vdsm-tool/vdsm_conf_item.py.in
@@ -0,0 +1,72 @@
+# Copyright 2012 IBM, 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
+#
+
+# Access python's config files from bash.
+# Usage: get-conf-itemname
+
+from vdsm.tool import expose
+try:
+ from vdsm.config import config
+ vdsmconf = config
+except:
+ import ConfigParser
+ vdsmconf = ConfigParser.ConfigParser()
+from functools import partial
+
+
+CONF_FILE = "@CONFDIR(a)/vdsm.conf"
+
+
+def _get_conf_item(file, section, item, default):
+ vdsmconf.read(file)
+ try:
+ return vdsmconf.get(section, item)
+ except:
+ return default
+
+
+def print_conf_item(file, section, item, default):
+ val = _get_conf_item(file, section, item, default)
+ if (val.lower() == "false" or val.lower() == "true"):
+ print val.lower()
+ else:
+ print val
+
+
+# there are so many item in vdsm.conf so list all the item
+# then iterate the list and expose every item in list
+# item in tuple: (file, section, value, default)
+get_item_list = (
+ (CONF_FILE, 'addresses', 'management_port', ''),
+ (CONF_FILE, 'addresses', 'management_ip', '0.0.0.0'),
+ (CONF_FILE, 'irs', 'repository', '/rhev/'),
+ (CONF_FILE, 'irs', 'vdsm_nice', '-5'),
+ (CONF_FILE, 'vars', 'core_dump_enable', 'false'),
+ (CONF_FILE, 'vars', 'ssl', 'true'),
+ (CONF_FILE, 'vars', 'libvirt_log_filters', '1:libvirt 1:remote'),
+ (CONF_FILE, 'vars', 'libvirt_log_outputs',
+ '1:file:/var/log/vdsm/libvirt.log'),
+ (CONF_FILE, 'vars', 'trust_store_path', '/etc/pki/vdsm'))
+
+for item in get_item_list:
+ f, s, v, d = item
+ alias = "get-conf-" + v
+ globals()[alias] = partial(print_conf_item, f, s, v, d)
+ globals()[alias].__doc__ = " get %s from vdsm configure file" % v
+ expose(alias)(globals()[alias])
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 0d1b195..e161a93 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -720,6 +720,7 @@
%{python_sitearch}/%{vdsm_name}/tool/__init__.py*
%{python_sitearch}/%{vdsm_name}/tool/passwd.py*
%{python_sitearch}/%{vdsm_name}/tool/validate_ovirt_certs.py*
+%{python_sitearch}/%{vdsm_name}/tool/vdsm_conf_item.py*
%files tests
%doc %{_datadir}/%{vdsm_name}/tests/README
diff --git a/vdsm/vdsmd.init.in b/vdsm/vdsmd.init.in
index 860e301..b33e1be 100755
--- a/vdsm/vdsmd.init.in
+++ b/vdsm/vdsmd.init.in
@@ -40,7 +40,7 @@
LDCONF=/etc/sysconfig/libvirtd
QLCONF=/etc/libvirt/qemu-sanlock.conf
-is_coredump=`$GETCONFITEM $CONF_FILE vars core_dump_enable false | tr A-Z a-z`
+is_coredump=`/usr/bin/vdsm-tool get-conf-core_dump_enable`
[ $is_coredump != true ] && is_coredump=false
SYSTEMCTL_SKIP_REDIRECT=true
@@ -52,12 +52,12 @@
check_port_taken() {
local MANAGEMENT_PORT MANAGEMENT_IP
- MANAGEMENT_PORT=`$GETCONFITEM $CONF_FILE addresses management_port ""`
+ MANAGEMENT_PORT=`/usr/bin/vdsm-tool get-conf-management_port`
if [ -z "$MANAGEMENT_PORT" ]; then
log_failure_msg "$prog: management_port not found in $CONF_FILE"
return 1
fi
- MANAGEMENT_IP=`$GETCONFITEM $CONF_FILE addresses management_ip 0.0.0.0`
+ MANAGEMENT_IP=`/usr/bin/vdsm-tool get-conf-management_ip`
netstat -ntl | grep -q "$MANAGEMENT_IP:$MANAGEMENT_PORT"
RETVAL=$?
if [ "$RETVAL" -eq 0 ]; then
@@ -69,7 +69,7 @@
mk_data_center() {
local dc
- dc=`$GETCONFITEM $CONF_FILE irs repository /rhev/`
+ dc=`/usr/bin/vdsm-tool get-conf-repository`
/bin/mkdir -p "$dc"
/bin/chown vdsm.kvm "$dc"
}
@@ -110,7 +110,7 @@
test_conflicting_conf() {
local listen_tcp auth_tcp ssl
- ssl=`$GETCONFITEM $CONF_FILE vars ssl true | tr A-Z a-z`
+ ssl=`/usr/bin/vdsm-tool get-conf-ssl`
[ "$ssl" == true ] && return 0
listen_tcp="`get_libvirt_conf_item $LCONF listen_tcp`"
@@ -276,7 +276,7 @@
fi
local lconf qconf ldconf
- local ssl=`$GETCONFITEM $CONF_FILE vars ssl true | tr A-Z a-z`
+ local ssl=`/usr/bin/vdsm-tool get-conf-ssl`
lconf="$2"
qconf="$3"
@@ -511,10 +511,10 @@
fi
echo $"Starting up vdsm daemon: "
- local vdsm_nice=`$GETCONFITEM $CONF_FILE vars vdsm_nice -5`
+ local vdsm_nice=`/usr/bin/vdsm-tool get-conf-vdsm_nice`
- 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"` \
+ LIBVIRT_LOG_FILTERS=`/usr/bin/vdsm-tool get-conf-libvirt_log_filters` \
+ LIBVIRT_LOG_OUTPUTS=`/usr/bin/vdsm-tool get-conf-libvirt_log_outputs` \
LC_ALL=C NICELEVEL=$vdsm_nice daemon --user=vdsm @VDSMDIR@/respawn --minlifetime 10 --daemon --masterpid $RESPAWNPIDFILE $VDSM_BIN
RETVAL=$?
[ "$RETVAL" -eq 0 ] && log_success_msg $"$prog start" || log_failure_msg $"$prog start"
--
To view, visit http://gerrit.ovirt.org/7695
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5c64de097bbaea6a8cf862b43243377e10e00391
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
9 years, 9 months
Change in vdsm[master]: Add shutdown based on qemu-ga(qemu guest agent) in vdsm
by shaohef@linux.vnet.ibm.com
Hello Bing Bu Cao,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/9655
to review the following change.
Change subject: Add shutdown based on qemu-ga(qemu guest agent) in vdsm
......................................................................
Add shutdown based on qemu-ga(qemu guest agent) in vdsm
As previously what we agreed, the agent-assisted shutdown and fsfreeze
would be handled by the qemu guest agent while oVirt-specific functionality
such as Single-Sign-On would continue to be managed by the ovirt guest agent.
http://www.ovirt.org/wiki/Guest_agent_proposals
This patch changes the shutdown verb, add an shutdown approach by qemu guest
agent
Change-Id: I86977c1b717d63de21ba4818c6b66e43976d65de
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
Signed-off-by: BingBu Cao <mars(a)linux.vnet.ibm.com>
---
M vdsm/libvirtvm.py
M vdsm/vm.py
2 files changed, 84 insertions(+), 28 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/55/9655/1
diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index f20968f..f1d82d7 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -1222,6 +1222,8 @@
self._releaseLock = threading.Lock()
self.saveState()
+ self.shutdownMethodUpdate()
+
def _buildLease(self, domainID, volumeID, leasePath, leaseOffset):
"""
Add a single SANLock lease.
@@ -2326,9 +2328,45 @@
physical, alloc)
self.extendDriveVolume(d)
+ def shutdownMethodUpdate(self):
+ self._shutdownMethods = []
+ self._shutdownMethods.append({'qemugaShutdown':
+ self.qemugaShutdown})
+ self._shutdownMethods.append({'guestAgentShutdown':
+ self.guestAgentShutdown})
+ self._shutdownMethods.append({'acpiShutdown':
+ self.acpiShutdown})
+
def _acpiShutdown(self):
self._dom.shutdownFlags(libvirt.VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN)
+ def acpiShutdown(self, now, *args):
+ if utils.tobool(self.conf.get('acpiEnable', 'true')):
+ self.log.debug("acpiShutdown vm")
+ self._guestEventTime = now
+ self._guestEvent = 'Powering down'
+ self._acpiShutdown()
+ else:
+ return None
+
+ return {'status': {'code': doneCode['code'],
+ 'message': 'Machine shut down'}}
+
+ def _qemugaShutdown(self):
+ self._dom.shutdownFlags(libvirt.VIR_DOMAIN_SHUTDOWN_GUEST_AGENT)
+
+ def qemugaShutdown(self, now, *args):
+ if utils.tobool(self.conf.get('qgaEnable', 'true')):
+ self.log.debug("qemugaShutdown vm")
+ self._guestEventTime = now
+ self._guestEvent = 'Powering down'
+ self._qemugaShutdown()
+ else:
+ return None
+
+ return {'status': {'code': doneCode['code'],
+ 'message': 'Machine shut down'}}
+
def _getPid(self):
pid = '0'
try:
diff --git a/vdsm/vm.py b/vdsm/vm.py
index cb0e552..bf6ee8b 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -364,6 +364,8 @@
CONTROLLER_DEVICES: [], GENERAL_DEVICES: [],
BALLOON_DEVICES: [], REDIR_DEVICES: [],
WATCHDOG_DEVICES: []}
+ self._shutdownMethods = []
+ self.shutdownMethodUpdate()
def _get_lastStatus(self):
PAUSED_STATES = ('Powering down', 'RebootInProgress', 'Up')
@@ -970,35 +972,51 @@
if not guestCpuLocked:
self._guestCpuLock.release()
+ def shutdownMethodUpdate(self):
+ self._shutdownMethods = []
+ self._shutdownMethods.append({'guestAgentShutdown':
+ self._guestAgentShutdown})
+
def shutdown(self, timeout, message):
- try:
- now = time.time()
- if self.lastStatus == 'Down':
- return
- if self.guestAgent and self.guestAgent.isResponsive():
- self._guestEventTime = now
- self._guestEvent = 'Powering down'
- self.log.debug('guestAgent shutdown called')
- self.guestAgent.desktopShutdown(timeout, message)
- agent_timeout = (int(timeout) +
- config.getint('vars', 'sys_shutdown_timeout'))
- timer = threading.Timer(agent_timeout, self._timedShutdown)
- timer.start()
- elif utils.tobool(self.conf.get('acpiEnable', 'true')):
- self._guestEventTime = now
- self._guestEvent = 'Powering down'
- self._acpiShutdown()
- # No tools, no ACPI
- else:
- return {
- 'status': {
- 'code': errCode['exist']['status']['code'],
- 'message': 'VM without ACPI or active SolidICE tools. '
- 'Try Forced Shutdown.'}}
- except:
- self.log.error("Shutdown failed", exc_info=True)
- return {'status': {'code': errCode['exist']['status']['code'],
- 'message': 'Failed to shutdown VM. Try Forced Shutdown.'}}
+ if self.lastStatus == 'Down':
+ return
+ now = time.time()
+
+ status = None
+ for method, func in self._shutdownMethods:
+ try:
+ status = func(now, timeout, message)
+ except:
+ self.log.error("%s failed", method, exc_info=True)
+ status = {'status':
+ {'code': errCode['exist']['status']['code'],
+ 'message': 'Failed to shutdown VM. '
+ 'Try Forced Shutdown.'}}
+ # if one shutdown method failed, will try another method
+ # the loop will stop once a shutdown method is successful
+ if doneCode['code'] == status['status']['code']:
+ return status
+ if not status:
+ return {'status':
+ {'code': errCode['exist']['status']['code'],
+ 'message': 'VM without ACPI or active SolidICE tools. '
+ 'Try Forced Shutdown.'}}
+
+ return status
+
+ def guestAgentShutdown(self, now, timeout, message):
+ if self.guestAgent and self.guestAgent.isResponsive():
+ self._guestEventTime = time.time()
+ self._guestEvent = 'Powering down'
+ self.log.debug('guestAgent shutdown called')
+ self.guestAgent.desktopShutdown(timeout, message)
+ agent_timeout = (int(timeout) +
+ config.getint('vars', 'sys_shutdown_timeout'))
+ timer = threading.Timer(agent_timeout, self._timedShutdown)
+ timer.start()
+ else:
+ return None
+
return {'status': {'code': doneCode['code'],
'message': 'Machine shut down'}}
--
To view, visit http://gerrit.ovirt.org/9655
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I86977c1b717d63de21ba4818c6b66e43976d65de
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
Gerrit-Reviewer: Bing Bu Cao <mars(a)linux.vnet.ibm.com>
9 years, 9 months
Change in vdsm[master]: domainMonitor: Improve logging
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: domainMonitor: Improve logging
......................................................................
domainMonitor: Improve logging
We have logs in domain monitor thread, and we can see when a monitor
starts or stops, but we don't have any info which thread triggered the
operation. This patch adds info level log messages when starting and
stopping domain monitoring, revealing the caller thread.
Change-Id: I20feb40b097fa65ebebf851e33c051fc184ff029
Relates-To: https://bugzilla.redhat.com/1032925
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M vdsm/storage/domainMonitor.py
1 file changed, 3 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/04/21904/1
diff --git a/vdsm/storage/domainMonitor.py b/vdsm/storage/domainMonitor.py
index 5b0d4ac..30928dd 100644
--- a/vdsm/storage/domainMonitor.py
+++ b/vdsm/storage/domainMonitor.py
@@ -98,6 +98,7 @@
domainThread.poolDomain |= poolDomain
return
+ self.log.info("Start monitoring %s", sdUUID)
domainThread = DomainMonitorThread(weakref.proxy(self),
sdUUID, hostId, self._interval)
domainThread.poolDomain = poolDomain
@@ -111,6 +112,7 @@
# Eg: when a domain is detached the domain monitor is stopped and
# the host id is released. If the monitor didn't actually exit it
# might respawn a new acquire host id.
+ self.log.info("Stop monitoring %s", sdUUID)
try:
self._domains[sdUUID].stop()
except KeyError:
@@ -122,6 +124,7 @@
return self._domains[sdUUID].getStatus()
def close(self):
+ self.log.info("Stopping domain monitors")
for sdUUID in self._domains.keys():
self.stopMonitoring(sdUUID)
--
To view, visit http://gerrit.ovirt.org/21904
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I20feb40b097fa65ebebf851e33c051fc184ff029
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
9 years, 9 months
Change in vdsm[master]: Added netinfoTests:testGetEmpty
by amuller@redhat.com
Assaf Muller has uploaded a new change for review.
Change subject: Added netinfoTests:testGetEmpty
......................................................................
Added netinfoTests:testGetEmpty
The new test should prevent the regression introduced in:
http://gerrit.ovirt.org/#/c/21652/
And fixed in:
http://gerrit.ovirt.org/#/c/21850/
Change-Id: Ibfb1d18eeb697de6bf8d35ab9748a61324fde9ac
Signed-off-by: Assaf Muller <amuller(a)redhat.com>
---
M tests/netinfoTests.py
1 file changed, 11 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/81/21881/1
diff --git a/tests/netinfoTests.py b/tests/netinfoTests.py
index 6886c0b..8001f40 100644
--- a/tests/netinfoTests.py
+++ b/tests/netinfoTests.py
@@ -97,6 +97,17 @@
# it should.
netinfo.get()
+ @MonkeyPatch(netinfo, 'getLinks', lambda: [])
+ @MonkeyPatch(netinfo, 'networks', lambda: {})
+ def testGetEmpty(self):
+ result = {}
+ result.update(netinfo.get())
+ self.assertEqual(result['networks'], {})
+ self.assertEqual(result['bridges'], {})
+ self.assertEqual(result['nics'], {})
+ self.assertEqual(result['bondings'], {})
+ self.assertEqual(result['vlans'], {})
+
def testIPv4toMapped(self):
self.assertEqual('::ffff:127.0.0.1', netinfo.IPv4toMapped('127.0.0.1'))
--
To view, visit http://gerrit.ovirt.org/21881
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibfb1d18eeb697de6bf8d35ab9748a61324fde9ac
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Assaf Muller <amuller(a)redhat.com>
9 years, 9 months
Change in vdsm[master]: clientIF: Fix use of getConfDevices
by ykaplan@redhat.com
Yeela Kaplan has uploaded a new change for review.
Change subject: clientIF: Fix use of getConfDevices
......................................................................
clientIF: Fix use of getConfDevices
getConfDevices was merged into buildConfDevices
Change-Id: Iaf9776e1237f6799dfccd5ff3edf197c5bf32f5e
Signed-off-by: Yeela Kaplan <ykaplan(a)redhat.com>
---
M vdsm/clientIF.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/32/21832/1
diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index 0b67e45..dd939f8 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -455,7 +455,7 @@
# Do not prepare volumes when system goes down
if self._enabled:
vmObj.preparePaths(
- vmObj.getConfDevices()[vm.DISK_DEVICES])
+ vmObj.buildConfDevices()[vm.DISK_DEVICES])
except:
self.log.error("Vm %s recovery failed",
vmId, exc_info=True)
--
To view, visit http://gerrit.ovirt.org/21832
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaf9776e1237f6799dfccd5ff3edf197c5bf32f5e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <ykaplan(a)redhat.com>
9 years, 9 months
Change in vdsm[master]: vdsm: report remaining values in migration stats
by peet@redhat.com
Peter V. Saveliev has uploaded a new change for review.
Change subject: vdsm: report remaining values in migration stats
......................................................................
vdsm: report remaining values in migration stats
So it would be possible to use such values to draw
eye-candy bars about migration statistics in the frontend.
Signed-off-by: Peter V. Saveliev <peet(a)redhat.com>
Change-Id: Idc32fa00eaa1b90c3ba9d0afffdeb1cdd8150f9a
---
M vdsm/libvirtvm.py
M vdsm/vm.py
2 files changed, 9 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/25/15125/1
diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index 5b16d69..2fcf249 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -377,6 +377,8 @@
self.daemon = True
self.data_progress = 0
self.mem_progress = 0
+ self.remaining = 0
+ self.remaining_lowmark = 0
def run(self):
def calculateProgress(remaining, total):
@@ -422,6 +424,8 @@
if jobType == 0:
continue
+ self.remaining = remaining
+ self.remaining_lowmark = lowmark
self.data_progress = calculateProgress(dataRemaining, dataTotal)
self.mem_progress = calculateProgress(memRemaining, memTotal)
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 2b76662..53def15 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -124,9 +124,12 @@
"""
if self._monitorThread is not None:
# fetch migration status from the monitor thread
+ # shortcut to make flake8 happy
+ t = self._monitorThread
self.status['progress'] = int(
- float(self._monitorThread.data_progress +
- self._monitorThread.mem_progress) / 2)
+ float(t.data_progress + t.mem_progress) / 2)
+ self.status['remaining'] = t.remaining
+ self.status['remaining_lowmark'] = t.remaining_lowmark
return self.status
def _setupVdsConnection(self):
--
To view, visit http://gerrit.ovirt.org/15125
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idc32fa00eaa1b90c3ba9d0afffdeb1cdd8150f9a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Peter V. Saveliev <peet(a)redhat.com>
9 years, 9 months
Change in vdsm[master]: bugfix: UpdateVmDevice QoS
by psebek@redhat.com
Petr Šebek has uploaded a new change for review.
Change subject: bugfix: UpdateVmDevice QoS
......................................................................
bugfix: UpdateVmDevice QoS
QoS was not handled in method Vm._updateInterfaceDevice.
Change-Id: I43a383b2a9cf96366927beebf63f1344027169fb
Bug-Url: https://bugzilla.redhat.com/1002300
Signed-off-by: Petr Sebek <psebek(a)redhat.com>
---
M vdsm/vm.py
1 file changed, 17 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/45/19545/1
diff --git a/vdsm/vm.py b/vdsm/vm.py
index f356c08..0bccd46 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -3095,12 +3095,13 @@
network = DUMMY_BRIDGE
linkValue = 'down'
custom = params.get('custom')
+ specParams = params.get('specParams')
netsToMirror = params.get('portMirroring',
netConf.get('portMirroring', []))
with self.setLinkAndNetwork(netDev, netConf, linkValue, network,
- custom):
+ custom, specParams):
with self.updatePortMirroring(netConf, netsToMirror):
return {'status': doneCode, 'vmList': self.status()}
except (LookupError,
@@ -3111,7 +3112,19 @@
'message': e.message}}
@contextmanager
- def setLinkAndNetwork(self, dev, conf, linkValue, networkValue, custom):
+ def setLinkAndNetwork(self, dev, conf, linkValue, networkValue, custom,
+ specParams):
+ def updateXMLWithQoS(vnicXML, qos):
+ bandwidth = vnicXML.getElementsByTagName('bandwidth')[0]
+ inbound = bandwidth.getElementsByTagName('inbound')[0]
+ outbound = bandwidth.getElementsByTagName('outbound')[0]
+ if 'inbound' in qos:
+ bandwidth.remove(inbound)
+ bandwidth.appendChildWithArgs('inbound', **qos['inbound'])
+ if 'outbound' in qos:
+ bandwidth.remove(outbound)
+ bandwidth.appendChildWithArgs('outbound', **qos['outbound'])
+
vnicXML = dev.getXML()
source = vnicXML.getElementsByTagName('source')[0]
source.setAttribute('bridge', networkValue)
@@ -3121,6 +3134,8 @@
link = xml.dom.minidom.Element('link')
vnicXML.appendChildWithArgs(link)
link.setAttribute('state', linkValue)
+ if specParams:
+ updateXMLWithQoS(vnicXML, specParams)
vnicStrXML = vnicXML.toprettyxml(encoding='utf-8')
try:
try:
--
To view, visit http://gerrit.ovirt.org/19545
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I43a383b2a9cf96366927beebf63f1344027169fb
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Šebek <psebek(a)redhat.com>
9 years, 9 months