FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 03-09-2009, 01:39 PM
Joel Granados Moreno
 
Default Use the pyblock functions when possible.

* storage/devicelibs/dm.py : For each function that is used in the
storage code, we try to use pyblock first. We fail to calling
dmsetup.
* storage/devices.py : Erased the commented line that had the
pyblock call. We are doing all the pyblock calls from
storage/devicelibs/dm.py.
* storage/devicetree.py : likewise.
* storage/formats/dmraid.py : likewise.
---
storage/devicelibs/dm.py | 9 +++++++++
storage/devices.py | 2 --
storage/devicetree.py | 2 --
storage/formats/dmraid.py | 1 -
4 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/storage/devicelibs/dm.py b/storage/devicelibs/dm.py
index 74d8228..d3f5b4b 100644
--- a/storage/devicelibs/dm.py
+++ b/storage/devicelibs/dm.py
@@ -22,6 +22,7 @@

import os

+import block
import iutil
from ..errors import *

@@ -32,6 +33,10 @@ import logging
log = logging.getLogger("storage")

def name_from_dm_node(dm_node):
+ name = block.getNameFromDmNode(dm_node)
+ if name not None:
+ return name
+
st = os.stat("/dev/%s" % dm_node)
major = os.major(st.st_rdev)
minor = os.minor(st.st_rdev)
@@ -44,6 +49,10 @@ def name_from_dm_node(dm_node):
return name.strip()

