Beispiel #1
0
 def convert(self, boneTable):
     parentName = self.parent if self.parent else ""
     parentIndex = boneTable.get(self.parent, -1)
     matflat = [float(x) for x in self.bindmat.split(' ')]
     mat = np.array([matflat[0:3], matflat[3:6], matflat[6:9]])
     q = quaternions.mat2quat(mat)
     (px, py, pz) = [formatValue(v) for v in self.bindpos.split(' ')]
     (qw, qx, qy, qz) = [formatValue(v) for v in q]
     return f'\t"{self.name}"\t{parentIndex} ( {px} {py} {pz} ) ( {qx} {qy} {qz} )\t\t// {parentName}'
Beispiel #2
0
def getVmfsVolumes(volumes):
    '''Find VMFS volumes in a datastore set (argument "volumes").
    This is a counterpart to populateVmfsVolumesModel() in
    gui/storage_widgets.py.
    '''

    vmfsList = []
    for entry in volumes:
        name = entry.name
        size = util.formatValue(entry.getSize() / util.SIZE_MB)
        freeSpace = util.formatValue(entry.getFreeSize() / util.SIZE_MB)
        vmfsList.append([name, size, freeSpace])

    return vmfsList
Beispiel #3
0
def getVmfsVolumes(volumes):
    '''Find VMFS volumes in a datastore set (argument "volumes").
    This is a counterpart to populateVmfsVolumesModel() in
    gui/storage_widgets.py.
    '''

    vmfsList = []
    for entry in volumes:
        name = entry.name
        size = util.formatValue(entry.getSize() / util.SIZE_MB)
        freeSpace = util.formatValue(entry.getFreeSize() / util.SIZE_MB)
        vmfsList.append([name, size, freeSpace])

    return vmfsList
Beispiel #4
0
    def getPartitionEntry(self, device=""):
        """Returns a formatted list of options for the partitioning screen"""

        entry = []
        fsType = ""

        if self.getId() == -1:
            entry.append("Free space")
        else:
            entry.append("%s:%d" % (device, self.getId()))
        entry.append(self.getMountPoint())

        if self.fsType:
            entry.append(self.fsType.name)
        elif self.partitionType == EXTENDED:
            entry.append("Extended")
        elif self.partitionType & FREESPACE:
            entry.append("")
        else:
            entry.append("Unknown")

        # CPD - We should append a checkmark or something like that here
        if self.getFormat():
            entry.append("*")
        else:
            entry.append("")

        entry.append(util.formatValue(self.getLength() / 2))
        #entry.append(util.formatValueInMegabytes(self.getStartSector() / 2))
        #entry.append(util.formatValueInMegabytes(self.getEndSector() / 2))

        return entry
Beispiel #5
0
    def editEntry(self, entry):
        """Take a partition request and reconstruct our PartitionWindow
           from the request settings.
        """

        # XXX - might want to stick this into a hash
        mountPoint = self.xml.get_widget("PartitionMountpointComboBoxEntry")
        fsCombo = self.xml.get_widget("PartitionfsComboBox")
        minSizeEntry = self.xml.get_widget("PartitionminsizeEntry")
        minSizeCombo = self.xml.get_widget("PartitionsizeComboBox")
        maxSizeLabel = self.xml.get_widget("SetupvmdkmaxsizeLabel")

        mountPoint.child.set_text(entry.mountPoint)

        # Set the filesystem and mount point sensitivity
        for count, fsType in enumerate(fsCombo.get_model()):
            if fsType[1].name == entry.fsType.name:
                log.debug("Filesystem = " + entry.fsType.name)
                fsCombo.set_active(count)
                break
        self.checkFs(fsCombo)

        size, unit = util.formatValue(entry.minimumSize * util.SIZE_MB).split()
        minSizeEntry.set_text(size)
        minSizeCombo.set_active(sizeValues.index(unit))

        self.setMaxSize(entry.minimumSize)

        self.currentRequest = entry
        self.show()
Beispiel #6
0
def populateVmfsVolumesModel(view, scrolled, volumes):
    model = view.get_model()
    model.clear()

    iterType = model.insert_before(None, None)
    model.set_value(iterType, 0, "Datastores")

    for entry in volumes:
        name = entry.name

        size = util.formatValue(entry.getSize() / util.SIZE_MB)
        freeSpace = util.formatValue(entry.getFreeSize() / util.SIZE_MB)

        diskIter = model.append(iterType, [name, size, freeSpace])

    view.expand_all()
    scrolled.show_all()
    findFirstSelectableRow(model, view)
Beispiel #7
0
def populateVmfsVolumesModel(view, scrolled, volumes):
    model = view.get_model()
    model.clear()

    iterType = model.insert_before(None, None)
    model.set_value(iterType, 0, "Datastores")

    for entry in volumes:
        name = entry.name

        size = util.formatValue(entry.getSize() / util.SIZE_MB)
        freeSpace = util.formatValue(entry.getFreeSize() / util.SIZE_MB)

        diskIter = model.append(iterType, [name, size, freeSpace])

    view.expand_all()
    scrolled.show_all()
    findFirstSelectableRow(model, view)
