qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v5 1/1] Introduce "xen-load-devices-state"


From: Changlong Xie
Subject: Re: [Qemu-devel] [PATCH v5 1/1] Introduce "xen-load-devices-state"
Date: Fri, 3 Jun 2016 09:56:03 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

On 06/02/2016 11:14 PM, Anthony PERARD wrote:
On Thu, Jun 02, 2016 at 06:36:46PM +0800, Changlong Xie wrote:
+void qmp_xen_load_devices_state(const char *filename, Error **errp)
+{
+    QEMUFile *f;
+    QIOChannelFile *ioc;
+    int ret;
+
+    /* Guest must be paused before loading the device state; the RAM state
+     * will already have been loaded by xc
+     */
+    if (runstate_is_running()) {
+        error_setg(errp, "Cannot update device state while vm is running");
+        return;
+    }
+    vm_stop(RUN_STATE_RESTORE_VM);
+
+    ioc = qio_channel_file_new_path(filename, O_WRONLY | O_CREAT, 0660, errp);

This does not look right, it looks like it's going to open the file
to write to it. You probably want O_RDONLY, also I don't think the
O_CREAT flag is needed. (and without O_WRONLY, mode can be 0 instead of
0660.)

+    if (!ioc) {
+        return;
+    }
+    f = qemu_fopen_channel_output(QIO_CHANNEL(ioc));

I'm not sure, but I guess here you want qemu_fopen_channel_input here.

After go over io channel mechanism, i think you are right here.


Thanks,






reply via email to

[Prev in Thread] Current Thread [Next in Thread]