Beispiel #1
0
    def info_lvm(self, lvm_name):
        ""

        storage_conf = self.conf.get_storage_conf()
        storage_db = storage_conf['db_path']
        sql_tools = SqliteTools(storage_db)

        fetchone_sql = 'SELECT * FROM lvm WHERE lvmName = ? '
        data = lvm_name
        item = sql_tools.fetchone(fetchone_sql, data)
        infos = {}
        if item is not None:
            infos['lvm_name'] = item[0]
            infos['vg_name'] = item[1]
            infos['lvm_size'] = item[2]
            infos['lvm_dir'] = item[3]
            infos['mount_dir'] = item[4]
            infos['lvm_mkfs'] = item[5]
            infos['lvm_type'] = item[6]
            infos['createtime'] = item[7]
            infos['remark'] = item[8]
        else:
            return None

        return infos
Beispiel #2
0
    def info_vm(self, vm_name):
        ""

        virtual_conf = self.conf.get_virtual_conf()
        virtual_db = virtual_conf['db_path']
        sql_tools = SqliteTools(virtual_db)

        fetchone_sql = 'SELECT * FROM %s WHERE vmName = ? ' % VMTABLE
        data = vm_name
        item = sql_tools.fetchone(fetchone_sql, data)
        infos = {}
        if item is not None:
            infos['vm_name'] = item[0]
            infos['vm_file'] = item[1]
            infos['image_name'] = item[2]
            infos['image_file'] = item[3]
            infos['vm_size'] = item[4]
            infos['mem_size'] = item[5]
            infos['vcpus'] = item[6]

            infos['vnc_port'] = item[7]
            infos['vnc_passwd'] = item[8]
            infos['interfaces'] = item[9]
            infos['ip'] = item[10]

            infos['createtime'] = item[11]
            infos['remark'] = item[12]
        else:
            return None

        return infos
Beispiel #3
0
 def info_image(self,image_name):
     ""
     
     image_conf = self.conf.get_image_conf()
     images_db = image_conf['db_path']
     sql_tools = SqliteTools(images_db)
     
     fetchone_sql = 'SELECT * FROM images WHERE name = ? '
     data = image_name
     item = sql_tools.fetchone(fetchone_sql,data)
     infos = {}
     if item is not None:
         infos['imageid']   = item[0]
         infos['name']      = item[1]
         infos['system']    = item[2]
         infos['version']   = item[3]
         infos['arch']      = item[4]
         infos['machine']   = item[5]
         infos['size']      = item[6]
         infos['savepath']  = item[7]
         infos['ext']       = item[8]
         infos['status']    = item[9]
         infos['vtype']     = item[10]
         infos['createtime']= item[11]
         infos['remark']    = item[12]
     
     
     return infos
Beispiel #4
0
    def exist_disk(self, disk_name):
        ""

        virtual_conf = self.conf.get_virtual_conf()
        virtual_db = virtual_conf['db_path']
        sql_tools = SqliteTools(virtual_db)

        fetchall_sql = 'SELECT * FROM %s where diskName = ?' % DISKTABLE
        data = disk_name
        infos = sql_tools.fetchone(fetchall_sql, data)
        if infos is None:
            return False
        else:
            return True