示例#1
0
    def __init__(self, xml, datastoreSet, parent):
        CommonWindow.__init__(self)

        self.dialog = xml.get_widget("selectdatastore")
        self.datastoreSet = datastoreSet

        self.xml = xml
        self.parent = parent

        global _selectDSHandlersInitialized
        if not _selectDSHandlersInitialized:
            self.xml.signal_autoconnect({
                'on_selectdatastore_ok_clicked':
                self.okClicked,
                'on_selectdatastore_cancel_clicked':
                self.cancelClicked,
            })
            _selectDSHandlersInitialized = True

        self.view = xml.get_widget("SelectdatastoreTreeView")
        self.scrolled = xml.get_widget("SelectdatastoreScrolledWindow")

        deviceName = userchoices.getEsxPhysicalDevice()
        skipList = [deviceName]

        if userchoices.getPartitionMountRequests():
            skipList = []

        prunedDatastore = buildDatastoreSet(self.datastoreSet, skipList)

        storage_widgets.setupVmfsVolumesView(self.view)
        storage_widgets.populateVmfsVolumesModel(self.view, self.scrolled,
                                                 prunedDatastore)

        self.addFrameToWindow()
示例#2
0
    def __init__(self, xml, datastoreSet, parent):
        CommonWindow.__init__(self)

        self.dialog = xml.get_widget("selectdatastore")
        self.datastoreSet = datastoreSet

        self.xml = xml
        self.parent = parent

        global _selectDSHandlersInitialized
        if not _selectDSHandlersInitialized:
            self.xml.signal_autoconnect({
                'on_selectdatastore_ok_clicked' : self.okClicked,
                'on_selectdatastore_cancel_clicked' : self.cancelClicked,
            })
            _selectDSHandlersInitialized = True

        self.view = xml.get_widget("SelectdatastoreTreeView")
        self.scrolled = xml.get_widget("SelectdatastoreScrolledWindow")

        deviceName = userchoices.getEsxPhysicalDevice()
        skipList = [deviceName]

        if userchoices.getPartitionMountRequests():
            skipList = []

        prunedDatastore = buildDatastoreSet(self.datastoreSet, skipList)

        storage_widgets.setupVmfsVolumesView(self.view)
        storage_widgets.populateVmfsVolumesModel(self.view, self.scrolled,
                                                 prunedDatastore)

        self.addFrameToWindow()
示例#3
0
    def start(self):
        "Initial step."

        # ESX device is previous user choice or location of /boot.
        self.esxDeviceName = userchoices.getEsxPhysicalDevice()
        devs = userchoices.getPhysicalPartitionRequestsDevices()
        for dev in devs:
            request = userchoices.getPhysicalPartitionRequests(dev)
            if request.findRequestByMountPoint('/boot'):
                self.esxDeviceName = dev
        assert self.esxDeviceName

        self.clearDrives = [self.esxDeviceName]

        createNewDataStoreFunc = self.createNewDataStore
        if not devices.DiskSet()[self.esxDeviceName].supportsVmfs:
            createNewDataStoreFunc = self.createNewDataStoreDiffDev

        ui = {
            'title': title,
            'body': dataStoreText,
            'menu': {
                '1': createNewDataStoreFunc,
                '2': self.useExistingDataStore,
                '<': self.stepBack,
                '?': self.help,
            }
        }
        self.setSubstepEnv(ui)
示例#4
0
    def start(self):
        "Initial step."

        # ESX device is previous user choice or location of /boot.
        self.esxDeviceName = userchoices.getEsxPhysicalDevice()
        devs = userchoices.getPhysicalPartitionRequestsDevices()
        for dev in devs:
            request = userchoices.getPhysicalPartitionRequests(dev)
            if request.findRequestByMountPoint('/boot'):
                self.esxDeviceName = dev
        assert self.esxDeviceName

        self.clearDrives = [self.esxDeviceName]

        createNewDataStoreFunc = self.createNewDataStore
        if not devices.DiskSet()[self.esxDeviceName].supportsVmfs:
            createNewDataStoreFunc = self.createNewDataStoreDiffDev
        
        ui = {
            'title': title,
            'body': dataStoreText,
            'menu': {
                '1': createNewDataStoreFunc,
                '2': self.useExistingDataStore,
                '<': self.stepBack,
                '?': self.help,
            }
        }
        self.setSubstepEnv(ui)
