def test_disks_capacity_gb(self): """Linked-cloned image disks are excluded from capacity calculation.""" image1 = DiskImage("disk_image1", DiskImage.COPY_ON_WRITE) image2 = DiskImage("disk_image2", DiskImage.FULL_COPY) disk1 = Disk(new_id(), DISK_FLAVOR, False, True, 1, image1) disk2 = Disk(new_id(), DISK_FLAVOR, False, True, 2, image2) disk3 = Disk(new_id(), DISK_FLAVOR, False, True, 3) disk4 = Disk(new_id(), DISK_FLAVOR, False, True, 4) disk5 = Disk(new_id(), DISK_FLAVOR, False, True, 5) disks = [disk1, disk2, disk3, disk4, disk5] assert_that(DiskUtil().disks_capacity_gb(disks), equal_to(14))
def __init__(self, hypervisor, option): self._logger = logging.getLogger(__name__) self._hypervisor = hypervisor self._option = option self._reserved_vms = {} self._reserved_disks = {} self._diskutil = DiskUtil() self._vm_manager = hypervisor.vm_manager self._image_manager = hypervisor.image_manager self._datastore_manager = hypervisor.datastore_manager self._system = hypervisor.system self._optimal_placement = OptimalPlaceEngine(self._datastore_manager, option) self._best_effort_placement = BestEffortPlaceEngine( self._datastore_manager, option) self._constrainted_placement = ConstraintDiskPlaceEngine( self._datastore_manager, option)