Skip to content

Commit

Permalink
fix(volumes): Virtual Machine Image might not list any attached volumes
Browse files Browse the repository at this point in the history
  • Loading branch information
adityahase committed Jan 2, 2025
1 parent 613e2a6 commit 0c95c88
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,10 @@ def get_root_volume(self):
if len(self.volumes) == 1:
return self.volumes[0]

return find(self.volumes, lambda v: v.device == "/dev/sda1")
volume = find(self.volumes, lambda v: v.device == "/dev/sda1")
if volume:
return volume
return frappe._dict({"size": 0})

def get_data_volume(self):
if not self.has_data_volume:
Expand All @@ -253,4 +256,7 @@ def get_data_volume(self):
if len(self.volumes) == 1:
return self.volumes[0]

return find(self.volumes, lambda v: v.device != "/dev/sda1")
volume = find(self.volumes, lambda v: v.device != "/dev/sda1")
if volume:
return volume
return frappe._dict({"size": 0})

0 comments on commit 0c95c88

Please sign in to comment.