Re: [PATCH 1/8] Add functions to go from an iScsiDiskDevice to an libiscsi node

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On a quick scan over the code.  Cant see anything wrong.
ack, to all the patches.

On Fri, Jul 31, 2009 at 07:22:57PM +0200, Hans de Goede wrote:
> Add functions to go from an iScsiDiskDevice to an libiscsi node and the other
> way around. This is a preparation patch for adding support for writing
> the necessary dracut cmdline options to grub.conf
> ---
>  storage/iscsi.py |   30 +++++++++++++++++++++++-------
>  1 files changed, 23 insertions(+), 7 deletions(-)
> 
> diff --git a/storage/iscsi.py b/storage/iscsi.py
> index cfe0c55..13ddc08 100644
> --- a/storage/iscsi.py
> +++ b/storage/iscsi.py
> @@ -268,13 +268,10 @@ class iscsi(object):
>                  # devices used for root get started by the initrd
>                  if root.dependsOn(disk):
>                      continue
> -                # find the iscsi node matching this disk
> -                for node in self.nodes:
> -                    if node.name    == disk.iscsi_name and \
> -                       node.address == disk.iscsi_address and \
> -                       node.port    == disk.iscsi_port:
> -                        node.setParameter("node.startup", "automatic")
> -                        break
> +
> +                node = self.getNode(disk.iscsi_name, disk.iscsi_address, disk.iscsi_port)
> +                if node:
> +                    node.setParameter("node.startup", "automatic")
>  
>              if not os.path.isdir(instPath + "/etc/iscsi"):
>                  os.makedirs(instPath + "/etc/iscsi", 0755)
> @@ -289,4 +286,23 @@ class iscsi(object):
>                  shutil.copytree("/var/lib/iscsi", instPath + "/var/lib/iscsi",
>                                  symlinks=True)
>  
> +    def getNode(self, name, address, port):
> +        for node in self.nodes:
> +            if node.name == name and node.address == address and \
> +               node.port == port:
> +                return node
> +
> +        return None
> +
> +    def getNodeDisks(self, node, storage):
> +        nodeDisks = []
> +        iscsiDisks = storage.devicetree.getDevicesByType("iscsi")
> +        for disk in iscsiDisks:
> +            if node.name    == disk.iscsi_name and \
> +               node.address == disk.iscsi_address and \
> +               node.port    == disk.iscsi_port:
> +                nodeDisks.append(disk)
> +
> +        return nodeDisks
> +
>  # vim:tw=78:ts=4:et:sw=4
> -- 
> 1.6.2.2
> 
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

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

Attachment: pgpbN3T2pFDrh.pgp
Description: PGP signature

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

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux