Reduce time needed for get_disks()
This commit is contained in:
parent
3922ed08a8
commit
e583929498
3 changed files with 10 additions and 6 deletions
|
|
@ -30,6 +30,7 @@ from wk.cfg.ddrescue import (
|
||||||
from wk.hw import disk as hw_disk
|
from wk.hw import disk as hw_disk
|
||||||
from wk.hw.smart import (
|
from wk.hw.smart import (
|
||||||
check_attributes,
|
check_attributes,
|
||||||
|
enable_smart,
|
||||||
smart_status_ok,
|
smart_status_ok,
|
||||||
update_smart_details,
|
update_smart_details,
|
||||||
)
|
)
|
||||||
|
|
@ -775,6 +776,12 @@ class State():
|
||||||
source_parts = select_disk_parts(self.mode, self.source)
|
source_parts = select_disk_parts(self.mode, self.source)
|
||||||
self.add_image_block_pairs(source_parts)
|
self.add_image_block_pairs(source_parts)
|
||||||
|
|
||||||
|
# Update SMART data
|
||||||
|
## TODO: Verify if needed
|
||||||
|
for dev in (self.source, self.destination):
|
||||||
|
enable_smart(dev)
|
||||||
|
update_smart_details(dev)
|
||||||
|
|
||||||
# Safety Checks #1
|
# Safety Checks #1
|
||||||
if self.mode == 'Clone':
|
if self.mode == 'Clone':
|
||||||
self.safety_check_destination()
|
self.safety_check_destination()
|
||||||
|
|
|
||||||
|
|
@ -171,6 +171,9 @@ class State():
|
||||||
# Add HW Objects
|
# Add HW Objects
|
||||||
self.system = hw_system.System()
|
self.system = hw_system.System()
|
||||||
self.disks = hw_disk.get_disks(skip_kits=True)
|
self.disks = hw_disk.get_disks(skip_kits=True)
|
||||||
|
for disk in self.disks:
|
||||||
|
hw_smart.enable_smart(disk)
|
||||||
|
hw_smart.update_smart_details(disk)
|
||||||
|
|
||||||
# Add test objects
|
# Add test objects
|
||||||
for name, details in menu.options.items():
|
for name, details in menu.options.items():
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,8 @@ from wk.cfg.python import DATACLASS_DECORATOR_KWARGS
|
||||||
from wk.exe import get_json_from_command, run_program
|
from wk.exe import get_json_from_command, run_program
|
||||||
from wk.hw.test import Test
|
from wk.hw.test import Test
|
||||||
from wk.hw.smart import (
|
from wk.hw.smart import (
|
||||||
enable_smart,
|
|
||||||
generate_attribute_report,
|
generate_attribute_report,
|
||||||
get_known_disk_attributes,
|
get_known_disk_attributes,
|
||||||
update_smart_details,
|
|
||||||
)
|
)
|
||||||
from wk.std import PLATFORM, color_string, strip_colors
|
from wk.std import PLATFORM, color_string, strip_colors
|
||||||
|
|
||||||
|
|
@ -64,15 +62,11 @@ class Disk:
|
||||||
self.update_details()
|
self.update_details()
|
||||||
self.set_description()
|
self.set_description()
|
||||||
self.known_attributes = get_known_disk_attributes(self.model)
|
self.known_attributes = get_known_disk_attributes(self.model)
|
||||||
enable_smart(self)
|
|
||||||
update_smart_details(self)
|
|
||||||
if not self.attributes and self.bus == 'USB':
|
if not self.attributes and self.bus == 'USB':
|
||||||
# Try using SAT
|
# Try using SAT
|
||||||
LOG.warning('Using SAT for smartctl for %s', self.path)
|
LOG.warning('Using SAT for smartctl for %s', self.path)
|
||||||
self.notes = []
|
self.notes = []
|
||||||
self.use_sat = True
|
self.use_sat = True
|
||||||
enable_smart(self)
|
|
||||||
update_smart_details(self)
|
|
||||||
self.initial_attributes = copy.deepcopy(self.attributes)
|
self.initial_attributes = copy.deepcopy(self.attributes)
|
||||||
if not self.is_4k_aligned():
|
if not self.is_4k_aligned():
|
||||||
self.add_note('One or more partitions are not 4K aligned', 'YELLOW')
|
self.add_note('One or more partitions are not 4K aligned', 'YELLOW')
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue