X7ROOT File Manager
Current Path:
/usr/lib/python2.7/site-packages/blivet/devicelibs
usr
/
lib
/
python2.7
/
site-packages
/
blivet
/
devicelibs
/
📁
..
📄
__init__.py
(0 B)
📄
__init__.pyc
(149 B)
📄
__init__.pyo
(149 B)
📄
btrfs.py
(6.42 KB)
📄
btrfs.pyc
(7.15 KB)
📄
btrfs.pyo
(7.15 KB)
📄
crypto.py
(6 KB)
📄
crypto.pyc
(5.83 KB)
📄
crypto.pyo
(5.83 KB)
📄
dasd.py
(11.04 KB)
📄
dasd.pyc
(11.74 KB)
📄
dasd.pyo
(11.74 KB)
📄
dm.py
(2.18 KB)
📄
dm.pyc
(2.13 KB)
📄
dm.pyo
(2.13 KB)
📄
edd.py
(8.75 KB)
📄
edd.pyc
(8 KB)
📄
edd.pyo
(8 KB)
📄
loop.py
(2.3 KB)
📄
loop.pyc
(2.33 KB)
📄
loop.pyo
(2.33 KB)
📄
lvm.py
(23.52 KB)
📄
lvm.pyc
(25.93 KB)
📄
lvm.pyo
(25.93 KB)
📄
mdraid.py
(13.35 KB)
📄
mdraid.pyc
(14.72 KB)
📄
mdraid.pyo
(14.72 KB)
📄
mpath.py
(1.01 KB)
📄
mpath.pyc
(1.51 KB)
📄
mpath.pyo
(1.51 KB)
📄
raid.py
(22.75 KB)
📄
raid.pyc
(32.84 KB)
📄
raid.pyo
(32.84 KB)
📄
swap.py
(5.15 KB)
📄
swap.pyc
(4.35 KB)
📄
swap.pyo
(4.35 KB)
Editing: dm.py
# # dm.py # device-mapper functions # # Copyright (C) 2009 Red Hat, Inc. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # Author(s): Dave Lehman <dlehman@redhat.com> # import os import block from .. import util from ..errors import DMError import logging log = logging.getLogger("blivet") def dm_setup(args): ret = util.run_program(["dmsetup"] + args) if ret: raise DMError("Failed to run dmsetup %s" % " ".join(args)) def dm_create_linear(map_name, device, length, uuid): table = "0 %d linear %s 0" % (length, device) args = ["create", map_name, "--uuid", uuid, "--table", "%s" % table] dm_setup(args) def dm_remove(map_name): args = ["remove", map_name] dm_setup(args) def name_from_dm_node(dm_node): # first, try sysfs name_file = "/sys/class/block/%s/dm/name" % dm_node try: name = open(name_file).read().strip() except IOError: # next, try pyblock name = block.getNameFromDmNode(dm_node) return name def dm_node_from_name(map_name): named_path = "/dev/mapper/%s" % map_name try: # /dev/mapper/ nodes are usually symlinks to /dev/dm-N node = os.path.basename(os.readlink(named_path)) except OSError: try: # dm devices' names are based on the block device minor st = os.stat(named_path) minor = os.minor(st.st_rdev) node = "dm-%d" % minor except OSError: # try pyblock node = block.getDmNodeFromName(map_name) if not node: raise DMError("dm_node_from_name(%s) has failed." % node) return node
Upload File
Create Folder