starcluster.commands.listvolumes

Package starcluster :: Package commands :: Module listvolumes |
[hide private]
[frames] | no frames]

# Source Code for Module starcluster.commands.listvolumes

     1  #!/usr/bin/env python
     2
     3  from starcluster import static
     4
     5  from base import CmdBase
     6
     7
     8 -class CmdListVolumes(CmdBase):
     9      """
    10      listvolumes
    11
    12      List all EBS volumes
    13      """
    14      names = ['listvolumes', 'lv']
    15
    16 -    def addopts(self, parser):
    17          parser.add_option("-n", "--name", dest="name", type="string",
    18                            default=None, action="store",
    19                            help="show all volumes with a given 'Name' tag")
    20          parser.add_option("-d", "--show-deleted", dest="show_deleted",
    21                            action="store_true", default=False,
    22                            help="show volumes that are being deleted")
    23          parser.add_option("-v", "--volume-id", dest="volume_id",
    24                            action="store", type="string", default=None,
    25                            help="show a single volume with id VOLUME_ID")
    26          parser.add_option("-s", "--size", dest="size", action="store",
    27                            type="string", default=None,
    28                            help="show all volumes of a particular size")
    29          parser.add_option("-S", "--status", dest="status", action="store",
    30                            default=None, choices=static.VOLUME_STATUS,
    31                            help="show all volumes with status")
    32          parser.add_option("-a", "--attach-status", dest="attach_status",
    33                            action="store", default=None,
    34                            choices=static.VOLUME_ATTACH_STATUS,
    35                            help="show all volumes with attachment status")
    36          parser.add_option("-z", "--zone", dest="zone", action="store",
    37                            type="string", default=None,
    38                            help="show all volumes in zone")
    39          parser.add_option("-i", "--snapshot-id", dest="snapshot_id",
    40                            action="store", type="string", default=None,
    41                            help="show all volumes created from snapshot")
    42          parser.add_option("-t", "--tag", dest="tags", type="string",
    43                            default={}, action="callback",
    44                            callback=self._build_dict,
    45                            help="show all volumes with a given tag")
    46
    47 -    def execute(self, args):
    48          self.ec2.list_volumes(**self.options_dict)
    49