* don't refresh the whole device list after each plugin run, but just refresh the current device

This commit is contained in:
lars 2009-06-11 23:14:58 +00:00
parent 94102a3575
commit 864d7091f6
3 changed files with 7 additions and 3 deletions

View File

@ -145,7 +145,7 @@ class CryptoBox:
+ "appropriate line to '/etc/super.tab'?") + "appropriate line to '/etc/super.tab'?")
def reread_container_list(self): def reread_container_list(self, reset_device=None):
"""Reinitialize the list of available containers. """Reinitialize the list of available containers.
This should be called whenever the available containers may have changed. This should be called whenever the available containers may have changed.
@ -153,7 +153,10 @@ class CryptoBox:
""" """
self.log.debug("rereading container list") self.log.debug("rereading container list")
self.__containers = [] self.__containers = []
blockdevice.CACHE.reset() if reset_device is None:
blockdevice.CACHE.reset()
else:
blockdevice.CACHE.reset(reset_device)
for device in blockdevice.Blockdevices().get_storage_devices(): for device in blockdevice.Blockdevices().get_storage_devices():
if self.is_device_allowed(device) and not self.is_config_partition(device): if self.is_device_allowed(device) and not self.is_config_partition(device):
self.__containers.append(cbxContainer.CryptoBoxContainer(device, self)) self.__containers.append(cbxContainer.CryptoBoxContainer(device, self))

View File

@ -171,7 +171,6 @@ class WebInterfaceDataset(dict):
del self[key] del self[key]
avail_counter = 0 avail_counter = 0
active_counter = 0 active_counter = 0
self.cbox.reread_container_list()
for container in self.cbox.get_container_list(): for container in self.cbox.get_container_list():
## useful if the container was changed during an action ## useful if the container was changed during an action
container.reset_object() container.reset_object()

View File

@ -354,6 +354,8 @@ class WebInterfaceSites:
## additionally: set the default template for plugins ## additionally: set the default template for plugins
if "volume" in plugin.plugin_capabilities: if "volume" in plugin.plugin_capabilities:
## maybe the state of the current volume was changed? ## maybe the state of the current volume was changed?
cryptobox.core.blockdevice.CACHE.reset(plugin.device)
plugin.device.reset()
self.__dataset.set_current_disk_state(plugin.device) self.__dataset.set_current_disk_state(plugin.device)
if not next_template: if not next_template:
next_template = { "plugin":"volume_mount", next_template = { "plugin":"volume_mount",