Пример #1
0
class DBOva(db.Model):
    __tablename__ = "ova"

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.Text, nullable=False, unique=True)
    ovf = db.Column(db.Text, nullable=False)

    def __init__(self, name, ovf):
        self.name = name
        self.ovf = ovf

    def __repr__(self):
        return "<id {}>".format(self.id)
Пример #2
0
class DBScript(db.Model):
    __tablename__ = "script"

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.Text, nullable=False, unique=True)
    script = db.Column(db.Text, nullable=False)

    def __init__(self, name, script):
        self.name = name
        self.script = script

    def __repr__(self):
        return "<id {}>".format(self.id)
Пример #3
0
class DBUserdata(db.Model):
    __tablename__ = "userdata"

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.Text, nullable=False, unique=True)
    userdata = db.Column(db.Text, nullable=False)

    def __init__(self, name, userdata):
        self.name = name
        self.userdata = userdata

    def __repr__(self):
        return "<id {}>".format(self.id)
Пример #4
0
class DBStorageTemplate(db.Model):
    __tablename__ = "storage_template"

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.Text, nullable=False, unique=True)
    ova = db.Column(db.Integer, db.ForeignKey("ova.id"), nullable=True)

    def __init__(self, name, ova=None):
        self.name = name
        self.ova = ova

    def __repr__(self):
        return "<id {}>".format(self.id)
Пример #5
0
class DBNetworkElement(db.Model):
    __tablename__ = "network"

    id = db.Column(db.Integer, primary_key=True)
    network_template = db.Column(db.Integer,
                                 db.ForeignKey("network_template.id"),
                                 nullable=False)
    vni = db.Column(db.Text, nullable=False)

    def __init__(self, network_template, vni):
        self.network_template = network_template
        self.vni = vni

    def __repr__(self):
        return "<id {}>".format(self.id)
Пример #6
0
class DBStorageBenchmarks(db.Model):
    __tablename__ = "storage_benchmarks"

    id = db.Column(db.Integer, primary_key=True)
    job = db.Column(db.Text, nullable=False)
    test_format = db.Column(db.Integer,
                            nullable=False,
                            default=0,
                            server_default="0")
    result = db.Column(db.Text, nullable=False)

    def __init__(self, job, result, test_format):
        self.job = job
        self.result = result
        self.test_format = test_format

    def __repr__(self):
        return "<id {}>".format(self.id)
Пример #7
0
class DBProfile(db.Model):
    __tablename__ = "profile"

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.Text, nullable=False, unique=True)
    profile_type = db.Column(db.Text, nullable=False)
    system_template = db.Column(db.Integer,
                                db.ForeignKey("system_template.id"))
    network_template = db.Column(db.Integer,
                                 db.ForeignKey("network_template.id"))
    storage_template = db.Column(db.Integer,
                                 db.ForeignKey("storage_template.id"))
    userdata = db.Column(db.Integer, db.ForeignKey("userdata.id"))
    script = db.Column(db.Integer, db.ForeignKey("script.id"))
    ova = db.Column(db.Integer, db.ForeignKey("ova.id"))
    arguments = db.Column(db.Text)

    def __init__(
        self,
        name,
        profile_type,
        system_template,
        network_template,
        storage_template,
        userdata,
        script,
        ova,
        arguments,
    ):
        self.name = name
        self.profile_type = profile_type
        self.system_template = system_template
        self.network_template = network_template
        self.storage_template = storage_template
        self.userdata = userdata
        self.script = script
        self.ova = ova
        self.arguments = arguments

    def __repr__(self):
        return "<id {}>".format(self.id)
Пример #8
0
class DBStorageElement(db.Model):
    __tablename__ = "storage"

    id = db.Column(db.Integer, primary_key=True)
    storage_template = db.Column(db.Integer,
                                 db.ForeignKey("storage_template.id"),
                                 nullable=False)
    pool = db.Column(db.Text, nullable=False)
    disk_id = db.Column(db.Text, nullable=False)
    source_volume = db.Column(db.Text)
    disk_size_gb = db.Column(db.Integer)
    mountpoint = db.Column(db.Text)
    filesystem = db.Column(db.Text)
    filesystem_args = db.Column(db.Text)

    def __init__(
        self,
        storage_template,
        pool,
        disk_id,
        source_volume,
        disk_size_gb,
        mountpoint,
        filesystem,
        filesystem_args,
    ):
        self.storage_template = storage_template
        self.pool = pool
        self.disk_id = disk_id
        self.source_volume = source_volume
        self.disk_size_gb = disk_size_gb
        self.mountpoint = mountpoint
        self.filesystem = filesystem
        self.filesystem_args = filesystem_args

    def __repr__(self):
        return "<id {}>".format(self.id)
Пример #9
0
class DBOvaVolume(db.Model):
    __tablename__ = "ova_volume"

    id = db.Column(db.Integer, primary_key=True)
    ova = db.Column(db.Integer, db.ForeignKey("ova.id"), nullable=False)
    pool = db.Column(db.Text, nullable=False)
    volume_name = db.Column(db.Text, nullable=False)
    volume_format = db.Column(db.Text, nullable=False)
    disk_id = db.Column(db.Text, nullable=False)
    disk_size_gb = db.Column(db.Integer, nullable=False)

    def __init__(self, ova, pool, volume_name, volume_format, disk_id,
                 disk_size_gb):
        self.ova = ova
        self.pool = pool
        self.volume_name = volume_name
        self.volume_format = volume_format
        self.disk_id = disk_id
        self.disk_size_gb = disk_size_gb

    def __repr__(self):
        return "<id {}>".format(self.id)
Пример #10
0
class DBSystemTemplate(db.Model):
    __tablename__ = "system_template"

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.Text, nullable=False, unique=True)
    vcpu_count = db.Column(db.Integer, nullable=False)
    vram_mb = db.Column(db.Integer, nullable=False)
    serial = db.Column(db.Boolean, nullable=False)
    vnc = db.Column(db.Boolean, nullable=False)
    vnc_bind = db.Column(db.Text)
    node_limit = db.Column(db.Text)
    node_selector = db.Column(db.Text)
    node_autostart = db.Column(db.Boolean, nullable=False)
    migration_method = db.Column(db.Text)
    ova = db.Column(db.Integer, db.ForeignKey("ova.id"), nullable=True)

    def __init__(
        self,
        name,
        vcpu_count,
        vram_mb,
        serial,
        vnc,
        vnc_bind,
        node_limit,
        node_selector,
        node_autostart,
        migration_method,
        ova=None,
    ):
        self.name = name
        self.vcpu_count = vcpu_count
        self.vram_mb = vram_mb
        self.serial = serial
        self.vnc = vnc
        self.vnc_bind = vnc_bind
        self.node_limit = node_limit
        self.node_selector = node_selector
        self.node_autostart = node_autostart
        self.migration_method = migration_method
        self.ova = ova

    def __repr__(self):
        return "<id {}>".format(self.id)