Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions mtda/storage/qemu.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,23 @@ def probe(self):
def commit(self, ignore_missing=False):
if self.cow is None:
if ignore_missing:
return
return True
raise MissingCowDeviceError('commit')

cmd = ['qemu-img', 'commit', self.cow]
subprocess.check_call(cmd)
return True

def rollback(self, ignore_missing=False):
if self.cow is None:
if ignore_missing:
return
return True
raise MissingCowDeviceError('rollback')

cmd = ['qemu-img', 'create', '-F', 'raw', '-f', 'qcow2',
'-b', self.file, self.cow, f'{self.size}M']
subprocess.check_call(cmd)
return True

def supports_hotplug(self):
return True
Expand Down
6 changes: 4 additions & 2 deletions mtda/storage/usbf.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def configure_systemd(self, dir):
def rollback(self, ignore_missing=False):
if self.cow_device is None:
if ignore_missing:
return
return True
raise MissingCowDeviceError('rollback')

subprocess.run(['/sbin/kpartx', '-dv', f"/dev/mapper/{DM_COW}"])
Expand All @@ -165,11 +165,12 @@ def rollback(self, ignore_missing=False):
f"0 {self.base_size} snapshot "
f"{self.base_device} {self.cow_device} P 8"]
subprocess.check_call(cmd)
return True

def commit(self, ignore_missing=False):
if self.cow_device is None:
if ignore_missing:
return
return True
raise MissingCowDeviceError('commit')

# Trigger merge
Expand Down Expand Up @@ -222,6 +223,7 @@ def commit(self, ignore_missing=False):
f"0 {self.base_size} snapshot "
f"{self.base_device} {self.cow_device} P 8"]
subprocess.check_call(cmd)
return True

""" Get file used by the USB Function driver"""
def probe(self):
Expand Down
Loading