Example #1
0
    def getJobIds(self):
        vm_ids = []
        cmd = 'onevm list all --list ID'

        if self.version == 'OpenNebula 2':
            cmd = 'onevm list all --list id'

        rc, stdout, stderr = iexe_cmd(cmd)

        for line in stdout:
            l = line.strip()
            if representsInt(l):
                vm_ids.append(l)
        return vm_ids
Example #2
0
    def getJobIds(self):
        vm_ids = []
        cmd = 'onevm list all --list ID'

        if self.version == 'OpenNebula 2':
            cmd = 'onevm list all --list id'

        rc,stdout,stderr = iexe_cmd(cmd)

        for line in stdout:
            l = line.strip()
            if representsInt(l):
                vm_ids.append(l)
        return vm_ids
Example #3
0
    def getJobsInfoFiltered(self, cols=None):
        info = {}

        if cols == None:
            return info

        if not isList(cols):
            raise "Unsupported data type for cols. Should be None or list"

        if len(cols) == 0:
            return info

        cmd = 'onevm list all --list %s' % (string.join(cols)).replace(' ',',')
        rc, stdout, stderr = iexe_cmd(cmd)
        for line in stdout:
            entry = line.split()
            if (len(entry) == len(cols)) and (representsInt(entry[0])):
                info[entry[0]] = {}
                for i in range(len(cols)):
                    info[entry[0]][cols[i]] = entry[i]

        return info
Example #4
0
    def getJobsInfoFiltered(self, cols=None):
        info = {}

        if cols == None:
            return info

        if not isList(cols):
            raise "Unsupported data type for cols. Should be None or list"

        if len(cols) == 0:
            return info

        cmd = 'onevm list all --list %s' % (string.join(cols)).replace(
            ' ', ',')
        rc, stdout, stderr = iexe_cmd(cmd)
        for line in stdout:
            entry = line.split()
            if (len(entry) == len(cols)) and (representsInt(entry[0])):
                info[entry[0]] = {}
                for i in range(len(cols)):
                    info[entry[0]][cols[i]] = entry[i]

        return info