コード例 #1
0
ファイル: distDocker.py プロジェクト: mojojojo99/Tango
 def getVMs(self):
     """ getVMs - Get all volumes of docker containers
     """
     machines = []
     try:
         hosts=socket.gethostbyname_ex(self.hostDNSPoolname)[2]
     except EnvironmentError:
         return machines
     volumePath = self.getVolumePath('')
     for host in hosts:
         volumes = subprocess.check_output(["ssh"] + DistDocker._SSH_FLAGS +
                                             DistDocker._SSH_AUTH_FLAGS +
                                             ["%s@%s" % (self.hostUser, host),
                                             "(ls %s)" % volumePath]).decode('utf-8').split('\n')
         for volume in volumes:
             if re.match("%s-" % config.Config.PREFIX, volume):
                 machine = TangoMachine()
                 machine.vmms = 'distDocker'
                 machine.name = volume
                 machine.domain_name = host
                 machine.ssh_flags = DistDocker._SSH_AUTH_FLAGS
                 machine.use_ssh_master = False
                 volume_l = volume.split('-')
                 machine.id = volume_l[1]
                 machine.image = volume_l[2]
                 machines.append(machine)
     return machines
コード例 #2
0
    def getVMs(self):
        """ getVMs - Get all volumes of docker containers
        """
        machines = []
        volumePath = self.getVolumePath('')

        for host in self.hosts:
            volumes = subprocess.check_output(["ssh"] + DistDocker._SSH_FLAGS +
                                                DistDocker._SSH_AUTH_FLAGS +
                                                ["%s@%s" % (self.hostUser, host),
                                                "(ls %s)" % volumePath]).split('\n')
            for volume in volumes:
                if re.match("%s-" % config.Config.PREFIX, volume):
                    machine = TangoMachine()
                    machine.vmms = 'distDocker'
                    machine.name = volume
                    machine.domain_name = host
                    volume_l = volume.split('-')
                    machine.id = volume_l[1]
                    machine.image = volume_l[2]
                    machine.ssh_control_dir = tempfile.mkdtemp(prefix="tango-docker-ssh")
                    machine.ssh_flags = ['-o', 'ControlPath=' + os.path.join(machine.ssh_control_dir, "control")]
                    machine.use_ssh_master = config.Config.USE_SSH_MASTER
                    machines.append(machine)
        return machines
コード例 #3
0
ファイル: distDocker.py プロジェクト: cg2v/Tango
 def getVMs(self):
     """ getVMs - Get all volumes of docker containers
     """
     machines = []
     try:
         hosts=socket.gethostbyname_ex(self.hostDNSPoolname)[2]
     except EnvironmentError:
         return machines
     volumePath = self.getVolumePath('')
     for host in hosts:
         volumes = subprocess.check_output(["ssh"] + DistDocker._SSH_FLAGS +
                                             DistDocker._SSH_AUTH_FLAGS +
                                             ["%s@%s" % (self.hostUser, host),
                                             "(ls %s)" % volumePath]).split('\n')
         for volume in volumes:
             if re.match("%s-" % config.Config.PREFIX, volume):
                 machine = TangoMachine()
                 machine.vmms = 'distDocker'
                 machine.name = volume
                 machine.domain_name = host
                 machine.ssh_flags = DistDocker._SSH_AUTH_FLAGS
                 machine.use_ssh_master = False
                 volume_l = volume.split('-')
                 machine.id = volume_l[1]
                 machine.image = volume_l[2]
                 machines.append(machine)
     return machines