コード例 #1
0
class Instance(compute_resource.ComputeResource):

    fields = {
        "state": wfields.StringField(default=InstanceState.ACTIVE.value),
        "memory": wfields.NonNegativeIntegerField(),
        "disk": wfields.IntegerField(),
        "disk_capacity": wfields.NonNegativeIntegerField(),
        "vcpus": wfields.NonNegativeIntegerField(),
    }

    def accept(self, visitor):
        raise NotImplementedError()
コード例 #2
0
class ComputeNode(compute_resource.ComputeResource):

    fields = {
        "id": wfields.NonNegativeIntegerField(),
        "hostname": wfields.StringField(),
        "status": wfields.StringField(default=ServiceState.ENABLED.value),
        "state": wfields.StringField(default=ServiceState.ONLINE.value),
        "memory": wfields.NonNegativeIntegerField(),
        "disk": wfields.IntegerField(),
        "disk_capacity": wfields.NonNegativeIntegerField(),
        "vcpus": wfields.NonNegativeIntegerField(),
    }

    def accept(self, visitor):
        raise NotImplementedError()
コード例 #3
0
ファイル: instance.py プロジェクト: crowdy/watcher
class Instance(compute_resource.ComputeResource):

    fields = {
        # If the resource is excluded by the scope,
        # 'watcher_exclude' property will be set True.
        "watcher_exclude": wfields.BooleanField(default=False),
        "state": wfields.StringField(default=InstanceState.ACTIVE.value),

        "memory": wfields.NonNegativeIntegerField(),
        "disk": wfields.IntegerField(),
        "disk_capacity": wfields.NonNegativeIntegerField(),
        "vcpus": wfields.NonNegativeIntegerField(),
        "metadata": wfields.JsonField(),
    }

    def accept(self, visitor):
        raise NotImplementedError()
コード例 #4
0
class ComputeNode(compute_resource.ComputeResource):

    fields = {
        "hostname": wfields.StringField(),
        "status": wfields.StringField(default=ServiceState.ENABLED.value),
        "disabled_reason": wfields.StringField(nullable=True),
        "state": wfields.StringField(default=ServiceState.ONLINE.value),
        "memory": wfields.NonNegativeIntegerField(),
        "memory_mb_reserved": wfields.NonNegativeIntegerField(),
        "disk": wfields.NonNegativeIntegerField(),
        "disk_gb_reserved": wfields.NonNegativeIntegerField(),
        "vcpus": wfields.NonNegativeIntegerField(),
        "vcpu_reserved": wfields.NonNegativeIntegerField(),
        "memory_ratio": wfields.NonNegativeFloatField(),
        "vcpu_ratio": wfields.NonNegativeFloatField(),
        "disk_ratio": wfields.NonNegativeFloatField(),
    }

    def accept(self, visitor):
        raise NotImplementedError()

    @property
    def memory_mb_capacity(self):
        return (self.memory - self.memory_mb_reserved) * self.memory_ratio

    @property
    def disk_gb_capacity(self):
        return (self.disk - self.disk_gb_reserved) * self.disk_ratio

    @property
    def vcpu_capacity(self):
        return (self.vcpus - self.vcpu_reserved) * self.vcpu_ratio
コード例 #5
0
class Volume(storage_resource.StorageResource):

    fields = {
        "size": wfields.NonNegativeIntegerField(),
        "status": wfields.StringField(default=VolumeState.AVAILABLE.value),
        "attachments": wfields.FlexibleListOfDictField(),
        "name": wfields.StringField(),
        "multiattach": wfields.BooleanField(),
        "snapshot_id": wfields.UUIDField(),
        "project_id": wfields.UUIDField(),
        "metadata": wfields.JsonField(),
        "bootable": wfields.BooleanField()
    }

    def accept(self, visitor):
        raise NotImplementedError()
コード例 #6
0
class Pool(storage_resource.StorageResource):

    fields = {
        "name": wfields.StringField(),
        "total_volumes": wfields.NonNegativeIntegerField(),
        "total_capacity_gb": wfields.NonNegativeIntegerField(),
        "free_capacity_gb": wfields.NonNegativeIntegerField(),
        "provisioned_capacity_gb": wfields.NonNegativeIntegerField(),
        "allocated_capacity_gb": wfields.NonNegativeIntegerField(),
        "virtual_free": wfields.NonNegativeIntegerField(default=0),
    }

    def accept(self, visitor):
        raise NotImplementedError()