コード例 #1
0
ファイル: Interface.py プロジェクト: Jumpscale/sandbox_osx
    def __init__(self,
                 controller,
                 bridge,
                 name=None,
                 mac=None,
                 interface_rate=None,
                 burst=None):
        """
        Interface object instance.

        @param controller object(j.sal.kvm.KVMController()): controller object to use.
        @param bridge object(j.sal.kvm.Network()): network object that create the bridge
        @param name str: name of interface
        @param mac str: mac address to be assigned to port
        @param interface_rate int: qos interface rate to bound to in Kb
        @param burst str: maximum allowed burst that can be reached in Kb/s
        """
        BaseKVMComponent.__init__(controller=controller)
        self.controller = controller
        self.name = name
        self.ovs = name is not None
        self.bridge = bridge
        self.qos = not (interface_rate is None)
        self.interface_rate = str(interface_rate)
        self.burst = burst
        if not (interface_rate is None) and burst is None:
            self.burst = str(int(interface_rate * 0.1))
        self.mac = mac if mac else Interface.generate_mac()
        self._ip = None
        self._iface = None
コード例 #2
0
    def __init__(self,
                 controller,
                 name,
                 disks,
                 nics,
                 memory,
                 cpucount,
                 cloud_init=False):
        """
        Machine object instance.

        @param contrller object(j.sal.kvm.KVMController()): controller object to use.
        @param name str: machine name
        @param disks [object(j.sal.kvm.Disk())]: list of disk instances to be used with machine.
        @param nics [object(j.sal.kvm.interface())]: instance of networks to be used with machine.
        @param memory int: disk memory in Mb.
        @param cpucount int: number of cpus to use.
        @param cloud_init bool: option to use cloud_init passing creating and passing ssh_keys,
         user name and passwd to the image
        """
        BaseKVMComponent.__init__(controller=controller)
        self.name = name
        self.disks = disks
        self.nics = nics
        self.memory = memory
        self.cpucount = cpucount
        self.controller = controller
        self.cloud_init = cloud_init
        self.image_path = "%s/%s_ci.iso" % (self.controller.base_path,
                                            self.name) if cloud_init else ""
        self._domain = None
        self._ip = None
        self._executor = None
コード例 #3
0
    def __init__(self,
                 controller,
                 pool,
                 name,
                 size,
                 image_name="",
                 disk_iops=None):
        """
        Disk object instance.

        @param controller object(j.sal.kvm.KVMController()): controller object to use.
        @param pool str: name of the pool to add disk to.
        @param name str: name of the disk.
        @param size int: size of disk in Gb.
        @param image_name  str: name of image to load on disk  if available.
        @param disk_iops int: total throughput limit in bytes per second.
        """
        BaseKVMComponent.__init__(controller=controller)
        self.size = size
        self.image_name = image_name
        self.controller = controller
        self.pool = pool
        self.name = name
        self.disk_iops = int(disk_iops) if disk_iops else None
        self._volume = None
コード例 #4
0
ファイル: Network.py プロジェクト: Jumpscale/sandbox_osx
    def __init__(self, controller, name, bridge=None, interfaces=[], ovs=True):
        """
        Instance of network object representation of open vstorage network.

        @param controller object: connection to libvirt controller.
        @param name string: name of network.
        @param bridge string: bridge name. if empty use the self.name as bridge name
        @param interfaces list: interfaces list.
        @param ovs boolean: use ovs to create bridge. if False use ip commands
        """
        BaseKVMComponent.__init__(controller=controller)
        self.name = name
        self.ovs = ovs
        self.bridge = bridge if bridge else name
        self._interfaces = interfaces
        self.controller = controller
        self._nw = None
コード例 #5
0
 def __init__(self, controller, domain, name, description=""):
     BaseKVMComponent.__init__(controller=controller)
     self.controller = controller
     self.domain = domain
     self.name = name
     self.description = description
コード例 #6
0
 def __init__(self, controller, name):
     BaseKVMComponent.__init__(controller=controller)
     self.controller = controller
     self.name = name
     self.poolpath = self.controller.executor.prefab.core.joinpaths(self.controller.base_path, self.name)
     self._lvpool = None
コード例 #7
0
 def __init__(self, controller):
     self.controller = controller
     BaseKVMComponent.__init__(controller=controller)