Ido Barkan has posted comments on this change.
Change subject: storage: introducing vdsm-dump-chains script (part of vdsm-tool) ......................................................................
Patch Set 11:
(5 comments)
Images volume chains (base volume first)
image: 8e285114-448e-4924-9531-f4ac1f38b93b - 63bc0a78-d4b2-4831-a2f3-7775b1cbc16e status: OK, voltype: LEAF, format: RAW, legality: LEGAL, type: SPARSE
image: 56415d9a-7faa-4ef8-9be8-32ad2a9de7c1 - fa6cb5b7-be42-45f5-994d-1129edb248b0 status: OK, voltype: INTERNAL, format: RAW, legality: LEGAL, type: SPARSE
- 06b512f6-ee6f-4c2c-b568-d40ff08fa482 status: OK, voltype: INTERNAL, format: COW, legality: LEGAL, type: SPARSE
- b7b9479d-027f-4d88-be7f-8677e8dc27b6 status: OK, voltype: INTERNAL, format: COW, legality: LEGAL, type: SPARSE
- 59b0b422-d00b-40ab-b3d9-c01bb599ff8d status: OK, voltype: LEAF, format: COW, legality: LEGAL, type: SPARSE
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:
Done 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.
Options are for options. We have an argument here which is non-optional (sd_uuid). So options is just wrong. 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)
Done 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')
- No need for nargs, adding an argument without it register a single sd_uu
Done 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
Done 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)
vdsm-patches@lists.fedorahosted.org