コード例 #1
0
    def install_cascaded(self, debug_cidr_block, base_cidr_block,
                         api_cidr_block, tunnel_cidr_block):
        if self.cascaded_vm_id:
            return

        # install cascaded vm
        self._get_cascaded_ip(debug_cidr_block, base_cidr_block,
                              api_cidr_block, tunnel_cidr_block)
        cascaded_debug_en = aws_util.AWSInterface(self.debug_subnet_id,
                                                  self.cascaded_debug_ip)
        cascaded_base_en = aws_util.AWSInterface(self.base_subnet_id,
                                                 self.cascaded_base_ip)
        cascaded_api_en = aws_util.AWSInterface(self.api_subnet_id,
                                                self.cascaded_api_ip)
        cascaded_tunnel_en = aws_util.AWSInterface(self.tunnel_subnet_id,
                                                   self.cascaded_tunnel_ip)

        self.cascaded_vm = self.installer.create_vm(
            self.cascaded_image, self.cascaded_vm_type, cascaded_debug_en,
            cascaded_base_en, cascaded_api_en, cascaded_tunnel_en)
        self.cascaded_vm_id = self.cascaded_vm.id

        for interface in self.cascaded_vm.interfaces:
            if self.cascaded_api_ip == interface.private_ip_address:
                self.cascaded_api_interface_id = interface.id
                continue

            if self.cascaded_base_ip == interface.private_ip_address:
                self.cascaded_base_interface_id = interface.id
                continue

            if self.cascaded_debug_ip == interface.private_ip_address:
                self.cascaded_debug_interface_id = interface.id
                continue

            if self.cascaded_tunnel_ip == interface.private_ip_address:
                self.cascaded_tunnel_interface_id = interface.id
                continue

        cascaded_eip = self.installer.allocate_elastic_address()
        self.installer.associate_elastic_address(
            eip=cascaded_eip,
            network_interface_id=self.cascaded_api_interface_id)
        self.cascaded_eip_public_ip = cascaded_eip.public_ip
        self.cascaded_eip_allocation_id = cascaded_eip.allocation_id

        data_handler.write_cascaded(
            self.cloud_id, self.cascaded_vm_id, self.cascaded_eip_public_ip,
            self.cascaded_eip_allocation_id, self.cascaded_debug_ip,
            self.cascaded_debug_interface_id, self.cascaded_base_ip,
            self.cascaded_base_interface_id, self.cascaded_api_ip,
            self.cascaded_api_interface_id, self.cascaded_tunnel_ip,
            self.cascaded_tunnel_interface_id)
コード例 #2
0
def install_aws_proxy():
    vpc_info = _read_vpc_info()
    access_key = vpc_info["access_key"]
    secret_key = vpc_info["secret_key"]
    region = vpc_info["region"]
    az = vpc_info["az"]
    tunnel_subnet_id = vpc_info["tunnel_subnet_id"]
    base_subnet_id = vpc_info["base_subnet_id"]

    installer = aws_util.AWSInstaller(access_key, secret_key, region, az)

    tunnel_en = aws_util.AWSInterface(tunnel_subnet_id)
    base_en = aws_util.AWSInterface(base_subnet_id)

    proxy_install_conf = _read_install_conf()
    proxy_vm = installer.create_vm(proxy_install_conf["proxy_image"],
                                   proxy_install_conf["proxy_vm_type"],
                                   tunnel_en, base_en)
    aws_proxy_data_handler.add_new_proxy(proxy_vm.id)
