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
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
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
def getVMs(self): """ getVMs - Executes and parses `docker ps` """ # Get all volumes of docker containers machines = [] volumePath = self.getVolumePath('') for volume in os.listdir(volumePath): if re.match("%s-" % config.Config.PREFIX, volume): machine = TangoMachine() machine.vmms = 'localDocker' machine.name = volume volume_l = volume.split('-') machine.id = volume_l[1] machine.image = volume_l[2] machines.append(machine) return machines
def getVMs(self): """ getVMs - Executes and parses `docker ps`. This function is a lot of parsing and can break easily. """ # Get all volumes of docker containers machines = [] volumePath = self.getVolumePath('') for volume in os.listdir(volumePath): if re.match("%s-" % config.Config.PREFIX, volume): machine = TangoMachine() machine.vmms = 'localDocker' machine.name = volume volume_l = volume.split('-') machine.id = volume_l[1] machine.image = volume_l[2] machines.append(machine) return machines
def getVMs(self): """getVMs - Executes and parses `docker ps`. This function is a lot of parsing and can break easily. """ # Get all volumes of docker containers machines = [] volumePath = self.getVolumePath("") for volume in os.listdir(volumePath): if re.match("%s-" % config.Config.PREFIX, volume): machine = TangoMachine() machine.vmms = "localDocker" machine.name = volume volume_l = volume.split("-") machine.id = volume_l[1] machine.image = volume_l[2] machines.append(machine) return machines
def getVMs(self): """ getVMs - Returns the complete list of VMs on this account. Each list entry is a boto.ec2.instance.Instance object. """ # TODO: Find a way to return vm objects as opposed ec2 instance # objects. instances = list() for i in self.connection.get_all_instances(): if i.id is not config.Config.TANGO_RESERVATION_ID: inst = i.instances.pop() if inst.state_code is config.Config.INSTANCE_RUNNING: instances.append(inst) vms = list() for inst in instances: vm = TangoMachine() vm.ec2_id = inst.id vm.name = str(inst.tags.get('Name')) self.log.debug('getVMs: Instance - %s, EC2 Id - %s' % (vm.name, vm.ec2_id)) vms.append(vm) return vms
def getVMs(self): """getVMs - Returns the complete list of VMs on this account. Each list entry is a boto.ec2.instance.Instance object. """ # TODO: Find a way to return vm objects as opposed ec2 instance # objects. instances = list() for i in self.connection.get_all_instances(): if i.id is not config.Config.TANGO_RESERVATION_ID: inst = i.instances.pop() if inst.state_code is config.Config.INSTANCE_RUNNING: instances.append(inst) vms = list() for inst in instances: vm = TangoMachine() vm.ec2_id = inst.id vm.name = str(inst.tags.get("Name")) self.log.debug("getVMs: Instance - %s, EC2 Id - %s" % (vm.name, vm.ec2_id)) vms.append(vm) return vms