Esempio n. 1
0
 def setupHosts1(self):
     self.setupHostGeneric(
         0, "T", False)  # configure basic hostTx vars; don't start thread
     self.setupHostGeneric(
         1, "R", False)  # configure basic hostRx vars; don't start thread
     # find NICs and log receiving NIC's description
     self.nicsTx, self.nicsRx = NICFinder(self.hostTx,
                                          self.hostRx).findNICs()
     libperf.logArg("rx_nic_desc", self.nicsRx.trans.desc)
     # determine network UUID (and create VLANs, if required)
     self.transNetUuidTx = self.hostTx.execdom0(
         "xe network-list bridge=%s params=uuid --minimal" %
         self.nicsTx.trans.bridge).strip()
     self.transNetUuidRx = self.hostRx.execdom0(
         "xe network-list bridge=%s params=uuid --minimal" %
         self.nicsRx.trans.bridge).strip()
     if self.use_vlan:
         pifUuidTx = self.hostTx.execdom0(
             "xe pif-list host-uuid=%s network-uuid=%s params=uuid --minimal"
             % (self.hostTx.uuid, self.transNetUuidTx)).strip()
         pifUuidRx = self.hostRx.execdom0(
             "xe pif-list host-uuid=%s network-uuid=%s params=uuid --minimal"
             % (self.hostRx.uuid, self.transNetUuidRx)).strip()
         self.transNetUuidTx = self.hostTx.execdom0(
             "xe network-create name-label=%s" % self.vlan_name).strip()
         self.transNetUuidRx = self.transNetUuidTx
         self.hostTx.execdom0(
             "xe vlan-create network-uuid=%s pif-uuid=%s vlan=%d" %
             (self.transNetUuidTx, pifUuidTx, self.vlan_tag))
         self.hostRx.execdom0(
             "xe vlan-create network-uuid=%s pif-uuid=%s vlan=%d" %
             (self.transNetUuidRx, pifUuidRx, self.vlan_tag))
     # configure host(s)
     threadTx = self.setupHostGeneric(0, "T",
                                      True)  # start thread for sender
     if self.num_hosts > 1:
         self.setupHostGeneric(1, "R", True).join(
         )  # if multiple hosts: start and join thread for receiver
     else:
         self.setupHostGeneric(
             0, "R", False)  # otherwise: configure "receiver" as sender
     threadTx.join()  # join thread for sender
Esempio n. 2
0
 def setupHosts1(self):
   self.setupHostGeneric(0, "T", False)                               # configure basic hostTx vars; don't start thread
   self.setupHostGeneric(1, "R", False)                               # configure basic hostRx vars; don't start thread
   # find NICs and log receiving NIC's description
   self.nicsTx, self.nicsRx = NICFinder(self.hostTx, self.hostRx).findNICs()
   libperf.logArg("rx_nic_desc", self.nicsRx.trans.desc)
   # determine network UUID (and create VLANs, if required)
   self.transNetUuidTx = self.hostTx.execdom0("xe network-list bridge=%s params=uuid --minimal" % self.nicsTx.trans.bridge).strip()
   self.transNetUuidRx = self.hostRx.execdom0("xe network-list bridge=%s params=uuid --minimal" % self.nicsRx.trans.bridge).strip()
   if self.use_vlan:
     pifUuidTx = self.hostTx.execdom0("xe pif-list host-uuid=%s network-uuid=%s params=uuid --minimal" % (self.hostTx.uuid, self.transNetUuidTx)).strip()
     pifUuidRx = self.hostRx.execdom0("xe pif-list host-uuid=%s network-uuid=%s params=uuid --minimal" % (self.hostRx.uuid, self.transNetUuidRx)).strip()
     self.transNetUuidTx = self.hostTx.execdom0("xe network-create name-label=%s" % self.vlan_name).strip()
     self.transNetUuidRx = self.transNetUuidTx
     self.hostTx.execdom0("xe vlan-create network-uuid=%s pif-uuid=%s vlan=%d" % (self.transNetUuidTx, pifUuidTx, self.vlan_tag))
     self.hostRx.execdom0("xe vlan-create network-uuid=%s pif-uuid=%s vlan=%d" % (self.transNetUuidRx, pifUuidRx, self.vlan_tag))
   # configure host(s)
   threadTx = self.setupHostGeneric(0, "T", True)                     # start thread for sender
   if self.num_hosts > 1: self.setupHostGeneric(1, "R", True).join()  # if multiple hosts: start and join thread for receiver
   else: self.setupHostGeneric(0, "R", False)                         # otherwise: configure "receiver" as sender
   threadTx.join()                                                    # join thread for sender
Esempio n. 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')
Esempio n. 4
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')