예제 #1
0
    def createClients(self, host):
        # Run synexec on the controller to allow this to work on any hypervisor
        libsynexec.initialise_master_on_controller(self.jobid)

        # Install 'client00'
        xenrt.TEC().progress("Installing client zero")
        self.clientvms.append(self.createVM(host, "client00"))

        # Copy synexec slave binary to 'client00'
        libsynexec.initialise_slave(self.clientvms[0])

        # Install apache tools on client00
        self.clientvms[0].execguest("apt-get -y --force-yes install apache2-utils")

        # Shutdown client00 for cloning
        self.clientvms[0].shutdown()

        # Install more VMs as appropriate
        for i in range(1, self.numclients):
            xenrt.TEC().progress("Installing client VM %d" % i)

            # Clone original VM
            self.clientvms.append(self.clientvms[0].cloneVM(name="client%02d" % i))
            self.clientvms[i].start()

        # Restart client00
        self.clientvms[0].start()
예제 #2
0
    def run(self, arglist=None):
        self.changeNrDom0vcpus(self.host, self.dom0vcpus)

        libsynexec.initialise_master_on_controller(self.jobid)

        guests = self.host.guests.values()
        self.installTemplate(guests)

        # Create SRs on the given devices
        for device in self.devices:
            if device == "default":
                sr = self.host.lookupDefaultSR()
                self.sr_to_diskname[sr] = "default"
            elif device.startswith("/dev/nullb"):
                sr = self.setup_null_device(device)
                self.sr_to_diskname[sr] = device.split(":")[0]
            elif device.startswith("xen-sr="):
                device = sr = device.split('=')[1]
                self.sr_to_diskname[sr] = sr.split("-")[0]
            elif device.startswith("xen-srname="):
                srname = device.split('=')[1]
                sr = self.host.minimalList("sr-list", args="name-label=%s" % (srname))[0]
                self.sr_to_diskname[sr] = sr.split("-")[0]
            elif device.startswith("xen-device="):
                device = device.split('=')[1]

                # Remove any existing SRs on the device
                uuids = self.host.minimalList("pbd-list",
                                              args="params=sr-uuid "
                                                   "device-config:device=%s" % device)
                for uuid in uuids:
                    self.host.forgetSR(uuids[0])

                diskname = self.host.execdom0("basename `readlink -f %s`" % device).strip()
                sr = xenrt.lib.xenserver.LVMStorageRepository(self.host, 'SR-%s' % diskname)
                sr.create(device)
                sr = sr.uuid
                self.sr_to_diskname[sr] = diskname
            elif device.startswith("esx-device="):
                device = sr = device.split('=')[1]

                diskname = 'local' + device[-1]
                disknum = ord(device[-1]) - ord('b')
                devices = self.host.execdom0("ls -1F /vmfs/devices/disks | grep -v '@' | grep -v ':' | sort").strip().split("\n")

                volumeinfo = self.host.execdom0("esxcli storage vmfs extent list").strip().split("\n")
                volumeinfo = volumeinfo[2:]
                rootdevice = ""
                for line in volumeinfo:
                    line = line.split()
                    if line[0] == "datastore1":
                        rootdevice = line[3]
                devices = sorted(filter(lambda dev: dev != rootdevice, devices))
                esxdev = devices[disknum]

                # Create the partition and format it
                size = self.host.execdom0('partedUtil get "/vmfs/devices/disks/%s" | head -n 1' % esxdev).strip().split(' ')[3]
                size = int(size) - 10240 # It doesn't seem to like using all the way up to the last sector
                self.host.execdom0('partedUtil setptbl "/vmfs/devices/disks/%s" gpt "1 2048 %d AA31E02A400F11DB9590000C2911D1B8 0"' % (esxdev, size))
                self.host.execdom0('vmkfstools -C vmfs5 -b 1m -S %s "/vmfs/devices/disks/%s:1"' % (diskname, esxdev))

                # Reload the host information until the new SR appears
                while diskname not in self.host.srs:
                    time.sleep(1)
                    self.host.existing()

                sr = self.host.getSRUUID(diskname)
                self.sr_to_diskname[sr] = diskname
            elif device.startswith("kvm-device="):
                device = device.split('=')[1]

                diskname = self.host.execdom0("basename `readlink -f %s`" % device).strip()
                srname = "SR-%s" % (diskname)
                sr = xenrt.lib.kvm.EXTStorageRepository(self.host, srname)
                sr.create(device)

                # Reload the host information until the new SR appears
                while srname not in self.host.srs:
                    time.sleep(1)
                    self.host.existing()
                    xenrt.TEC().logverbose("host has SRs %s" % (self.host.srs))

                sr = self.host.getSRUUID(srname)
                self.sr_to_diskname[sr] = diskname

            # Set the SR scheduler
            if device in self.disk_schedulers:
                self.changeDiskScheduler(self.host, sr, self.disk_schedulers[device])

            self.createVMsForSR(sr)

        # Log the IO engine used, for RAGE

        libperf.logArg("ioengine", self.bench)

        if self.prepopulate:
            if self.windows:
                self.runPrepopulateWindows()
            else:
                self.runPrepopulate()

        for i in range(self.write_iterations):
            if self.windows:
                self.runPhaseWindows(i, 'w')
            else:
                self.runPhase(i, 'w')

        for i in range(self.read_iterations):
            if self.windows:
                self.runPhaseWindows(i, 'r')
            else:
                self.runPhase(i, 'r')
