def _default_keymap(self): if (self.conn and support.check_conn_support(self.conn, support.SUPPORT_CONN_KEYMAP_AUTODETECT)): return None return _util.default_keymap()
def _set_conn(self, val): if not isinstance(val, libvirt.virConnect): raise ValueError(_("'conn' must be a libvirt connection object.")) if not support.check_conn_support(val, support.SUPPORT_CONN_INTERFACE): raise ValueError(_("Passed connection is not libvirt interface " "capable")) self._conn = val
def pool_list_from_sources(conn, name, pool_type, host=None): """ Return a list of StoragePool instances built from libvirt's pool source enumeration (if supported). @param conn: Libvirt connection @param name: Name for the new pool @param pool_type: Pool type string from L{Types} @param host: Option host string to poll for sources """ if not support.check_conn_support(conn, support.SUPPORT_CONN_FINDPOOLSOURCES): return [] pool_class = StoragePool.get_pool_class(pool_type) pool_inst = pool_class(conn=conn, name=name) if host: source_xml = "<source><host name='%s'/></source>" % host else: source_xml = "<source/>" try: xml = conn.findStoragePoolSources(pool_type, source_xml, 0) except libvirt.libvirtError, e: if support.is_error_nosupport(e): return [] raise
def pool_list_from_sources(conn, name, pool_type, host=None): """ Return a list of StoragePool instances built from libvirt's pool source enumeration (if supported). @param conn: Libvirt connection @param name: Name for the new pool @param pool_type: Pool type string from I{Types} @param host: Option host string to poll for sources """ if not support.check_conn_support(conn, support.SUPPORT_CONN_FINDPOOLSOURCES): return [] pool_class = StoragePool.get_pool_class(pool_type) pool_inst = pool_class(conn=conn, name=name) if host: source_xml = "<source><host name='%s'/></source>" % host else: source_xml = "<source/>" try: xml = conn.findStoragePoolSources(pool_type, source_xml, 0) except libvirt.libvirtError, e: if support.is_error_nosupport(e): return [] raise
def is_pci_detach_capable(conn): """ Check if the passed libvirt connection support pci device Detach/Reset @param conn: Connection to check @type conn: libvirt.virConnect @rtype: C{bool} """ return support.check_conn_support(conn, support.SUPPORT_NODEDEV_PCI_DETACH)
def is_nodedev_capable(conn): """ Check if the passed libvirt connection supports host device routines @param conn: Connection to check @type conn: libvirt.virConnect @rtype: C{bool} """ return support.check_conn_support(conn, support.SUPPORT_CONN_NODEDEV)
def is_storage_capable(conn): """check if virConnectPtr passed has storage API support""" return support.check_conn_support(conn, support.SUPPORT_CONN_STORAGE)