def create(self, sr_uuid, size): if util.pathexists(self.blockdevice): util.zeroOut(self.blockdevice, 0, 1024 * 1024) cmd = ["mkfs", "-t", "ocfs2", "-b", "4K", "-C", "1M", "-N", "16", "-F", self.blockdevice] try: ret = util.pread(cmd) except util.CommandException, inst: raise xs_errors.XenError("OCFSFilesystem", opterr="mkfs failed error %d" % os.strerror(inst.code))
def create(self, sr_uuid, size): if util.pathexists(self.blockdevice): util.zeroOut(self.blockdevice, 0, 1024*1024) cmd = ['mkfs', '-t', 'ocfs2', '-b', '4K', '-C', '1M', '-N', '16', '-F', self.blockdevice ] try: ret = util.pread(cmd) except util.CommandException, inst: raise xs_errors.XenError('OCFSFilesystem', \ opterr='mkfs failed error %d' % os.strerror(inst.code))
def create(self, sr_uuid, size): if util.pathexists(self.blockdevice): util.zeroOut(self.blockdevice, 0, 1024 * 1024) cmd = [ 'mkfs', '-t', 'ocfs2', '-b', '4K', '-C', '1M', '-N', '16', '-F', self.blockdevice ] try: ret = util.pread(cmd) except util.CommandException, inst: raise xs_errors.XenError('OCFSFilesystem', \ opterr='mkfs failed error %d' % os.strerror(inst.code))
def PerformSRControlPathTests(session, sr_ref): e = None try: checkPoint = 0 vdi_ref = None vbd_ref = None retVal = True (retVal, vdi_ref, vbd_ref, vdi_size) = CreateMaxSizeVDIAndVBD(session, sr_ref) if not retVal: raise Exception("Failed to create max size VDI and VBD.") checkPoint += 2 # Now try to zero out the entire disk Print(" Now attempt to write the maximum number of bytes on this newly plugged device.") devicename = "/dev/" + session.xenapi.VBD.get_device(vbd_ref) XenCertPrint("First finding out the time taken to write 1GB on the device.") timeFor512MiBSec = FindTimeToWriteData(devicename, 512) timeToWrite = int((float(vdi_size) / (1024 * 1024 * 1024)) * (timeFor512MiBSec * 2)) if timeToWrite > timeLimitControlInSec: raise Exception( "Writing through this device will take more than %s hours, please use a source upto %s GiB in size." % (timeLimitControlInSec / 3600, timeLimitControlInSec / (timeFor512MiBSec * 2)) ) minutes = 0 hrs = 0 if timeToWrite > 60: minutes = int(timeToWrite / 60) timeToWrite = int(timeToWrite - (minutes * 60)) if minutes > 60: hrs = int(minutes / 60) minutes = int(minutes - (hrs * 60)) Print(" START TIME: %s " % (time.asctime(time.localtime()))) if hrs > 0: Print(" APPROXIMATE RUN TIME: %s hours, %s minutes, %s seconds." % (hrs, minutes, timeToWrite)) elif minutes > 0: Print(" APPROXIMATE RUN TIME: %s minutes, %s seconds." % (minutes, timeToWrite)) elif timeToWrite > 0: Print(" APPROXIMATE RUN TIME: %s seconds." % (timeToWrite)) ddOutFile = "of=" + devicename bytes = 0 if not util.zeroOut(devicename, 1, int(vdi_size)): raise Exception( " - Could not write through the allocated disk space on test disk, please check the log for the exception details." ) displayOperationStatus(False) Print(" END TIME: %s " % (time.asctime(time.localtime()))) displayOperationStatus(True) checkPoint += 1 except Exception, e: Print("There was an exception performing control path stress tests. Exception: %s" % str(e)) retVal = False
def PerformSRControlPathTests(session, sr_ref): e = None try: checkPoint = 0 vdi_ref = None vbd_ref = None retVal = True (retVal, vdi_ref, vbd_ref, vdi_size) = CreateMaxSizeVDIAndVBD(session, sr_ref) if not retVal: raise Exception("Failed to create max size VDI and VBD.") checkPoint += 2 # Now try to zero out the entire disk Print(" Now attempt to write the maximum number of bytes on this newly plugged device.") devicename = '/dev/' + session.xenapi.VBD.get_device(vbd_ref) XenCertPrint("First finding out the time taken to write 1GB on the device.") timeFor512MiBSec = FindTimeToWriteData(devicename, 512) timeToWrite = int((float(vdi_size)/(1024*1024*1024)) * (timeFor512MiBSec * 2)) if timeToWrite > timeLimitControlInSec: raise Exception("Writing through this device will take more than %s hours, please use a source upto %s GiB in size." % (timeLimitControlInSec/3600, timeLimitControlInSec/(timeFor512MiBSec * 2))) minutes = 0 hrs = 0 if timeToWrite > 60: minutes = int(timeToWrite/60) timeToWrite = int(timeToWrite - (minutes * 60)) if minutes > 60: hrs = int(minutes/60) minutes = int(minutes - (hrs * 60)) Print(" START TIME: %s " % (time.asctime(time.localtime()))) if hrs > 0: Print(" APPROXIMATE RUN TIME: %s hours, %s minutes, %s seconds." % (hrs, minutes, timeToWrite)) elif minutes > 0: Print(" APPROXIMATE RUN TIME: %s minutes, %s seconds." % (minutes, timeToWrite)) elif timeToWrite > 0: Print(" APPROXIMATE RUN TIME: %s seconds." % (timeToWrite)) ddOutFile = 'of=' + devicename bytes = 0 if not util.zeroOut(devicename, 1, int(vdi_size)): raise Exception(" - Could not write through the allocated disk space on test disk, please check the log for the exception details.") displayOperationStatus(False) Print(" END TIME: %s " % (time.asctime(time.localtime()))) displayOperationStatus(True) checkPoint += 1 except Exception, e: Print("There was an exception performing control path stress tests. Exception: %s" % str(e)) retVal = False
def zeroOut_cmd(self): z = zeroOut() hireSel = [] sel = cmds.ls(sl=True) for i in sel: #del hireSel[0:len(hireSel)] cmds.select("%s" % i, hierarchy=True, add=True) ee = cmds.ls(sl=1) for j in ee: z.zeroOutJoint(j)
def delete(self, sr_uuid, vdi_uuid): # TODO: checks if no vbd exists log("Calling VDI DELLETE") if not self.sr.vdis.has_key(vdi_uuid): raise xs_errors.XenError('VDIUnavailable') if self.attached: raise xs_errors.XenError('VDIInUse') try : self.validate_iqn() self.attach(sr_uuid, vdi_uuid) util.zeroOut(self.path, 0, self.ZEROOUT_BLOCK_SIZE) self.detach(sr_uuid, vdi_uuid) except: pass self._db_forget() self.sr._updateStats(self.sr.uuid, -self.size)
def inflate(journaler, srUuid, vdiUuid, size): """Expand a VDI LV (and its VHD) to 'size'. If the LV is already bigger than that, it's a no-op. Does not change the virtual size of the VDI""" lvName = LV_PREFIX[vhdutil.VDI_TYPE_VHD] + vdiUuid vgName = VG_PREFIX + srUuid path = os.path.join(VG_LOCATION, vgName, lvName) lvmCache = journaler.lvmCache currSizeLV = lvmCache.getSize(lvName) newSize = calcSizeLV(size) if newSize <= currSizeLV: return journaler.create(JRN_INFLATE, vdiUuid, str(currSizeLV)) util.fistpoint.activate("LVHDRT_inflate_after_create_journal", srUuid) lvmCache.setSize(lvName, newSize) util.fistpoint.activate("LVHDRT_inflate_after_setSize", srUuid) util.zeroOut(path, newSize - vhdutil.VHD_FOOTER_SIZE, vhdutil.VHD_FOOTER_SIZE) util.fistpoint.activate("LVHDRT_inflate_after_zeroOut", srUuid) vhdutil.setSizePhys(path, newSize, False) util.fistpoint.activate("LVHDRT_inflate_after_setSizePhys", srUuid) journaler.remove(JRN_INFLATE, vdiUuid)
def __init__(self): self.disDMS = list() self.IKcurveAttatchLOC = list() self.IKcurveAttatchNUL = list() self.IKSubCon = list() self.IKSubNull = list() self.FKCon = list() self.FKNull = list() self.defaultGrp = defaultGroupNode() self.z = zeroOut() self.worldCON = ['place_CON', 'direction_CON', 'move_CON', 'root_CON'] self.trs = ['t', 'r', 's'] self.xyz = ['x', 'y', 'z'] self.XYZ = ['X', 'Y', 'Z']