Beispiel #8
0
def reviewStorage(values):
    allReqs = partition.PartitionRequestSet()

    values['esxDriveName'] = ""

    newVmfs = False
    devices = userchoices.getPhysicalPartitionRequestsDevices()
    for dev in devices:
        reqs = userchoices.getPhysicalPartitionRequests(dev)
        reqs.fitRequestsOnDevice()
        bootPart = reqs.findRequestByMountPoint('/boot')
        if bootPart:
            values['esxDriveName'] = htmlEscape(dev)

        for req in reqs:
            if isinstance(req.fsType, fsset.vmfs3FileSystem):
                newVmfs = True
                
        allReqs += reqs

    if newVmfs:
        values['datastoreType'] = 'New'
    else:
        values['datastoreType'] = 'Existing'

    vdevices = userchoices.getVirtualDevices()
    for vdevChoice in vdevices:
        vdev = vdevChoice['device']
        values['datastoreName'] = htmlEscape(vdev.vmfsVolume)
        if vdev.physicalDeviceName:
            values['datastoreDev'] = htmlEscape(vdev.physicalDeviceName)
        else:
            datastoreSet = datastore.DatastoreSet()
            cosVolume = datastoreSet.getEntryByName(vdev.vmfsVolume)
            values['datastoreDev'] = htmlEscape(cosVolume.driveName)

    vdeviceNames = userchoices.getVirtualPartitionRequestsDevices()
    for vdevName in vdeviceNames:
        reqs = userchoices.getVirtualPartitionRequests(vdevName)
        reqs.fitRequestsOnDevice()
        allReqs += reqs

    values['datastoreParts'] = ""
    allReqs.sort(sortByMountPoint=True)
    for req in allReqs:
        size = util.formatValue(req.apparentSize * util.SIZE_MB)
        if req.mountPoint:
            mountPoint = htmlEscape(req.mountPoint)
        else:
            mountPoint = ""

        values['datastoreParts'] += (
            '<tabs count="1" />%s'
            '<tabs count="1" /><verbatim value="%10s" />'
            '<tabs count="1" />%s<br/>' % (req.fsType.name, size, mountPoint))
Beispiel #9
0
 def enterFileSysSize(self):
     "Enter file system size."
     maxsize = self.parent.maxVmdkSize - self.parent.requests.getMinimumSize() \
         + self.editSize
     sizetext = util.formatValue(maxsize * util.SIZE_MB)
     ui = {
         'title': title,
         'body': enterFileSysSizeText % {'maxsize': sizetext },
         'menu': {
             '<': self.start,
             '?': self.help,
             '*': self.inputFileSysSize,
         }
     }
     self.setSubstepEnv(ui)
Beispiel #10
0
def getPartitionsList(requests):
    '''Find partitions within list of requests.
    This is a counterpart to populatePartitioningModel() in
    gui/storage_widgets.py.
    '''
    partList = []
    for request in requests:
        maxSize = ''
        grow = ''

        mountPoint = request.mountPoint
        fsType = request.fsType.name
        size = util.formatValue(request.minimumSize * util.SIZE_MB)
        partList.append([mountPoint, fsType, size, request])

    return partList
Beispiel #11
0
def populatePartitioningModel(view, scrolled, requests):
    model = view.get_model()
    model.clear()

    for request in requests:
        maxSize = ''
        grow = ''

        mountPoint = request.mountPoint
        fsType = request.fsType.name
        size = util.formatValue(request.minimumSize * util.SIZE_MB)

        diskIter = model.append(None, [mountPoint, fsType, size, request])

    view.expand_all()
    scrolled.show_all()
Beispiel #12
0
def getPartitionsList(requests):
    '''Find partitions within list of requests.
    This is a counterpart to populatePartitioningModel() in
    gui/storage_widgets.py.
    '''
    partList = []
    for request in requests:
        maxSize = ''
        grow = ''

        mountPoint = request.mountPoint
        fsType = request.fsType.name
        size = util.formatValue(request.minimumSize * util.SIZE_MB)
        partList.append([mountPoint, fsType, size, request])

    return partList
Beispiel #13
0
def populatePartitioningModel(view, scrolled, requests):
    model = view.get_model()
    model.clear()

    for request in requests:
        maxSize = ''
        grow = ''

        mountPoint = request.mountPoint
        fsType = request.fsType.name
        size = util.formatValue(request.minimumSize * util.SIZE_MB)

        diskIter = model.append(None,
            [mountPoint, fsType, size, request])

    view.expand_all()
    scrolled.show_all()
Beispiel #14
0
 def enterFileSysSize(self):
     "Enter file system size."
     maxsize = self.parent.maxVmdkSize - self.parent.requests.getMinimumSize() \
         + self.editSize
     sizetext = util.formatValue(maxsize * util.SIZE_MB)
     ui = {
         'title': title,
         'body': enterFileSysSizeText % {
             'maxsize': sizetext
         },
         'menu': {
             '<': self.start,
             '?': self.help,
             '*': self.inputFileSysSize,
         }
     }
     self.setSubstepEnv(ui)
Beispiel #15
0
 def setMaxSize(self, entrySize=0):
     '''Set the maximum size label'''
     maxSizeLabel = self.xml.get_widget("SetupvmdkmaxsizeLabel")
     size = self.parent.maxVmdkSize - self.parent.requests.getMinimumSize() \
         + entrySize
     maxSizeLabel.set_text(util.formatValue(size * util.SIZE_MB))
Beispiel #16
0
 def getFormattedSize(self):
     return util.formatValue(self.getSizeInKilobytes())
Beispiel #17
0
 def setConsoleVMSize(self):
     size = self.requests.getMinimumSize()
     self.consoleVMSizeLabel.set_text(util.formatValue(size * util.SIZE_MB))
Beispiel #18
0
 def getFormattedSize(self):
     return util.formatValue(self.getSizeInKilobytes())
Beispiel #19
0
 def convert(self):
     index, joint, bias, position = self.values
     (p_x, p_y, p_z) = [float(x) for x in position.split(' ')]
     b = formatValue(bias)
     return f'\tweight {index} {joint} {b} ( {formatValue(p_x)} {formatValue(p_y)} {formatValue(p_z)} )'