* [PATCH] migration: Truncate state file in xen-save-devices-state
@ 2020-09-21 9:48 Dov Murik
2020-09-21 11:17 ` Dr. David Alan Gilbert
0 siblings, 1 reply; 8+ messages in thread
From: Dov Murik @ 2020-09-21 9:48 UTC (permalink / raw)
To: qemu-devel; +Cc: Dov Murik, Dr. David Alan Gilbert, Juan Quintela
When running the xen-save-devices-state QMP command, if the filename
already exists it will be truncated before dumping the devices' state
into it.
Signed-off-by: Dov Murik <dovmurik@linux.vnet.ibm.com>
---
Note that I found the above issue while trying to debug
xen-load-devices-state which simply fails (prints "Configuration section
missing" to stderr) directly after xen-save-devices-state (in the same
VM). I wonder if I should file a bug report as-is or investigate some
more. Advice welcome.
-Dov
---
migration/savevm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/migration/savevm.c b/migration/savevm.c
index 304d98ff78..e1b26672cc 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2803,7 +2803,8 @@ void qmp_xen_save_devices_state(const char *filename, bool has_live, bool live,
vm_stop(RUN_STATE_SAVE_VM);
global_state_store_running();
- ioc = qio_channel_file_new_path(filename, O_WRONLY | O_CREAT, 0660, errp);
+ ioc = qio_channel_file_new_path(filename, O_WRONLY | O_CREAT | O_TRUNC,
+ 0660, errp);
if (!ioc) {
goto the_end;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] migration: Truncate state file in xen-save-devices-state
2020-09-21 9:48 [PATCH] migration: Truncate state file in xen-save-devices-state Dov Murik
@ 2020-09-21 11:17 ` Dr. David Alan Gilbert
2020-09-21 12:28 ` Dov Murik
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Dr. David Alan Gilbert @ 2020-09-21 11:17 UTC (permalink / raw)
To: Dov Murik, sstabellini, anthony.perard; +Cc: qemu-devel, Juan Quintela
* Dov Murik (dovmurik@linux.vnet.ibm.com) wrote:
> When running the xen-save-devices-state QMP command, if the filename
> already exists it will be truncated before dumping the devices' state
> into it.
>
> Signed-off-by: Dov Murik <dovmurik@linux.vnet.ibm.com>
> ---
OK, that looks fine to me, so:
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
>
> Note that I found the above issue while trying to debug
> xen-load-devices-state which simply fails (prints "Configuration section
> missing" to stderr) directly after xen-save-devices-state (in the same
> VM). I wonder if I should file a bug report as-is or investigate some
> more. Advice welcome.
I don't try the xen-* commands normally; I've cc'ing in Stefano and
Anthony.
Dave
>
> -Dov
>
> ---
> migration/savevm.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/migration/savevm.c b/migration/savevm.c
> index 304d98ff78..e1b26672cc 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -2803,7 +2803,8 @@ void qmp_xen_save_devices_state(const char *filename, bool has_live, bool live,
> vm_stop(RUN_STATE_SAVE_VM);
> global_state_store_running();
>
> - ioc = qio_channel_file_new_path(filename, O_WRONLY | O_CREAT, 0660, errp);
> + ioc = qio_channel_file_new_path(filename, O_WRONLY | O_CREAT | O_TRUNC,
> + 0660, errp);
> if (!ioc) {
> goto the_end;
> }
> --
> 2.20.1
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] migration: Truncate state file in xen-save-devices-state
2020-09-21 11:17 ` Dr. David Alan Gilbert
@ 2020-09-21 12:28 ` Dov Murik
2020-09-21 17:56 ` Dr. David Alan Gilbert
2020-09-23 18:59 ` Dr. David Alan Gilbert
2020-09-28 16:46 ` Anthony PERARD via
2 siblings, 1 reply; 8+ messages in thread
From: Dov Murik @ 2020-09-21 12:28 UTC (permalink / raw)
To: Dr. David Alan Gilbert, sstabellini, anthony.perard
Cc: qemu-devel, Juan Quintela
On 21/09/2020 14:17, Dr. David Alan Gilbert wrote:
> * Dov Murik (dovmurik@linux.vnet.ibm.com) wrote:
>> When running the xen-save-devices-state QMP command, if the filename
>> already exists it will be truncated before dumping the devices' state
>> into it.
>>
>> Signed-off-by: Dov Murik <dovmurik@linux.vnet.ibm.com>
>> ---
>
> OK, that looks fine to me, so:
>
> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
>
>>
>> Note that I found the above issue while trying to debug
>> xen-load-devices-state which simply fails (prints "Configuration section
>> missing" to stderr) directly after xen-save-devices-state (in the same
>> VM). I wonder if I should file a bug report as-is or investigate some
>> more. Advice welcome.
>
> I don't try the xen-* commands normally; I've cc'ing in Stefano and
> Anthony.
Thanks Dave. Just to be clear, I'm running this without Xen at all; but
these commands seem to work OK for dumping/restoring guest's devices
state (without RAM) -- if I modify the code to circumvent the mentioned
problem.
Dov
>
> Dave
>
>>
>> -Dov
>>
>> ---
>> migration/savevm.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/migration/savevm.c b/migration/savevm.c
>> index 304d98ff78..e1b26672cc 100644
>> --- a/migration/savevm.c
>> +++ b/migration/savevm.c
>> @@ -2803,7 +2803,8 @@ void qmp_xen_save_devices_state(const char *filename, bool has_live, bool live,
>> vm_stop(RUN_STATE_SAVE_VM);
>> global_state_store_running();
>>
>> - ioc = qio_channel_file_new_path(filename, O_WRONLY | O_CREAT, 0660, errp);
>> + ioc = qio_channel_file_new_path(filename, O_WRONLY | O_CREAT | O_TRUNC,
>> + 0660, errp);
>> if (!ioc) {
>> goto the_end;
>> }
>> --
>> 2.20.1
>>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] migration: Truncate state file in xen-save-devices-state
2020-09-21 12:28 ` Dov Murik
@ 2020-09-21 17:56 ` Dr. David Alan Gilbert
2020-09-21 23:46 ` Stefano Stabellini
0 siblings, 1 reply; 8+ messages in thread
From: Dr. David Alan Gilbert @ 2020-09-21 17:56 UTC (permalink / raw)
To: Dov Murik; +Cc: anthony.perard, sstabellini, qemu-devel, Juan Quintela
* Dov Murik (dovmurik@linux.vnet.ibm.com) wrote:
>
>
> On 21/09/2020 14:17, Dr. David Alan Gilbert wrote:
> > * Dov Murik (dovmurik@linux.vnet.ibm.com) wrote:
> > > When running the xen-save-devices-state QMP command, if the filename
> > > already exists it will be truncated before dumping the devices' state
> > > into it.
> > >
> > > Signed-off-by: Dov Murik <dovmurik@linux.vnet.ibm.com>
> > > ---
> >
> > OK, that looks fine to me, so:
> >
> > Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> >
> > >
> > > Note that I found the above issue while trying to debug
> > > xen-load-devices-state which simply fails (prints "Configuration section
> > > missing" to stderr) directly after xen-save-devices-state (in the same
> > > VM). I wonder if I should file a bug report as-is or investigate some
> > > more. Advice welcome.
> >
> > I don't try the xen-* commands normally; I've cc'ing in Stefano and
> > Anthony.
>
> Thanks Dave. Just to be clear, I'm running this without Xen at all; but
> these commands seem to work OK for dumping/restoring guest's devices
> state (without RAM) -- if I modify the code to circumvent the mentioned
> problem.
Yeh, although you can't rely on them not doing something Xen in the
future. There are a few other similar ways of doing what you want; eg.
if your RAM is 'shared' then you can set the x-ignore-shared migration
capability.
Dave
> Dov
>
> >
> > Dave
> >
> > >
> > > -Dov
> > >
> > > ---
> > > migration/savevm.c | 3 ++-
> > > 1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/migration/savevm.c b/migration/savevm.c
> > > index 304d98ff78..e1b26672cc 100644
> > > --- a/migration/savevm.c
> > > +++ b/migration/savevm.c
> > > @@ -2803,7 +2803,8 @@ void qmp_xen_save_devices_state(const char *filename, bool has_live, bool live,
> > > vm_stop(RUN_STATE_SAVE_VM);
> > > global_state_store_running();
> > > - ioc = qio_channel_file_new_path(filename, O_WRONLY | O_CREAT, 0660, errp);
> > > + ioc = qio_channel_file_new_path(filename, O_WRONLY | O_CREAT | O_TRUNC,
> > > + 0660, errp);
> > > if (!ioc) {
> > > goto the_end;
> > > }
> > > --
> > > 2.20.1
> > >
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] migration: Truncate state file in xen-save-devices-state
2020-09-21 17:56 ` Dr. David Alan Gilbert
@ 2020-09-21 23:46 ` Stefano Stabellini
0 siblings, 0 replies; 8+ messages in thread
From: Stefano Stabellini @ 2020-09-21 23:46 UTC (permalink / raw)
To: Dr. David Alan Gilbert
Cc: sstabellini, Paul Durrant, Juan Quintela, qemu-devel, Dov Murik,
anthony.perard
Adding Paul
On Mon, 21 Sep 2020, Dr. David Alan Gilbert wrote:
> * Dov Murik (dovmurik@linux.vnet.ibm.com) wrote:
> >
> >
> > On 21/09/2020 14:17, Dr. David Alan Gilbert wrote:
> > > * Dov Murik (dovmurik@linux.vnet.ibm.com) wrote:
> > > > When running the xen-save-devices-state QMP command, if the filename
> > > > already exists it will be truncated before dumping the devices' state
> > > > into it.
> > > >
> > > > Signed-off-by: Dov Murik <dovmurik@linux.vnet.ibm.com>
> > > > ---
> > >
> > > OK, that looks fine to me, so:
> > >
> > > Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > >
> > > >
> > > > Note that I found the above issue while trying to debug
> > > > xen-load-devices-state which simply fails (prints "Configuration section
> > > > missing" to stderr) directly after xen-save-devices-state (in the same
> > > > VM). I wonder if I should file a bug report as-is or investigate some
> > > > more. Advice welcome.
> > >
> > > I don't try the xen-* commands normally; I've cc'ing in Stefano and
> > > Anthony.
> >
> > Thanks Dave. Just to be clear, I'm running this without Xen at all; but
> > these commands seem to work OK for dumping/restoring guest's devices
> > state (without RAM) -- if I modify the code to circumvent the mentioned
> > problem.
>
> Yeh, although you can't rely on them not doing something Xen in the
> future. There are a few other similar ways of doing what you want; eg.
> if your RAM is 'shared' then you can set the x-ignore-shared migration
> capability.
>
> Dave
>
> > Dov
> >
> > >
> > > Dave
> > >
> > > >
> > > > -Dov
> > > >
> > > > ---
> > > > migration/savevm.c | 3 ++-
> > > > 1 file changed, 2 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/migration/savevm.c b/migration/savevm.c
> > > > index 304d98ff78..e1b26672cc 100644
> > > > --- a/migration/savevm.c
> > > > +++ b/migration/savevm.c
> > > > @@ -2803,7 +2803,8 @@ void qmp_xen_save_devices_state(const char *filename, bool has_live, bool live,
> > > > vm_stop(RUN_STATE_SAVE_VM);
> > > > global_state_store_running();
> > > > - ioc = qio_channel_file_new_path(filename, O_WRONLY | O_CREAT, 0660, errp);
> > > > + ioc = qio_channel_file_new_path(filename, O_WRONLY | O_CREAT | O_TRUNC,
> > > > + 0660, errp);
> > > > if (!ioc) {
> > > > goto the_end;
> > > > }
> > > > --
> > > > 2.20.1
> > > >
> >
> --
> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] migration: Truncate state file in xen-save-devices-state
2020-09-21 11:17 ` Dr. David Alan Gilbert
2020-09-21 12:28 ` Dov Murik
@ 2020-09-23 18:59 ` Dr. David Alan Gilbert
2020-09-28 16:46 ` Anthony PERARD via
2 siblings, 0 replies; 8+ messages in thread
From: Dr. David Alan Gilbert @ 2020-09-23 18:59 UTC (permalink / raw)
To: Dov Murik, sstabellini, anthony.perard; +Cc: qemu-devel, Juan Quintela
* Dr. David Alan Gilbert (dgilbert@redhat.com) wrote:
> * Dov Murik (dovmurik@linux.vnet.ibm.com) wrote:
> > When running the xen-save-devices-state QMP command, if the filename
> > already exists it will be truncated before dumping the devices' state
> > into it.
> >
> > Signed-off-by: Dov Murik <dovmurik@linux.vnet.ibm.com>
> > ---
>
> OK, that looks fine to me, so:
>
> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Queued
> >
> > Note that I found the above issue while trying to debug
> > xen-load-devices-state which simply fails (prints "Configuration section
> > missing" to stderr) directly after xen-save-devices-state (in the same
> > VM). I wonder if I should file a bug report as-is or investigate some
> > more. Advice welcome.
>
> I don't try the xen-* commands normally; I've cc'ing in Stefano and
> Anthony.
>
> Dave
>
> >
> > -Dov
> >
> > ---
> > migration/savevm.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/migration/savevm.c b/migration/savevm.c
> > index 304d98ff78..e1b26672cc 100644
> > --- a/migration/savevm.c
> > +++ b/migration/savevm.c
> > @@ -2803,7 +2803,8 @@ void qmp_xen_save_devices_state(const char *filename, bool has_live, bool live,
> > vm_stop(RUN_STATE_SAVE_VM);
> > global_state_store_running();
> >
> > - ioc = qio_channel_file_new_path(filename, O_WRONLY | O_CREAT, 0660, errp);
> > + ioc = qio_channel_file_new_path(filename, O_WRONLY | O_CREAT | O_TRUNC,
> > + 0660, errp);
> > if (!ioc) {
> > goto the_end;
> > }
> > --
> > 2.20.1
> >
> --
> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
>
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] migration: Truncate state file in xen-save-devices-state
2020-09-21 11:17 ` Dr. David Alan Gilbert
2020-09-21 12:28 ` Dov Murik
2020-09-23 18:59 ` Dr. David Alan Gilbert
@ 2020-09-28 16:46 ` Anthony PERARD via
2020-09-28 22:47 ` Marek Marczykowski-Górecki
2 siblings, 1 reply; 8+ messages in thread
From: Anthony PERARD via @ 2020-09-28 16:46 UTC (permalink / raw)
To: Marek Marczykowski-Górecki
Cc: Dov Murik, sstabellini, qemu-devel, Juan Quintela, Paul Durrant,
Dr. David Alan Gilbert
On Mon, Sep 21, 2020 at 12:17:23PM +0100, Dr. David Alan Gilbert wrote:
> * Dov Murik (dovmurik@linux.vnet.ibm.com) wrote:
> > When running the xen-save-devices-state QMP command, if the filename
> > already exists it will be truncated before dumping the devices' state
> > into it.
> >
> > Signed-off-by: Dov Murik <dovmurik@linux.vnet.ibm.com>
> > ---
> > migration/savevm.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/migration/savevm.c b/migration/savevm.c
> > index 304d98ff78..e1b26672cc 100644
> > --- a/migration/savevm.c
> > +++ b/migration/savevm.c
> > @@ -2803,7 +2803,8 @@ void qmp_xen_save_devices_state(const char *filename, bool has_live, bool live,
> > vm_stop(RUN_STATE_SAVE_VM);
> > global_state_store_running();
> >
> > - ioc = qio_channel_file_new_path(filename, O_WRONLY | O_CREAT, 0660, errp);
> > + ioc = qio_channel_file_new_path(filename, O_WRONLY | O_CREAT | O_TRUNC,
> > + 0660, errp);
> > if (!ioc) {
> > goto the_end;
> > }
Hi Marek,
Do you know if the above patch is going to work in a linux stubdomain?
Can we truncate the "save file" which seems to be stubdomain's console 1?
Cheers,
--
Anthony PERARD
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] migration: Truncate state file in xen-save-devices-state
2020-09-28 16:46 ` Anthony PERARD via
@ 2020-09-28 22:47 ` Marek Marczykowski-Górecki
0 siblings, 0 replies; 8+ messages in thread
From: Marek Marczykowski-Górecki @ 2020-09-28 22:47 UTC (permalink / raw)
To: Anthony PERARD
Cc: sstabellini, Paul Durrant, Juan Quintela, qemu-devel,
Dr. David Alan Gilbert, Dov Murik
[-- Attachment #1: Type: text/plain, Size: 1859 bytes --]
On Mon, Sep 28, 2020 at 05:46:18PM +0100, Anthony PERARD wrote:
> On Mon, Sep 21, 2020 at 12:17:23PM +0100, Dr. David Alan Gilbert wrote:
> > * Dov Murik (dovmurik@linux.vnet.ibm.com) wrote:
> > > When running the xen-save-devices-state QMP command, if the filename
> > > already exists it will be truncated before dumping the devices' state
> > > into it.
> > >
> > > Signed-off-by: Dov Murik <dovmurik@linux.vnet.ibm.com>
> > > ---
> > > migration/savevm.c | 3 ++-
> > > 1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/migration/savevm.c b/migration/savevm.c
> > > index 304d98ff78..e1b26672cc 100644
> > > --- a/migration/savevm.c
> > > +++ b/migration/savevm.c
> > > @@ -2803,7 +2803,8 @@ void qmp_xen_save_devices_state(const char *filename, bool has_live, bool live,
> > > vm_stop(RUN_STATE_SAVE_VM);
> > > global_state_store_running();
> > >
> > > - ioc = qio_channel_file_new_path(filename, O_WRONLY | O_CREAT, 0660, errp);
> > > + ioc = qio_channel_file_new_path(filename, O_WRONLY | O_CREAT | O_TRUNC,
> > > + 0660, errp);
> > > if (!ioc) {
> > > goto the_end;
> > > }
>
> Hi Marek,
>
> Do you know if the above patch is going to work in a linux stubdomain?
> Can we truncate the "save file" which seems to be stubdomain's console 1?
No, truncate won't work on the stubdomain's console. I mean, the
operation won't fail, but the actual file connected to the console on
the other end won't get truncated. But I think in case of stubdomain,
toolstack should connect the console to an empty file, so it shouldn't
be a problem.
--
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-09-28 22:48 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-21 9:48 [PATCH] migration: Truncate state file in xen-save-devices-state Dov Murik
2020-09-21 11:17 ` Dr. David Alan Gilbert
2020-09-21 12:28 ` Dov Murik
2020-09-21 17:56 ` Dr. David Alan Gilbert
2020-09-21 23:46 ` Stefano Stabellini
2020-09-23 18:59 ` Dr. David Alan Gilbert
2020-09-28 16:46 ` Anthony PERARD via
2020-09-28 22:47 ` Marek Marczykowski-Górecki
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).