def mkvm_nosql(self, conn): hw_list = ['00:44:01:61:76:f7', '00:44:01:61:76:f8', '00:44:01:61:76:f9', '00:44:01:61:76:fA', '00:44:01:61:77:00', '00:44:01:61:77:01' ] ip_list = ['192.168.122.2', #'192.168.122.3', #'192.168.122.4', #'192.168.122.5', #'192.168.122.11', #'192.168.122.12' ] for pos in range(len(ip_list)): name = 'nosql-{0}'.format(pos) ubuntu_img_path = \ '/home/koder/vm_images/ubuntu-kvm-diff{0}.qcow2'\ .format(pos) hdd = HDDFileDevice(ubuntu_img_path, 'qcow2') vm = KVMDomain.construct(conn, True, name, 1024 * 1024, 1, hdd, ETHNetworkDevice(hw_list[pos], "vnet7", ip = ip_list[pos])) yield vm
def mkvm_testvm(self, conn): hw = '00:44:01:61:76:fC' ip = '192.168.122.7' ubuntu_img_path = '/home/koder/vm_images/ubuntu-kvm-diff4.qcow2' vm = KVMDomain.construct(conn, True, 'testvm', 1024 * 1024, 1, HDDFileDevice(ubuntu_img_path, 'qcow2'), ETHNetworkDevice(hw, "vnet7", ip=ip)) yield vm
def mkvm_ubuntu(self, conn): hw = '00:44:01:61:76:fD' ip = '192.168.122.9' ubuntu_img_path = '/home/koder/vm_images/Ubuntu_11_10_x64.qcow2' vm = KVMDomain.construct(conn, True, 'ubuntu_11_10', 2 * 1024 * 1024, 2, HDDFileDevice(ubuntu_img_path, 'qcow2'), ETHNetworkDevice(hw, "vnet7", ip=ip)) yield vm
def mkvm_nosql_root(self, conn): hw = '00:44:01:61:76:fB' ip = '192.168.122.6' ubuntu_img_path = '/home/koder/vm_images/ubuntu-kvm-test.qcow2' vm = KVMDomain.construct(conn, True, 'nosql-root', 1024 * 1024, 1, HDDFileDevice(ubuntu_img_path, 'qcow2'), ETHNetworkDevice(hw, "vnet7", ip=ip)) yield vm
def make_vm(hdd, ip, libvirt_url): from libvirtex.devices import ETHNetworkDevice from libvirtex.connection import open_libvirt, KVMDomain hw = "00:44:01:61:77:20" vm = KVMDomain.construct( open_libvirt(libvirt_url), True, "disk_test_vm", 1024 * 1024, 1, hdd, ETHNetworkDevice(hw, "vnet7", ip=ip) ) wait_ssh_ready(ip) return vm
def mkvm_nova(self, conn): hw = '00:44:01:61:78:01' ip = '192.168.122.225' fpath = '/home/koder/vm_images/ubuntu-server-nova-1.qcow2' vm = KVMDomain.construct(conn, True, 'nova', 1024 * 1024, 1, HDDFileDevice(fpath, 'qcow2'), HDDBlockDevice('/dev/vm_images/nova_images', dev='vdb'), ETHNetworkDevice(hw, "vnet7", ip=ip)) yield vm
def start(self): """starts container""" self.vm_file = "/tmp/{0}.qcow2".format(uuid.uuid1()) shell_exec('qemu-img create -f qcow2 -b "{0}" "{1}"'. format(self.img_file, self.vm_file)) self.vm = KVMDomain.construct(self.conn, True, self.name, 1024 * 1024, 1, HDDFileDevice(self.vm_file, type_='qcow2', dev='hda', bus='ide'), ETHNetworkDevice(self.hwaddr, "vnet7", ip=self.ip)) return self
def mkvm_testvm(self, conn): hw = '00:44:01:61:77:20' ip = '192.168.122.13' fname = os.environ['TEST_VM_DIMAGE'] if fname.endswith('qcow2'): hdd = HDDFileDevice(fname, 'qcow2') elif fname.endswith('raw'): hdd = HDDFileDevice(fname, 'raw') elif fname.startswith('/dev/'): hdd = HDDBlockDevice(fname, 'raw') vm = KVMDomain.construct(conn, True, 'disk_test_vm', 1024 * 1024, 1, hdd, ETHNetworkDevice(hw, "vnet7", ip=ip)) yield vm