Beispiel #1
0
def change_edge_appliance(edge_id):
    """Update the appliances data of an edge

    Update the edge appliances data according to its current availability zone
    and the nsx.ini config, including the resource pool, edge_ha, datastore &
    ha_datastore.
    The availability zone of the edge will not be changed.
    This can be useful when the global resource pool/datastore/edge ha
    configuration is updated, or when the configuration of a specific
    availability zone was updated.
    """
    # find out what is the current resource pool & size, so we can keep them
    az_name, size = _get_edge_az_and_size(edge_id)
    az = nsx_az.ConfiguredAvailabilityZones().get_availability_zone(az_name)
    appliances = [{'resourcePoolId': az.resource_pool,
                   'datastoreId': az.datastore_id}]

    if az.ha_datastore_id and az.edge_ha:
        appliances.append({'resourcePoolId': az.resource_pool,
                           'datastoreId': az.ha_datastore_id})
    request = {'appliances': appliances, 'applianceSize': size}
    try:
        nsxv.change_edge_appliance(edge_id, request)
    except nsxv_exceptions.ResourceNotFound as e:
        LOG.error(_LE("Edge %s not found"), edge_id)
    except exceptions.NeutronException as e:
        LOG.error(_LE("%s"), str(e))
    else:
        # also update the edge_ha of the edge
        change_edge_ha(az.edge_ha, edge_id)
 def setUp(self):
     super(EdgeUtilsTestCaseMixin, self).setUp()
     nsxv_manager_p = mock.patch(vmware.VCNS_DRIVER_NAME, autospec=True)
     self.nsxv_manager = nsxv_manager_p.start()
     task = mock.Mock()
     nsxv_manager_p.return_value = task
     self.nsxv_manager.callbacks = mock.Mock()
     self.nsxv_manager.vcns = mock.Mock()
     get_ver = mock.patch.object(self.nsxv_manager.vcns,
                                 'get_version').start()
     get_ver.return_value = '6.1.4'
     self.ctx = context.get_admin_context()
     self.addCleanup(nsxv_manager_p.stop)
     self.az = (nsx_az.ConfiguredAvailabilityZones().
                get_default_availability_zone())
Beispiel #3
0
 def _create_l2_gateway_edge(self, context):
     # Create a dedicated DLR
     lrouter = {'name': nsxv_constants.L2_GATEWAY_EDGE,
                'id': uuidutils.generate_uuid()}
     # Create the router on the default availability zone
     availability_zone = (nsx_az.ConfiguredAvailabilityZones().
         get_default_availability_zone())
     self._edge_manager.create_lrouter(context,
                                       lrouter, lswitch=None, dist=True,
                                       availability_zone=availability_zone)
     edge_binding = nsxv_db.get_nsxv_router_binding(context.session,
                                                    lrouter['id'])
     if not edge_binding:
         raise nsx_exc.NsxL2GWDeviceNotFound()
     # Enable edge HA on the DLR
     if availability_zone.edge_ha:
         edge_id = edge_binding['edge_id']
         self._edge_manager.nsxv_manager.update_edge_ha(edge_id)
     return edge_binding['edge_id']
Beispiel #4
0
    def setUp(self):
        super(VcnsDriverTestCase, self).setUp()

        self.ctx = neutron_context.get_admin_context()
        self.temp_e_drv_nsxv_db = e_drv.nsxv_db
        e_drv.nsxv_db = mock.MagicMock()
        self.config_parse(args=['--config-file', VCNS_CONFIG_FILE])

        self.fc = fake_vcns.FakeVcns()
        self.mock_vcns = mock.patch(vmware.VCNS_NAME, autospec=True)
        self.vcns_patch()

        self.addCleanup(self.fc.reset_all)

        self.vcns_driver = vcns_driver.VcnsDriver(self)

        self.az = (nsx_az.ConfiguredAvailabilityZones().
                   get_default_availability_zone())
        self.edge_id = None
        self.result = None
 def get_network_az(self, context, network_id):
     return (nsx_az.ConfiguredAvailabilityZones().
             get_default_availability_zone())