Ejemplo n.º 1
0
    def set_lbaas(self):
        if not self.ip_ns.netns.exists(self.namespace):
            self.create()

        haproxy_process.start_update_haproxy(self.cfg_file, self.namespace, True,
                                             self.keystone_auth_cfg_file)

        try:
            self.ip_ns.netns.execute(['route', 'add', 'default', 'gw', self.gw_ip])
        except RuntimeError:
            pass
Ejemplo n.º 2
0
    def set_lbaas(self):
        if not self.ip_ns.netns.exists(self.namespace):
            raise ValueError('Need to create the network namespace before set '
                             'up the lbaas')

        haproxy_process.start_update_haproxy(self.cfg_file, self.namespace)

        try:
            self.ip_ns.netns.execute(['route', 'add', 'default', 'gw', self.gw_ip])
        except RuntimeError:
            pass
Ejemplo n.º 3
0
    def set_lbaas(self):
        if not self.ip_ns.netns.exists(self.namespace):
            self.create()

        haproxy_process.start_update_haproxy(self.cfg_file, self.namespace,
                                             True)

        try:
            self.ip_ns.netns.execute(
                ['route', 'add', 'default', 'gw', self.gw_ip])
        except RuntimeError:
            pass
Ejemplo n.º 4
0
    def set_lbaas(self):
        if not self.ip_ns.netns.exists(self.namespace):
            self.create()

        lbaas_type = self.find_lbaas_type(self.cfg_file)
        if (lbaas_type == ''):
            raise ValueError('LBAAS_TYPE does not exist %s' % self.cfg_file)
        self.cfg_file = self.move_cfg_file_to_lbaas_dir(self.cfg_file)
        if (lbaas_type == 'haproxy_config'):
            haproxy_process.start_update_haproxy(self.loadbalancer_id, self.cfg_file,
                          self.namespace, True, self.keystone_auth_cfg_file)
        try:
            self.ip_ns.netns.execute(['route', 'add', 'default', 'gw', self.gw_ip])
        except RuntimeError:
            pass
Ejemplo n.º 5
0
    def set_lbaas(self):
        if not self.ip_ns.netns.exists(self.namespace):
            self.create()

        lbaas_type = self.find_lbaas_type(self.cfg_file)
        if (lbaas_type == ''):
            raise ValueError('LBAAS_TYPE does not exist %s' % self.cfg_file)
        self.cfg_file = self.move_cfg_file_to_lbaas_dir(self.cfg_file)
        if (lbaas_type == 'haproxy_config'):
            haproxy_process.start_update_haproxy(self.loadbalancer_id,
                                                 self.cfg_file, self.namespace,
                                                 True,
                                                 self.keystone_auth_cfg_file)
        try:
            self.ip_ns.netns.execute(
                ['route', 'add', 'default', 'gw', self.gw_ip])
        except RuntimeError:
            pass
    def set_lbaas(self):
        if not self.ip_ns.netns.exists(self.namespace):
            self.create()

        if not (os.path.isfile(self.cfg_file)):
            msg = "%s is missing for "\
                  "Loadbalancer-ID %s" %(self.cfg_file, self.loadbalancer_id)
            raise ValueError(msg)
        lbaas_type = self.find_lbaas_type(self.cfg_file)
        if (lbaas_type == ''):
            raise ValueError('LBAAS_TYPE does not exist %s' % self.cfg_file)
        if (lbaas_type == 'haproxy_config'):
            ret = haproxy_process.start_update_haproxy(
                          self.loadbalancer_id, self.cfg_file,
                          self.namespace, True, self.keystone_auth_cfg_file)
            if (ret == False):
                self.remove_cfg_file(self.cfg_file)
                return False
        try:
            self.ip_ns.netns.execute(['route', 'add', 'default', 'gw', self.gw_ip])
        except RuntimeError:
            pass
        return True
Ejemplo n.º 7
0
    def set_lbaas(self):
        if not self.ip_ns.netns.exists(self.namespace):
            self.create()

        if not (os.path.isfile(self.cfg_file)):
            msg = "%s is missing for "\
                  "Loadbalancer-ID %s" %(self.cfg_file, self.loadbalancer_id)
            raise ValueError(msg)
        lbaas_type = self.find_lbaas_type(self.cfg_file)
        if (lbaas_type == ''):
            raise ValueError('LBAAS_TYPE does not exist %s' % self.cfg_file)
        if (lbaas_type == 'haproxy_config'):
            ret = haproxy_process.start_update_haproxy(self.loadbalancer_id,
                                                       self.cfg_file,
                                                       self.namespace, True)
            if (ret == False):
                self.remove_cfg_file(self.cfg_file)
                return False
        try:
            self.ip_ns.netns.execute(
                ['route', 'add', 'default', 'gw', self.gw_ip])
        except RuntimeError:
            pass
        return True