コード例 #1
0
    def dev(self):
        if not self._dev:
            self._dev = DirectoryDevice(
                "/dev", format=getFormat("bind", device="/dev", mountpoint="/dev", exists=True), exists=True
            )

        return self._dev
コード例 #2
0
ファイル: deviceaction.py プロジェクト: fabiand/blivet
 def __init__(self, device, format=None):
     DeviceAction.__init__(self, device)
     if format:
         self.origFormat = device.format
         self.device.format = format
     else:
         self.origFormat = getFormat(None)
コード例 #3
0
ファイル: operations.py プロジェクト: Tayyib/uludag
 def __init__(self, device, format=None):
     DeviceOperation.__init__(self, device)
     if format:
         self.origFormat = device.format
         if self.device.format.exists:
             self.device.format.teardown()
         self.device.format = format
     else:
         self.origFormat = getFormat(None)
コード例 #4
0
 def __init__(self, device, format=None):
     DeviceAction.__init__(self, device)
     if format:
         self.origFormat = device.format
         if self.device.format.exists:
             self.device.format.teardown()
         self.device.format = format
     else:
         self.origFormat = getFormat(None)
コード例 #5
0
    def createSwapFile(self, device, size, rootPath=None):
        """ Create and activate a swap file under rootPath. """
        if not rootPath:
            rootPath = self.rootpath

        filename = "/SWAP"
        count = 0
        basedir = os.path.normpath("%s/%s" % (rootPath, device.format.mountpoint))
        while os.path.exists("%s/%s" % (basedir, filename)) or self.devicetree.getDeviceByName(filename):
            file = os.path.normpath("%s/%s" % (basedir, filename))
            count += 1
            filename = "/SWAP-%d" % count

        dev = FileDevice(filename, size=size, parents=[device], format=getFormat("swap", device=filename))
        dev.create()
        dev.setup()
        dev.format.create()
        dev.format.setup()
        self.devicetree._addDevice(dev)
コード例 #6
0
def checkForSwapNoMatch(intf, storage):
    """Check for any partitions of type 0x82 which don't have a swap fs."""
    for device in storage.partitions:
        if not device.exists:
            # this is only for existing partitions
            continue

        if device.getFlag(parted.PARTITION_SWAP) and \
           not device.format.type == "swap":
            rc = intf.messageWindow(_("Format as Swap?"),
                                    _("%s has a partition type of 0x82 "
                                      "(Linux swap) but does not appear to "
                                      "be formatted as a Linux swap "
                                      "partition.\n\n"
                                      "Would you like to format this "
                                      "partition as a swap partition?")
                                    % device.path, type = "yesno")
            if rc == 1:
                format = getFormat("swap", device=device.path)
                storage.formatDevice(device, format)
    return
コード例 #7
0
def checkForSwapNoMatch(intf, storage):
    """Check for any partitions of type 0x82 which don't have a swap fs."""
    for device in storage.partitions:
        if not device.exists:
            # this is only for existing partitions
            continue

        if device.getFlag(parted.PARTITION_SWAP) and \
           not device.format.type == "swap":
            rc = intf.messageWindow(_("Format as Swap?"),
                                    _("%s has a partition type of 0x82 "
                                      "(Linux swap) but does not appear to "
                                      "be formatted as a Linux swap "
                                      "partition.\n\n"
                                      "Would you like to format this "
                                      "partition as a swap partition?")
                                    % device.path, type = "yesno")
            if rc == 1:
                format = getFormat("swap", device=device.path)
                storage.formatDevice(device, format)
    return
コード例 #8
0
ファイル: storageset.py プロジェクト: Tayyib/uludag
 def devshm(self):
     if not self._devshm:
         self._devshm = NoDevice(format=getFormat("tmpfs",
                                                  device="tmpfs",
                                                  mountpoint="/dev/shm"))
     return self._devshm
コード例 #9
0
ファイル: storageset.py プロジェクト: Tayyib/uludag
 def proc(self):
     if not self._proc:
         self._proc = NoDevice(format=getFormat("proc",
                                                device="proc",
                                                mountpoint="/proc"))
     return self._proc
コード例 #10
0
ファイル: storageset.py プロジェクト: Tayyib/uludag
 def debugfs(self):
     if not self._debugfs:
         self._debugfs = NoDevice(format=getFormat("debugfs",
                                                  device="debugfs",
                                                  mountpoint="/sys/kernel/debug"))
     return self._debugfs
コード例 #11
0
ファイル: storageset.py プロジェクト: Tayyib/uludag
 def sysfs(self):
     if not self._sysfs:
         self._sysfs = NoDevice(format=getFormat("sysfs",
                                                 device="sys",
                                                 mountpoint="/sys"))
     return self._sysfs