コード例 #1
0
 def get_resource(self, disk_id):
     datastore = self.get_datastore(disk_id)
     if datastore is None:
         raise DiskNotFoundException(disk_id)
     resource = Disk(disk_id)
     resource.flavor = Flavor("default")  # TODO
     resource.persistent = False  # TODO
     resource.new_disk = False
     resource.capacity_gb = -1  # TODO
     resource.image = None
     resource.datastore = datastore
     return resource
コード例 #2
0
 def get_resource(self, disk_id):
     datastore = self.get_datastore(disk_id)
     if datastore is None:
         raise DiskNotFoundException(disk_id)
     resource = Disk(disk_id)
     resource.flavor = Flavor("default")  # TODO
     resource.persistent = False  # TODO
     resource.new_disk = False
     resource.capacity_gb = -1  # TODO
     resource.image = None
     resource.datastore = datastore
     return resource
コード例 #3
0
 def local_consume_disk_reservation(reservation_id):
     assert_that(reservation_id is "reservation_id_1")
     host_disk = HostDisk()
     host_disk.id = "disk_id_1"
     host_disk.flavor = HostFlavor("disk_flavor_1")
     host_disk.persistent = True
     host_disk.new_disk = True
     host_disk.capacity_gb = 2
     if placement:
         host_disk.placement = AgentResourcePlacement(
             AgentResourcePlacement.DISK, host_disk.id, placement)
     return [host_disk]
コード例 #4
0
 def local_consume_disk_reservation(reservation_id):
     assert_that(reservation_id is "reservation_id_1")
     host_disk = HostDisk()
     host_disk.id = "disk_id_1"
     host_disk.flavor = HostFlavor("disk_flavor_1")
     host_disk.persistent = True
     host_disk.new_disk = True
     host_disk.capacity_gb = 2
     if placement:
         host_disk.placement = AgentResourcePlacement(
             AgentResourcePlacement.DISK,
             host_disk.id,
             placement
         )
     return [host_disk]
コード例 #5
0
    def get_resource(self, disk_id):
        datastore = self.get_datastore(disk_id)
        if datastore is None:
            raise DiskNotFoundException(disk_id)

        size = os.path.getsize(self._disk_path(datastore, disk_id))

        resource = Disk(disk_id)
        resource.flavor = Flavor("default")
        resource.persistent = False
        resource.new_disk = False
        # Every one byte in fake world equals to one G byte in real world
        resource.capacity_gb = size
        resource.image = None
        resource.datastore = datastore
        return resource
コード例 #6
0
    def get_resource(self, disk_id):
        datastore = self.get_datastore(disk_id)
        if datastore is None:
            raise DiskNotFoundException(disk_id)

        size = os.path.getsize(self._disk_path(datastore, disk_id))

        resource = Disk(disk_id)
        resource.flavor = Flavor("default")
        resource.persistent = False
        resource.new_disk = False
        # Every one byte in fake world equals to one G byte in real world
        resource.capacity_gb = size
        resource.image = None
        resource.datastore = datastore
        return resource