def create(self, context, loadbalancer): """ Create a loadbalancer. """ l = loadbalancer['loadbalancer'] tenant_id = self._get_tenant_id_for_create(context, l) project = self._project_read(project_id=tenant_id) obj_uuid = uuidutils.generate_uuid() name = self._get_resource_name('loadbalancer', project, l['name'], obj_uuid) id_perms = IdPermsType(enable=True, description=l['description']) lb = Loadbalancer(name, project, id_perms=id_perms, display_name=l['name']) lb.uuid = obj_uuid vmi, vip_address = self._create_virtual_interface( project, obj_uuid, l['vip_subnet_id'], l.get('vip_address')) lb.set_virtual_machine_interface(vmi) props = self.make_properties(l) props.set_vip_address(vip_address) lb.set_loadbalancer_properties(props) self._api.loadbalancer_create(lb) return self.make_dict(lb)
def create(self, context, loadbalancer): """ Create a loadbalancer. """ l = loadbalancer['loadbalancer'] if (l['provider'] == ATTR_NOT_SPECIFIED): l['provider'] = "opencontrail" sas_obj = self.check_provider_exists(l['provider']) tenant_id = self._get_tenant_id_for_create(context, l) project = self._project_read(project_id=tenant_id) obj_uuid = uuidutils.generate_uuid() name = self._get_resource_name('loadbalancer', project, l['name'], obj_uuid) id_perms = IdPermsType(enable=True, description=l['description']) lb = Loadbalancer(name, project, uuid=obj_uuid, loadbalancer_provider=l['provider'], id_perms=id_perms, display_name=l['name']) lb.set_service_appliance_set(sas_obj) vmi, vip_address = self._create_virtual_interface(project, obj_uuid, l['vip_subnet_id'], l.get('vip_address')) lb.set_virtual_machine_interface(vmi) l['provisioning_status'] = 'ACTIVE' l['operating_status'] = 'ONLINE' props = self.make_properties(l) props.set_vip_address(vip_address) lb.set_loadbalancer_properties(props) self._api.loadbalancer_create(lb) return self.make_dict(lb)
def create(self, context, loadbalancer): """ Create a loadbalancer. """ l = loadbalancer['loadbalancer'] tenant_id = self._get_tenant_id_for_create(context, l) project = self._project_read(project_id=tenant_id) obj_uuid = uuidutils.generate_uuid() name = self._get_resource_name('loadbalancer', project, l['name'], obj_uuid) id_perms = IdPermsType(enable=True, description=l['description']) lb = Loadbalancer(name, project, id_perms=id_perms, display_name=l['name']) lb.uuid = obj_uuid vmi, vip_address = self._create_virtual_interface(project, obj_uuid, l['vip_subnet_id'], l.get('vip_address')) lb.set_virtual_machine_interface(vmi) props = self.make_properties(l) props.set_vip_address(vip_address) lb.set_loadbalancer_properties(props) self._api.loadbalancer_create(lb) return self.make_dict(lb)
def create(self, context, loadbalancer): """ Create a loadbalancer. """ _l = loadbalancer['loadbalancer'] if (_l['provider'] == ATTR_NOT_SPECIFIED): _l['provider'] = "opencontrail" sas_obj = self.check_provider_exists(_l['provider']) tenant_id = self._get_tenant_id_for_create(context, _l) project = self._project_read(project_id=tenant_id) obj_uuid = uuidutils.generate_uuid() name = self._get_resource_name('loadbalancer', project, _l['name'], obj_uuid) id_perms = IdPermsType(enable=True, description=_l['description']) lb = Loadbalancer(name, project, uuid=obj_uuid, loadbalancer_provider=_l['provider'], id_perms=id_perms, display_name=_l['name']) lb.set_service_appliance_set(sas_obj) vmi, vip_address, vip_subnet_id = self._create_virtual_interface( project, obj_uuid, _l['vip_subnet_id'], _l['vip_network_id'], _l['vip_address']) lb.set_virtual_machine_interface(vmi) _l['provisioning_status'] = 'ACTIVE' _l['operating_status'] = 'ONLINE' _l['vip_subnet_id'] = vip_subnet_id props = self.make_properties(_l) props.set_vip_address(vip_address) lb.set_loadbalancer_properties(props) self._api.loadbalancer_create(lb) return self.make_dict(lb)