[Kimchi-devel] [PATCH] Fix duplicate dev names in host with multipath storage
Sheldon
shaohef at linux.vnet.ibm.com
Thu Feb 20 22:05:45 UTC 2014
Reviewed-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
set is good to avoid duplicate element
Type: method_descriptor
String Form:<method 'add' of 'set' objects>
Namespace: Python builtin
Docstring:
Add an element to a set.
This has no effect if the element is already present.
On 02/21/2014 04:01 AM, Rodrigo Trujillo wrote:
> If the host has a storage connection with multipath, lsblk is going to
> return the block devices twice, then when creating LOGICAL storage pool
> the user sees devices paths replicated in the UI.
> This patch fixes this problem.
>
> Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
> ---
> src/kimchi/disks.py | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/kimchi/disks.py b/src/kimchi/disks.py
> index 83d5cc6..ef065e2 100644
> --- a/src/kimchi/disks.py
> +++ b/src/kimchi/disks.py
> @@ -113,7 +113,7 @@ def _get_vgname(devNodePath):
>
>
> def get_partitions_names():
> - names = []
> + names = set()
> keys = ["NAME", "TYPE", "FSTYPE", "MOUNTPOINT", "MAJ:MIN"]
> # output is on format key="value",
> # where key can be NAME, TYPE, FSTYPE, MOUNTPOINT
> @@ -133,9 +133,9 @@ def get_partitions_names():
> _is_dev_leaf(devNodePath)):
> continue
>
> - names.append(name)
> + names.add(name)
>
> - return names
> + return list(names)
>
>
> def get_partition_details(name):
--
Thanks and best regards!
Sheldon Feng(冯少合)<shaohef at linux.vnet.ibm.com>
IBM Linux Technology Center
More information about the Kimchi-devel
mailing list