Make service-list output consistent
When libvirt automatic disable/enable services, the disabled reason will be 'None'. However, the column is Nullable and make it 'None' let the service-list output inconsistent. This patch changes the default value to NULL. Change-Id: I958accb500b4b417d755cff8df8ef7d615b710c0 Closes-Bug: #1401480
This commit is contained in:
parent
68e417f1b1
commit
66cad4ce4d
@ -7731,7 +7731,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
||||
conn.init_host("wibble")
|
||||
conn.get_num_instances()
|
||||
self.assertTrue(not service_mock.disabled and
|
||||
service_mock.disabled_reason is 'None')
|
||||
service_mock.disabled_reason is None)
|
||||
|
||||
def test_immediate_delete(self):
|
||||
def fake_lookup_by_name(instance_name):
|
||||
|
@ -840,7 +840,7 @@ class LibvirtConnTestCase(_VirtDriverTestCase, test.TestCase):
|
||||
return_value=service_mock):
|
||||
self.connection._set_host_enabled(True)
|
||||
self.assertFalse(service_mock.disabled)
|
||||
self.assertEqual(service_mock.disabled_reason, 'None')
|
||||
self.assertIsNone(service_mock.disabled_reason)
|
||||
|
||||
def test_set_host_enabled_when_manually_disabled(self):
|
||||
self.mox.UnsetStubs()
|
||||
|
@ -283,7 +283,7 @@ MAX_CONSOLE_BYTES = 100 * units.Ki
|
||||
# The libvirt driver will prefix any disable reason codes with this string.
|
||||
DISABLE_PREFIX = 'AUTO: '
|
||||
# Disable reason for the service which was enabled or disabled without reason
|
||||
DISABLE_REASON_UNDEFINED = 'None'
|
||||
DISABLE_REASON_UNDEFINED = None
|
||||
|
||||
# Guest config console string
|
||||
CONSOLE = "console=tty0 console=ttyS0"
|
||||
@ -509,8 +509,6 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||
def _handle_conn_event(self, enabled, reason):
|
||||
LOG.info(_LI("Connection event '%(enabled)d' reason '%(reason)s'"),
|
||||
{'enabled': enabled, 'reason': reason})
|
||||
if reason is None:
|
||||
reason = DISABLE_REASON_UNDEFINED
|
||||
self._set_host_enabled(enabled, reason)
|
||||
|
||||
def init_host(self, host):
|
||||
|
Loading…
Reference in New Issue
Block a user