def delete_pool_health_monitor(self, health_monitor, pool_id): LOG.info('vLB Driver::delete_pool_health_monitor') vlb = vlb_db.get_vlb_from_pool_id(pool_id) mgmt_ip = vlb['mgmt_ip'] def _vLb_soap(): while True: try: impl = driver_impl.BrocadeAdxDeviceDriverImpl( self.conf.brocade_vlb.username, self.conf.brocade_vlb.password, mgmt_ip) impl.delete_health_monitor(health_monitor, pool_id) except UnsupportedFeature as e: raise e except Exception as e: LOG.debug('vLB Driver::delete_pool_health_monitor trying ' ' to connect to vLB - %s' % e) yield self.conf.brocade_vlb.vlb_poll_interval continue break self._wait(_vLb_soap, timeout=self.conf.brocade_vlb.vlb_boot_timeout) LOG.info(_("vLB Driver:vLB finish deleting health monitor"))
def create_member(self, member): LOG.info('vLB Driver::create_member') vlb = vlb_db.get_vlb_from_pool_id(member['pool_id']) mgmt_ip = vlb['mgmt_ip'] vip = self._get_vip(member['pool_id']) member['vip_id'] = vip['id'] def _vLb_soap(): while True: try: impl = driver_impl.BrocadeAdxDeviceDriverImpl( self.conf.brocade_vlb.username, self.conf.brocade_vlb.password, mgmt_ip) impl.create_member(member) except UnsupportedFeature as e: raise e except Exception as e: LOG.debug('vLB Driver::create_member trying to connect to' ' vLB - %s' % e) yield self.conf.brocade_vlb.vlb_poll_interval continue break self._wait(_vLb_soap, timeout=self.conf.brocade_vlb.vlb_boot_timeout) LOG.info(_("vLB Driver:vLB finish creating member"))
def undeploy_instance(self, pool_id): """Fully undeploys the loadbalancer instance.""" LOG.debug('vLB Driver::undeploy_instance') vlb_value = vlb_db.get_vlb_from_pool_id(pool_id['pool']['id']) nova_client = self._get_nova_client() instance = nova_client.servers.find(name=vlb_value['name']) instance.delete() vlb_db.delete_vlb(pool_id['pool']['id'])
def delete_vip(self, vip): LOG.debug('vLB Driver::delete_vip') vlb = vlb_db.get_vlb_from_pool_id(vip['pool_id']) mgmt_ip = vlb['mgmt_ip'] def _vLb_soap(): while True: try: impl = driver_impl.BrocadeAdxDeviceDriverImpl( self.conf.brocade_vlb.username, self.conf.brocade_vlb.password, mgmt_ip) impl.delete_vip(vip) except Exception as e: LOG.debug('vLB Driver::delete_vip trying to connect to' 'vLB - %s' % e) yield self.conf.brocade_vlb.vlb_poll_interval continue break self._wait(_vLb_soap, timeout=self.conf.brocade_vlb.vlb_boot_timeout) LOG.info(_("vLB Driver:vLB finish deleting vip"))
def update_pool(self, old_pool, pool): LOG.info('vLB Driver::update_pool') LOG.debug('>>>>>>>>>>>>>>>>>>>>> %s' % pool) vlb = vlb_db.get_vlb_from_pool_id(pool['id']) mgmt_ip = vlb['mgmt_ip'] def _vLb_soap(): while True: try: impl = driver_impl.BrocadeAdxDeviceDriverImpl( self.conf.brocade_vlb.username, self.conf.brocade_vlb.password, mgmt_ip) impl.update_pool(old_pool, pool) except UnsupportedFeature as e: raise e except Exception as e: LOG.debug('vLB Driver::update_pool trying to connect to' 'vLB - %s' % e) yield self.conf.brocade_vlb.vlb_poll_interval continue break self._wait(_vLb_soap, timeout=self.conf.brocade_vlb.vlb_boot_timeout) LOG.info(_("vLB Driver:vLB finish updating pool"))
def deploy_instance(self, pool): """Fully deploys a loadbalancer instance from a given config.""" if vlb_db.get_vlb_from_pool_id(pool['pool']['id']) is not None: LOG.debug('This is an error') return name = 'vlb_{0}'.format(os.urandom(6).encode('hex')) nova_client = self._get_nova_client() neutron_client = self._get_neutron_client() subnet = neutron_client.show_subnet(pool['pool']['subnet_id']) LOG.debug('brocade_vlb_driver::deploy_instance %s' % name) vLb = nova_client.servers.create( name, self.conf.brocade_vlb.image_id, self.conf.brocade_vlb.flavor_id, nics=[{ 'net-id': self.conf.brocade_vlb.management_network_id }, { 'net-id': subnet['subnet']['network_id'] }]) def _vLb_active(): while True: try: instance = nova_client.servers.get(vLb.id) except Exception: yield self.conf.brocade_vlb.nova_poll_interval continue LOG.info( _("vLB Driver::Load Balancer instance status: %s") % instance.status) if instance.status not in ('ACTIVE', 'ERROR'): yield self.conf.brocade_vlb.nova_poll_interval elif instance.status == 'ERROR': raise InstanceSpawnError() else: break self._wait(_vLb_active, timeout=self.conf.brocade_vlb.nova_spawn_timeout) LOG.info( _("vLB Driver::Waiting for the vLB app to initialize %s") % vLb.id) mgmt_ip = self._get_address( vLb, self.conf.brocade_vlb.management_network_id) data_ip = self._get_address(vLb, subnet['subnet']['network_id']) vlb_db.create_vlb(pool['pool']['id'], vLb.id, vLb.tenant_id, vLb.name, data_ip, mgmt_ip) # Now wait for vlb to boot def _vLb_soap(): while True: try: impl = driver_impl.BrocadeAdxDeviceDriverImpl( self.conf.brocade_vlb.username, self.conf.brocade_vlb.password, mgmt_ip) impl.create_pool(pool['pool']) impl.ifconfig_e1(data_ip, subnet['subnet']['cidr']) impl.create_static_route('0.0.0.0', '0', subnet['subnet']['gateway_ip']) impl.enable_source_nat() except Exception as e: LOG.debug('vLB Driver::Load Balancer instance %s' % e) yield self.conf.brocade_vlb.vlb_poll_interval continue break self._wait(_vLb_soap, timeout=self.conf.brocade_vlb.vlb_boot_timeout) LOG.info(_("vLB Driver:vLB successfully deployed and configured"))