コード例 #3
0
    def install_vpn(self, api_cidr_block, tunnel_cidr_block, local_api_cidr,
                    local_tunnel_cidr):
        if self.vpn_vm_id:
            return

        # install vpn vm
        self._get_vpn_ip(api_cidr_block, tunnel_cidr_block)
        vpn_api_en = aws_util.AWSInterface(self.api_subnet_id, self.vpn_api_ip)
        vpn_tunnel_en = aws_util.AWSInterface(self.tunnel_subnet_id,
                                              self.vpn_tunnel_ip)

        self.vpn_vm = self.installer.create_vm(self.vpn_image,
                                               self.vpn_vm_type, vpn_api_en,
                                               vpn_tunnel_en)
        self.vpn_vm_id = self.vpn_vm.id

        for interface in self.vpn_vm.interfaces:
            if self.vpn_api_ip == interface.private_ip_address:
                self.vpn_api_interface_id = interface.id

            elif self.vpn_tunnel_ip == interface.private_ip_address:
                self.vpn_tunnel_interface_id = interface.id

        self.installer.disable_network_interface_sdcheck(
            self.vpn_api_interface_id)
        self.installer.disable_network_interface_sdcheck(
            self.vpn_tunnel_interface_id)

        vpn_eip = self.installer.allocate_elastic_address()
        self.installer.associate_elastic_address(
            eip=vpn_eip, network_interface_id=self.vpn_api_interface_id)
        self.vpn_eip_public_ip = vpn_eip.public_ip
        self.vpn_eip_allocation_id = vpn_eip.allocation_id

        self.add_route("api", local_api_cidr)
        self.add_route("tunnel", local_tunnel_cidr)

        data_handler.write_vpn(self.cloud_id, self.vpn_vm_id,
                               self.vpn_eip_public_ip,
                               self.vpn_eip_allocation_id, self.vpn_api_ip,
                               self.vpn_tunnel_ip, self.vpn_api_interface_id,
                               self.vpn_tunnel_interface_id)
コード例 #4
0
    def install_ceph_cluster(self, api_cidr_block):
        if self.ceph_node1_ip:
            return

        # install ceph cluster
        self._get_ceph_cluster_ip(api_cidr_block)
        ceph_deploy_en = aws_util.AWSInterface(self.ceph_subnet_id,
                                               self.ceph_deploy_ip)
        ceph_deploy_vm = self.installer.create_vm(self.ceph_image,
                                                  self.ceph_vm_type,
                                                  ceph_deploy_en)

        self.ceph_deploy_vm_id = ceph_deploy_vm.id

        ceph_node1_en = aws_util.AWSInterface(self.ceph_subnet_id,
                                              self.ceph_node1_ip)
        ceph_node1_vm = self.installer.create_vm(self.ceph_image,
                                                 self.ceph_vm_type,
                                                 ceph_node1_en)
        self.ceph_node1_vm_id = ceph_node1_vm.id

        ceph_node2_en = aws_util.AWSInterface(self.ceph_subnet_id,
                                              self.ceph_node2_ip)
        ceph_node2_vm = self.installer.create_vm(self.ceph_image,
                                                 self.ceph_vm_type,
                                                 ceph_node2_en)
        self.ceph_node2_vm_id = ceph_node2_vm.id

        ceph_node3_en = aws_util.AWSInterface(self.ceph_subnet_id,
                                              self.ceph_node3_ip)
        ceph_node3_vm = self.installer.create_vm(self.ceph_image,
                                                 self.ceph_vm_type,
                                                 ceph_node3_en)
        self.ceph_node3_vm_id = ceph_node3_vm.id

        data_handler.write_ceph_cluster(
            self.cloud_id, self.ceph_deploy_vm_id, self.ceph_deploy_ip,
            self.ceph_node1_vm_id, self.ceph_node1_ip, self.ceph_node2_vm_id,
            self.ceph_node2_ip, self.ceph_node3_vm_id, self.ceph_node3_ip)
コード例 #5
0
    def install_v2v_gateway(self, api_cidr_block):
        if self.v2v_vm_id:
            return

        # install v2v gateway
        self._get_v2v_ip(api_cidr_block)
        v2v_en = aws_util.AWSInterface(self.api_subnet_id, self.v2v_ip)

        v2v_vm = self.installer.create_vm(self.v2v_image, self.v2v_vm_type,
                                          v2v_en)
        self.v2v_vm_id = v2v_vm.id

        data_handler.write_v2v_gateway(self.cloud_id, self.v2v_vm_id,
                                       self.v2v_ip)