示例#5
0
    def setup(self):
        self.xml.get_widget('DatastorecreateRadioButton').set_active(True)

        # If /boot is on an unsupported disk (IDE), we won't be able put a
        # vmfs datastore on it.
        checkButton = self.xml.get_widget('DatastoreCheckButton')
        dsPart = self.xml.get_widget("DatastorepartitionEntry")

        supportedDisk = self.diskSet[self.defaultDeviceName].supportsVmfs
        checkButton.set_active(supportedDisk)
        checkButton.set_sensitive(supportedDisk)

        if len(self.diskSet.keys()) == 1:
            checkButton.set_sensitive(False)

        skipList = [self.defaultDeviceName]

        radioButton = self.xml.get_widget('DatastoreexistingRadioButton')

        # don't skip the datastore with the vmfs partition if we're
        # preserving it
        if self.preserveVmfs:
            radioButton.set_active(True)
            checkButton.set_active(False)
            checkButton.set_sensitive(False)
            skipList = []

            drive = userchoices.getEsxPhysicalDevice()
            datastores = self.datastoreSet.getEntriesByDriveName(drive)

            assert len(datastores) > 0

            # remove the size of the vmdk so that it shows up correctly
            # in the datastore pop-up window
            log.debug("Block size = %d" % (datastores[0].blockSize))
            datastores[0].blocksUsed -= self.vmdkSize

            dsPart.set_text(datastores[0].name)

            global _vmfsVolume
            _vmfsVolume = datastores[0].name
        else:
            checkButton.set_sensitive(True)

        vols = buildDatastoreSet(self.datastoreSet, skipList)

        if vols:
            radioButton.set_sensitive(True)
        else:
            radioButton.set_sensitive(False)
示例#6
0
    def setup(self):
        self.xml.get_widget('DatastorecreateRadioButton').set_active(True)

        # If /boot is on an unsupported disk (IDE), we won't be able put a
        # vmfs datastore on it.
        checkButton = self.xml.get_widget('DatastoreCheckButton')
        dsPart = self.xml.get_widget("DatastorepartitionEntry")

        supportedDisk = self.diskSet[self.defaultDeviceName].supportsVmfs
        checkButton.set_active(supportedDisk)
        checkButton.set_sensitive(supportedDisk)

        if len(self.diskSet.keys()) == 1:
            checkButton.set_sensitive(False)

        skipList = [self.defaultDeviceName]

        radioButton = self.xml.get_widget('DatastoreexistingRadioButton')

        # don't skip the datastore with the vmfs partition if we're
        # preserving it
        if self.preserveVmfs:
            radioButton.set_active(True)
            checkButton.set_active(False)
            checkButton.set_sensitive(False)
            skipList = []

            drive = userchoices.getEsxPhysicalDevice()
            datastores = self.datastoreSet.getEntriesByDriveName(drive)

            assert len(datastores) > 0

            # remove the size of the vmdk so that it shows up correctly
            # in the datastore pop-up window
            log.debug("Block size = %d" % (datastores[0].blockSize))
            datastores[0].blocksUsed -= self.vmdkSize

            dsPart.set_text(datastores[0].name)

            global _vmfsVolume
            _vmfsVolume = datastores[0].name
        else:
            checkButton.set_sensitive(True)

        vols = buildDatastoreSet(self.datastoreSet, skipList)

        if vols:
            radioButton.set_sensitive(True)
        else:
            radioButton.set_sensitive(False)
