示例#1
0
    def commit(self):
        """Commit updates.  By the time we get here, we assume:
        * volume name has been sanity checked
        * requested size has been checked
        """

        assert self.deviceName, 'datastore device name not set'
        assert self.volumeName, 'datastore volume name not set'
        log.debug("DataStoreWindow.commit device %s volume %s" %
                  (self.deviceName, self.volumeName))

        # Check if drives to clear are in use; if so stop this madness.
        diskSet = devices.DiskSet()
        if self.deviceName == self.esxDeviceName:
            clearDrives = [self.deviceName]
        else:
            clearDrives = [self.deviceName, self.esxDeviceName]
            # presumably self.choseCreateNewDatastoreOnEsxDevice == False

        log.debug("Cleared drives = %s" % (', '.join(clearDrives)))
        volumePath = os.path.join('/vmfs/volumes', self.volumeName)

        if (os.path.exists(volumePath) or os.path.islink(volumePath)) \
           and not checkForClearedVolume(clearDrives, self.datastoreSet,
                                         self.volumeName):
            log.debug("Volume name in use")
            self.setSubstepEnv({'next': self.warnInUse})
            return

        # build partition requests, add to userchoices
        partition.addDefaultPartitionRequests(diskSet[self.esxDeviceName],
                                              False)

        if self.choseCreateNewDatastore:
            physicalRequests = [
                (None, 100, 0, True, fsset.vmfs3FileSystem(self.volumeName)),
            ]
            dev = diskSet[self.deviceName]
            userchoices.addPhysicalPartitionRequests(
                self.deviceName,
                partition.createPartitionRequestSet(dev, physicalRequests))

            userchoices.setClearPartitions(drives=clearDrives)

            userchoices.setEsxDatastoreDevice(dev.name)
            userchoices.setVmdkDatastore(self.volumeName)
        else:  # use existing datastore
            userchoices.setClearPartitions(drives=[self.esxDeviceName])

            userchoices.clearVirtualDevices()

            userchoices.setEsxDatastoreDevice(None)
            userchoices.setVmdkDatastore(self.volumeName)

        # size check
        size = partition.getRequestsSize(partition.getDefaultVirtualRequests())
        if size > devices.runtimeActionFindMaxVmdkSize():
            self.setSubstepEnv({'next': self.warnTooSmall})
            return
        self.setSubstepEnv({'next': self.stepForward})
示例#2
0
    def commit(self):
        """Commit updates.  By the time we get here, we assume:
        * volume name has been sanity checked
        * requested size has been checked
        """

        assert self.deviceName, 'datastore device name not set'
        assert self.volumeName, 'datastore volume name not set'
        log.debug("DataStoreWindow.commit device %s volume %s" %
                (self.deviceName, self.volumeName))

        # Check if drives to clear are in use; if so stop this madness.
        diskSet = devices.DiskSet()
        if self.deviceName == self.esxDeviceName:
            clearDrives = [self.deviceName]
        else:
            clearDrives = [self.deviceName, self.esxDeviceName]
            # presumably self.choseCreateNewDatastoreOnEsxDevice == False

        log.debug("Cleared drives = %s" % (', '.join(clearDrives)))
        volumePath = os.path.join('/vmfs/volumes', self.volumeName)

        if (os.path.exists(volumePath) or os.path.islink(volumePath)) \
           and not checkForClearedVolume(clearDrives, self.datastoreSet,
                                         self.volumeName):
            log.debug("Volume name in use")
            self.setSubstepEnv({'next': self.warnInUse})
            return

        # build partition requests, add to userchoices
        partition.addDefaultPartitionRequests(diskSet[self.esxDeviceName],
                                              False)

        if self.choseCreateNewDatastore:
            physicalRequests = [
                (None, 100, 0, True, fsset.vmfs3FileSystem(self.volumeName)),
            ]
            dev = diskSet[self.deviceName]
            userchoices.addPhysicalPartitionRequests(self.deviceName,
                partition.createPartitionRequestSet(dev, physicalRequests))

            userchoices.setClearPartitions(drives=clearDrives)

            userchoices.setEsxDatastoreDevice(dev.name)
            userchoices.setVmdkDatastore(self.volumeName)
        else:   # use existing datastore
            userchoices.setClearPartitions(drives=[self.esxDeviceName])

            userchoices.clearVirtualDevices()

            userchoices.setEsxDatastoreDevice(None)
            userchoices.setVmdkDatastore(self.volumeName)

        # size check
        size = partition.getRequestsSize(partition.getDefaultVirtualRequests())
        if size > devices.runtimeActionFindMaxVmdkSize():
            self.setSubstepEnv({'next': self.warnTooSmall})
            return
        self.setSubstepEnv({'next': self.stepForward})
