Nir Soffer has uploaded a new change for review.
Change subject: domain_descriptor: Eliminate magic hash init value
......................................................................
domain_descriptor: Eliminate magic hash init value
We used to initialize devices hash to 0 when there are no devices. There
is no need for using this magic value. Hashing an empty string does not
require additional comments and is more general.
The magic "0" hash value was exposed in the past in the stats xml, and
could be used for detecting a fresh domain without any devices, but this
value is not exposed any more since we introduced the guest agent disk
mapping hash.
Change-Id: I36767eafbef3dbebef5a1d04417f18e0cc4898c2
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M vdsm/virt/domain_descriptor.py
1 file changed, 2 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/22/34622/1
diff --git a/vdsm/virt/domain_descriptor.py b/vdsm/virt/domain_descriptor.py
index baca905..3e567ab 100644
--- a/vdsm/virt/domain_descriptor.py
+++ b/vdsm/virt/domain_descriptor.py
@@ -26,9 +26,8 @@
self._xml = xmlStr
self._dom = xml.dom.minidom.parseString(xmlStr)
self._devices = self._firstElementByTagName('devices')
- # VDSM by default reports '0' as hash when it has no device list yet
- self._devicesHash = (hash(self._devices.toxml()) if self._devices
- else 0)
+ self._devicesHash = hash(self._devices.toxml()
+ if self._devices else '')
@classmethod
def fromId(cls, uuid):
--
To view, visit http://gerrit.ovirt.org/34622
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I36767eafbef3dbebef5a1d04417f18e0cc4898c2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Alon Bar-Lev has posted comments on this change.
Change subject: Revised the format of output from the vdsm-tool vdsm-id command.
......................................................................
Patch Set 1: Code-Review+1
--
To view, visit http://gerrit.ovirt.org/34583
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I7379e969881931aaa4745dedf85ddfb61487f4a4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Andrew Dahms <andrewjdahms(a)gmail.com>
Gerrit-Reviewer: Alon Bar-Lev <alonbl(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-Reviewer: mooli tayer <mtayer(a)redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: No
Yaniv Bronhaim has posted comments on this change.
Change subject: Revised the format of output from the vdsm-tool vdsm-id command.
......................................................................
Patch Set 1:
please get alonbl ack. ovirt-host-deploy reads it and im not sure how \n can effect the way it uses it. I guess its fine, but let him double check that.
and please verify. just add new host by engine
--
To view, visit http://gerrit.ovirt.org/34583
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I7379e969881931aaa4745dedf85ddfb61487f4a4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Andrew Dahms <andrewjdahms(a)gmail.com>
Gerrit-Reviewer: Alon Bar-Lev <alonbl(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-Reviewer: mooli tayer <mtayer(a)redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: No
mooli tayer has uploaded a new change for review.
Change subject: tool: bugfix function called as attribute.
......................................................................
tool: bugfix function called as attribute.
to fix bug, instead of using selinux.is_selinux_enabled I suggest
using the recently added utils.get_selinux_enforce_mode().
In both cases the code means to check if selinux != disabled
(permissive | enforcing).
Change-Id: Id7c52e6f409b808c79653e40255cf62743b1fd0c
Signed-off-by: Mooli Tayer <mtayer(a)redhat.com>
---
M lib/vdsm/tool/configurators/configfile.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/87/34487/1
diff --git a/lib/vdsm/tool/configurators/configfile.py b/lib/vdsm/tool/configurators/configfile.py
index 9ec6b5b..13ed563 100644
--- a/lib/vdsm/tool/configurators/configfile.py
+++ b/lib/vdsm/tool/configurators/configfile.py
@@ -187,7 +187,7 @@
if self._oldmod != os.stat(self._filename).st_mode:
os.chmod(self._filename, self._oldmod)
- if selinux.is_selinux_enabled:
+ if utils.get_selinux_enforce_mode() > -1:
try:
selinux.restorecon(self._filename)
except OSError:
--
To view, visit http://gerrit.ovirt.org/34487
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id7c52e6f409b808c79653e40255cf62743b1fd0c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: mooli tayer <mtayer(a)redhat.com>
Francesco Romani has uploaded a new change for review.
Change subject: vm: hold config lock while replying status
......................................................................
vm: hold config lock while replying status
confLock must be held in the Vm.status()
method while iterating in conf to avoid
Thread-97::ERROR::2014-10-13
02:47:58,251::__init__::491::jsonrpc.JsonRpcServer::(_serveRequest)
Internal server error
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/yajsonrpc/__init__.py", line
486, in _serveRequest
res = method(**params)
File "/usr/share/vdsm/rpc/Bridge.py", line 266, in _dynamicMethod
result = fn(*methodArgs)
File "/usr/share/vdsm/API.py", line 1267, in getAllVmStats
vms = self.getVMList()
File "/usr/share/vdsm/API.py", line 1360, in getVMList
if not vmSet or v.id in vmSet]}
File "/usr/share/vdsm/API.py", line 1349, in reportedStatus
d = v.status()
File "/usr/share/vdsm/virt/vm.py", line 2855, in status
return dict((k, v) for k, v in self.conf.iteritems()
File "/usr/share/vdsm/virt/vm.py", line 2855, in <genexpr>
return dict((k, v) for k, v in self.conf.iteritems()
RuntimeError: dictionary changed size during iteration
Change-Id: I604f8534c9380d289633df4a8151699ab0d97e34
Relates-To: https://bugzilla.redhat.com/1151953
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 3 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/47/34147/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index ad8cb0e..ef41c6f 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -2416,8 +2416,9 @@
# used by API.Global.getVMList
self.conf['status'] = self.lastStatus
# Filter out any internal keys
- status = dict((k, v) for k, v in self.conf.iteritems()
- if not k.startswith("_"))
+ with self._confLock:
+ status = dict((k, v) for k, v in self.conf.iteritems()
+ if not k.startswith("_"))
status['guestDiskMapping'] = self.guestAgent.guestDiskMapping
return status
--
To view, visit http://gerrit.ovirt.org/34147
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I604f8534c9380d289633df4a8151699ab0d97e34
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Francesco Romani has uploaded a new change for review.
Change subject: vm: safe(r) Vm.conf update.
......................................................................
vm: safe(r) Vm.conf update.
Vm.conf is updated in unsafe in quite too many creation flows.
The effect is that we can get RuntimeError due to the concurrent
access of two threads, like
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/yajsonrpc/__init__.py", line 242, in sendReply
encodedObjects.append(response.encode())
File "/usr/lib/python2.6/site-packages/yajsonrpc/__init__.py", line 140, in encode
return json.dumps(res, 'utf-8')
File "/usr/lib64/python2.6/json/__init__.py", line 237, in dumps
**kw).encode(obj)
File "/usr/lib64/python2.6/json/encoder.py", line 367, in encode
chunks = list(self.iterencode(o))
File "/usr/lib64/python2.6/json/encoder.py", line 309, in _iterencode
for chunk in self._iterencode_dict(o, markers):
File "/usr/lib64/python2.6/json/encoder.py", line 275, in _iterencode_dict
for chunk in self._iterencode(value, markers):
File "/usr/lib64/python2.6/json/encoder.py", line 309, in _iterencode
for chunk in self._iterencode_dict(o, markers):
File "/usr/lib64/python2.6/json/encoder.py", line 275, in _iterencode_dict
for chunk in self._iterencode(value, markers):
File "/usr/lib64/python2.6/json/encoder.py", line 306, in _iterencode
for chunk in self._iterencode_list(o, markers):
File "/usr/lib64/python2.6/json/encoder.py", line 204, in _iterencode_list
for chunk in self._iterencode(value, markers):
File "/usr/lib64/python2.6/json/encoder.py", line 309, in _iterencode
for chunk in self._iterencode_dict(o, markers):
File "/usr/lib64/python2.6/json/encoder.py", line 247, in _iterencode_dict
for key, value in items:
RuntimeError: dictionary changed size during iteration
One of the most prominent issues is that the Device hierarchy
(Vm.conf['devices']) is updated in the Vm.run() method, after the
Vm object is registered into vmContainer, thus is queryable.
This is performed in an unsafe way, by doing a shallow copy of
the device container.
This patch fixes this problem by doing a deepcopy in the
_run() flow. Doing so, the device conf appears to be atomically
updated from the perspective of a client of the Vm class.
There are other, more rare, known failures like the one being fixed
here, still caused by uncareful update of the Vm.conf data, in this
flow on in other creation flows, but they will be addressed by separate
patches once pinpointed.
Finally, this issue is yet another reminder that an overhaul of the
handling of the conf data and of the device tree is long due and
really needed, but there is still a long road ahead.
Bug-Url: https://bugzilla.redhat.com/1143968
Change-Id: Ie9dee2aa01b2c231b99e02a879dcfbd7ecc7f70a
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 5 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/13/34813/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 9740ab3..c17327a 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1395,7 +1395,10 @@
# For BC we need to save previous behaviour for old type parameters.
# The new/old type parameter will be distinguished
# by existence/absence of the 'devices' key
- if self.conf.get('devices') is None:
+ with self._confLock:
+ devConf = deepcopy(self.conf.get('devices'))
+
+ if devConf is None:
devices[DISK_DEVICES] = self.getConfDrives()
devices[NIC_DEVICES] = self.getConfNetworkInterfaces()
devices[SOUND_DEVICES] = self.getConfSound()
@@ -1403,7 +1406,7 @@
devices[GRAPHICS_DEVICES] = self.getConfGraphics()
devices[CONTROLLER_DEVICES] = self.getConfController()
else:
- for dev in self.conf.get('devices'):
+ for dev in devConf:
try:
devices[dev['type']].append(dev)
except KeyError:
--
To view, visit http://gerrit.ovirt.org/34813
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie9dee2aa01b2c231b99e02a879dcfbd7ecc7f70a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>