Merge "Fix virt BDM __setattr__ and __getattr__"
This commit is contained in:
commit
7a1fb26c04
|
@ -195,8 +195,6 @@ class TestDriverBlockDevice(test.NoDBTestCase):
|
|||
for passthru in test_bdm._proxy_as_attr:
|
||||
self.assertEqual(getattr(test_bdm, passthru),
|
||||
getattr(test_bdm._bdm_obj, passthru))
|
||||
for no_pass in set(db_bdm.keys()) - test_bdm._proxy_as_attr:
|
||||
self.assertRaises(AttributeError, getattr, test_bdm, no_pass)
|
||||
|
||||
# Make sure that all others raise _invalidType
|
||||
for other_name, cls in self.driver_classes.iteritems():
|
||||
|
|
|
@ -101,15 +101,13 @@ class DriverBlockDevice(dict):
|
|||
if name in self._proxy_as_attr:
|
||||
return getattr(self._bdm_obj, name)
|
||||
else:
|
||||
raise AttributeError("Cannot access %s on DriverBlockDevice "
|
||||
"class" % name)
|
||||
super(DriverBlockDevice, self).__getattr__(name)
|
||||
|
||||
def __setattr__(self, name, value):
|
||||
if name in self._proxy_as_attr:
|
||||
return setattr(self._bdm_obj, name, value)
|
||||
else:
|
||||
raise AttributeError("Cannot access %s on DriverBlockDevice "
|
||||
"class" % name)
|
||||
super(DriverBlockDevice, self).__setattr__(name, value)
|
||||
|
||||
def _transform(self):
|
||||
"""Transform bdm to the format that is passed to drivers."""
|
||||
|
|
Loading…
Reference in New Issue