Добавлен учёт размеров заголовков таблицы разделов для виртуальных устройств

legacy27 3.6.4.6
Mike Hiretsky 5 years ago
parent ffa299c6f7
commit f5fd6dc487

@ -230,7 +230,7 @@ class VirtualDisk(SizeableDisk, DosDisk, GptDisk):
self.mount = mount self.mount = mount
self.part = part self.part = part
self.partid = partid self.partid = partid
self.size = round_disk_size(size) self.size = size
self.format = "" self.format = ""
def __init__(self, parent, dev, size): def __init__(self, parent, dev, size):
@ -330,6 +330,7 @@ class VirtualDisk(SizeableDisk, DosDisk, GptDisk):
class VirtualDosDisk(VirtualDisk, DosDisk): class VirtualDosDisk(VirtualDisk, DosDisk):
parttype = "dos" parttype = "dos"
header_size = Sizes().M
def write(self): def write(self):
res = super(VirtualDosDisk, self).write() res = super(VirtualDosDisk, self).write()
@ -338,6 +339,7 @@ class VirtualDosDisk(VirtualDisk, DosDisk):
class VirtualGptDisk(VirtualDisk, GptDisk): class VirtualGptDisk(VirtualDisk, GptDisk):
parttype = "gpt" parttype = "gpt"
header_size = Sizes().M + Sizes().Sector * 34
class VirtualLvm(SizeableDisk, LvmDisk): class VirtualLvm(SizeableDisk, LvmDisk):
@ -631,7 +633,7 @@ class RoundableVolumesBuilder(VolumesBuilder):
def is_roundable_size(self, size): def is_roundable_size(self, size):
if (size is not VolumesBuilder.SizeAllFree and size and if (size is not VolumesBuilder.SizeAllFree and size and
abs(size - self.free_size) < min(size * self.rounding, abs(size - self.free_size) < min(size * self.rounding,
100 * Sizes.M)): 110 * Sizes.M)):
return True return True
return False return False

Loading…
Cancel
Save