示例#7
0
    def __init__(self, controlState, xml):
        controlState.displayHeaderBar = True
        controlState.windowIcon = 'datastore.png'
        controlState.windowTitle = "Datastore"
        controlState.windowText = "Specify a datastore for ESX"

        self.xml = xml

        self.diskSet = devices.DiskSet()
        self.datastoreSet = datastore.DatastoreSet()

        self.datastoreExistTable = xml.get_widget("DatastoreexistingTable")
        self.datastoreCreateTable = xml.get_widget("DatastorecreateTable")

        connectSignalHandlerByDict(
            self, DataStoreWindow, self.xml, {
                ('DatastoredeviceButton', 'clicked'): 'createNewDatastore',
                ('DatastorepartitionButton', 'clicked'): 'selectDatastore',
                ('DatastorecreateRadioButton', 'toggled'):
                'toggleDatastoreChoice',
                ('DatastoreCheckButton', 'toggled'): 'toggleSameDevice',
            })

        self.defaultDeviceName = userchoices.getEsxPhysicalDevice()

        # set up the aux. helper windows
        self.createDataStoreWindow = \
            CreateDataStoreWindow(self.xml, self.diskSet, self)
        self.selectDataStoreWindow = \
            SelectDataStoreWindow(self.xml, self.datastoreSet, self)

        # find the existing vmdk size that we're going to remove
        vmdkPath = userchoices.getExistingVmdkLocation().get('vmdkLocation')
        self.vmdkSize = devices.runtimeActionFindExistingVmdkSize(vmdkPath)

        self.preserveVmfs = bool(userchoices.getPartitionMountRequests())

        if userchoices.getResetEsxLocation():
            self.setup()
            userchoices.setResetEsxLocation(False)
示例#8
0
    def addPartRequest(self):
        """Add the default partition request.  May be configured for
        basic or advanced."""

        self.popSubstep()  # kludge, pop state from warn()

        # schedule default partition operation
        request = devices.DiskSet()[self.driveName]
        if self.partMode == 'basic':
            partition.addDefaultPartitionRequests(request)
        else:  # partMode == 'advanced'
            partition.addDefaultPartitionRequests(request,
                                                  addVirtualPartitions=False)

        # If ESX location is changing (or this is first time), tell
        # DataStoreWindow via userchoices so it can clear options.
        if self.driveName != userchoices.getEsxPhysicalDevice():
            userchoices.setResetEsxLocation(True)
        else:
            userchoices.setResetEsxLocation(False)

        self.setSubstepEnv({'next': self.stepForward})
示例#9
0
    def addPartRequest(self):
        """Add the default partition request.  May be configured for
        basic or advanced."""

        self.popSubstep()       # kludge, pop state from warn()

        # schedule default partition operation
        request = devices.DiskSet()[self.driveName]
        if self.partMode == 'basic':
            partition.addDefaultPartitionRequests(request)
        else:   # partMode == 'advanced'
            partition.addDefaultPartitionRequests(request,
                addVirtualPartitions=False)

        # If ESX location is changing (or this is first time), tell
        # DataStoreWindow via userchoices so it can clear options.
        if self.driveName != userchoices.getEsxPhysicalDevice():
            userchoices.setResetEsxLocation(True)
        else:
            userchoices.setResetEsxLocation(False)

        self.setSubstepEnv( {'next': self.stepForward } )