예제 #3
0
    def run(self, arglist=None):
        self.changeNrDom0vcpus(self.host, self.dom0vcpus)

        libsynexec.initialise_master_on_controller(self.jobid)

        guests = self.host.guests.values()
        self.installTemplate(guests)

        # Create SRs on the given devices
        for device in self.devices:
            if device == "default":
                sr = self.host.lookupDefaultSR()
                self.sr_to_diskname[sr] = "default"
            elif device.startswith("/dev/nullb"):
                sr = self.setup_null_device(device)
                self.sr_to_diskname[sr] = device.split(":")[0]
            elif device.startswith("xen-sr="):
                device = sr = device.split('=')[1]
                self.sr_to_diskname[sr] = sr.split("-")[0]
            elif device.startswith("xen-srname="):
                srname = device.split('=')[1]
                sr = self.host.minimalList("sr-list",
                                           args="name-label=%s" % (srname))[0]
                self.sr_to_diskname[sr] = sr.split("-")[0]
            elif device.startswith("xen-device="):
                device = device.split('=')[1]

                # Remove any existing SRs on the device
                uuids = self.host.minimalList("pbd-list",
                                              args="params=sr-uuid "
                                              "device-config:device=%s" %
                                              device)
                for uuid in uuids:
                    self.host.forgetSR(uuids[0])

                diskname = self.host.execdom0("basename `readlink -f %s`" %
                                              device).strip()
                sr = xenrt.lib.xenserver.LVMStorageRepository(
                    self.host, 'SR-%s' % diskname)
                sr.create(device)
                sr = sr.uuid
                self.sr_to_diskname[sr] = diskname
            elif device.startswith("esx-device="):
                device = sr = device.split('=')[1]

                diskname = 'local' + device[-1]
                disknum = ord(device[-1]) - ord('b')
                devices = self.host.execdom0(
                    "ls -1F /vmfs/devices/disks | grep -v '@' | grep -v ':' | sort"
                ).strip().split("\n")

                volumeinfo = self.host.execdom0(
                    "esxcli storage vmfs extent list").strip().split("\n")
                volumeinfo = volumeinfo[2:]
                rootdevice = ""
                for line in volumeinfo:
                    line = line.split()
                    if line[0] == "datastore1":
                        rootdevice = line[3]
                devices = sorted(filter(lambda dev: dev != rootdevice,
                                        devices))
                esxdev = devices[disknum]

                # Create the partition and format it
                size = self.host.execdom0(
                    'partedUtil get "/vmfs/devices/disks/%s" | head -n 1' %
                    esxdev).strip().split(' ')[3]
                size = int(
                    size
                ) - 10240  # It doesn't seem to like using all the way up to the last sector
                self.host.execdom0(
                    'partedUtil setptbl "/vmfs/devices/disks/%s" gpt "1 2048 %d AA31E02A400F11DB9590000C2911D1B8 0"'
                    % (esxdev, size))
                self.host.execdom0(
                    'vmkfstools -C vmfs5 -b 1m -S %s "/vmfs/devices/disks/%s:1"'
                    % (diskname, esxdev))

                # Reload the host information until the new SR appears
                while diskname not in self.host.srs:
                    time.sleep(1)
                    self.host.existing()

                sr = self.host.getSRUUID(diskname)
                self.sr_to_diskname[sr] = diskname
            elif device.startswith("kvm-device="):
                device = device.split('=')[1]

                diskname = self.host.execdom0("basename `readlink -f %s`" %
                                              device).strip()
                srname = "SR-%s" % (diskname)
                sr = xenrt.lib.kvm.EXTStorageRepository(self.host, srname)
                sr.create(device)

                # Reload the host information until the new SR appears
                while srname not in self.host.srs:
                    time.sleep(1)
                    self.host.existing()
                    xenrt.TEC().logverbose("host has SRs %s" % (self.host.srs))

                sr = self.host.getSRUUID(srname)
                self.sr_to_diskname[sr] = diskname

            # Set the SR scheduler
            if device in self.disk_schedulers:
                self.changeDiskScheduler(self.host, sr,
                                         self.disk_schedulers[device])

            self.createVMsForSR(sr)

        # Log the IO engine used, for RAGE

        libperf.logArg("ioengine", self.bench)

        if self.prepopulate:
            if self.windows:
                self.runPrepopulateWindows()
            else:
                self.runPrepopulate()

        for i in range(self.write_iterations):
            if self.windows:
                self.runPhaseWindows(i, 'w')
            else:
                self.runPhase(i, 'w')

        for i in range(self.read_iterations):
            if self.windows:
                self.runPhaseWindows(i, 'r')
            else:
                self.runPhase(i, 'r')