def _bootpartOption(match): uuid = match.group(1) if not util.uuidToDevicePath(uuid): failWithLog("error: cannot find device for UUID: %s\n" % uuid) userchoices.setBootUUID(uuid) mountPath = util.mountByUuid(uuid) if not mountPath: failWithLog("error: cannot mount boot partition with UUID -- %s" % uuid) restoredGrubConf = False for prefix in ("boot/grub", "grub"): path = os.path.join(mountPath, prefix, "grub.conf") if os.path.exists(path): tmpPath = os.tempnam(os.path.dirname(path), "grub.conf") os.symlink(os.path.basename(GRUB_CONF_PREV), tmpPath) # Use rename so the replacement is atomic. os.rename(tmpPath, path) restoredGrubConf = True break if not restoredGrubConf: log.warn("could not restore %s, upgrade failure will not " "reboot into ESX v3" % GRUB_CONF_PREV) util.umount(mountPath) return []
def _rootpartOption(match): uuid = match.group(1) if not util.uuidToDevicePath(uuid): failWithLog("error: cannot find device for UUID: %s\n" % uuid) userchoices.setRootUUID(uuid) return []
def _attachMountPoint(self, uuid, mountPoint): '''Find the partition matching the given UUID and set its mountPoint field to the given value.''' partitionPath = util.uuidToDevicePath(uuid) devicePath, _partNum = partition.splitPath(partitionPath) device = self.getDiskByPath(devicePath) if device: for part in device.partitions: if part.consoleDevicePath == partitionPath: part.mountPoint = mountPoint else: log.error("could not find partition with UUID (%s) for " "mount point -- %s" % (uuid, mountPoint))