示例#1
0
    def editVolumeGroup(self, device, isNew=False):
        volumegroupEditor =  LVMEditor(self, device, isNew=isNew)

        while True:
            origDevice = copy.copy(device)
            operations = volumegroupEditor.run()

            for operation in operations:
                self.storage.devicetree.addOperation(operation)

            if self.refresh(justRedraw=not operations):
                operations.reverse()

                for operation in operations:
                    self.storage.devicetree.removeOperation(operation)

                if not isNew:
                    device = origDevice

                if self.refresh():
                    raise RuntimeError, ("Returning partitions to state "
                                         "prior to edit failed")
            else:
                break

        volumegroupEditor.destroy()
示例#2
0
    def editVolumeGroup(self, device, isNew=False):
        volumegroupEditor = LVMEditor(self, device, isNew=isNew)

        while True:
            origDevice = copy.copy(device)
            operations = volumegroupEditor.run()

            for operation in operations:
                self.storage.devicetree.addOperation(operation)

            if self.refresh(justRedraw=not operations):
                operations.reverse()

                for operation in operations:
                    self.storage.devicetree.removeOperation(operation)

                if not isNew:
                    device = origDevice

                if self.refresh():
                    raise RuntimeError, ("Returning partitions to state "
                                         "prior to edit failed")
            else:
                break

        volumegroupEditor.destroy()
示例#3
0
    def editLogicalVolume(self, lv=None, vg=None):
        """Will be consistent with the state of things and use this funciton
        for creating and editing LVs.

        lv -- the logical volume to edit.  If this is set there is no need
              for the other two arguments.
        vg -- the volume group where the new lv is going to be created. This
              will only be relevant when we are createing an LV.
        """
        if lv != None:
            volumegroupEditor = LVMEditor(self, lv.vg, isNew=False)
            lv = volumegroupEditor.lvs[lv.lvname]
            isNew = False

        elif vg != None:
            volumegroupEditor = LVMEditor(self, vg, isNew=False)
            tempvg = volumegroupEditor.tmpVolumeGroup
            name = self.storage.createSuggestedLogicalVolumeName(tempvg)
            format = formats.getFormat(self.storage.defaultFSType)
            volumegroupEditor.lvs[name] = {
                'name': name,
                'size': vg.freeSpace,
                'format': format,
                'originalFormat': format,
                'stripes': 1,
                'logSize': 0,
                'snapshotSpace': 0,
                'exists': False
            }
            lv = volumegroupEditor.lvs[name]
            isNew = True

        else:
            return

        while True:
            #volumegroupEditor.editLogicalVolume(lv, isNew=isNew)
            operations = volumegroupEditor.run()

            for operation in operations:
                self.storage.devicetree.addOperation(operation)

            if self.refresh(justRedraw=True):
                operations.reverse()
                for operation in operations:
                    self.storage.devicetree.removeOperation(operation)

                if self.refresh():
                    raise RuntimeError, ("Returning partitions to state "
                                         "prior to edit failed")
                continue
            else:
                break

        volumegroupEditor.destroy()
示例#4
0
    def editLogicalVolume(self, lv=None, vg=None):
        """Will be consistent with the state of things and use this funciton
        for creating and editing LVs.

        lv -- the logical volume to edit.  If this is set there is no need
              for the other two arguments.
        vg -- the volume group where the new lv is going to be created. This
              will only be relevant when we are createing an LV.
        """
        if lv != None:
            volumegroupEditor = LVMEditor(self, lv.vg, isNew = False)
            lv = volumegroupEditor.lvs[lv.lvname]
            isNew = False

        elif vg != None:
            volumegroupEditor = LVMEditor(self, vg, isNew = False)
            tempvg = volumegroupEditor.tmpVolumeGroup
            name = self.storage.createSuggestedLogicalVolumeName(tempvg)
            format = fornmats.getFormat(self.storage.defaultFSType)
            volumegroupEditor.lvs[name] = {'name': name,
                                           'size': vg.freeSpace,
                                           'format': format,
                                           'originalFormat': format,
                                           'stripes': 1,
                                           'logSize': 0,
                                           'snapshotSpace': 0,
                                           'exists': False}
            lv = volumegroupEditor.lvs[name]
            isNew = True

        else:
            return

        while True:
            #volumegroupEditor.editLogicalVolume(lv, isNew = isNew)
            operations = volumegroupEditor.run()

            for operation in operations:
                self.storage.devicetree.addOperation(operation)

            if self.refresh(justRedraw=True):
                operations.reverse()
                for operation in operations:
                    self.storage.devicetree.removeOperation(operation)

                if self.refresh():
                    raise RuntimeError, ("Returning partitions to state "
                                         "prior to edit failed")
                continue
            else:
                break

        volumegroupEditor.destroy()