示例#3
0
    def __init__(self, controlState, xml):
        controlState.displayHeaderBar = True
        controlState.windowIcon = 'partitioning.png'
        controlState.windowTitle = "Service Console Virtual Disk Image"
        controlState.windowText = \
            "Configure the service console virtual disk image"

        global _resetPartitions, _datastoreDevice

        # reset the vmdk partitions if the datastore device has been changed
        if userchoices.getEsxDatastoreDevice() != _datastoreDevice:
            _resetPartitions = True

        _datastoreDevice = userchoices.getEsxDatastoreDevice()

        self.xml = xml
        self.diskSet = devices.DiskSet()

        self.maxVmdkSize = devices.runtimeActionFindMaxVmdkSize()

        self.consoleVMSizeLabel = xml.get_widget("SetupvmdksizeLabel")
        self.view = xml.get_widget("SetupvmdkTreeView")
        self.scrolled = xml.get_widget("SetupvmdkScrolledWindow")

        # Download the package data so we can figure out the minimum partition
        # sizes
        weaselConfig = systemsettings.WeaselConfig()
        packagesXML = packages.getPackagesXML(weaselConfig.packageGroups)
        packageData = packages.PackageData(packagesXML.fullInstallDepot)

        self.fileSizes = packageData.fileDict

        self.requests = None
        self.newButton = xml.get_widget("SetupvmdkNewButton")
        self.deleteButton = xml.get_widget("SetupvmdkDeleteButton")

        if _resetPartitions:
            self._resetPartitions()
            _resetPartitions = False
            
        self.setupVirtualDevice()

        connectSignalHandlerByDict(self, SetupVmdkWindow, self.xml,
          { ('SetupvmdkNewButton', 'clicked') : 'newPartition',
            ('SetupvmdkEditButton', 'clicked') : 'editPartition',
            ('SetupvmdkDeleteButton', 'clicked') : 'deletePartition',
            ('SetupvmdkResetButton', 'clicked') : 'resetPartitions',
          })

        self.partitionWindow = PartitionWindow(xml, self)

        self.setButtons()
示例#4
0
    def __init__(self):
        super(SetupVmdkWindow, self).__init__()
        self.substep = self.start

        self.diskSet = devices.DiskSet()
        self.maxVmdkSize = devices.runtimeActionFindMaxVmdkSize()

        self.requests = None

        # Download the package data so we can figure out the minimum partition
        # sizes
        weaselConfig = systemsettings.WeaselConfig()
        packagesXML = packages.getPackagesXML(weaselConfig.packageGroups)
        packageData = packages.PackageData(packagesXML.fullInstallDepot)

        self.fileSizes = packageData.fileDict

        if not userchoices.getVirtualDevices():
            self.reset()
        else:
            self.setupVirtualDevice()
示例#5
0
    def __init__(self):
        super(SetupVmdkWindow, self).__init__()
        self.substep = self.start

        self.diskSet = devices.DiskSet()
        self.maxVmdkSize = devices.runtimeActionFindMaxVmdkSize()

        self.requests = None

        # Download the package data so we can figure out the minimum partition
        # sizes
        weaselConfig = systemsettings.WeaselConfig()
        packagesXML = packages.getPackagesXML(weaselConfig.packageGroups)
        packageData = packages.PackageData(packagesXML.fullInstallDepot)

        self.fileSizes = packageData.fileDict

        if not userchoices.getVirtualDevices():
            self.reset()
        else:
            self.setupVirtualDevice()
示例#6
0
                    self.diskSet[self.defaultDeviceName], False)

                userchoices.setClearPartitions(drives=[self.defaultDeviceName])

            userchoices.setEsxDatastoreDevice(None)
            userchoices.setVmdkDatastore(_vmfsVolume)

        # find the size of the virtual partitions and then remove the
        # size of any existing COS since it can be removed to free up space
        size = partition.getRequestsSize(partition.getDefaultVirtualRequests())
        size += VMFS_OVERHEAD

        if self.vmdkSize > 0:
            size -= self.vmdkSize

        if size > devices.runtimeActionFindMaxVmdkSize():
            MessageWindow(None, "No Free Space",
                          storage_widgets.COSVMDK_TOTALLY_FULL)
            raise exception.StayOnScreen

        #print "Max vmdk = %d" % devices.runtimeActionFindMaxVmdkSize()


class CreateDataStoreWindow(CommonWindow):
    def __init__(self, xml, diskSet, parent):
        CommonWindow.__init__(self)

        self.dialog = xml.get_widget("createdatastore")
        self.diskSet = diskSet
        self.xml = xml
        self.parent = parent
示例#7
0
                    self.diskSet[self.defaultDeviceName], False)

                userchoices.setClearPartitions(drives=[self.defaultDeviceName])
            
            userchoices.setEsxDatastoreDevice(None)
            userchoices.setVmdkDatastore(_vmfsVolume)

        # find the size of the virtual partitions and then remove the
        # size of any existing COS since it can be removed to free up space
        size = partition.getRequestsSize(partition.getDefaultVirtualRequests())
        size += VMFS_OVERHEAD

        if self.vmdkSize > 0:
            size -= self.vmdkSize

        if size > devices.runtimeActionFindMaxVmdkSize():
            MessageWindow(None, "No Free Space",
                storage_widgets.COSVMDK_TOTALLY_FULL)
            raise exception.StayOnScreen

        #print "Max vmdk = %d" % devices.runtimeActionFindMaxVmdkSize()


class CreateDataStoreWindow(CommonWindow):
    def __init__(self, xml, diskSet, parent):
        CommonWindow.__init__(self)

        self.dialog = xml.get_widget("createdatastore")
        self.diskSet = diskSet
        self.xml = xml
        self.parent = parent