def dm_node_from_name(map_name):
+ dm_node = block.getDmNodeFromName(map_name)
+ if dm_node not None:
+ return dm_node
+
devnum = iutil.execWithCapture("dmsetup",
["info", "--columns",
"--noheadings",
diff --git a/storage/devices.py b/storage/devices.py
index 8dc20c1..3e2ae10 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -98,7 +98,6 @@ import math
# device backend modules
from devicelibs import mdraid
from devicelibs import lvm
-#import block
from devicelibs import dm
import parted
import _ped
@@ -1230,7 +1229,6 @@ class DMDevice(StorageDevice):
raise DeviceError("device has not been created")

return dm.dm_node_from_name(self.name)
- #return block.getDmNodeFromName(self.name)

def _setName(self, name):
""" Set the device's map name. """
diff --git a/storage/devicetree.py b/storage/devicetree.py
index 2a9d62e..f110b19 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -674,7 +674,6 @@ class DeviceTree(object):
for slave_name in slave_names:
# if it's a dm-X name, resolve it to a map name first
if slave_name.startswith("dm-"):
- #slave_name = block.getNameFromDmNode(slave_name)
slave_name = dm.name_from_dm_node(slave_name)
slave_dev = self.getDeviceByName(slave_name)
if slave_dev:
@@ -728,7 +727,6 @@ class DeviceTree(object):
for slave_name in slave_names:
# if it's a dm-X name, resolve it to a map name
if slave_name.startswith("dm-"):
- #slave_name = block.getNameFromDmNode(slave_name)
slave_name = dm.name_from_dm_node(slave_name)
slave_dev = self.getDeviceByName(slave_name)
if slave_dev:
diff --git a/storage/formats/dmraid.py b/storage/formats/dmraid.py
index ef80902..f5f2808 100644
--- a/storage/formats/dmraid.py
+++ b/storage/formats/dmraid.py
@@ -23,7 +23,6 @@
import block

from iutil import log_method_call
-#from dm import dm_node_from_name
from ..errors import *
from . import DeviceFormat, register_device_format

--
1.6.0.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 03-09-2009, 02:01 PM
David Lehman
 
Default Use the pyblock functions when possible.

I like the approach, but there are a couple of syntax errors.

On Mon, 2009-03-09 at 15:39 +0100, Joel Granados Moreno wrote:
> * storage/devicelibs/dm.py : For each function that is used in the
> storage code, we try to use pyblock first. We fail to calling
> dmsetup.
> * storage/devices.py : Erased the commented line that had the
> pyblock call. We are doing all the pyblock calls from
> storage/devicelibs/dm.py.
> * storage/devicetree.py : likewise.
> * storage/formats/dmraid.py : likewise.
> ---
> storage/devicelibs/dm.py | 9 +++++++++
> storage/devices.py | 2 --
> storage/devicetree.py | 2 --
> storage/formats/dmraid.py | 1 -
> 4 files changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/storage/devicelibs/dm.py b/storage/devicelibs/dm.py
> index 74d8228..d3f5b4b 100644
> --- a/storage/devicelibs/dm.py
> +++ b/storage/devicelibs/dm.py
> @@ -22,6 +22,7 @@
>
> import os
>
> +import block
> import iutil
> from ..errors import *
>
> @@ -32,6 +33,10 @@ import logging
> log = logging.getLogger("storage")
>
> def name_from_dm_node(dm_node):
> + name = block.getNameFromDmNode(dm_node)
> + if name not None:
> + return name
> +

Syntax error:

- if name not None:
+ if name is not None:

> st = os.stat("/dev/%s" % dm_node)
> major = os.major(st.st_rdev)
> minor = os.minor(st.st_rdev)
> @@ -44,6 +49,10 @@ def name_from_dm_node(dm_node):
> return name.strip()
>
> def dm_node_from_name(map_name):
> + dm_node = block.getDmNodeFromName(map_name)
> + if dm_node not None:
> + return dm_node
> +

Syntax error:

- if name not None:
+ if name is not None:


> devnum = iutil.execWithCapture("dmsetup",
> ["info", "--columns",
> "--noheadings",
> diff --git a/storage/devices.py b/storage/devices.py
> index 8dc20c1..3e2ae10 100644
> --- a/storage/devices.py
> +++ b/storage/devices.py
> @@ -98,7 +98,6 @@ import math
> # device backend modules
> from devicelibs import mdraid
> from devicelibs import lvm
> -#import block
> from devicelibs import dm
> import parted
> import _ped
> @@ -1230,7 +1229,6 @@ class DMDevice(StorageDevice):
> raise DeviceError("device has not been created")
>
> return dm.dm_node_from_name(self.name)
> - #return block.getDmNodeFromName(self.name)
>
> def _setName(self, name):
> """ Set the device's map name. """
> diff --git a/storage/devicetree.py b/storage/devicetree.py
> index 2a9d62e..f110b19 100644
> --- a/storage/devicetree.py
> +++ b/storage/devicetree.py
> @@ -674,7 +674,6 @@ class DeviceTree(object):
> for slave_name in slave_names:
> # if it's a dm-X name, resolve it to a map name first
> if slave_name.startswith("dm-"):
> - #slave_name = block.getNameFromDmNode(slave_name)
> slave_name = dm.name_from_dm_node(slave_name)
> slave_dev = self.getDeviceByName(slave_name)
> if slave_dev:
> @@ -728,7 +727,6 @@ class DeviceTree(object):
> for slave_name in slave_names:
> # if it's a dm-X name, resolve it to a map name
> if slave_name.startswith("dm-"):
> - #slave_name = block.getNameFromDmNode(slave_name)
> slave_name = dm.name_from_dm_node(slave_name)
> slave_dev = self.getDeviceByName(slave_name)
> if slave_dev:
> diff --git a/storage/formats/dmraid.py b/storage/formats/dmraid.py
> index ef80902..f5f2808 100644
> --- a/storage/formats/dmraid.py
> +++ b/storage/formats/dmraid.py
> @@ -23,7 +23,6 @@
> import block
>
> from iutil import log_method_call
> -#from dm import dm_node_from_name
> from ..errors import *
> from . import DeviceFormat, register_device_format
>

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 03-09-2009, 02:15 PM
Joel Granados Moreno
 
Default Use the pyblock functions when possible.

* storage/devicelibs/dm.py : For each function that is used in the
storage code, we try to use pyblock first. We fail to calling
dmsetup.
* storage/devices.py : Erased the commented line that had the
pyblock call. We are doing all the pyblock calls from
storage/devicelibs/dm.py.
* storage/devicetree.py : likewise.
* storage/formats/dmraid.py : likewise.
---
storage/devicelibs/dm.py | 9 +++++++++
storage/devices.py | 2 --
storage/devicetree.py | 2 --
storage/formats/dmraid.py | 1 -
4 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/storage/devicelibs/dm.py b/storage/devicelibs/dm.py
index 74d8228..d3f5b4b 100644
--- a/storage/devicelibs/dm.py
+++ b/storage/devicelibs/dm.py
@@ -22,6 +22,7 @@

import os

+import block
import iutil
from ..errors import *

@@ -32,6 +33,10 @@ import logging
log = logging.getLogger("storage")

def name_from_dm_node(dm_node):
+ name = block.getNameFromDmNode(dm_node)
+ if name not None:
+ return name
+
st = os.stat("/dev/%s" % dm_node)
major = os.major(st.st_rdev)
minor = os.minor(st.st_rdev)
@@ -44,6 +49,10 @@ def name_from_dm_node(dm_node):
return name.strip()

def dm_node_from_name(map_name):
+ dm_node = block.getDmNodeFromName(map_name)
+ if dm_node not None:
+ return dm_node
+
devnum = iutil.execWithCapture("dmsetup",
["info", "--columns",
"--noheadings",
diff --git a/storage/devices.py b/storage/devices.py
index 8dc20c1..3e2ae10 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -98,7 +98,6 @@ import math
# device backend modules
from devicelibs import mdraid
from devicelibs import lvm
-#import block
from devicelibs import dm
import parted
import _ped
@@ -1230,7 +1229,6 @@ class DMDevice(StorageDevice):
raise DeviceError("device has not been created")

return dm.dm_node_from_name(self.name)
- #return block.getDmNodeFromName(self.name)

def _setName(self, name):
""" Set the device's map name. """
diff --git a/storage/devicetree.py b/storage/devicetree.py
index 2a9d62e..f110b19 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -674,7 +674,6 @@ class DeviceTree(object):
for slave_name in slave_names:
# if it's a dm-X name, resolve it to a map name first
if slave_name.startswith("dm-"):
- #slave_name = block.getNameFromDmNode(slave_name)
slave_name = dm.name_from_dm_node(slave_name)
slave_dev = self.getDeviceByName(slave_name)
if slave_dev:
@@ -728,7 +727,6 @@ class DeviceTree(object):
for slave_name in slave_names:
# if it's a dm-X name, resolve it to a map name
if slave_name.startswith("dm-"):
- #slave_name = block.getNameFromDmNode(slave_name)
slave_name = dm.name_from_dm_node(slave_name)
slave_dev = self.getDeviceByName(slave_name)
if slave_dev:
diff --git a/storage/formats/dmraid.py b/storage/formats/dmraid.py
index ef80902..f5f2808 100644
--- a/storage/formats/dmraid.py
+++ b/storage/formats/dmraid.py
@@ -23,7 +23,6 @@
import block

from iutil import log_method_call
-#from dm import dm_node_from_name
from ..errors import *
from . import DeviceFormat, register_device_format

--
1.6.0.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 03-09-2009, 02:17 PM
Joel Granados
 
Default Use the pyblock functions when possible.

Yep. I know. I had already fixed them but forgot to put them in the
patch. This is actually already tested. Sorry for the noise.

On Mon, Mar 09, 2009 at 10:01:51AM -0500, David Lehman wrote:
> I like the approach, but there are a couple of syntax errors.
>
> On Mon, 2009-03-09 at 15:39 +0100, Joel Granados Moreno wrote:
> > * storage/devicelibs/dm.py : For each function that is used in the
> > storage code, we try to use pyblock first. We fail to calling
> > dmsetup.
> > * storage/devices.py : Erased the commented line that had the
> > pyblock call. We are doing all the pyblock calls from
> > storage/devicelibs/dm.py.
> > * storage/devicetree.py : likewise.
> > * storage/formats/dmraid.py : likewise.
> > ---
> > storage/devicelibs/dm.py | 9 +++++++++
> > storage/devices.py | 2 --
> > storage/devicetree.py | 2 --
> > storage/formats/dmraid.py | 1 -
> > 4 files changed, 9 insertions(+), 5 deletions(-)
> >
> > diff --git a/storage/devicelibs/dm.py b/storage/devicelibs/dm.py
> > index 74d8228..d3f5b4b 100644
> > --- a/storage/devicelibs/dm.py
> > +++ b/storage/devicelibs/dm.py
> > @@ -22,6 +22,7 @@
> >
> > import os
> >
> > +import block
> > import iutil
> > from ..errors import *
> >
> > @@ -32,6 +33,10 @@ import logging
> > log = logging.getLogger("storage")
> >
> > def name_from_dm_node(dm_node):
> > + name = block.getNameFromDmNode(dm_node)
> > + if name not None:
> > + return name
> > +
>
> Syntax error:
>
> - if name not None:
> + if name is not None:
>
> > st = os.stat("/dev/%s" % dm_node)
> > major = os.major(st.st_rdev)
> > minor = os.minor(st.st_rdev)
> > @@ -44,6 +49,10 @@ def name_from_dm_node(dm_node):
> > return name.strip()
> >
> > def dm_node_from_name(map_name):
> > + dm_node = block.getDmNodeFromName(map_name)
> > + if dm_node not None:
> > + return dm_node
> > +
>
> Syntax error:
>
> - if name not None:
> + if name is not None:
>
>
> > devnum = iutil.execWithCapture("dmsetup",
> > ["info", "--columns",
> > "--noheadings",
> > diff --git a/storage/devices.py b/storage/devices.py
> > index 8dc20c1..3e2ae10 100644
> > --- a/storage/devices.py
> > +++ b/storage/devices.py
> > @@ -98,7 +98,6 @@ import math
> > # device backend modules
> > from devicelibs import mdraid
> > from devicelibs import lvm
> > -#import block
> > from devicelibs import dm
> > import parted
> > import _ped
> > @@ -1230,7 +1229,6 @@ class DMDevice(StorageDevice):
> > raise DeviceError("device has not been created")
> >
> > return dm.dm_node_from_name(self.name)
> > - #return block.getDmNodeFromName(self.name)
> >
> > def _setName(self, name):
> > """ Set the device's map name. """
> > diff --git a/storage/devicetree.py b/storage/devicetree.py
> > index 2a9d62e..f110b19 100644
> > --- a/storage/devicetree.py
> > +++ b/storage/devicetree.py
> > @@ -674,7 +674,6 @@ class DeviceTree(object):
> > for slave_name in slave_names:
> > # if it's a dm-X name, resolve it to a map name first
> > if slave_name.startswith("dm-"):
> > - #slave_name = block.getNameFromDmNode(slave_name)
> > slave_name = dm.name_from_dm_node(slave_name)
> > slave_dev = self.getDeviceByName(slave_name)
> > if slave_dev:
> > @@ -728,7 +727,6 @@ class DeviceTree(object):
> > for slave_name in slave_names:
> > # if it's a dm-X name, resolve it to a map name
> > if slave_name.startswith("dm-"):
> > - #slave_name = block.getNameFromDmNode(slave_name)
> > slave_name = dm.name_from_dm_node(slave_name)
> > slave_dev = self.getDeviceByName(slave_name)
> > if slave_dev:
> > diff --git a/storage/formats/dmraid.py b/storage/formats/dmraid.py
> > index ef80902..f5f2808 100644
> > --- a/storage/formats/dmraid.py
> > +++ b/storage/formats/dmraid.py
> > @@ -23,7 +23,6 @@
> > import block
> >
> > from iutil import log_method_call
> > -#from dm import dm_node_from_name
> > from ..errors import *
> > from . import DeviceFormat, register_device_format
> >
>
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@redhat.com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

--
Joel Andres Granados
Brno, Czech Republic, Red Hat.

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 03-09-2009, 02:19 PM
Joel Granados
 
Default Use the pyblock functions when possible.

Pls ignore this one. just some trash that was left from previous email
.
On Mon, Mar 09, 2009 at 04:15:55PM +0100, Joel Granados Moreno wrote:
> * storage/devicelibs/dm.py : For each function that is used in the
> storage code, we try to use pyblock first. We fail to calling
> dmsetup.
> * storage/devices.py : Erased the commented line that had the
> pyblock call. We are doing all the pyblock calls from
> storage/devicelibs/dm.py.
> * storage/devicetree.py : likewise.
> * storage/formats/dmraid.py : likewise.
> ---
> storage/devicelibs/dm.py | 9 +++++++++
> storage/devices.py | 2 --
> storage/devicetree.py | 2 --
> storage/formats/dmraid.py | 1 -
> 4 files changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/storage/devicelibs/dm.py b/storage/devicelibs/dm.py
> index 74d8228..d3f5b4b 100644
> --- a/storage/devicelibs/dm.py
> +++ b/storage/devicelibs/dm.py
> @@ -22,6 +22,7 @@
>
> import os
>
> +import block
> import iutil
> from ..errors import *
>
> @@ -32,6 +33,10 @@ import logging
> log = logging.getLogger("storage")
>
> def name_from_dm_node(dm_node):
> + name = block.getNameFromDmNode(dm_node)
> + if name not None:
> + return name
> +
> st = os.stat("/dev/%s" % dm_node)
> major = os.major(st.st_rdev)
> minor = os.minor(st.st_rdev)
> @@ -44,6 +49,10 @@ def name_from_dm_node(dm_node):
> return name.strip()
>
> def dm_node_from_name(map_name):
> + dm_node = block.getDmNodeFromName(map_name)
> + if dm_node not None:
> + return dm_node
> +
> devnum = iutil.execWithCapture("dmsetup",
> ["info", "--columns",
> "--noheadings",
> diff --git a/storage/devices.py b/storage/devices.py
> index 8dc20c1..3e2ae10 100644
> --- a/storage/devices.py
> +++ b/storage/devices.py
> @@ -98,7 +98,6 @@ import math
> # device backend modules
> from devicelibs import mdraid
> from devicelibs import lvm
> -#import block
> from devicelibs import dm
> import parted
> import _ped
> @@ -1230,7 +1229,6 @@ class DMDevice(StorageDevice):
> raise DeviceError("device has not been created")
>
> return dm.dm_node_from_name(self.name)
> - #return block.getDmNodeFromName(self.name)
>
> def _setName(self, name):
> """ Set the device's map name. """
> diff --git a/storage/devicetree.py b/storage/devicetree.py
> index 2a9d62e..f110b19 100644
> --- a/storage/devicetree.py
> +++ b/storage/devicetree.py
> @@ -674,7 +674,6 @@ class DeviceTree(object):
> for slave_name in slave_names:
> # if it's a dm-X name, resolve it to a map name first
> if slave_name.startswith("dm-"):
> - #slave_name = block.getNameFromDmNode(slave_name)
> slave_name = dm.name_from_dm_node(slave_name)
> slave_dev = self.getDeviceByName(slave_name)
> if slave_dev:
> @@ -728,7 +727,6 @@ class DeviceTree(object):
> for slave_name in slave_names:
> # if it's a dm-X name, resolve it to a map name
> if slave_name.startswith("dm-"):
> - #slave_name = block.getNameFromDmNode(slave_name)
> slave_name = dm.name_from_dm_node(slave_name)
> slave_dev = self.getDeviceByName(slave_name)
> if slave_dev:
> diff --git a/storage/formats/dmraid.py b/storage/formats/dmraid.py
> index ef80902..f5f2808 100644
> --- a/storage/formats/dmraid.py
> +++ b/storage/formats/dmraid.py
> @@ -23,7 +23,6 @@
> import block
>
> from iutil import log_method_call
> -#from dm import dm_node_from_name
> from ..errors import *
> from . import DeviceFormat, register_device_format
>
> --
> 1.6.0.6
>
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@redhat.com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

--
Joel Andres Granados
Brno, Czech Republic, Red Hat.

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 03-09-2009, 03:36 PM
Joel Granados Moreno
 
Default Use the pyblock functions when possible.

* storage/devicelibs/dm.py : For each function that is used in the
storage code, we try to use pyblock first. We fail to calling
dmsetup.
* storage/devices.py : Erased the commented line that had the
pyblock call. We are doing all the pyblock calls from
storage/devicelibs/dm.py.
* storage/devicetree.py : likewise.
* storage/formats/dmraid.py : likewise.
---
storage/devicelibs/dm.py | 9 +++++++++
storage/devices.py | 2 --
storage/devicetree.py | 2 --
storage/formats/dmraid.py | 1 -
4 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/storage/devicelibs/dm.py b/storage/devicelibs/dm.py
index 74d8228..29df126 100644
--- a/storage/devicelibs/dm.py
+++ b/storage/devicelibs/dm.py
@@ -22,6 +22,7 @@

import os

+import block
import iutil
from ..errors import *

@@ -32,6 +33,10 @@ import logging
log = logging.getLogger("storage")

def name_from_dm_node(dm_node):
+ name = block.getNameFromDmNode(dm_node)
+ if name is not None:
+ return name
+
st = os.stat("/dev/%s" % dm_node)
major = os.major(st.st_rdev)
minor = os.minor(st.st_rdev)
@@ -44,6 +49,10 @@ def name_from_dm_node(dm_node):
return name.strip()

def dm_node_from_name(map_name):
+ dm_node = block.getDmNodeFromName(map_name)
+ if dm_node is not None:
+ return dm_node
+
devnum = iutil.execWithCapture("dmsetup",
["info", "--columns",
"--noheadings",
diff --git a/storage/devices.py b/storage/devices.py
index 8dc20c1..3e2ae10 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -98,7 +98,6 @@ import math
# device backend modules
from devicelibs import mdraid
from devicelibs import lvm
-#import block
from devicelibs import dm
import parted
import _ped
@@ -1230,7 +1229,6 @@ class DMDevice(StorageDevice):
raise DeviceError("device has not been created")

return dm.dm_node_from_name(self.name)
- #return block.getDmNodeFromName(self.name)

def _setName(self, name):
""" Set the device's map name. """
diff --git a/storage/devicetree.py b/storage/devicetree.py
index 2a9d62e..f110b19 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -674,7 +674,6 @@ class DeviceTree(object):
for slave_name in slave_names:
# if it's a dm-X name, resolve it to a map name first
if slave_name.startswith("dm-"):
- #slave_name = block.getNameFromDmNode(slave_name)
slave_name = dm.name_from_dm_node(slave_name)
slave_dev = self.getDeviceByName(slave_name)
if slave_dev:
@@ -728,7 +727,6 @@ class DeviceTree(object):
for slave_name in slave_names:
# if it's a dm-X name, resolve it to a map name
if slave_name.startswith("dm-"):
- #slave_name = block.getNameFromDmNode(slave_name)
slave_name = dm.name_from_dm_node(slave_name)
slave_dev = self.getDeviceByName(slave_name)
if slave_dev:
diff --git a/storage/formats/dmraid.py b/storage/formats/dmraid.py
index ef80902..f5f2808 100644
--- a/storage/formats/dmraid.py
+++ b/storage/formats/dmraid.py
@@ -23,7 +23,6 @@
import block

from iutil import log_method_call
-#from dm import dm_node_from_name
from ..errors import *
from . import DeviceFormat, register_device_format

--
1.6.0.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 03-10-2009, 02:49 PM
David Lehman
 
Default Use the pyblock functions when possible.

Looks good to me.

On Mon, 2009-03-09 at 17:36 +0100, Joel Granados Moreno wrote:
> * storage/devicelibs/dm.py : For each function that is used in the
> storage code, we try to use pyblock first. We fail to calling
> dmsetup.
> * storage/devices.py : Erased the commented line that had the
> pyblock call. We are doing all the pyblock calls from
> storage/devicelibs/dm.py.
> * storage/devicetree.py : likewise.
> * storage/formats/dmraid.py : likewise.
> ---
> storage/devicelibs/dm.py | 9 +++++++++
> storage/devices.py | 2 --
> storage/devicetree.py | 2 --
> storage/formats/dmraid.py | 1 -
> 4 files changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/storage/devicelibs/dm.py b/storage/devicelibs/dm.py
> index 74d8228..29df126 100644
> --- a/storage/devicelibs/dm.py
> +++ b/storage/devicelibs/dm.py
> @@ -22,6 +22,7 @@
>
> import os
>
> +import block
> import iutil
> from ..errors import *
>
> @@ -32,6 +33,10 @@ import logging
> log = logging.getLogger("storage")
>
> def name_from_dm_node(dm_node):
> + name = block.getNameFromDmNode(dm_node)
> + if name is not None:
> + return name
> +
> st = os.stat("/dev/%s" % dm_node)
> major = os.major(st.st_rdev)
> minor = os.minor(st.st_rdev)
> @@ -44,6 +49,10 @@ def name_from_dm_node(dm_node):
> return name.strip()
>
> def dm_node_from_name(map_name):
> + dm_node = block.getDmNodeFromName(map_name)
> + if dm_node is not None:
> + return dm_node
> +
> devnum = iutil.execWithCapture("dmsetup",
> ["info", "--columns",
> "--noheadings",
> diff --git a/storage/devices.py b/storage/devices.py
> index 8dc20c1..3e2ae10 100644
> --- a/storage/devices.py
> +++ b/storage/devices.py
> @@ -98,7 +98,6 @@ import math
> # device backend modules
> from devicelibs import mdraid
> from devicelibs import lvm
> -#import block
> from devicelibs import dm
> import parted
> import _ped
> @@ -1230,7 +1229,6 @@ class DMDevice(StorageDevice):
> raise DeviceError("device has not been created")
>
> return dm.dm_node_from_name(self.name)
> - #return block.getDmNodeFromName(self.name)
>
> def _setName(self, name):
> """ Set the device's map name. """
> diff --git a/storage/devicetree.py b/storage/devicetree.py
> index 2a9d62e..f110b19 100644
> --- a/storage/devicetree.py
> +++ b/storage/devicetree.py
> @@ -674,7 +674,6 @@ class DeviceTree(object):
> for slave_name in slave_names:
> # if it's a dm-X name, resolve it to a map name first
> if slave_name.startswith("dm-"):
> - #slave_name = block.getNameFromDmNode(slave_name)
> slave_name = dm.name_from_dm_node(slave_name)
> slave_dev = self.getDeviceByName(slave_name)
> if slave_dev:
> @@ -728,7 +727,6 @@ class DeviceTree(object):
> for slave_name in slave_names:
> # if it's a dm-X name, resolve it to a map name
> if slave_name.startswith("dm-"):
> - #slave_name = block.getNameFromDmNode(slave_name)
> slave_name = dm.name_from_dm_node(slave_name)
> slave_dev = self.getDeviceByName(slave_name)
> if slave_dev:
> diff --git a/storage/formats/dmraid.py b/storage/formats/dmraid.py
> index ef80902..f5f2808 100644
> --- a/storage/formats/dmraid.py
> +++ b/storage/formats/dmraid.py
> @@ -23,7 +23,6 @@
> import block
>
> from iutil import log_method_call
> -#from dm import dm_node_from_name
> from ..errors import *
> from . import DeviceFormat, register_device_format
>

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 12:35 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org