Change in vdsm[master]: storage: introducing vdsm-dump-chains script (part of vdsm-t...

nsoffer at redhat.com nsoffer at redhat.com
Mon Mar 30 14:45:22 UTC 2015


Nir Soffer has posted comments on this change.

Change subject: storage: introducing vdsm-dump-chains script (part of vdsm-tool)
......................................................................


Patch Set 11:

(5 comments)

Please show the new output.

https://gerrit.ovirt.org/#/c/38281/11/lib/vdsm/tool/dump_volume_chains.py
File lib/vdsm/tool/dump_volume_chains.py:

Line 53: 
Line 54: 
Line 55: _chainError_message = '''
Line 56: Error in volume chain %s: %s
Line 57:         volumes and parents: %s'''
Should be:

    ChainError:
        message = """..."""

        def __str__(self):
            return self.message % ...
Line 58: 
Line 59: 
Line 60: class ChainError(DumpChainsError):
Line 61:     def __init__(self, volumes_children, img_uuid):


Line 97:     dump-volume-chains
Line 98:     Query VDSM about the existing structure of image volumes and prints
Line 99:     them in an ordered fashion with optional additional info per volume.
Line 100:     """
Line 101:     parsed_args = _parse_args(args)
While this name is correct, "options" is even better.
Line 102:     server = _connect_to_server(parsed_args.host, parsed_args.port,
Line 103:                                 parsed_args.use_ssl)
Line 104:     image_chains, volumes_info = _get_volumes_chains(
Line 105:         server, parsed_args.sd_uuid[0])


Line 101:     parsed_args = _parse_args(args)
Line 102:     server = _connect_to_server(parsed_args.host, parsed_args.port,
Line 103:                                 parsed_args.use_ssl)
Line 104:     image_chains, volumes_info = _get_volumes_chains(
Line 105:         server, parsed_args.sd_uuid[0])
Use parsed_args.sd_uuid (see comment in parse_args)
Line 106: 
Line 107:     _print_volume_chains(image_chains, volumes_info)
Line 108: 
Line 109: 


Line 119: 
Line 120: 
Line 121: def _parse_args(args):
Line 122:     parser = argparse.ArgumentParser()
Line 123:     parser.add_argument('sd_uuid', nargs=1, help='sd_UUID')
1. No need for nargs, adding an argument without it register a single sd_uuid argument.

2. "sd UUID" -> "storage domain UUID"
Line 124:     parser.add_argument('-u', '--unsecured', action='store_false',
Line 125:                         dest='use_ssl', default=True,
Line 126:                         help="use unsecured connection")
Line 127:     parser.add_argument('-H', '--host', default=vdscli.ADDRESS)


Line 187:         child_vol = volumes_by_parents.get(child_vol)
Line 188:         if child_vol in chain:
Line 189:             raise ChainLoopError(volumes_children, img_uuid)
Line 190:         if child_vol is None:
Line 191:             break  # end of chain
Should become before "in chain" check. This is the exit condition, and twe can check it right after the get.
Line 192:         chain.append(child_vol)
Line 193: 
Line 194:     if not chain and volumes_by_parents:
Line 195:         raise NoBaseVolume(volumes_children, img_uuid)


-- 
To view, visit https://gerrit.ovirt.org/38281
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I428c443bb7d6b2a504a6f77efcd4838f7ae6c404
Gerrit-PatchSet: 11
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ido Barkan <ibarkan at redhat.com>
Gerrit-Reviewer: Adam Litke <alitke at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Darshan N <dnarayan at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Ido Barkan <ibarkan at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Vladik Romanovsky <vladik.romanovsky at gmail.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: Yaniv Dary <ydary at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list