Esempio n. 1
0
    def from_thrift(thrift_object):
        flavor = Flavor.from_thrift(thrift_object.flavor_info)
        image = DiskImage.from_thrift(thrift_object.image)
        constraints = Disk.from_thrift_constraints(thrift_object)

        instance = Disk(thrift_object.id, flavor, thrift_object.persistent,
                        thrift_object.new_disk, thrift_object.capacity_gb,
                        image, None, constraints)

        if thrift_object.datastore:
            instance.datastore = thrift_object.datastore.id

        return instance
Esempio n. 2
0
    def from_thrift(thrift_object):
        instance = Vm(
            vm_id=thrift_object.id,
            flavor=Flavor.from_thrift(thrift_object.flavor_info),
            state=State(thrift_object.state),
            environment=thrift_object.environment,
        )
        if thrift_object.disks:
            instance.disks = [Disk.from_thrift(d) for d in thrift_object.disks]
        if thrift_object.datastore:
            instance.datastore = thrift_object.datastore.id

        if thrift_object.resource_constraints:
            instance.resource_constraints = thrift_object.resource_constraints

        return instance
Esempio n. 3
0
    def from_thrift(thrift_object):
        instance = Vm(
            vm_id=thrift_object.id,
            flavor=Flavor.from_thrift(thrift_object.flavor_info),
            state=State(thrift_object.state),
            environment=thrift_object.environment,
        )
        if thrift_object.disks:
            instance.disks = [Disk.from_thrift(d) for d in thrift_object.disks]
        if thrift_object.datastore:
            instance.datastore = thrift_object.datastore.id

        if thrift_object.resource_constraints:
            instance.resource_constraints = \
                thrift_object.resource_constraints

        return instance
Esempio n. 4
0
    def from_thrift(thrift_object):
        flavor = Flavor.from_thrift(thrift_object.flavor_info)
        image = DiskImage.from_thrift(thrift_object.image)
        constraints = Disk.from_thrift_constraints(thrift_object)

        instance = Disk(
            thrift_object.id,
            flavor,
            thrift_object.persistent,
            thrift_object.new_disk,
            thrift_object.capacity_gb,
            image,
            None,
            constraints,
        )

        if thrift_object.datastore:
            instance.datastore = thrift_object.datastore.id

        return instance