Exemplo n.º 1
0
    def _update_volumes(self):
        if not self.is_active():
            self._volumes = {}
            return

        (ignore, ignore, allvols) = pollhelpers.fetch_volumes(
            self.conn.get_backend(), self.get_backend(), self._volumes.copy(),
            lambda obj, key: vmmStorageVolume(self.conn, obj, key))
        self._volumes = allvols
Exemplo n.º 2
0
    def _update_volumes(self, force):
        if not self.is_active():
            self._volumes = []
            return
        if not force and self._volumes is not None:
            return

        keymap = dict((o.get_connkey(), o) for o in self._volumes or [])
        (ignore, ignore, allvols) = pollhelpers.fetch_volumes(
            self.conn.get_backend(), self.get_backend(), keymap,
            lambda obj, key: vmmStorageVolume(self.conn, obj, key))
        self._volumes = allvols
Exemplo n.º 3
0
    def _update_volumes(self, force):
        if not self.is_active():
            self._volumes = []
            return
        if not force and self._volumes is not None:
            return

        keymap = dict((o.get_connkey(), o) for o in self._volumes or [])
        (ignore, ignore, allvols) = pollhelpers.fetch_volumes(
            self.conn.get_backend(), self.get_backend(), keymap,
            lambda obj, key: vmmStorageVolume(self.conn, obj, key))
        self._volumes = allvols
Exemplo n.º 4
0
    def _update_volumes(self, force):
        if not self.is_active():
            self._volumes = []
            return
        if not force and self._volumes is not None:
            return

        keymap = dict((o.get_name(), o) for o in self._volumes or [])
        def cb(obj, key):
            return vmmStorageVolume(self.conn, obj, key)
        (dummy1, dummy2, allvols) = pollhelpers.fetch_volumes(
            self.conn.get_backend(), self.get_backend(), keymap, cb)
        self._volumes = allvols
Exemplo n.º 5
0
    def update_volumes(self, refresh=False):
        if not self.is_active():
            self._volumes = {}
            return

        (ignore, new, allvols) = pollhelpers.fetch_volumes(
            self.conn.get_backend(), self.get_backend(), self._volumes.copy(),
            lambda obj, key: vmmStorageVolume(self.conn, obj, key))

        for volname in allvols:
            if volname not in new and refresh:
                allvols[volname].refresh_xml()
        self._volumes = allvols
Exemplo n.º 6
0
    def _fetch_all_vols_cached(self):
        key = self._FETCH_KEY_VOLS
        if key in self._fetch_cache:
            return self._fetch_cache[key]

        ret = []
        for xmlobj in self.fetch_all_pools():
            pool = self._libvirtconn.storagePoolLookupByName(xmlobj.name)
            ignore, ignore, vols = pollhelpers.fetch_volumes(
                self, pool, {}, lambda obj, ignore: obj)

            for vol in vols.values():
                try:
                    xml = vol.XMLDesc(0)
                    ret.append(StorageVolume(weakref.ref(self), parsexml=xml))
                except Exception, e:
                    logging.debug("Fetching volume XML failed: %s", e)