Exemplo n.º 1
0
 def __init__(self, instance):
     super(Foreman, self).__init__(instance)
     self.credentials = get_or_none_credentials_for(
         self.environment, CredentialType.FOREMAN
     )
     self._provider = None
     self.host_prov_client = HostProviderClient(self.environment)
Exemplo n.º 2
0
    def do(self):
        pod_metadata = self.client.read_namespaced_pod(self.pod_name,
                                                       'default')
        self.instance.address = pod_metadata.status.pod_ip
        self.instance.port = self.driver.default_port

        host = self.host
        host.address = self.instance.address
        host.save()
        hp_client = HostProviderClient(self.environment)
        hp_client.edit_host(host.identifier, payload={'address': host.address})
Exemplo n.º 3
0
    def do(self):
        host_provider_cli = HostProviderClient(self.infra.environment)
        vm = host_provider_cli.get_vm_by_host(self.host)
        cloudstack_offering_id = self.cs_provider.get_vm_offering_id(
            vm_id=vm.identifier,
            project_id=self.cs_credentials.project
        )

        if cloudstack_offering_id == self.target_offering_id:
            return

        success = self.cs_provider.change_service_for_vm(
            vm.identifier, self.target_offering_id
        )
        if not success:
            raise Exception("Could not change offering")
Exemplo n.º 4
0
    def equipments(self):
        equipments = []
        host_provider_cli = HostProviderClient(self.infra.environment)
        for instance in self.infra.instances.all():
            host = instance.hostname
            vm = host_provider_cli.get_vm_by_host(host)
            if vm is None:
                raise Exception(
                    "Cannot get information for host {} for identifier {}".
                    format(host, host.identifier))
            equipment = Equipment(
                '{}-{}'.format(self.api.vm_name, vm.identifier), host.address,
                instance.port)
            equipments.append(equipment)

        return equipments
 def __init__(self, instance):
     super(VolumeProviderBase, self).__init__(instance)
     self._credential = None
     self.host_prov_client = HostProviderClient(self.environment)
Exemplo n.º 6
0
 def __init__(self, instance=None):
     super(VipProviderStep, self).__init__(instance)
     self.credentials = None
     self._provider = None
     self.host_prov_client = HostProviderClient(self.environment)