From: Fam Zheng <famz@redhat.com>
To: Ishani Chugh <chugh.ishani@research.iiit.ac.in>
Cc: qemu-devel@nongnu.org, jsnow@redhat.com, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 1/3] backup: QEMU Backup Tool
Date: Wed, 30 Aug 2017 12:15:39 +0800 [thread overview]
Message-ID: <20170830041539.GF4208@lemon.lan> (raw)
In-Reply-To: <1504025019-16820-2-git-send-email-chugh.ishani@research.iiit.ac.in>
On Tue, 08/29 22:13, Ishani Chugh wrote:
> + def _restore(self, guest_name):
> + """
> + Prints Steps to perform restore operation
> + """
> + if guest_name not in self.config.sections():
> + print("Cannot find specified guest", file=sys.stderr)
> + sys.exit(1)
> +
> + self.verify_guest_running(guest_name)
> + connection = QEMUMonitorProtocol(
> + self.get_socket_address(
> + self.config[guest_name]['qmp']))
> + connection.connect()
> + print("To perform restore:")
> + print("Shut down guest")
> + for key in self.config[guest_name]:
> + if key.startswith("drive_"):
> + drive = key[len('drive_'):]
> + target = self.config[guest_name][key]
> + cmd = {'execute': 'query-block'}
> + returned_json = connection.cmd_obj(cmd)
> + device_present = False
> + for device in returned_json['return']:
> + if device['device'] == drive:
> + device_present = True
> + location = device['inserted']['image']['filename']
> + print("Replace " + location + " By " + target)
Maybe just
print("qemu-img convert " + location + " " + target)
which is almost ready to copy&paste into a command line? (You or the user needs
take care of quoting and escaping to handle the special characters, if any.)
> +
> + if not device_present:
> + print("No such drive in guest", file=sys.stderr)
> + sys.exit(1)
> +
Fam
next prev parent reply other threads:[~2017-08-30 4:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-29 16:43 [Qemu-devel] [PATCH v2 0/3] QEMU Backup Tool Ishani Chugh
2017-08-29 16:43 ` [Qemu-devel] [PATCH v2 1/3] backup: " Ishani Chugh
2017-08-30 4:15 ` Fam Zheng [this message]
2017-08-30 4:21 ` Fam Zheng
2017-08-30 14:57 ` Ishani
2017-08-30 15:05 ` Stefan Hajnoczi
2017-08-29 16:43 ` [Qemu-devel] [PATCH v2 2/3] Test for full Backup Ishani Chugh
2017-08-29 16:43 ` [Qemu-devel] [PATCH v2 3/3] Add manpage for QEMU Backup Tool Ishani Chugh
2017-08-30 4:30 ` Fam Zheng
2017-08-30 4:31 ` [Qemu-devel] [PATCH v2 0/3] " Fam Zheng
2017-08-30 10:38 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170830041539.GF4208@lemon.lan \
--to=famz@redhat.com \
--cc=chugh.ishani@research.iiit.ac.in \
--cc=jsnow@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).