Ejemplo n.º 1
0
 def take_action(self, args):
     cli = client.get_client_from_options(self._cmd_options)
     vm = cli.get_vm(args.id)
     columns = ('ID', 'Friendly name', 'UUID', 'Disks', 'Snapshots')
     data = (vm["name"], vm["friendly_name"], vm["uuid"],
             "\n".join([d["name"]
                        for d in vm["disks"]]), "\n".join(vm["snapshots"]))
     return (columns, data)
Ejemplo n.º 2
0
    def take_action(self, args):
        cli = client.get_client_from_options(
            self._cmd_options)
        kw = {
            "compare_to": args.diff_from,
            "squash": True,
        }
        snap = cli.get_snapshot(
            args.vmID, args.snapshotID, **kw)
        self._ensure_out_dir(args.out_dir)

        for disk in snap["disks"]:
            self._download_disk(cli, args, disk)
Ejemplo n.º 3
0
    def take_action(self, args):
        cli = client.get_client_from_options(self._cmd_options)
        vms = cli.get_vms()
        ret = [["ID", "Friendly Name", "Snapshots"]]
        items = []
        for vm in vms:
            item = [
                vm["name"], vm["friendly_name"], "\n".join(vm["snapshots"])
            ]
            items.append(item)

        ret.append(items)
        return ret
Ejemplo n.º 4
0
    def take_action(self, args):
        cli = client.get_client_from_options(
            self._cmd_options)
        snap = cli.get_snapshot(args.vmID, args.snapshotID)
        columns = ('Snapshot ID',
                   'VM ID',
                   'Disks')

        data = (
            snap["id"],
            snap["vm_id"],
            "\n".join(
                [d["name"] for d in snap["disks"]]
            )
        )
        return (columns, data)
Ejemplo n.º 5
0
    def take_action(self, args):
        cli = client.get_client_from_options(
            self._cmd_options)
        snapshots = cli.get_snapshots(args.vmID)
        ret = [
            ["Snapshot ID",]
        ]
        items = []
        for snap in snapshots:
            item = [
                snap["id"],
            ]
            items.append(item)

        ret.append(items)
        return ret
Ejemplo n.º 6
0
 def take_action(self, args):
     cli = client.get_client_from_options(
         self._cmd_options)
     cli.delete_all_snapshots(args.vmID)