def __init__(self, virtapi, read_only=False):
    super(LibvirtDriver, self).__init__(virtapi)
    global libvirt
    if (libvirt is None):
        libvirt = importutils.import_module('libvirt')
    self._skip_list_all_domains = False
    self._host_state = None
    self._initiator = None
    self._fc_wwnns = None
    self._fc_wwpns = None
    self._wrapped_conn = None
    self._wrapped_conn_lock = threading.Lock()
    self._caps = None
    self._vcpu_total = 0
    self.read_only = read_only
    self.firewall_driver = firewall.load_driver(DEFAULT_FIREWALL_DRIVER, self.virtapi, get_connection=self._get_connection)
    self.vif_driver = libvirt_vif.LibvirtGenericVIFDriver(self._get_connection)
    self.volume_drivers = driver.driver_dict_from_config(CONF.libvirt.volume_drivers, self)
    self.dev_filter = pci_whitelist.get_pci_devices_filter()
    self._event_queue = None
    self._disk_cachemode = None
    self.image_cache_manager = imagecache.ImageCacheManager()
    self.image_backend = imagebackend.Backend(CONF.use_cow_images)
    self.disk_cachemodes = {}
    self.valid_cachemodes = ['default', 'none', 'writethrough', 'writeback', 'directsync', 'unsafe']
    self._conn_supports_start_paused = (CONF.libvirt.virt_type in ('kvm', 'qemu'))
    for mode_str in CONF.libvirt.disk_cachemodes:
        (disk_type, sep, cache_mode) = mode_str.partition('=')
        if (cache_mode not in self.valid_cachemodes):
            LOG.warn(_LW('Invalid cachemode %(cache_mode)s specified for disk type %(disk_type)s.'), {'cache_mode': cache_mode, 'disk_type': disk_type})
            continue
        self.disk_cachemodes[disk_type] = cache_mode
    self._volume_api = volume.API()
    self._image_api = image.API()
def __init__(self, virtapi, read_only=False):
    super(LibvirtDriver, self).__init__(virtapi)
    global libvirt
    if (libvirt is None):
        libvirt = importutils.import_module('libvirt')
    self._skip_list_all_domains = False
    self._host_state = None
    self._initiator = None
    self._fc_wwnns = None
    self._fc_wwpns = None
    self._wrapped_conn = None
    self._wrapped_conn_lock = threading.Lock()
    self._caps = None
    self._vcpu_total = 0
    self.read_only = read_only
    self.firewall_driver = firewall.load_driver(DEFAULT_FIREWALL_DRIVER, self.virtapi, get_connection=self._get_connection)
    self.vif_driver = libvirt_vif.LibvirtGenericVIFDriver(self._get_connection)
    self.volume_drivers = driver.driver_dict_from_config(CONF.libvirt.volume_drivers, self)
    self.dev_filter = pci_whitelist.get_pci_devices_filter()
    self._event_queue = None
    self._disk_cachemode = None
    self.image_cache_manager = imagecache.ImageCacheManager()
    self.image_backend = imagebackend.Backend(CONF.use_cow_images)
    self.disk_cachemodes = {}
    self.valid_cachemodes = ['default', 'none', 'writethrough', 'writeback', 'directsync', 'unsafe']
    self._conn_supports_start_paused = (CONF.libvirt.virt_type in ('kvm', 'qemu'))
    for mode_str in CONF.libvirt.disk_cachemodes:
        (disk_type, sep, cache_mode) = mode_str.partition('=')
        if (cache_mode not in self.valid_cachemodes):
            LOG.warn(_LW('Invalid cachemode %(cache_mode)s specified for disk type %(disk_type)s.'), {'cache_mode': cache_mode, 'disk_type': disk_type})
            continue
        self.disk_cachemodes[disk_type] = cache_mode
    self._volume_api = volume.API()
    self._image_api = image.API()