示例#10
0
    def __init__(self, controlState, xml):
        controlState.displayHeaderBar = True
        controlState.windowIcon = 'datastore.png'
        controlState.windowTitle = "Datastore"
        controlState.windowText = "Specify a datastore for ESX"

        self.xml = xml

        self.diskSet = devices.DiskSet()
        self.datastoreSet = datastore.DatastoreSet()

        self.datastoreExistTable = xml.get_widget("DatastoreexistingTable")
        self.datastoreCreateTable = xml.get_widget("DatastorecreateTable")

        connectSignalHandlerByDict(self, DataStoreWindow, self.xml,
          { ('DatastoredeviceButton', 'clicked'): 'createNewDatastore',
            ('DatastorepartitionButton', 'clicked'): 'selectDatastore',
            ('DatastorecreateRadioButton', 'toggled'): 'toggleDatastoreChoice',
            ('DatastoreCheckButton', 'toggled'): 'toggleSameDevice',
          })

        self.defaultDeviceName = userchoices.getEsxPhysicalDevice()

        # set up the aux. helper windows
        self.createDataStoreWindow = \
            CreateDataStoreWindow(self.xml, self.diskSet, self)
        self.selectDataStoreWindow = \
            SelectDataStoreWindow(self.xml, self.datastoreSet, self)

        # find the existing vmdk size that we're going to remove
        vmdkPath = userchoices.getExistingVmdkLocation().get('vmdkLocation')
        self.vmdkSize = devices.runtimeActionFindExistingVmdkSize(vmdkPath)

        self.preserveVmfs = bool(userchoices.getPartitionMountRequests())

        if userchoices.getResetEsxLocation():
            self.setup()
            userchoices.setResetEsxLocation(False)
