From 59894b6fef462a378a290aef23386b74952527e7 Mon Sep 17 00:00:00 2001 From: Bogdan Popescu <68062990+bopopescu@users.noreply.github.com> Date: Fri, 24 Jul 2020 12:10:09 +0300 Subject: [PATCH] Changing the master-slave words --- doc/source/conf.py | 4 +- .../openstack/compute/contrib/extended_ips.py | 8 +- .../compute/contrib/extended_ips_mac.py | 8 +- .../contrib/extended_server_attributes.py | 8 +- .../compute/contrib/extended_status.py | 8 +- .../extended_virtual_interfaces_net.py | 4 +- .../compute/contrib/extended_volumes.py | 8 +- .../compute/contrib/flavor_access.py | 12 +- .../openstack/compute/contrib/image_size.py | 8 +- .../openstack/compute/contrib/server_usage.py | 8 +- .../plugins/v3/extended_server_attributes.py | 8 +- .../compute/plugins/v3/extended_status.py | 8 +- .../compute/plugins/v3/extended_volumes.py | 8 +- .../compute/plugins/v3/flavor_access.py | 12 +- .../compute/plugins/v3/server_usage.py | 8 +- .../openstack/compute/plugins/v3/servers.py | 16 +- nova/api/openstack/compute/servers.py | 16 +- nova/api/openstack/wsgi.py | 2 +- nova/api/openstack/xmlutil.py | 120 ++++++------ nova/compute/manager.py | 8 +- nova/compute/rpcapi.py | 10 +- nova/console/xvp.py | 2 +- nova/db/sqlalchemy/utils.py | 2 +- nova/network/ldapdns.py | 8 +- nova/network/linux_net.py | 2 +- .../openstack/common/db/sqlalchemy/session.py | 30 +-- nova/tests/api/openstack/test_xmlutil.py | 174 +++++++++--------- nova/tests/compute/test_compute.py | 12 +- nova/tests/compute/test_rpcapi.py | 4 +- nova/tests/virt/xenapi/test_xenapi.py | 84 ++++----- nova/virt/xenapi/driver.py | 12 +- nova/virt/xenapi/fake.py | 4 +- nova/virt/xenapi/pool.py | 86 ++++----- nova/virt/xenapi/pool_states.py | 2 +- tools/db/schema_diff.py | 6 +- 35 files changed, 360 insertions(+), 360 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 95126b67e..e45f59133 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -55,8 +55,8 @@ # The encoding of source files. #source_encoding = 'utf-8' -# The master toctree document. -master_doc = 'index' +# The main toctree document. +main_doc = 'index' # General information about the project. project = u'nova' diff --git a/nova/api/openstack/compute/contrib/extended_ips.py b/nova/api/openstack/compute/contrib/extended_ips.py index 20356c08d..19c80ee6f 100644 --- a/nova/api/openstack/compute/contrib/extended_ips.py +++ b/nova/api/openstack/compute/contrib/extended_ips.py @@ -47,7 +47,7 @@ def _extend_server(self, context, server, instance): def show(self, req, resp_obj, id): context = req.environ['nova.context'] if authorize(context): - # Attach our slave template to the response object + # Attach our subordinate template to the response object resp_obj.attach(xml=ExtendedIpsServerTemplate()) server = resp_obj.obj['server'] db_instance = req.get_db_instance(server['id']) @@ -59,7 +59,7 @@ def show(self, req, resp_obj, id): def detail(self, req, resp_obj): context = req.environ['nova.context'] if authorize(context): - # Attach our slave template to the response object + # Attach our subordinate template to the response object resp_obj.attach(xml=ExtendedIpsServersTemplate()) servers = list(resp_obj.obj['servers']) for server in servers: @@ -96,7 +96,7 @@ def construct(self): root = xmlutil.TemplateElement('server', selector='server') xmlutil.SubTemplateElement(root, 'server', selector='servers') make_server(root) - return xmlutil.SlaveTemplate(root, 1, nsmap={ + return xmlutil.SubordinateTemplate(root, 1, nsmap={ Extended_ips.alias: Extended_ips.namespace}) @@ -105,5 +105,5 @@ def construct(self): root = xmlutil.TemplateElement('servers') elem = xmlutil.SubTemplateElement(root, 'server', selector='servers') make_server(elem) - return xmlutil.SlaveTemplate(root, 1, nsmap={ + return xmlutil.SubordinateTemplate(root, 1, nsmap={ Extended_ips.alias: Extended_ips.namespace}) diff --git a/nova/api/openstack/compute/contrib/extended_ips_mac.py b/nova/api/openstack/compute/contrib/extended_ips_mac.py index a577513fd..a1395fa8e 100644 --- a/nova/api/openstack/compute/contrib/extended_ips_mac.py +++ b/nova/api/openstack/compute/contrib/extended_ips_mac.py @@ -49,7 +49,7 @@ def _extend_server(self, context, server, instance): def show(self, req, resp_obj, id): context = req.environ['nova.context'] if authorize(context): - # Attach our slave template to the response object + # Attach our subordinate template to the response object resp_obj.attach(xml=ExtendedIpsMacServerTemplate()) server = resp_obj.obj['server'] db_instance = req.get_db_instance(server['id']) @@ -61,7 +61,7 @@ def show(self, req, resp_obj, id): def detail(self, req, resp_obj): context = req.environ['nova.context'] if authorize(context): - # Attach our slave template to the response object + # Attach our subordinate template to the response object resp_obj.attach(xml=ExtendedIpsMacServersTemplate()) servers = list(resp_obj.obj['servers']) for server in servers: @@ -97,7 +97,7 @@ class ExtendedIpsMacServerTemplate(xmlutil.TemplateBuilder): def construct(self): root = xmlutil.TemplateElement('server', selector='server') make_server(root) - return xmlutil.SlaveTemplate(root, 1, nsmap={ + return xmlutil.SubordinateTemplate(root, 1, nsmap={ Extended_ips_mac.alias: Extended_ips_mac.namespace}) @@ -106,5 +106,5 @@ def construct(self): root = xmlutil.TemplateElement('servers') elem = xmlutil.SubTemplateElement(root, 'server', selector='servers') make_server(elem) - return xmlutil.SlaveTemplate(root, 1, nsmap={ + return xmlutil.SubordinateTemplate(root, 1, nsmap={ Extended_ips_mac.alias: Extended_ips_mac.namespace}) diff --git a/nova/api/openstack/compute/contrib/extended_server_attributes.py b/nova/api/openstack/compute/contrib/extended_server_attributes.py index a8b441f80..87c823261 100644 --- a/nova/api/openstack/compute/contrib/extended_server_attributes.py +++ b/nova/api/openstack/compute/contrib/extended_server_attributes.py @@ -39,7 +39,7 @@ def _extend_server(self, context, server, instance): def show(self, req, resp_obj, id): context = req.environ['nova.context'] if authorize(context): - # Attach our slave template to the response object + # Attach our subordinate template to the response object resp_obj.attach(xml=ExtendedServerAttributeTemplate()) server = resp_obj.obj['server'] db_instance = req.get_db_instance(server['id']) @@ -51,7 +51,7 @@ def show(self, req, resp_obj, id): def detail(self, req, resp_obj): context = req.environ['nova.context'] if authorize(context): - # Attach our slave template to the response object + # Attach our subordinate template to the response object resp_obj.attach(xml=ExtendedServerAttributesTemplate()) servers = list(resp_obj.obj['servers']) @@ -92,7 +92,7 @@ def construct(self): make_server(root) alias = Extended_server_attributes.alias namespace = Extended_server_attributes.namespace - return xmlutil.SlaveTemplate(root, 1, nsmap={alias: namespace}) + return xmlutil.SubordinateTemplate(root, 1, nsmap={alias: namespace}) class ExtendedServerAttributesTemplate(xmlutil.TemplateBuilder): @@ -102,4 +102,4 @@ def construct(self): make_server(elem) alias = Extended_server_attributes.alias namespace = Extended_server_attributes.namespace - return xmlutil.SlaveTemplate(root, 1, nsmap={alias: namespace}) + return xmlutil.SubordinateTemplate(root, 1, nsmap={alias: namespace}) diff --git a/nova/api/openstack/compute/contrib/extended_status.py b/nova/api/openstack/compute/contrib/extended_status.py index 75086309a..65a3b61f4 100644 --- a/nova/api/openstack/compute/contrib/extended_status.py +++ b/nova/api/openstack/compute/contrib/extended_status.py @@ -36,7 +36,7 @@ def _extend_server(self, server, instance): def show(self, req, resp_obj, id): context = req.environ['nova.context'] if authorize(context): - # Attach our slave template to the response object + # Attach our subordinate template to the response object resp_obj.attach(xml=ExtendedStatusTemplate()) server = resp_obj.obj['server'] db_instance = req.get_db_instance(server['id']) @@ -48,7 +48,7 @@ def show(self, req, resp_obj, id): def detail(self, req, resp_obj): context = req.environ['nova.context'] if authorize(context): - # Attach our slave template to the response object + # Attach our subordinate template to the response object resp_obj.attach(xml=ExtendedStatusesTemplate()) servers = list(resp_obj.obj['servers']) for server in servers: @@ -86,7 +86,7 @@ class ExtendedStatusTemplate(xmlutil.TemplateBuilder): def construct(self): root = xmlutil.TemplateElement('server', selector='server') make_server(root) - return xmlutil.SlaveTemplate(root, 1, nsmap={ + return xmlutil.SubordinateTemplate(root, 1, nsmap={ Extended_status.alias: Extended_status.namespace}) @@ -95,5 +95,5 @@ def construct(self): root = xmlutil.TemplateElement('servers') elem = xmlutil.SubTemplateElement(root, 'server', selector='servers') make_server(elem) - return xmlutil.SlaveTemplate(root, 1, nsmap={ + return xmlutil.SubordinateTemplate(root, 1, nsmap={ Extended_status.alias: Extended_status.namespace}) diff --git a/nova/api/openstack/compute/contrib/extended_virtual_interfaces_net.py b/nova/api/openstack/compute/contrib/extended_virtual_interfaces_net.py index 8779d6879..2637d9334 100644 --- a/nova/api/openstack/compute/contrib/extended_virtual_interfaces_net.py +++ b/nova/api/openstack/compute/contrib/extended_virtual_interfaces_net.py @@ -35,7 +35,7 @@ def construct(self): elem = xmlutil.SubTemplateElement(root, 'virtual_interface', selector='virtual_interfaces') make_vif(elem) - return xmlutil.SlaveTemplate(root, 1, + return xmlutil.SubordinateTemplate(root, 1, nsmap={Extended_virtual_interfaces_net.alias: Extended_virtual_interfaces_net.namespace}) @@ -50,7 +50,7 @@ def index(self, req, resp_obj, server_id): key = "%s:net_id" % Extended_virtual_interfaces_net.alias context = req.environ['nova.context'] if authorize(context): - # Attach our slave template to the response object + # Attach our subordinate template to the response object resp_obj.attach(xml=ExtendedVirtualInterfaceNetTemplate()) for vif in resp_obj.obj['virtual_interfaces']: vif1 = self.network_api.get_vif_by_mac_address(context, diff --git a/nova/api/openstack/compute/contrib/extended_volumes.py b/nova/api/openstack/compute/contrib/extended_volumes.py index 22963c49e..2308c8dff 100644 --- a/nova/api/openstack/compute/contrib/extended_volumes.py +++ b/nova/api/openstack/compute/contrib/extended_volumes.py @@ -39,7 +39,7 @@ def _extend_server(self, context, server, instance): def show(self, req, resp_obj, id): context = req.environ['nova.context'] if authorize(context): - # Attach our slave template to the response object + # Attach our subordinate template to the response object resp_obj.attach(xml=ExtendedVolumesServerTemplate()) server = resp_obj.obj['server'] db_instance = req.get_db_instance(server['id']) @@ -51,7 +51,7 @@ def show(self, req, resp_obj, id): def detail(self, req, resp_obj): context = req.environ['nova.context'] if authorize(context): - # Attach our slave template to the response object + # Attach our subordinate template to the response object resp_obj.attach(xml=ExtendedVolumesServersTemplate()) servers = list(resp_obj.obj['servers']) for server in servers: @@ -90,7 +90,7 @@ class ExtendedVolumesServerTemplate(xmlutil.TemplateBuilder): def construct(self): root = xmlutil.TemplateElement('server', selector='server') make_server(root) - return xmlutil.SlaveTemplate(root, 1, nsmap={ + return xmlutil.SubordinateTemplate(root, 1, nsmap={ Extended_volumes.alias: Extended_volumes.namespace}) @@ -99,5 +99,5 @@ def construct(self): root = xmlutil.TemplateElement('servers') elem = xmlutil.SubTemplateElement(root, 'server', selector='servers') make_server(elem) - return xmlutil.SlaveTemplate(root, 1, nsmap={ + return xmlutil.SubordinateTemplate(root, 1, nsmap={ Extended_volumes.alias: Extended_volumes.namespace}) diff --git a/nova/api/openstack/compute/contrib/flavor_access.py b/nova/api/openstack/compute/contrib/flavor_access.py index 95444e94e..16656e108 100644 --- a/nova/api/openstack/compute/contrib/flavor_access.py +++ b/nova/api/openstack/compute/contrib/flavor_access.py @@ -46,7 +46,7 @@ def construct(self): make_flavor(root) alias = Flavor_access.alias namespace = Flavor_access.namespace - return xmlutil.SlaveTemplate(root, 1, nsmap={alias: namespace}) + return xmlutil.SubordinateTemplate(root, 1, nsmap={alias: namespace}) class FlavorsTemplate(xmlutil.TemplateBuilder): @@ -56,7 +56,7 @@ def construct(self): make_flavor(elem) alias = Flavor_access.alias namespace = Flavor_access.namespace - return xmlutil.SlaveTemplate(root, 1, nsmap={alias: namespace}) + return xmlutil.SubordinateTemplate(root, 1, nsmap={alias: namespace}) class FlavorAccessTemplate(xmlutil.TemplateBuilder): @@ -65,7 +65,7 @@ def construct(self): elem = xmlutil.SubTemplateElement(root, 'access', selector='flavor_access') make_flavor_access(elem) - return xmlutil.MasterTemplate(root, 1) + return xmlutil.MainTemplate(root, 1) def _marshall_flavor_access(flavor_id): @@ -134,7 +134,7 @@ def _extend_flavor(self, flavor_rval, flavor_ref): def show(self, req, resp_obj, id): context = req.environ['nova.context'] if authorize(context): - # Attach our slave template to the response object + # Attach our subordinate template to the response object resp_obj.attach(xml=FlavorTemplate()) db_flavor = req.get_db_flavor(id) @@ -144,7 +144,7 @@ def show(self, req, resp_obj, id): def detail(self, req, resp_obj): context = req.environ['nova.context'] if authorize(context): - # Attach our slave template to the response object + # Attach our subordinate template to the response object resp_obj.attach(xml=FlavorsTemplate()) flavors = list(resp_obj.obj['flavors']) @@ -156,7 +156,7 @@ def detail(self, req, resp_obj): def create(self, req, body, resp_obj): context = req.environ['nova.context'] if authorize(context): - # Attach our slave template to the response object + # Attach our subordinate template to the response object resp_obj.attach(xml=FlavorTemplate()) db_flavor = req.get_db_flavor(resp_obj.obj['flavor']['id']) diff --git a/nova/api/openstack/compute/contrib/image_size.py b/nova/api/openstack/compute/contrib/image_size.py index 21998738f..f4cd98cdf 100644 --- a/nova/api/openstack/compute/contrib/image_size.py +++ b/nova/api/openstack/compute/contrib/image_size.py @@ -29,7 +29,7 @@ def construct(self): root = xmlutil.TemplateElement('images') elem = xmlutil.SubTemplateElement(root, 'image', selector='images') make_image(elem) - return xmlutil.SlaveTemplate(root, 1, nsmap={ + return xmlutil.SubordinateTemplate(root, 1, nsmap={ Image_size.alias: Image_size.namespace}) @@ -37,7 +37,7 @@ class ImageSizeTemplate(xmlutil.TemplateBuilder): def construct(self): root = xmlutil.TemplateElement('image', selector='image') make_image(root) - return xmlutil.SlaveTemplate(root, 1, nsmap={ + return xmlutil.SubordinateTemplate(root, 1, nsmap={ Image_size.alias: Image_size.namespace}) @@ -51,7 +51,7 @@ def _extend_image(self, image, image_cache): def show(self, req, resp_obj, id): context = req.environ["nova.context"] if authorize(context): - # Attach our slave template to the response object + # Attach our subordinate template to the response object resp_obj.attach(xml=ImageSizeTemplate()) image_resp = resp_obj.obj['image'] # image guaranteed to be in the cache due to the core API adding @@ -63,7 +63,7 @@ def show(self, req, resp_obj, id): def detail(self, req, resp_obj): context = req.environ['nova.context'] if authorize(context): - # Attach our slave template to the response object + # Attach our subordinate template to the response object resp_obj.attach(xml=ImagesSizeTemplate()) images_resp = list(resp_obj.obj['images']) # images guaranteed to be in the cache due to the core API adding diff --git a/nova/api/openstack/compute/contrib/server_usage.py b/nova/api/openstack/compute/contrib/server_usage.py index 88ad4ca42..6b9059e23 100644 --- a/nova/api/openstack/compute/contrib/server_usage.py +++ b/nova/api/openstack/compute/contrib/server_usage.py @@ -41,7 +41,7 @@ def _extend_server(self, server, instance): def show(self, req, resp_obj, id): context = req.environ['nova.context'] if authorize(context): - # Attach our slave template to the response object + # Attach our subordinate template to the response object resp_obj.attach(xml=ServerUsageTemplate()) server = resp_obj.obj['server'] db_instance = req.get_db_instance(server['id']) @@ -53,7 +53,7 @@ def show(self, req, resp_obj, id): def detail(self, req, resp_obj): context = req.environ['nova.context'] if authorize(context): - # Attach our slave template to the response object + # Attach our subordinate template to the response object resp_obj.attach(xml=ServerUsagesTemplate()) servers = list(resp_obj.obj['servers']) for server in servers: @@ -89,7 +89,7 @@ class ServerUsageTemplate(xmlutil.TemplateBuilder): def construct(self): root = xmlutil.TemplateElement('server', selector='server') make_server(root) - return xmlutil.SlaveTemplate(root, 1, nsmap={ + return xmlutil.SubordinateTemplate(root, 1, nsmap={ Server_usage.alias: Server_usage.namespace}) @@ -98,5 +98,5 @@ def construct(self): root = xmlutil.TemplateElement('servers') elem = xmlutil.SubTemplateElement(root, 'server', selector='servers') make_server(elem) - return xmlutil.SlaveTemplate(root, 1, nsmap={ + return xmlutil.SubordinateTemplate(root, 1, nsmap={ Server_usage.alias: Server_usage.namespace}) diff --git a/nova/api/openstack/compute/plugins/v3/extended_server_attributes.py b/nova/api/openstack/compute/plugins/v3/extended_server_attributes.py index cd26d0a08..8beea995b 100644 --- a/nova/api/openstack/compute/plugins/v3/extended_server_attributes.py +++ b/nova/api/openstack/compute/plugins/v3/extended_server_attributes.py @@ -39,7 +39,7 @@ def _extend_server(self, context, server, instance): def show(self, req, resp_obj, id): context = req.environ['nova.context'] if authorize(context): - # Attach our slave template to the response object + # Attach our subordinate template to the response object resp_obj.attach(xml=ExtendedServerAttributeTemplate()) server = resp_obj.obj['server'] db_instance = req.get_db_instance(server['id']) @@ -51,7 +51,7 @@ def show(self, req, resp_obj, id): def detail(self, req, resp_obj): context = req.environ['nova.context'] if authorize(context): - # Attach our slave template to the response object + # Attach our subordinate template to the response object resp_obj.attach(xml=ExtendedServerAttributesTemplate()) servers = list(resp_obj.obj['servers']) @@ -95,7 +95,7 @@ def construct(self): make_server(root) alias = ExtendedServerAttributes.alias namespace = ExtendedServerAttributes.namespace - return xmlutil.SlaveTemplate(root, 1, nsmap={alias: namespace}) + return xmlutil.SubordinateTemplate(root, 1, nsmap={alias: namespace}) class ExtendedServerAttributesTemplate(xmlutil.TemplateBuilder): @@ -105,4 +105,4 @@ def construct(self): make_server(elem) alias = ExtendedServerAttributes.alias namespace = ExtendedServerAttributes.namespace - return xmlutil.SlaveTemplate(root, 1, nsmap={alias: namespace}) + return xmlutil.SubordinateTemplate(root, 1, nsmap={alias: namespace}) diff --git a/nova/api/openstack/compute/plugins/v3/extended_status.py b/nova/api/openstack/compute/plugins/v3/extended_status.py index 854767a2c..a46f47bbd 100644 --- a/nova/api/openstack/compute/plugins/v3/extended_status.py +++ b/nova/api/openstack/compute/plugins/v3/extended_status.py @@ -37,7 +37,7 @@ def _extend_server(self, server, instance): def show(self, req, resp_obj, id): context = req.environ['nova.context'] if authorize(context): - # Attach our slave template to the response object + # Attach our subordinate template to the response object resp_obj.attach(xml=ExtendedStatusTemplate()) server = resp_obj.obj['server'] db_instance = req.get_db_instance(server['id']) @@ -49,7 +49,7 @@ def show(self, req, resp_obj, id): def detail(self, req, resp_obj): context = req.environ['nova.context'] if authorize(context): - # Attach our slave template to the response object + # Attach our subordinate template to the response object resp_obj.attach(xml=ExtendedStatusesTemplate()) servers = list(resp_obj.obj['servers']) for server in servers: @@ -92,7 +92,7 @@ class ExtendedStatusTemplate(xmlutil.TemplateBuilder): def construct(self): root = xmlutil.TemplateElement('server', selector='server') make_server(root) - return xmlutil.SlaveTemplate(root, 1, nsmap={ + return xmlutil.SubordinateTemplate(root, 1, nsmap={ ExtendedStatus.alias: ExtendedStatus.namespace}) @@ -101,5 +101,5 @@ def construct(self): root = xmlutil.TemplateElement('servers') elem = xmlutil.SubTemplateElement(root, 'server', selector='servers') make_server(elem) - return xmlutil.SlaveTemplate(root, 1, nsmap={ + return xmlutil.SubordinateTemplate(root, 1, nsmap={ ExtendedStatus.alias: ExtendedStatus.namespace}) diff --git a/nova/api/openstack/compute/plugins/v3/extended_volumes.py b/nova/api/openstack/compute/plugins/v3/extended_volumes.py index 5e183f1e8..0908f385b 100644 --- a/nova/api/openstack/compute/plugins/v3/extended_volumes.py +++ b/nova/api/openstack/compute/plugins/v3/extended_volumes.py @@ -53,7 +53,7 @@ def _extend_server(self, context, server, instance): def show(self, req, resp_obj, id): context = req.environ['nova.context'] if authorize(context): - # Attach our slave template to the response object + # Attach our subordinate template to the response object resp_obj.attach(xml=ExtendedVolumesServerTemplate()) server = resp_obj.obj['server'] db_instance = req.get_db_instance(server['id']) @@ -65,7 +65,7 @@ def show(self, req, resp_obj, id): def detail(self, req, resp_obj): context = req.environ['nova.context'] if authorize(context): - # Attach our slave template to the response object + # Attach our subordinate template to the response object resp_obj.attach(xml=ExtendedVolumesServersTemplate()) servers = list(resp_obj.obj['servers']) for server in servers: @@ -212,7 +212,7 @@ class ExtendedVolumesServerTemplate(xmlutil.TemplateBuilder): def construct(self): root = xmlutil.TemplateElement('server', selector='server') make_server(root) - return xmlutil.SlaveTemplate(root, 1, nsmap={ + return xmlutil.SubordinateTemplate(root, 1, nsmap={ ExtendedVolumes.alias: ExtendedVolumes.namespace}) @@ -221,5 +221,5 @@ def construct(self): root = xmlutil.TemplateElement('servers') elem = xmlutil.SubTemplateElement(root, 'server', selector='servers') make_server(elem) - return xmlutil.SlaveTemplate(root, 1, nsmap={ + return xmlutil.SubordinateTemplate(root, 1, nsmap={ ExtendedVolumes.alias: ExtendedVolumes.namespace}) diff --git a/nova/api/openstack/compute/plugins/v3/flavor_access.py b/nova/api/openstack/compute/plugins/v3/flavor_access.py index 4baa8bf37..5ac9b5fd8 100644 --- a/nova/api/openstack/compute/plugins/v3/flavor_access.py +++ b/nova/api/openstack/compute/plugins/v3/flavor_access.py @@ -46,7 +46,7 @@ def construct(self): make_flavor(root) alias = FlavorAccess.alias namespace = FlavorAccess.namespace - return xmlutil.SlaveTemplate(root, 1, nsmap={alias: namespace}) + return xmlutil.SubordinateTemplate(root, 1, nsmap={alias: namespace}) class FlavorsTemplate(xmlutil.TemplateBuilder): @@ -56,7 +56,7 @@ def construct(self): make_flavor(elem) alias = FlavorAccess.alias namespace = FlavorAccess.namespace - return xmlutil.SlaveTemplate(root, 1, nsmap={alias: namespace}) + return xmlutil.SubordinateTemplate(root, 1, nsmap={alias: namespace}) class FlavorAccessTemplate(xmlutil.TemplateBuilder): @@ -65,7 +65,7 @@ def construct(self): elem = xmlutil.SubTemplateElement(root, 'access', selector='flavor_access') make_flavor_access(elem) - return xmlutil.MasterTemplate(root, 1) + return xmlutil.MainTemplate(root, 1) def _marshall_flavor_access(flavor_id): @@ -127,7 +127,7 @@ def _extend_flavor(self, flavor_rval, flavor_ref): def show(self, req, resp_obj, id): context = req.environ['nova.context'] if authorize(context): - # Attach our slave template to the response object + # Attach our subordinate template to the response object resp_obj.attach(xml=FlavorTemplate()) db_flavor = req.get_db_flavor(id) @@ -137,7 +137,7 @@ def show(self, req, resp_obj, id): def detail(self, req, resp_obj): context = req.environ['nova.context'] if authorize(context): - # Attach our slave template to the response object + # Attach our subordinate template to the response object resp_obj.attach(xml=FlavorsTemplate()) flavors = list(resp_obj.obj['flavors']) @@ -149,7 +149,7 @@ def detail(self, req, resp_obj): def create(self, req, body, resp_obj): context = req.environ['nova.context'] if authorize(context): - # Attach our slave template to the response object + # Attach our subordinate template to the response object resp_obj.attach(xml=FlavorTemplate()) db_flavor = req.get_db_flavor(resp_obj.obj['flavor']['id']) diff --git a/nova/api/openstack/compute/plugins/v3/server_usage.py b/nova/api/openstack/compute/plugins/v3/server_usage.py index 38586c5c2..d3a3e8c10 100644 --- a/nova/api/openstack/compute/plugins/v3/server_usage.py +++ b/nova/api/openstack/compute/plugins/v3/server_usage.py @@ -43,7 +43,7 @@ def _extend_server(self, server, instance): def show(self, req, resp_obj, id): context = req.environ['nova.context'] if authorize(context): - # Attach our slave template to the response object + # Attach our subordinate template to the response object resp_obj.attach(xml=ServerUsageTemplate()) server = resp_obj.obj['server'] db_instance = req.get_db_instance(server['id']) @@ -55,7 +55,7 @@ def show(self, req, resp_obj, id): def detail(self, req, resp_obj): context = req.environ['nova.context'] if authorize(context): - # Attach our slave template to the response object + # Attach our subordinate template to the response object resp_obj.attach(xml=ServerUsagesTemplate()) servers = list(resp_obj.obj['servers']) for server in servers: @@ -94,7 +94,7 @@ class ServerUsageTemplate(xmlutil.TemplateBuilder): def construct(self): root = xmlutil.TemplateElement('server', selector='server') make_server(root) - return xmlutil.SlaveTemplate(root, 1, nsmap={ + return xmlutil.SubordinateTemplate(root, 1, nsmap={ ServerUsage.alias: ServerUsage.namespace}) @@ -103,5 +103,5 @@ def construct(self): root = xmlutil.TemplateElement('servers') elem = xmlutil.SubTemplateElement(root, 'server', selector='servers') make_server(elem) - return xmlutil.SlaveTemplate(root, 1, nsmap={ + return xmlutil.SubordinateTemplate(root, 1, nsmap={ ServerUsage.alias: ServerUsage.namespace}) diff --git a/nova/api/openstack/compute/plugins/v3/servers.py b/nova/api/openstack/compute/plugins/v3/servers.py index c8d1e933e..b4c367978 100644 --- a/nova/api/openstack/compute/plugins/v3/servers.py +++ b/nova/api/openstack/compute/plugins/v3/servers.py @@ -109,7 +109,7 @@ class ServerTemplate(xmlutil.TemplateBuilder): def construct(self): root = xmlutil.TemplateElement('server', selector='server') make_server(root, detailed=True) - return xmlutil.MasterTemplate(root, 1, nsmap=server_nsmap) + return xmlutil.MainTemplate(root, 1, nsmap=server_nsmap) class MinimalServersTemplate(xmlutil.TemplateBuilder): @@ -118,7 +118,7 @@ def construct(self): elem = xmlutil.SubTemplateElement(root, 'server', selector='servers') make_server(elem) xmlutil.make_links(root, 'servers_links') - return xmlutil.MasterTemplate(root, 1, nsmap=server_nsmap) + return xmlutil.MainTemplate(root, 1, nsmap=server_nsmap) class ServersTemplate(xmlutil.TemplateBuilder): @@ -126,27 +126,27 @@ def construct(self): root = xmlutil.TemplateElement('servers') elem = xmlutil.SubTemplateElement(root, 'server', selector='servers') make_server(elem, detailed=True) - return xmlutil.MasterTemplate(root, 1, nsmap=server_nsmap) + return xmlutil.MainTemplate(root, 1, nsmap=server_nsmap) class ServerAdminPassTemplate(xmlutil.TemplateBuilder): def construct(self): root = xmlutil.TemplateElement('server') root.set('admin_pass') - return xmlutil.SlaveTemplate(root, 1, nsmap=server_nsmap) + return xmlutil.SubordinateTemplate(root, 1, nsmap=server_nsmap) class ServerMultipleCreateTemplate(xmlutil.TemplateBuilder): def construct(self): root = xmlutil.TemplateElement('server') root.set('reservation_id') - return xmlutil.MasterTemplate(root, 1, nsmap=server_nsmap) + return xmlutil.MainTemplate(root, 1, nsmap=server_nsmap) def FullServerTemplate(): - master = ServerTemplate() - master.attach(ServerAdminPassTemplate()) - return master + main = ServerTemplate() + main.attach(ServerAdminPassTemplate()) + return main class CommonDeserializer(wsgi.MetadataXMLDeserializer): diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py index f4f1bdf0b..41e6288c9 100644 --- a/nova/api/openstack/compute/servers.py +++ b/nova/api/openstack/compute/servers.py @@ -110,7 +110,7 @@ class ServerTemplate(xmlutil.TemplateBuilder): def construct(self): root = xmlutil.TemplateElement('server', selector='server') make_server(root, detailed=True) - return xmlutil.MasterTemplate(root, 1, nsmap=server_nsmap) + return xmlutil.MainTemplate(root, 1, nsmap=server_nsmap) class MinimalServersTemplate(xmlutil.TemplateBuilder): @@ -119,7 +119,7 @@ def construct(self): elem = xmlutil.SubTemplateElement(root, 'server', selector='servers') make_server(elem) xmlutil.make_links(root, 'servers_links') - return xmlutil.MasterTemplate(root, 1, nsmap=server_nsmap) + return xmlutil.MainTemplate(root, 1, nsmap=server_nsmap) class ServersTemplate(xmlutil.TemplateBuilder): @@ -127,27 +127,27 @@ def construct(self): root = xmlutil.TemplateElement('servers') elem = xmlutil.SubTemplateElement(root, 'server', selector='servers') make_server(elem, detailed=True) - return xmlutil.MasterTemplate(root, 1, nsmap=server_nsmap) + return xmlutil.MainTemplate(root, 1, nsmap=server_nsmap) class ServerAdminPassTemplate(xmlutil.TemplateBuilder): def construct(self): root = xmlutil.TemplateElement('server') root.set('adminPass') - return xmlutil.SlaveTemplate(root, 1, nsmap=server_nsmap) + return xmlutil.SubordinateTemplate(root, 1, nsmap=server_nsmap) class ServerMultipleCreateTemplate(xmlutil.TemplateBuilder): def construct(self): root = xmlutil.TemplateElement('server') root.set('reservation_id') - return xmlutil.MasterTemplate(root, 1, nsmap=server_nsmap) + return xmlutil.MainTemplate(root, 1, nsmap=server_nsmap) def FullServerTemplate(): - master = ServerTemplate() - master.attach(ServerAdminPassTemplate()) - return master + main = ServerTemplate() + main.attach(ServerAdminPassTemplate()) + return main class CommonDeserializer(wsgi.MetadataXMLDeserializer): diff --git a/nova/api/openstack/wsgi.py b/nova/api/openstack/wsgi.py index 13f6af445..bf694bc6d 100644 --- a/nova/api/openstack/wsgi.py +++ b/nova/api/openstack/wsgi.py @@ -576,7 +576,7 @@ def preserialize(self, content_type, default_serializers=None): self.serializer = serializer() def attach(self, **kwargs): - """Attach slave templates to serializers.""" + """Attach subordinate templates to serializers.""" if self.media_type in kwargs: self.serializer.attach(kwargs[self.media_type]) diff --git a/nova/api/openstack/xmlutil.py b/nova/api/openstack/xmlutil.py index b8d1779af..6f113c385 100644 --- a/nova/api/openstack/xmlutil.py +++ b/nova/api/openstack/xmlutil.py @@ -647,13 +647,13 @@ def wrap(self): # We are a template return self - def apply(self, master): - """Hook method for determining slave applicability. + def apply(self, main): + """Hook method for determining subordinate applicability. An overridable hook method used to determine if this template - is applicable as a slave to a given master template. + is applicable as a subordinate to a given main template. - :param master: The master template to test. + :param main: The main template to test. """ return True @@ -668,17 +668,17 @@ def tree(self): return "%r: %s" % (self, self.root.tree()) -class MasterTemplate(Template): - """Represent a master template. +class MainTemplate(Template): + """Represent a main template. - Master templates are versioned derivatives of templates that - additionally allow slave templates to be attached. Slave + Main templates are versioned derivatives of templates that + additionally allow subordinate templates to be attached. Subordinate templates allow modification of the serialized result without - directly changing the master. + directly changing the main. """ def __init__(self, root, version, nsmap=None): - """Initialize a master template. + """Initialize a main template. :param root: The root element of the template. :param version: The version number of the template. @@ -687,9 +687,9 @@ def __init__(self, root, version, nsmap=None): template. """ - super(MasterTemplate, self).__init__(root, nsmap) + super(MainTemplate, self).__init__(root, nsmap) self.version = version - self.slaves = [] + self.subordinates = [] def __repr__(self): """Return string representation of the template.""" @@ -703,88 +703,88 @@ def _siblings(self): An overridable hook method to return the siblings of the root element. This is the root element plus the root elements of - all the slave templates. + all the subordinate templates. """ - return [self.root] + [slave.root for slave in self.slaves] + return [self.root] + [subordinate.root for subordinate in self.subordinates] def _nsmap(self): """Hook method for computing the namespace dictionary. An overridable hook method to return the namespace dictionary. - The namespace dictionary is computed by taking the master + The namespace dictionary is computed by taking the main template's namespace dictionary and updating it from all the - slave templates. + subordinate templates. """ nsmap = self.nsmap.copy() - for slave in self.slaves: - nsmap.update(slave._nsmap()) + for subordinate in self.subordinates: + nsmap.update(subordinate._nsmap()) return nsmap - def attach(self, *slaves): - """Attach one or more slave templates. + def attach(self, *subordinates): + """Attach one or more subordinate templates. - Attaches one or more slave templates to the master template. - Slave templates must have a root element with the same tag as - the master template. The slave template's apply() method will - be called to determine if the slave should be applied to this - master; if it returns False, that slave will be skipped. - (This allows filtering of slaves based on the version of the - master template.) + Attaches one or more subordinate templates to the main template. + Subordinate templates must have a root element with the same tag as + the main template. The subordinate template's apply() method will + be called to determine if the subordinate should be applied to this + main; if it returns False, that subordinate will be skipped. + (This allows filtering of subordinates based on the version of the + main template.) """ - slave_list = [] - for slave in slaves: - slave = slave.wrap() + subordinate_list = [] + for subordinate in subordinates: + subordinate = subordinate.wrap() # Make sure we have a tree match - if slave.root.tag != self.root.tag: - msg = _("Template tree mismatch; adding slave %(slavetag)s to " - "master %(mastertag)s") % {'slavetag': slave.root.tag, - 'mastertag': self.root.tag} + if subordinate.root.tag != self.root.tag: + msg = _("Template tree mismatch; adding subordinate %(subordinatetag)s to " + "main %(maintag)s") % {'subordinatetag': subordinate.root.tag, + 'maintag': self.root.tag} raise ValueError(msg) - # Make sure slave applies to this template - if not slave.apply(self): + # Make sure subordinate applies to this template + if not subordinate.apply(self): continue - slave_list.append(slave) + subordinate_list.append(subordinate) - # Add the slaves - self.slaves.extend(slave_list) + # Add the subordinates + self.subordinates.extend(subordinate_list) def copy(self): - """Return a copy of this master template.""" + """Return a copy of this main template.""" - # Return a copy of the MasterTemplate + # Return a copy of the MainTemplate tmp = self.__class__(self.root, self.version, self.nsmap) - tmp.slaves = self.slaves[:] + tmp.subordinates = self.subordinates[:] return tmp -class SlaveTemplate(Template): - """Represent a slave template. +class SubordinateTemplate(Template): + """Represent a subordinate template. - Slave templates are versioned derivatives of templates. Each - slave has a minimum version and optional maximum version of the - master template to which they can be attached. + Subordinate templates are versioned derivatives of templates. Each + subordinate has a minimum version and optional maximum version of the + main template to which they can be attached. """ def __init__(self, root, min_vers, max_vers=None, nsmap=None): - """Initialize a slave template. + """Initialize a subordinate template. :param root: The root element of the template. - :param min_vers: The minimum permissible version of the master - template for this slave template to apply. - :param max_vers: An optional upper bound for the master + :param min_vers: The minimum permissible version of the main + template for this subordinate template to apply. + :param max_vers: An optional upper bound for the main template version. :param nsmap: An optional namespace dictionary to be associated with the root element of the template. """ - super(SlaveTemplate, self).__init__(root, nsmap) + super(SubordinateTemplate, self).__init__(root, nsmap) self.min_vers = min_vers self.max_vers = max_vers @@ -795,23 +795,23 @@ def __repr__(self): (self.__class__.__module__, self.__class__.__name__, self.min_vers, self.max_vers, id(self))) - def apply(self, master): - """Hook method for determining slave applicability. + def apply(self, main): + """Hook method for determining subordinate applicability. An overridable hook method used to determine if this template - is applicable as a slave to a given master template. This - version requires the master template to have a version number + is applicable as a subordinate to a given main template. This + version requires the main template to have a version number between min_vers and max_vers. - :param master: The master template to test. + :param main: The main template to test. """ - # Does the master meet our minimum version requirement? - if master.version < self.min_vers: + # Does the main meet our minimum version requirement? + if main.version < self.min_vers: return False # How about our maximum version requirement? - if self.max_vers is not None and master.version > self.max_vers: + if self.max_vers is not None and main.version > self.max_vers: return False return True diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 8a907b2b4..9657ccb96 100755 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -4749,7 +4749,7 @@ def _error_out_instance_on_exception(self, context, instance_uuid, self._set_instance_error_state(context, instance_uuid) @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id()) - def add_aggregate_host(self, context, host, slave_info=None, + def add_aggregate_host(self, context, host, subordinate_info=None, aggregate=None, aggregate_id=None): """Notify hypervisor of change (for hypervisor pools).""" if not aggregate: @@ -4757,7 +4757,7 @@ def add_aggregate_host(self, context, host, slave_info=None, try: self.driver.add_to_aggregate(context, aggregate, host, - slave_info=slave_info) + subordinate_info=subordinate_info) except exception.AggregateError: with excutils.save_and_reraise_exception(): self.driver.undo_aggregate_operation( @@ -4766,7 +4766,7 @@ def add_aggregate_host(self, context, host, slave_info=None, aggregate, host) @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id()) - def remove_aggregate_host(self, context, host, slave_info=None, + def remove_aggregate_host(self, context, host, subordinate_info=None, aggregate=None, aggregate_id=None): """Removes a host from a physical hypervisor pool.""" if not aggregate: @@ -4774,7 +4774,7 @@ def remove_aggregate_host(self, context, host, slave_info=None, try: self.driver.remove_from_aggregate(context, aggregate, host, - slave_info=slave_info) + subordinate_info=subordinate_info) except (exception.AggregateError, exception.InvalidAggregateAction) as e: with excutils.save_and_reraise_exception(): diff --git a/nova/compute/rpcapi.py b/nova/compute/rpcapi.py index 8c03e199c..7a3fe8eac 100644 --- a/nova/compute/rpcapi.py +++ b/nova/compute/rpcapi.py @@ -142,7 +142,7 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy): 2.0 - Remove 1.x backwards compat 2.1 - Adds orig_sys_metadata to rebuild_instance() - 2.2 - Adds slave_info parameter to add_aggregate_host() and + 2.2 - Adds subordinate_info parameter to add_aggregate_host() and remove_aggregate_host() 2.3 - Adds volume_id to reserve_block_device_name() 2.4 - Add bdms to terminate_instance @@ -217,7 +217,7 @@ def __init__(self): version_cap=version_cap) def add_aggregate_host(self, ctxt, aggregate, host_param, host, - slave_info=None): + subordinate_info=None): '''Add aggregate host. :param ctxt: request context @@ -230,7 +230,7 @@ def add_aggregate_host(self, ctxt, aggregate, host_param, host, aggregate_p = jsonutils.to_primitive(aggregate) self.cast(ctxt, self.make_msg('add_aggregate_host', aggregate=aggregate_p, host=host_param, - slave_info=slave_info), + subordinate_info=subordinate_info), topic=_compute_topic(self.topic, ctxt, host, None), version='2.14') @@ -505,7 +505,7 @@ def refresh_provider_fw_rules(self, ctxt, host): _compute_topic(self.topic, ctxt, host, None)) def remove_aggregate_host(self, ctxt, aggregate, host_param, host, - slave_info=None): + subordinate_info=None): '''Remove aggregate host. :param ctxt: request context @@ -518,7 +518,7 @@ def remove_aggregate_host(self, ctxt, aggregate, host_param, host, aggregate_p = jsonutils.to_primitive(aggregate) self.cast(ctxt, self.make_msg('remove_aggregate_host', aggregate=aggregate_p, host=host_param, - slave_info=slave_info), + subordinate_info=subordinate_info), topic=_compute_topic(self.topic, ctxt, host, None), version='2.15') diff --git a/nova/console/xvp.py b/nova/console/xvp.py index 12e5c0156..4b77e8944 100644 --- a/nova/console/xvp.py +++ b/nova/console/xvp.py @@ -42,7 +42,7 @@ help='generated XVP conf file'), cfg.StrOpt('console_xvp_pid', default='/var/run/xvp.pid', - help='XVP master process pid file'), + help='XVP main process pid file'), cfg.StrOpt('console_xvp_log', default='/var/log/xvp.log', help='XVP log file'), diff --git a/nova/db/sqlalchemy/utils.py b/nova/db/sqlalchemy/utils.py index 4dda1d23c..2abb91ab3 100644 --- a/nova/db/sqlalchemy/utils.py +++ b/nova/db/sqlalchemy/utils.py @@ -98,7 +98,7 @@ def _get_unique_constraints_in_sqlite(migrate_engine, table_name): """ SELECT sql FROM - sqlite_master + sqlite_main WHERE type = 'table' AND name = :table_name; diff --git a/nova/network/ldapdns.py b/nova/network/ldapdns.py index 484918c4b..f0b9f4697 100644 --- a/nova/network/ldapdns.py +++ b/nova/network/ldapdns.py @@ -42,9 +42,9 @@ default='password', help='password for ldap DNS', secret=True), - cfg.StrOpt('ldap_dns_soa_hostmaster', - default='hostmaster@example.org', - help='Hostmaster for ldap dns driver Statement of Authority'), + cfg.StrOpt('ldap_dns_soa_hostmain', + default='hostmain@example.org', + help='Hostmain for ldap dns driver Statement of Authority'), cfg.MultiStrOpt('ldap_dns_servers', default=['dns.example.org'], help='DNS Servers for ldap dns driver'), @@ -156,7 +156,7 @@ def _soa(cls): date = time.strftime('%Y%m%d%H%M%S') soa = '%s %s %s %s %s %s %s' % ( CONF.ldap_dns_servers[0], - CONF.ldap_dns_soa_hostmaster, + CONF.ldap_dns_soa_hostmain, date, CONF.ldap_dns_soa_refresh, CONF.ldap_dns_soa_retry, diff --git a/nova/network/linux_net.py b/nova/network/linux_net.py index 99f94d70c..9ca5d7f6e 100644 --- a/nova/network/linux_net.py +++ b/nova/network/linux_net.py @@ -1535,7 +1535,7 @@ def ensure_bridge(_self, bridge, interface, net_attrs=None, gateway=True, run_as_root=True) if (err and err != "device %s is already a member of a bridge;" - "can't enslave it to bridge %s.\n" % (interface, bridge)): + "can't ensubordinate it to bridge %s.\n" % (interface, bridge)): msg = _('Failed to add interface: %s') % err raise exception.NovaException(msg) diff --git a/nova/openstack/common/db/sqlalchemy/session.py b/nova/openstack/common/db/sqlalchemy/session.py index be1a78a4c..2e96f16ea 100644 --- a/nova/openstack/common/db/sqlalchemy/session.py +++ b/nova/openstack/common/db/sqlalchemy/session.py @@ -281,10 +281,10 @@ def soft_delete_multi_models(): cfg.DeprecatedOpt('sql_connection', group='DATABASE')], secret=True), - cfg.StrOpt('slave_connection', + cfg.StrOpt('subordinate_connection', default='', help='The SQLAlchemy connection string used to connect to the ' - 'slave database', + 'subordinate database', secret=True), cfg.IntOpt('idle_timeout', default=3600, @@ -410,20 +410,20 @@ def connect(self, dbapi_con, con_record): def get_session(autocommit=True, expire_on_commit=False, - sqlite_fk=False, slave_session=False): + sqlite_fk=False, subordinate_session=False): """Return a SQLAlchemy session.""" global _MAKER global _SLAVE_MAKER maker = _MAKER - if slave_session: + if subordinate_session: maker = _SLAVE_MAKER if maker is None: - engine = get_engine(sqlite_fk=sqlite_fk, slave_engine=slave_session) + engine = get_engine(sqlite_fk=sqlite_fk, subordinate_engine=subordinate_session) maker = get_maker(engine, autocommit, expire_on_commit) - if slave_session: + if subordinate_session: _SLAVE_MAKER = maker else: _MAKER = maker @@ -545,21 +545,21 @@ def _wrap(*args, **kwargs): return _wrap -def get_engine(sqlite_fk=False, slave_engine=False): +def get_engine(sqlite_fk=False, subordinate_engine=False): """Return a SQLAlchemy engine.""" global _ENGINE global _SLAVE_ENGINE engine = _ENGINE db_uri = CONF.database.connection - if slave_engine: + if subordinate_engine: engine = _SLAVE_ENGINE - db_uri = CONF.database.slave_connection + db_uri = CONF.database.subordinate_connection if engine is None: engine = create_engine(db_uri, sqlite_fk=sqlite_fk) - if slave_engine: + if subordinate_engine: _SLAVE_ENGINE = engine else: _ENGINE = engine @@ -621,7 +621,7 @@ def _is_db_connection_error(args): def create_engine(sql_connection, sqlite_fk=False): """Return a new SQLAlchemy engine.""" # NOTE(geekinutah): At this point we could be connecting to the normal - # db handle or the slave db handle. Things like + # db handle or the subordinate db handle. Things like # _wrap_db_error aren't going to work well if their # backends don't match. Let's check. _assert_matching_drivers() @@ -773,12 +773,12 @@ def _do_query(self, q): def _assert_matching_drivers(): - """Make sure slave handle and normal handle have the same driver.""" + """Make sure subordinate handle and normal handle have the same driver.""" # NOTE(geekinutah): There's no use case for writing to one backend and # reading from another. Who knows what the future holds? - if CONF.database.slave_connection == '': + if CONF.database.subordinate_connection == '': return normal = sqlalchemy.engine.url.make_url(CONF.database.connection) - slave = sqlalchemy.engine.url.make_url(CONF.database.slave_connection) - assert normal.drivername == slave.drivername + subordinate = sqlalchemy.engine.url.make_url(CONF.database.subordinate_connection) + assert normal.drivername == subordinate.drivername diff --git a/nova/tests/api/openstack/test_xmlutil.py b/nova/tests/api/openstack/test_xmlutil.py index bb7e6c45c..c25fd586f 100644 --- a/nova/tests/api/openstack/test_xmlutil.py +++ b/nova/tests/api/openstack/test_xmlutil.py @@ -393,17 +393,17 @@ def test__render(self): attr2=xmlutil.ConstantSelector(2), attr3=xmlutil.ConstantSelector(3)) - # Create a master template element - master_elem = xmlutil.TemplateElement('test', attr1=attrs['attr1']) + # Create a main template element + main_elem = xmlutil.TemplateElement('test', attr1=attrs['attr1']) - # Create a couple of slave template element - slave_elems = [ + # Create a couple of subordinate template element + subordinate_elems = [ xmlutil.TemplateElement('test', attr2=attrs['attr2']), xmlutil.TemplateElement('test', attr3=attrs['attr3']), ] # Try the render - elem = master_elem._render(None, None, slave_elems, None) + elem = main_elem._render(None, None, subordinate_elems, None) # Verify the particulars of the render self.assertEqual(elem.tag, 'test') @@ -415,7 +415,7 @@ def test__render(self): parent = etree.Element('parent') # Try the render again... - elem = master_elem._render(parent, None, slave_elems, dict(a='foo')) + elem = main_elem._render(parent, None, subordinate_elems, dict(a='foo')) # Verify the particulars of the render self.assertEqual(len(parent), 1) @@ -552,47 +552,47 @@ def test__nsmap(self): self.assertEqual(len(nsmap), 1) self.assertEqual(nsmap['a'], 'foo') - def test_master_attach(self): - # Set up a master template + def test_main_attach(self): + # Set up a main template elem = xmlutil.TemplateElement('test') - tmpl = xmlutil.MasterTemplate(elem, 1) + tmpl = xmlutil.MainTemplate(elem, 1) - # Make sure it has a root but no slaves + # Make sure it has a root but no subordinates self.assertEqual(tmpl.root, elem) - self.assertEqual(len(tmpl.slaves), 0) + self.assertEqual(len(tmpl.subordinates), 0) self.assertTrue(repr(tmpl)) - # Try to attach an invalid slave + # Try to attach an invalid subordinate bad_elem = xmlutil.TemplateElement('test2') self.assertRaises(ValueError, tmpl.attach, bad_elem) - self.assertEqual(len(tmpl.slaves), 0) + self.assertEqual(len(tmpl.subordinates), 0) - # Try to attach an invalid and a valid slave + # Try to attach an invalid and a valid subordinate good_elem = xmlutil.TemplateElement('test') self.assertRaises(ValueError, tmpl.attach, good_elem, bad_elem) - self.assertEqual(len(tmpl.slaves), 0) + self.assertEqual(len(tmpl.subordinates), 0) # Try to attach an inapplicable template class InapplicableTemplate(xmlutil.Template): - def apply(self, master): + def apply(self, main): return False inapp_tmpl = InapplicableTemplate(good_elem) tmpl.attach(inapp_tmpl) - self.assertEqual(len(tmpl.slaves), 0) + self.assertEqual(len(tmpl.subordinates), 0) # Now try attaching an applicable template tmpl.attach(good_elem) - self.assertEqual(len(tmpl.slaves), 1) - self.assertEqual(tmpl.slaves[0].root, good_elem) + self.assertEqual(len(tmpl.subordinates), 1) + self.assertEqual(tmpl.subordinates[0].root, good_elem) - def test_master_copy(self): - # Construct a master template + def test_main_copy(self): + # Construct a main template elem = xmlutil.TemplateElement('test') - tmpl = xmlutil.MasterTemplate(elem, 1, nsmap=dict(a='foo')) + tmpl = xmlutil.MainTemplate(elem, 1, nsmap=dict(a='foo')) - # Give it a slave - slave = xmlutil.TemplateElement('test') - tmpl.attach(slave) + # Give it a subordinate + subordinate = xmlutil.TemplateElement('test') + tmpl.attach(subordinate) # Construct a copy copy = tmpl.copy() @@ -602,43 +602,43 @@ def test_master_copy(self): self.assertEqual(tmpl.root, copy.root) self.assertEqual(tmpl.version, copy.version) self.assertEqual(id(tmpl.nsmap), id(copy.nsmap)) - self.assertNotEqual(id(tmpl.slaves), id(copy.slaves)) - self.assertEqual(len(tmpl.slaves), len(copy.slaves)) - self.assertEqual(tmpl.slaves[0], copy.slaves[0]) + self.assertNotEqual(id(tmpl.subordinates), id(copy.subordinates)) + self.assertEqual(len(tmpl.subordinates), len(copy.subordinates)) + self.assertEqual(tmpl.subordinates[0], copy.subordinates[0]) - def test_slave_apply(self): - # Construct a master template + def test_subordinate_apply(self): + # Construct a main template elem = xmlutil.TemplateElement('test') - master = xmlutil.MasterTemplate(elem, 3) + main = xmlutil.MainTemplate(elem, 3) - # Construct a slave template with applicable minimum version - slave = xmlutil.SlaveTemplate(elem, 2) - self.assertEqual(slave.apply(master), True) - self.assertTrue(repr(slave)) + # Construct a subordinate template with applicable minimum version + subordinate = xmlutil.SubordinateTemplate(elem, 2) + self.assertEqual(subordinate.apply(main), True) + self.assertTrue(repr(subordinate)) - # Construct a slave template with equal minimum version - slave = xmlutil.SlaveTemplate(elem, 3) - self.assertEqual(slave.apply(master), True) + # Construct a subordinate template with equal minimum version + subordinate = xmlutil.SubordinateTemplate(elem, 3) + self.assertEqual(subordinate.apply(main), True) - # Construct a slave template with inapplicable minimum version - slave = xmlutil.SlaveTemplate(elem, 4) - self.assertEqual(slave.apply(master), False) + # Construct a subordinate template with inapplicable minimum version + subordinate = xmlutil.SubordinateTemplate(elem, 4) + self.assertEqual(subordinate.apply(main), False) - # Construct a slave template with applicable version range - slave = xmlutil.SlaveTemplate(elem, 2, 4) - self.assertEqual(slave.apply(master), True) + # Construct a subordinate template with applicable version range + subordinate = xmlutil.SubordinateTemplate(elem, 2, 4) + self.assertEqual(subordinate.apply(main), True) - # Construct a slave template with low version range - slave = xmlutil.SlaveTemplate(elem, 1, 2) - self.assertEqual(slave.apply(master), False) + # Construct a subordinate template with low version range + subordinate = xmlutil.SubordinateTemplate(elem, 1, 2) + self.assertEqual(subordinate.apply(main), False) - # Construct a slave template with high version range - slave = xmlutil.SlaveTemplate(elem, 4, 5) - self.assertEqual(slave.apply(master), False) + # Construct a subordinate template with high version range + subordinate = xmlutil.SubordinateTemplate(elem, 4, 5) + self.assertEqual(subordinate.apply(main), False) - # Construct a slave template with matching version range - slave = xmlutil.SlaveTemplate(elem, 3, 3) - self.assertEqual(slave.apply(master), True) + # Construct a subordinate template with matching version range + subordinate = xmlutil.SubordinateTemplate(elem, 3, 3) + self.assertEqual(subordinate.apply(main), True) def test__serialize(self): # Our test object to serialize @@ -659,7 +659,7 @@ def test__serialize(self): }, } - # Set up our master template + # Set up our main template root = xmlutil.TemplateElement('test', selector='test', name='name') value = xmlutil.SubTemplateElement(root, 'value', selector='values') @@ -667,22 +667,22 @@ def test__serialize(self): attrs = xmlutil.SubTemplateElement(root, 'attrs', selector='attrs') xmlutil.SubTemplateElement(attrs, 'attr', selector=xmlutil.get_items, key=0, value=1) - master = xmlutil.MasterTemplate(root, 1, nsmap=dict(f='foo')) + main = xmlutil.MainTemplate(root, 1, nsmap=dict(f='foo')) - # Set up our slave template - root_slave = xmlutil.TemplateElement('test', selector='test') - image = xmlutil.SubTemplateElement(root_slave, 'image', + # Set up our subordinate template + root_subordinate = xmlutil.TemplateElement('test', selector='test') + image = xmlutil.SubTemplateElement(root_subordinate, 'image', selector='image', id='id') image.text = xmlutil.Selector('name') - slave = xmlutil.SlaveTemplate(root_slave, 1, nsmap=dict(b='bar')) + subordinate = xmlutil.SubordinateTemplate(root_subordinate, 1, nsmap=dict(b='bar')) - # Attach the slave to the master... - master.attach(slave) + # Attach the subordinate to the main... + main.attach(subordinate) # Try serializing our object - siblings = master._siblings() - nsmap = master._nsmap() - result = master._serialize(None, obj, siblings, nsmap) + siblings = main._siblings() + nsmap = main._nsmap() + result = main._serialize(None, obj, siblings, nsmap) # Now we get to manually walk the element tree... self.assertEqual(result.tag, 'test') @@ -709,60 +709,60 @@ def test__serialize(self): self.assertEqual(templ.serialize(None), '') -class MasterTemplateBuilder(xmlutil.TemplateBuilder): +class MainTemplateBuilder(xmlutil.TemplateBuilder): def construct(self): elem = xmlutil.TemplateElement('test') - return xmlutil.MasterTemplate(elem, 1) + return xmlutil.MainTemplate(elem, 1) -class SlaveTemplateBuilder(xmlutil.TemplateBuilder): +class SubordinateTemplateBuilder(xmlutil.TemplateBuilder): def construct(self): elem = xmlutil.TemplateElement('test') - return xmlutil.SlaveTemplate(elem, 1) + return xmlutil.SubordinateTemplate(elem, 1) class TemplateBuilderTest(test.TestCase): - def test_master_template_builder(self): + def test_main_template_builder(self): # Make sure the template hasn't been built yet - self.assertEqual(MasterTemplateBuilder._tmpl, None) + self.assertEqual(MainTemplateBuilder._tmpl, None) # Now, construct the template - tmpl1 = MasterTemplateBuilder() + tmpl1 = MainTemplateBuilder() # Make sure that there is a template cached... - self.assertNotEqual(MasterTemplateBuilder._tmpl, None) + self.assertNotEqual(MainTemplateBuilder._tmpl, None) # Make sure it wasn't what was returned... - self.assertNotEqual(MasterTemplateBuilder._tmpl, tmpl1) + self.assertNotEqual(MainTemplateBuilder._tmpl, tmpl1) # Make sure it doesn't get rebuilt - cached = MasterTemplateBuilder._tmpl - tmpl2 = MasterTemplateBuilder() - self.assertEqual(MasterTemplateBuilder._tmpl, cached) + cached = MainTemplateBuilder._tmpl + tmpl2 = MainTemplateBuilder() + self.assertEqual(MainTemplateBuilder._tmpl, cached) # Make sure we're always getting fresh copies self.assertNotEqual(tmpl1, tmpl2) # Make sure we can override the copying behavior - tmpl3 = MasterTemplateBuilder(False) - self.assertEqual(MasterTemplateBuilder._tmpl, tmpl3) + tmpl3 = MainTemplateBuilder(False) + self.assertEqual(MainTemplateBuilder._tmpl, tmpl3) - def test_slave_template_builder(self): + def test_subordinate_template_builder(self): # Make sure the template hasn't been built yet - self.assertEqual(SlaveTemplateBuilder._tmpl, None) + self.assertEqual(SubordinateTemplateBuilder._tmpl, None) # Now, construct the template - tmpl1 = SlaveTemplateBuilder() + tmpl1 = SubordinateTemplateBuilder() # Make sure there is a template cached... - self.assertNotEqual(SlaveTemplateBuilder._tmpl, None) + self.assertNotEqual(SubordinateTemplateBuilder._tmpl, None) # Make sure it was what was returned... - self.assertEqual(SlaveTemplateBuilder._tmpl, tmpl1) + self.assertEqual(SubordinateTemplateBuilder._tmpl, tmpl1) # Make sure it doesn't get rebuilt - tmpl2 = SlaveTemplateBuilder() - self.assertEqual(SlaveTemplateBuilder._tmpl, tmpl1) + tmpl2 = SubordinateTemplateBuilder() + self.assertEqual(SubordinateTemplateBuilder._tmpl, tmpl1) # Make sure we're always getting the cached copy self.assertEqual(tmpl1, tmpl2) @@ -788,7 +788,7 @@ def test_make_flat_dict(self): expected_xml = ("\n" 'foobar') root = xmlutil.make_flat_dict('wrapper') - tmpl = xmlutil.MasterTemplate(root, 1) + tmpl = xmlutil.MainTemplate(root, 1) result = tmpl.serialize(dict(wrapper=dict(a='foo', b='bar'))) self.assertEqual(result, expected_xml) @@ -796,7 +796,7 @@ def test_make_flat_dict(self): 'foobar' "") root = xmlutil.make_flat_dict('wrapper', ns='ns') - tmpl = xmlutil.MasterTemplate(root, 1) + tmpl = xmlutil.MainTemplate(root, 1) result = tmpl.serialize(dict(wrapper=dict(a='foo', b='bar'))) self.assertEqual(result, expected_xml) diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py index 795949e3e..cb4eb49da 100644 --- a/nova/tests/compute/test_compute.py +++ b/nova/tests/compute/test_compute.py @@ -8426,33 +8426,33 @@ def fake_driver_remove_from_aggregate(context, aggregate, host, aggregate=jsonutils.to_primitive(self.aggr), host="host") self.assertTrue(fake_driver_remove_from_aggregate.called) - def test_add_aggregate_host_passes_slave_info_to_driver(self): + def test_add_aggregate_host_passes_subordinate_info_to_driver(self): def driver_add_to_aggregate(context, aggregate, host, **kwargs): self.assertEquals(self.context, context) self.assertEquals(aggregate['id'], self.aggr['id']) self.assertEquals(host, "the_host") - self.assertEquals("SLAVE_INFO", kwargs.get("slave_info")) + self.assertEquals("SLAVE_INFO", kwargs.get("subordinate_info")) self.stubs.Set(self.compute.driver, "add_to_aggregate", driver_add_to_aggregate) self.compute.add_aggregate_host(self.context, "the_host", - slave_info="SLAVE_INFO", + subordinate_info="SLAVE_INFO", aggregate=jsonutils.to_primitive(self.aggr)) - def test_remove_from_aggregate_passes_slave_info_to_driver(self): + def test_remove_from_aggregate_passes_subordinate_info_to_driver(self): def driver_remove_from_aggregate(context, aggregate, host, **kwargs): self.assertEquals(self.context, context) self.assertEquals(aggregate['id'], self.aggr['id']) self.assertEquals(host, "the_host") - self.assertEquals("SLAVE_INFO", kwargs.get("slave_info")) + self.assertEquals("SLAVE_INFO", kwargs.get("subordinate_info")) self.stubs.Set(self.compute.driver, "remove_from_aggregate", driver_remove_from_aggregate) self.compute.remove_aggregate_host(self.context, aggregate=jsonutils.to_primitive(self.aggr), host="the_host", - slave_info="SLAVE_INFO") + subordinate_info="SLAVE_INFO") class ComputePolicyTestCase(BaseTestCase): diff --git a/nova/tests/compute/test_rpcapi.py b/nova/tests/compute/test_rpcapi.py index e1b02a998..cca56bafd 100644 --- a/nova/tests/compute/test_rpcapi.py +++ b/nova/tests/compute/test_rpcapi.py @@ -100,7 +100,7 @@ def _fake_rpc_method(*args, **kwargs): def test_add_aggregate_host(self): self._test_compute_api('add_aggregate_host', 'cast', aggregate={'id': 'fake_id'}, host_param='host', host='host', - slave_info={}, version='2.14') + subordinate_info={}, version='2.14') def test_add_fixed_ip_to_instance(self): self._test_compute_api('add_fixed_ip_to_instance', 'cast', @@ -300,7 +300,7 @@ def test_refresh_security_group_members(self): def test_remove_aggregate_host(self): self._test_compute_api('remove_aggregate_host', 'cast', aggregate={'id': 'fake_id'}, host_param='host', host='host', - slave_info={}, version='2.15') + subordinate_info={}, version='2.15') def test_remove_fixed_ip_from_instance(self): self._test_compute_api('remove_fixed_ip_from_instance', 'cast', diff --git a/nova/tests/virt/xenapi/test_xenapi.py b/nova/tests/virt/xenapi/test_xenapi.py index cb5eb3bb9..61bd7f638 100644 --- a/nova/tests/virt/xenapi/test_xenapi.py +++ b/nova/tests/virt/xenapi/test_xenapi.py @@ -1343,7 +1343,7 @@ def fake_aggregate_get_by_host(self, *args, **kwargs): self.stubs.Set(self.conn._session._virtapi, "aggregate_get_by_host", fake_aggregate_get_by_host) - self.stubs.Set(self.conn._session, "is_slave", True) + self.stubs.Set(self.conn._session, "is_subordinate", True) try: self.conn._session._get_host_uuid() @@ -2735,7 +2735,7 @@ def setUp(self): pool_states.POOL_FLAG: 'XenAPI'}} self.aggr = db.aggregate_create(self.context, values) self.fake_metadata = {pool_states.POOL_FLAG: 'XenAPI', - 'master_compute': 'host', + 'main_compute': 'host', 'availability_zone': 'fake_zone', pool_states.KEY: pool_states.ACTIVE, 'host': xenapi_fake.get_record('host', @@ -2745,18 +2745,18 @@ def test_pool_add_to_aggregate_called_by_driver(self): calls = [] - def pool_add_to_aggregate(context, aggregate, host, slave_info=None): + def pool_add_to_aggregate(context, aggregate, host, subordinate_info=None): self.assertEquals("CONTEXT", context) self.assertEquals("AGGREGATE", aggregate) self.assertEquals("HOST", host) - self.assertEquals("SLAVEINFO", slave_info) + self.assertEquals("SLAVEINFO", subordinate_info) calls.append(pool_add_to_aggregate) self.stubs.Set(self.conn._pool, "add_to_aggregate", pool_add_to_aggregate) self.conn.add_to_aggregate("CONTEXT", "AGGREGATE", "HOST", - slave_info="SLAVEINFO") + subordinate_info="SLAVEINFO") self.assertTrue(pool_add_to_aggregate in calls) @@ -2765,18 +2765,18 @@ def test_pool_remove_from_aggregate_called_by_driver(self): calls = [] def pool_remove_from_aggregate(context, aggregate, host, - slave_info=None): + subordinate_info=None): self.assertEquals("CONTEXT", context) self.assertEquals("AGGREGATE", aggregate) self.assertEquals("HOST", host) - self.assertEquals("SLAVEINFO", slave_info) + self.assertEquals("SLAVEINFO", subordinate_info) calls.append(pool_remove_from_aggregate) self.stubs.Set(self.conn._pool, "remove_from_aggregate", pool_remove_from_aggregate) self.conn.remove_from_aggregate("CONTEXT", "AGGREGATE", "HOST", - slave_info="SLAVEINFO") + subordinate_info="SLAVEINFO") self.assertTrue(pool_remove_from_aggregate in calls) @@ -2792,11 +2792,11 @@ def fake_init_pool(id, name): self.assertThat(self.fake_metadata, matchers.DictMatches(result['metadetails'])) - def test_join_slave(self): - # Ensure join_slave gets called when the request gets to master. - def fake_join_slave(id, compute_uuid, host, url, user, password): - fake_join_slave.called = True - self.stubs.Set(self.conn._pool, "_join_slave", fake_join_slave) + def test_join_subordinate(self): + # Ensure join_subordinate gets called when the request gets to main. + def fake_join_subordinate(id, compute_uuid, host, url, user, password): + fake_join_subordinate.called = True + self.stubs.Set(self.conn._pool, "_join_subordinate", fake_join_subordinate) aggregate = self._aggregate_setup(hosts=['host', 'host2'], metadata=self.fake_metadata) @@ -2806,7 +2806,7 @@ def fake_join_slave(id, compute_uuid, host, url, user, password): user='fake_user', passwd='fake_pass', xenhost_uuid='fake_uuid')) - self.assertTrue(fake_join_slave.called) + self.assertTrue(fake_join_subordinate.called) def test_add_to_aggregate_first_host(self): def fake_pool_set_name_label(self, session, pool_ref, name): @@ -2847,19 +2847,19 @@ def test_remove_from_empty_aggregate(self): self.conn._pool.remove_from_aggregate, self.context, result, "test_host") - def test_remove_slave(self): - # Ensure eject slave gets called. - def fake_eject_slave(id, compute_uuid, host_uuid): - fake_eject_slave.called = True - self.stubs.Set(self.conn._pool, "_eject_slave", fake_eject_slave) + def test_remove_subordinate(self): + # Ensure eject subordinate gets called. + def fake_eject_subordinate(id, compute_uuid, host_uuid): + fake_eject_subordinate.called = True + self.stubs.Set(self.conn._pool, "_eject_subordinate", fake_eject_subordinate) self.fake_metadata['host2'] = 'fake_host2_uuid' aggregate = self._aggregate_setup(hosts=['host', 'host2'], metadata=self.fake_metadata, aggr_state=pool_states.ACTIVE) self.conn._pool.remove_from_aggregate(self.context, aggregate, "host2") - self.assertTrue(fake_eject_slave.called) + self.assertTrue(fake_eject_subordinate.called) - def test_remove_master_solo(self): + def test_remove_main_solo(self): # Ensure metadata are cleared after removal. def fake_clear_pool(id): fake_clear_pool.called = True @@ -2874,8 +2874,8 @@ def fake_clear_pool(id): pool_states.KEY: pool_states.ACTIVE}, matchers.DictMatches(result['metadetails'])) - def test_remote_master_non_empty_pool(self): - # Ensure AggregateError is raised if removing the master. + def test_remote_main_non_empty_pool(self): + # Ensure AggregateError is raised if removing the main. aggregate = self._aggregate_setup(hosts=['host', 'host2'], metadata=self.fake_metadata) @@ -2994,16 +2994,16 @@ def __init__(self): self._mock_calls = [] def add_aggregate_host(self, ctxt, aggregate, - host_param, host, slave_info): + host_param, host, subordinate_info): self._mock_calls.append(( self.add_aggregate_host, ctxt, aggregate, - host_param, host, slave_info)) + host_param, host, subordinate_info)) def remove_aggregate_host(self, ctxt, aggregate_id, host_param, - host, slave_info): + host, subordinate_info): self._mock_calls.append(( self.remove_aggregate_host, ctxt, aggregate_id, - host_param, host, slave_info)) + host_param, host, subordinate_info)) class StubDependencies(object): @@ -3018,10 +3018,10 @@ def _is_hv_pool(self, *_ignore): def _get_metadata(self, *_ignore): return { pool_states.KEY: {}, - 'master_compute': 'master' + 'main_compute': 'main' } - def _create_slave_info(self, *ignore): + def _create_subordinate_info(self, *ignore): return "SLAVE_INFO" @@ -3035,32 +3035,32 @@ class HypervisorPoolTestCase(test.TestCase): 'id': 98, 'hosts': [], 'metadetails': { - 'master_compute': 'master', + 'main_compute': 'main', pool_states.POOL_FLAG: {}, pool_states.KEY: {} } } - def test_slave_asks_master_to_add_slave_to_pool(self): - slave = ResourcePoolWithStubs() + def test_subordinate_asks_main_to_add_subordinate_to_pool(self): + subordinate = ResourcePoolWithStubs() - slave.add_to_aggregate("CONTEXT", self.fake_aggregate, "slave") + subordinate.add_to_aggregate("CONTEXT", self.fake_aggregate, "subordinate") self.assertIn( - (slave.compute_rpcapi.add_aggregate_host, + (subordinate.compute_rpcapi.add_aggregate_host, "CONTEXT", jsonutils.to_primitive(self.fake_aggregate), - "slave", "master", "SLAVE_INFO"), - slave.compute_rpcapi._mock_calls) + "subordinate", "main", "SLAVE_INFO"), + subordinate.compute_rpcapi._mock_calls) - def test_slave_asks_master_to_remove_slave_from_pool(self): - slave = ResourcePoolWithStubs() + def test_subordinate_asks_main_to_remove_subordinate_from_pool(self): + subordinate = ResourcePoolWithStubs() - slave.remove_from_aggregate("CONTEXT", self.fake_aggregate, "slave") + subordinate.remove_from_aggregate("CONTEXT", self.fake_aggregate, "subordinate") self.assertIn( - (slave.compute_rpcapi.remove_aggregate_host, - "CONTEXT", 98, "slave", "master", "SLAVE_INFO"), - slave.compute_rpcapi._mock_calls) + (subordinate.compute_rpcapi.remove_aggregate_host, + "CONTEXT", 98, "subordinate", "main", "SLAVE_INFO"), + subordinate.compute_rpcapi._mock_calls) class SwapXapiHostTestCase(test.TestCase): diff --git a/nova/virt/xenapi/driver.py b/nova/virt/xenapi/driver.py index 98d97a975..2e1224cd7 100755 --- a/nova/virt/xenapi/driver.py +++ b/nova/virt/xenapi/driver.py @@ -623,7 +623,7 @@ def __init__(self, url, user, pw, virtapi): import XenAPI self.XenAPI = XenAPI self._sessions = queue.Queue() - self.is_slave = False + self.is_subordinate = False exception = self.XenAPI.Failure(_("Unable to log in to XenAPI " "(is the Dom0 disk full?)")) url = self._create_first_session(url, user, pw, exception) @@ -639,13 +639,13 @@ def _create_first_session(self, url, user, pw, exception): with timeout.Timeout(CONF.xenapi_login_timeout, exception): session.login_with_password(user, pw) except self.XenAPI.Failure as e: - # if user and pw of the master are different, we're doomed! + # if user and pw of the main are different, we're doomed! if e.details[0] == 'HOST_IS_SLAVE': - master = e.details[1] - url = pool.swap_xapi_host(url, master) + main = e.details[1] + url = pool.swap_xapi_host(url, main) session = self.XenAPI.Session(url) session.login_with_password(user, pw) - self.is_slave = True + self.is_subordinate = True else: raise self._sessions.put(session) @@ -659,7 +659,7 @@ def _populate_session_pool(self, url, user, pw, exception): self._sessions.put(session) def _get_host_uuid(self): - if self.is_slave: + if self.is_subordinate: aggr = self._virtapi.aggregate_get_by_host( context.get_admin_context(), CONF.host, key=pool_states.POOL_FLAG)[0] diff --git a/nova/virt/xenapi/fake.py b/nova/virt/xenapi/fake.py index 2a9d50b38..ae32d4c4a 100644 --- a/nova/virt/xenapi/fake.py +++ b/nova/virt/xenapi/fake.py @@ -114,7 +114,7 @@ def create_host(name_label, hostname='fake_name', address='fake_addr'): # Create a pool if we don't have one already if len(_db_content['pool']) == 0: pool_ref = _create_pool('') - _db_content['pool'][pool_ref]['master'] = host_ref + _db_content['pool'][pool_ref]['main'] = host_ref _db_content['pool'][pool_ref]['default-SR'] = host_default_sr_ref _db_content['pool'][pool_ref]['suspend-image-SR'] = host_default_sr_ref @@ -733,7 +733,7 @@ def __getattr__(self, name): return self._session elif name == 'xenapi': return _Dispatcher(self.xenapi_request, None) - elif name.startswith('login') or name.startswith('slave_local'): + elif name.startswith('login') or name.startswith('subordinate_local'): return lambda *params: self._login(name, params) elif name.startswith('Async'): return lambda *params: self._async(name, params) diff --git a/nova/virt/xenapi/pool.py b/nova/virt/xenapi/pool.py index 43025ea27..ee52292a7 100644 --- a/nova/virt/xenapi/pool.py +++ b/nova/virt/xenapi/pool.py @@ -72,7 +72,7 @@ def undo_aggregate_operation(self, context, op, aggregate, 'during operation on %(host)s'), {'aggregate_id': aggregate['id'], 'host': host}) - def add_to_aggregate(self, context, aggregate, host, slave_info=None): + def add_to_aggregate(self, context, aggregate, host, subordinate_info=None): """Add a compute host to an aggregate.""" if not pool_states.is_hv_pool(aggregate['metadetails']): return @@ -92,10 +92,10 @@ def add_to_aggregate(self, context, aggregate, host, slave_info=None): {pool_states.KEY: pool_states.CHANGING}) if len(aggregate['hosts']) == 1: - # this is the first host of the pool -> make it master + # this is the first host of the pool -> make it main self._init_pool(aggregate['id'], aggregate['name']) - # save metadata so that we can find the master again - metadata = {'master_compute': host, + # save metadata so that we can find the main again + metadata = {'main_compute': host, host: self._host_uuid, pool_states.KEY: pool_states.ACTIVE} self._virtapi.aggregate_metadata_add(context, aggregate, @@ -103,29 +103,29 @@ def add_to_aggregate(self, context, aggregate, host, slave_info=None): else: # the pool is already up and running, we need to figure out # whether we can serve the request from this host or not. - master_compute = aggregate['metadetails']['master_compute'] - if master_compute == CONF.host and master_compute != host: - # this is the master -> do a pool-join - # To this aim, nova compute on the slave has to go down. + main_compute = aggregate['metadetails']['main_compute'] + if main_compute == CONF.host and main_compute != host: + # this is the main -> do a pool-join + # To this aim, nova compute on the subordinate has to go down. # NOTE: it is assumed that ONLY nova compute is running now - self._join_slave(aggregate['id'], host, - slave_info.get('compute_uuid'), - slave_info.get('url'), slave_info.get('user'), - slave_info.get('passwd')) - metadata = {host: slave_info.get('xenhost_uuid'), } + self._join_subordinate(aggregate['id'], host, + subordinate_info.get('compute_uuid'), + subordinate_info.get('url'), subordinate_info.get('user'), + subordinate_info.get('passwd')) + metadata = {host: subordinate_info.get('xenhost_uuid'), } self._virtapi.aggregate_metadata_add(context, aggregate, metadata) - elif master_compute and master_compute != host: - # send rpc cast to master, asking to add the following + elif main_compute and main_compute != host: + # send rpc cast to main, asking to add the following # host with specified credentials. - slave_info = self._create_slave_info() + subordinate_info = self._create_subordinate_info() self.compute_rpcapi.add_aggregate_host( - context, aggregate, host, master_compute, slave_info) + context, aggregate, host, main_compute, subordinate_info) - def remove_from_aggregate(self, context, aggregate, host, slave_info=None): + def remove_from_aggregate(self, context, aggregate, host, subordinate_info=None): """Remove a compute host from an aggregate.""" - slave_info = slave_info or dict() + subordinate_info = subordinate_info or dict() if not pool_states.is_hv_pool(aggregate['metadetails']): return @@ -138,20 +138,20 @@ def remove_from_aggregate(self, context, aggregate, host, slave_info=None): aggregate_id=aggregate['id'], reason=invalid[aggregate['metadetails'][pool_states.KEY]]) - master_compute = aggregate['metadetails']['master_compute'] - if master_compute == CONF.host and master_compute != host: - # this is the master -> instruct it to eject a host from the pool + main_compute = aggregate['metadetails']['main_compute'] + if main_compute == CONF.host and main_compute != host: + # this is the main -> instruct it to eject a host from the pool host_uuid = aggregate['metadetails'][host] - self._eject_slave(aggregate['id'], - slave_info.get('compute_uuid'), host_uuid) + self._eject_subordinate(aggregate['id'], + subordinate_info.get('compute_uuid'), host_uuid) self._virtapi.aggregate_metadata_delete(context, aggregate, host) - elif master_compute == host: - # Remove master from its own pool -> destroy pool only if the - # master is on its own, otherwise raise fault. Destroying a - # pool made only by master is fictional + elif main_compute == host: + # Remove main from its own pool -> destroy pool only if the + # main is on its own, otherwise raise fault. Destroying a + # pool made only by main is fictional if len(aggregate['hosts']) > 1: - # NOTE: this could be avoided by doing a master + # NOTE: this could be avoided by doing a main # re-election, but this is simpler for now. raise exception.InvalidAggregateAction( aggregate_id=aggregate['id'], @@ -160,34 +160,34 @@ def remove_from_aggregate(self, context, aggregate, host, slave_info=None): 'from the pool; pool not empty') % host) self._clear_pool(aggregate['id']) - for key in ['master_compute', host]: + for key in ['main_compute', host]: self._virtapi.aggregate_metadata_delete(context, aggregate, key) - elif master_compute and master_compute != host: - # A master exists -> forward pool-eject request to master - slave_info = self._create_slave_info() + elif main_compute and main_compute != host: + # A main exists -> forward pool-eject request to main + subordinate_info = self._create_subordinate_info() self.compute_rpcapi.remove_aggregate_host( - context, aggregate['id'], host, master_compute, slave_info) + context, aggregate['id'], host, main_compute, subordinate_info) else: # this shouldn't have happened raise exception.AggregateError(aggregate_id=aggregate['id'], action='remove_from_aggregate', reason=_('Unable to eject %s ' - 'from the pool; No master found') + 'from the pool; No main found') % host) - def _join_slave(self, aggregate_id, host, compute_uuid, url, user, passwd): - """Joins a slave into a XenServer resource pool.""" + def _join_subordinate(self, aggregate_id, host, compute_uuid, url, user, passwd): + """Joins a subordinate into a XenServer resource pool.""" try: args = {'compute_uuid': compute_uuid, 'url': url, 'user': user, 'password': passwd, 'force': jsonutils.dumps(CONF.use_join_force), - 'master_addr': self._host_addr, - 'master_user': CONF.xenapi_connection_username, - 'master_pass': CONF.xenapi_connection_password, } + 'main_addr': self._host_addr, + 'main_user': CONF.xenapi_connection_username, + 'main_pass': CONF.xenapi_connection_password, } self._session.call_plugin('xenhost', 'host_join', args) except self._session.XenAPI.Failure as e: LOG.error(_("Pool-Join failed: %s"), e) @@ -196,8 +196,8 @@ def _join_slave(self, aggregate_id, host, compute_uuid, url, user, passwd): reason=_('Unable to join %s ' 'in the pool') % host) - def _eject_slave(self, aggregate_id, compute_uuid, host_uuid): - """Eject a slave from a XenServer resource pool.""" + def _eject_subordinate(self, aggregate_id, compute_uuid, host_uuid): + """Eject a subordinate from a XenServer resource pool.""" try: # shutdown nova-compute; if there are other VMs running, e.g. # guest instances, the eject will fail. That's a precaution @@ -237,7 +237,7 @@ def _clear_pool(self, aggregate_id): action='remove_from_aggregate', reason=str(e.details)) - def _create_slave_info(self): + def _create_subordinate_info(self): """XenServer specific info needed to join the hypervisor pool.""" # replace the address from the xenapi connection url # because this might be 169.254.0.1, i.e. xenapi diff --git a/nova/virt/xenapi/pool_states.py b/nova/virt/xenapi/pool_states.py index f2ec02c1d..d45eb5d91 100644 --- a/nova/virt/xenapi/pool_states.py +++ b/nova/virt/xenapi/pool_states.py @@ -27,7 +27,7 @@ A 'created' pool becomes 'changing' during the first request of adding a host. During a 'changing' status no other requests will be accepted; this is to allow the hypervisor layer to instantiate the underlying pool -without any potential race condition that may incur in master/slave-based +without any potential race condition that may incur in main/subordinate-based configurations. The pool goes into the 'active' state when the underlying pool has been correctly instantiated. All other operations (e.g. add/remove hosts) that succeed will keep the diff --git a/tools/db/schema_diff.py b/tools/db/schema_diff.py index d2fd49391..39a1e1e2f 100755 --- a/tools/db/schema_diff.py +++ b/tools/db/schema_diff.py @@ -29,7 +29,7 @@ commit hash) and a SQLAlchemy-Migrate version number: Run like: - ./tools/db/schema_diff.py mysql master:latest my_branch:82 + ./tools/db/schema_diff.py mysql main:latest my_branch:82 """ import datetime import glob @@ -216,12 +216,12 @@ def parse_options(): try: orig_branch, orig_version = sys.argv[2].split(':') except IndexError: - usage('original branch and version required (e.g. master:82)') + usage('original branch and version required (e.g. main:82)') try: new_branch, new_version = sys.argv[3].split(':') except IndexError: - usage('new branch and version required (e.g. master:82)') + usage('new branch and version required (e.g. main:82)') return db_type, orig_branch, orig_version, new_branch, new_version