ProviderTree.new_child: parent is either uuid or name

Change the signature of ProviderTree.new_child to accept either uuid or
name for parent. This way virt drivers can easiy add new children in the
provider tree having only a nodename.

Change-Id: I30b9d5b97f014b38e6fe619e38aebab273525826
This commit is contained in:
Radoslav Gerganov
2018-01-26 17:17:45 +02:00
parent 91f7a99998
commit adda157c53
2 changed files with 11 additions and 5 deletions

View File

@@ -56,7 +56,9 @@ class TestProviderTree(test.NoDBTestCase):
self.assertEqual(set([cn1.uuid, cn2.uuid]), pt.get_provider_uuids())
numa_cell0_uuid = pt.new_child('numa_cell0', cn1.uuid)
numa_cell1_uuid = pt.new_child('numa_cell1', cn1.uuid)
numa_cell1_uuid = pt.new_child('numa_cell1', cn1.hypervisor_hostname)
self.assertEqual(cn1.uuid, pt.data(numa_cell1_uuid).parent_uuid)
self.assertTrue(pt.exists(numa_cell0_uuid))
self.assertTrue(pt.exists('numa_cell0'))