示例#11
0
    def getNext(self):
        haveMountPoint = bool(userchoices.getPartitionMountRequests())

        userchoices.clearPhysicalPartitionRequests()
        userchoices.clearPartitionMountRequests()
        userchoices.clearExistingVmdkLocation()

        (model, diskIter) = self.view.get_selection().get_selected()
        if diskIter and model.get(diskIter, STORAGEVIEW_DISK_ENTRY)[0]:
            drive = model.get(diskIter, STORAGEVIEW_DISK_ENTRY)[0]

            log.debug("Selected drive %s" % (drive))

            diskSet = devices.DiskSet()
            datastoreSet = datastore.DatastoreSet()

            rc = storage_widgets.promptDeviceHasExistingData(drive)

            if rc == storage_widgets.EXISTING_DATA_STAY_ON_SCREEN:
                raise exception.StayOnScreen
            elif rc == storage_widgets.EXISTING_DATA_PRESERVE_VMFS:
                vmdkPath = \
                    esxconf.runtimeActionExtractVmdkPathFromInitrd(drive)
                vmdkSize = \
                    devices.runtimeActionFindExistingVmdkSize(vmdkPath)

                log.debug("VMDK Size = %d Path = %s" % (vmdkSize, vmdkPath))

                if vmdkSize > 0:
                    vmdkCheckBox = True

                    # only turn off the preserveVmdk check button if
                    # we're on the install location screen since the user
                    # can choose to put the vmdk on a different datastore
                    # on the esxlocation screen

                    if self.SCREEN_NAME == 'installlocation':
                        ds = datastoreSet.getEntriesByDriveName(drive)[0]
                        freeSize = ds.getFreeSize() / 1024 / 1024
                        requestSize = partition.getRequestsSize(
                                          partition.getDefaultVirtualRequests())

                        if freeSize + vmdkSize <= requestSize + VMFS_OVERHEAD:
                            MessageWindow(None, "No Free Space",
                                storage_widgets.COSVMDK_TOTALLY_FULL)
                            raise exception.StayOnScreen

                        elif freeSize < requestSize:
                            vmdkCheckBox = False

                    preserveVmdk = PreserveCosVmdkWindow(vmdkCheckBox).run()
                    if preserveVmdk == -1:
                        raise exception.StayOnScreen
                    elif preserveVmdk == 1:
                        pass
                    else:
                        userchoices.setExistingVmdkLocation(vmdkPath)

                # Set up virtual disk and settings
                datastore.preserveDatastoreOnDrive(drive)

                if self.SCREEN_NAME == 'esxlocation':
                    userchoices.setEsxPhysicalDevice(drive)
                    userchoices.setResetEsxLocation(True)

            elif rc == storage_widgets.EXISTING_DATA_CLEAR_DRIVE:
                if self.SCREEN_NAME == 'installlocation':
                    partition.addDefaultPartitionRequests(diskSet[drive])

                else:
                    # clear out the datastore options if the user has changed
                    # their mind about which drive to use -- this will get
                    # changed back to false on the next screen
                    if drive != userchoices.getEsxPhysicalDevice() or \
                       haveMountPoint:
                        userchoices.setResetEsxLocation(True)
                    else:
                        userchoices.setResetEsxLocation(False)

                    userchoices.setEsxPhysicalDevice(drive)
            else:
                raise ValueError, "Got unexpected return code"

        else:
            MessageWindow(self.controlState.gui.getWindow(),
                "Storage Selection Error",
                "You must select a place to install ESX.")
            raise exception.StayOnScreen
    def getNext(self):
        haveMountPoint = bool(userchoices.getPartitionMountRequests())

        userchoices.clearPhysicalPartitionRequests()
        userchoices.clearPartitionMountRequests()
        userchoices.clearExistingVmdkLocation()

        (model, diskIter) = self.view.get_selection().get_selected()
        if diskIter and model.get(diskIter, STORAGEVIEW_DISK_ENTRY)[0]:
            drive = model.get(diskIter, STORAGEVIEW_DISK_ENTRY)[0]

            log.debug("Selected drive %s" % (drive))

            diskSet = devices.DiskSet()
            datastoreSet = datastore.DatastoreSet()

            rc = storage_widgets.promptDeviceHasExistingData(drive)

            if rc == storage_widgets.EXISTING_DATA_STAY_ON_SCREEN:
                raise exception.StayOnScreen
            elif rc == storage_widgets.EXISTING_DATA_PRESERVE_VMFS:
                vmdkPath = \
                    esxconf.runtimeActionExtractVmdkPathFromInitrd(drive)
                vmdkSize = \
                    devices.runtimeActionFindExistingVmdkSize(vmdkPath)

                log.debug("VMDK Size = %d Path = %s" % (vmdkSize, vmdkPath))

                if vmdkSize > 0:
                    vmdkCheckBox = True

                    # only turn off the preserveVmdk check button if
                    # we're on the install location screen since the user
                    # can choose to put the vmdk on a different datastore
                    # on the esxlocation screen

                    if self.SCREEN_NAME == 'installlocation':
                        ds = datastoreSet.getEntriesByDriveName(drive)[0]
                        freeSize = ds.getFreeSize() / 1024 / 1024
                        requestSize = partition.getRequestsSize(
                            partition.getDefaultVirtualRequests())

                        if freeSize + vmdkSize <= requestSize + VMFS_OVERHEAD:
                            MessageWindow(None, "No Free Space",
                                          storage_widgets.COSVMDK_TOTALLY_FULL)
                            raise exception.StayOnScreen

                        elif freeSize < requestSize:
                            vmdkCheckBox = False

                    preserveVmdk = PreserveCosVmdkWindow(vmdkCheckBox).run()
                    if preserveVmdk == -1:
                        raise exception.StayOnScreen
                    elif preserveVmdk == 1:
                        pass
                    else:
                        userchoices.setExistingVmdkLocation(vmdkPath)

                # Set up virtual disk and settings
                datastore.preserveDatastoreOnDrive(drive)

                if self.SCREEN_NAME == 'esxlocation':
                    userchoices.setEsxPhysicalDevice(drive)
                    userchoices.setResetEsxLocation(True)

            elif rc == storage_widgets.EXISTING_DATA_CLEAR_DRIVE:
                if self.SCREEN_NAME == 'installlocation':
                    partition.addDefaultPartitionRequests(diskSet[drive])

                else:
                    # clear out the datastore options if the user has changed
                    # their mind about which drive to use -- this will get
                    # changed back to false on the next screen
                    if drive != userchoices.getEsxPhysicalDevice() or \
                       haveMountPoint:
                        userchoices.setResetEsxLocation(True)
                    else:
                        userchoices.setResetEsxLocation(False)

                    userchoices.setEsxPhysicalDevice(drive)
            else:
                raise ValueError, "Got unexpected return code"

        else:
            MessageWindow(self.controlState.gui.getWindow(),
                          "Storage Selection Error",
                          "You must select a place to install ESX.")
            raise exception.StayOnScreen