Пример #1
0
    def __add_vip_to_host(cls, vip_type, host, host_ip, ssh_user, ssh_port, ssh_options):
        if vip_type == ConfigHelper.VIP_PROVIDER_TYPE_METAL:
            vip_helper = VIPMetalHelper(host, host_ip, ssh_user, ssh_port, ssh_options)
            if not vip_helper.assign_vip():
                return False
        elif vip_type == ConfigHelper.VIP_PROVIDER_TYPE_AWS:
            pass
        elif vip_type == ConfigHelper.VIP_PROVIDER_TYPE_OS:
            pass
        else:
            # There are no other vip providers apart from what we are testing for above. Hence we throw an
            # error here
            return False

        return True
Пример #2
0
    def __add_vip_to_host(cls, vip_type, host, host_ip, ssh_user, ssh_port):
        if vip_type == ConfigHelper.VIP_PROVIDER_TYPE_METAL:
            vip_helper = VIPMetalHelper(host, host_ip, ssh_user, ssh_port)
            if not vip_helper.assign_vip():
                return False
        elif vip_type == ConfigHelper.VIP_PROVIDER_TYPE_AWS:
            pass
        elif vip_type == ConfigHelper.VIP_PROVIDER_TYPE_OS:
            pass
        else:
            # There are no other vip providers apart from what we are testing for above. Hence we throw an
            # error here
            return False

        return True
Пример #3
0
    def __remove_vip_from_host(cls, vip_type, host, host_ip, ssh_user, ssh_port, ssh_options, failover_type):
        if vip_type == ConfigHelper.VIP_PROVIDER_TYPE_METAL:
            vip_helper = VIPMetalHelper(host, host_ip, ssh_user, ssh_port, ssh_options)

            # If this is a hard failover and we cannot connect to the original master over SSH then we cannot really do
            # anything here at the moment.
            # TODO: At the moment we are not doing anything here but we would probably want to do something here
            if failover_type == cls.FAILOVER_TYPE_HARD:
                return True

            if not vip_helper.remove_vip():
                return False
        elif vip_type == ConfigHelper.VIP_PROVIDER_TYPE_AWS:
            pass
        elif vip_type == ConfigHelper.VIP_PROVIDER_TYPE_OS:
            pass
        else:
            # There are no other vip providers apart from what we are testing for above. Hence we throw an
            # error here
            return False

        return True
Пример #4
0
    def __check_vip_on_host(cls, vip_type, host, host_ip, ssh_user, ssh_port):
        if vip_type == ConfigHelper.VIP_PROVIDER_TYPE_METAL:
            return VIPMetalHelper(host, host_ip, ssh_user, ssh_port).has_vip()
        elif vip_type == ConfigHelper.VIP_PROVIDER_TYPE_AWS:
            pass
        elif vip_type == ConfigHelper.VIP_PROVIDER_TYPE_OS:
            pass
        else:
            # There are no other vip providers apart from what we are testing for above. Hence we throw an
            # error here
            return False

        return True
Пример #5
0
    def __remove_vip_from_host(cls, vip_type, host, host_ip, ssh_user,
                               ssh_port, failover_type):
        if vip_type == ConfigHelper.VIP_PROVIDER_TYPE_METAL:
            vip_helper = VIPMetalHelper(host, host_ip, ssh_user, ssh_port)

            # If this is a hard failover and we cannot connect to the original master over SSH then we cannot really do
            # anything here at the moment.
            # TODO: At the moment we are not doing anything here but we would probably want to do something here
            if failover_type == cls.FAILOVER_TYPE_HARD:
                return True

            if not vip_helper.remove_vip():
                return False
        elif vip_type == ConfigHelper.VIP_PROVIDER_TYPE_AWS:
            pass
        elif vip_type == ConfigHelper.VIP_PROVIDER_TYPE_OS:
            pass
        else:
            # There are no other vip providers apart from what we are testing for above. Hence we throw an
            # error here
            return False

        return True