def okClicked(self, *args): vmfsName = getSelectionFromView(self.view) if not vmfsName or vmfsName == "Datastores": MessageWindow(None, "Storage Selection Error", "A valid existing datastore must be selected.") else: setPartEntry = False # TODO: at some point it might be nice to allow the user to change # the name of the vmdk file entry = self.datastoreSet.getEntryByName(vmfsName) assert entry if entry: vmdkPath = os.path.normpath( os.path.join( entry.consolePath, fsset.vmfs3FileSystem.systemUniqueName('esxconsole'), devices.DEFAULT_COS_IMAGE)) # This is extremely unlikely to ever be executed given # that the UUID should be unique, however we still need # to nuke it if it does exist. if os.path.exists(vmdkPath): rc = MessageWindow( None, "Existing Service Console", "There is an existing service console at the " "specified location. " "Overwrite it?", type="yesno") if rc.affirmativeResponse: setPartEntry = True else: setPartEntry = True if setPartEntry: dsPart = \ self.xml.get_widget("DatastorepartitionEntry") dsPart.set_text(vmfsName) global _vmfsVolume _vmfsVolume = vmfsName self.hide() else: # should never be able to get here MessageWindow( None, "Error", "The selected datastore does not exist. " "Choose a different datastore.")
def okClicked(self, *args): createDatastore = False name = getSelectionFromView(self.view, column=STORAGEVIEW_DISK_ENTRY) assert not name or name in self.diskSet.keys() if not name: MessageWindow(None, "Storage Selection Error", "Select a place to create the new datastore.") else: # check and prompt if there is already a vmfs partition on the # device createDatastore = \ storage_widgets.promptDeviceHasExistingData(name, False) # update the 'Device:' textentry with the appropriate drive name if createDatastore == storage_widgets.EXISTING_DATA_CLEAR_DRIVE: self.parent.updateCreateDatastore(name) self.hide()
def okClicked(self, *args): vmfsName = getSelectionFromView(self.view) if not vmfsName or vmfsName == "Datastores": MessageWindow(None, "Storage Selection Error", "A valid existing datastore must be selected.") else: setPartEntry = False # TODO: at some point it might be nice to allow the user to change # the name of the vmdk file entry = self.datastoreSet.getEntryByName(vmfsName) assert entry if entry: vmdkPath = os.path.normpath( os.path.join(entry.consolePath, fsset.vmfs3FileSystem.systemUniqueName('esxconsole'), devices.DEFAULT_COS_IMAGE)) # This is extremely unlikely to ever be executed given # that the UUID should be unique, however we still need # to nuke it if it does exist. if os.path.exists(vmdkPath): rc = MessageWindow(None, "Existing Service Console", "There is an existing service console at the " "specified location. " "Overwrite it?", type="yesno") if rc.affirmativeResponse: setPartEntry = True else: setPartEntry = True if setPartEntry: dsPart = \ self.xml.get_widget("DatastorepartitionEntry") dsPart.set_text(vmfsName) global _vmfsVolume _vmfsVolume = vmfsName self.hide() else: # should never be able to get here MessageWindow(None, "Error", "The selected datastore does not exist. " "Choose a different datastore.")
def _toggleDatastoreDevice(self, active): global _deviceName for name in ["Label", "Entry", "Button"]: deviceWidget = self.xml.get_widget("Datastoredevice%s" % (name)) deviceWidget.set_sensitive(active) # Set the widget to the default device if it's selected, otherwise # return it to whatever the user set it to if active: try: _deviceName = \ getSelectionFromView(self.createDataStoreWindow.view, column=STORAGEVIEW_DISK_ENTRY) self._setDatastoreDeviceText(self.diskSet[_deviceName]) except KeyError: pass else: self.xml.get_widget("DatastoredeviceEntry").set_text('') _deviceName = ''