QMP, HMP: introduce 'writeconfig' command
Hi Guys,
This thread is a continuation of discussion started in
http://lists.nongnu.org/archive/html/qemu-devel/2017-02/msg03182.html.
This series introduces ‘writeconfig’ command support for QMP and HMP monitors. This functionality might be useful for live migration for cases when guest configuration was modified in runtime (for example as a result of hot- plug/unplug operations) and actual Qemu command line no longer reflects setup exposed to guest.
Original series has ‘qemu_opts’ patch as well (http://lists.nongnu.org/archive/html/qemu-devel/2017-02/msg03183.html) because HMP’s ‘object_add’ result was not reflected in ‘writeconfig’ output. Later I found that QMP’s ‘object-add’ has the same issue. Anyway, I don’t include ‘qemu_opts’ patches here because Markus mentioned (here http://lists.nongnu.org/archive/html/qemu-devel/2017-02/msg03476.html) that this functionality is going to be reworked in some future and such patches might collide with the rework process.
Markus, could you please post if you have an update on this topic? Current ‘master’ branch (9993c82dc2f5ce58b41d708b765e1a717ad4281d) still has the issue.
Also, Markus mentioned that once configuration was changed during live migration -- it might be an issue because ‘writeconfig’ data became outdated (and might be make sense to think about to embed this data into migration stream itself). In the same time David said that this is another problem which is unrelated to this patch series. What is your current opinion on this topic? Can we consider these patches to be included into ‘master’ taking into account that not all configuration is dumped by ‘writeconfig’ (‘object_add’ problem), but this can be fixed later?
Best regards,
Vadim
PATCH 1/4 qmp: introduce 'writeconfig' command
Add support for `writeconfig' command for QMP monitor. This is a simple way to keep track of current state of VM after series of hotplugs and/or hotunplugs of different devices.
--- qapi-schema.json | 18 ++++++++++++++++++ qmp.c | 21 +++++++++++++++++++++ 2 files changed, 39 insertions(+)
qapi-schema.json +18 -0
@@ -3200,3 +3200,21 @@ # Since: 2.11 ## { 'command': 'watchdog-set-action', 'data' : {'action': 'WatchdogAction'} } + +## +# @writeconfig: +# +# Dump current configuration into specified file +# +# @file: pathname of a file to store current configuration +# +# Since: 2.11 +# +# Example: +# +# -> { "execute": "writeconfig", +# "arguments": { "file": "/tmp/qemu.conf" } } +# <- { "return": {} } +# +## +{ 'command': 'writeconfig', 'data': {'file': 'str'} }
qmp.c +21 -0
@@ -722,3 +722,24 @@ MemoryInfo *qmp_query_memory_size_summary(Error **errp)return mem_info; } + +void qmp_writeconfig (const char *file,Error **errp) +{ +int fd; +FILE *fp; + + fd =qemu_open (file,O_WRONLY |O_CREAT |O_TRUNC ,0600 ); +if (fd !=-1 ) { + + fp =fdopen (fd,"wb" ); +if (fp) { +qemu_config_write (fp); +fclose (fp); +return ; + } + +qemu_close (fd); + } + +error_setg (errp,"cannot write configuration file: '%s'" , file); +}
Signature · 1 line
2.13.1.394.g41dd433
Re: [Qemu-devel] [PATCH 1/4] qmp: introduce 'writeconfig' command
Quoted 73 lines · Vadim Galitsyn
Add support for `writeconfig' command for QMP monitor. This is a simple way to keep track of current state of VM after series of hotplugs and/or hotunplugs of different devices.
Signed-off-by Vadim Galitsyn <[email protected]>Signed-off-by Eduardo Otubo <[email protected]>Cc Markus Armbruster <[email protected]>Cc Eric Blake <[email protected]>--- qapi-schema.json | 18 ++++++++++++++++++ qmp.c | 21 +++++++++++++++++++++ 2 files changed, 39 insertions(+)qapi-schema.json +18
-0@@ -3200,3 +3200,21 @@ # Since: 2.11 ## { 'command': 'watchdog-set-action', 'data' : {'action': 'WatchdogAction'} } + +## +# @writeconfig: +# +# Dump current configuration into specified file +# +# @file: pathname of a file to store current configuration +# +# Since: 2.11 +# +# Example: +# +# -> { "execute": "writeconfig", +# "arguments": { "file": "/tmp/qemu.conf" } } +# <- { "return": {} } +# +## +{ 'command': 'writeconfig', 'data': {'file': 'str'} }qmp.c +21
-0@@ -722,3 +722,24 @@ MemoryInfo *qmp_query_memory_size_summary(Error **errp)return mem_info; } + +void qmp_writeconfig (const char *file,Error **errp) +{ +int fd; +FILE *fp; + + fd =qemu_open (file,O_WRONLY |O_CREAT |O_TRUNC ,0600 ); +if (fd !=-1 ) { + + fp =fdopen (fd,"wb" ); +if (fp) { +qemu_config_write (fp); +fclose (fp); +return ; + } + +qemu_close (fd); + } + +error_setg (errp,"cannot write configuration file: '%s'" , file); +}Signature · 1 line
2.13.1.394.g41dd433
Signature · 1 line
Eduardo Otubo
Re: [Qemu-devel] [PATCH 1/4] qmp: introduce 'writeconfig' command
In reply to Vadim GalitsynHi
Quoted 54 lines · Vadim Galitsyn
Add support for `writeconfig' command for QMP monitor. This is a simple way to keep track of current state of VM after series of hotplugs and/or hotunplugs of different devices.
Signed-off-by Vadim Galitsyn <[email protected]>Signed-off-by Eduardo Otubo <[email protected]>Cc Markus Armbruster <[email protected]>Cc Eric Blake <[email protected]>--- qapi-schema.json | 18 ++++++++++++++++++ qmp.c | 21 +++++++++++++++++++++ 2 files changed, 39 insertions(+)qapi-schema.json +0
-0@@ -3200,3 +3200,21 @@ # Since: 2.11 ## { 'command': 'watchdog-set-action', 'data' : {'action': 'WatchdogAction'}}
qapi-schema.json +18
-0+ +## +# @writeconfig: +# +# Dump current configuration into specified file +# +# @file: pathname of a file to store current configuration +# +# Since: 2.11 +# +# Example: +# +# -> { "execute": "writeconfig", +# "arguments": { "file": "/tmp/qemu.conf" } } +# <- { "return": {} } +# +## +{ 'command': 'writeconfig', 'data': {'file': 'str'} }qmp.c +3
-0@@ -722,3 +722,24 @@ MemoryInfo *qmp_query_memory_size_summary(Error **errp)return mem_info; } + +void qmp_writeconfig (const char *file,Error **errp) +{
qmp.c MemoryInfo *qmp_query_memory_size_summary(Error · line 737
Quoted 10 lines
qmp.c +10
-0+int fd; +FILE *fp; + + fd =qemu_open (file,O_WRONLY |O_CREAT |O_TRUNC ,0600 ); +if (fd !=-1 ) { + + fp =fdopen (fd,"wb" ); +if (fp) { +qemu_config_write (fp); +fclose (fp);
If you use /dev/fdset, this will close the underlying file, but not remove the file from the fdset.
Dup it or remove it with monitor_fdset_dup_fd_remove() etc?
+ return;
qmp.c MemoryInfo *qmp_query_memory_size_summary(Error **errp) · line 741
Quoted 4 lines
qmp.c +3
-0+ } + +qemu_close (fd);
But this will close & remove it from fdset (when the operation failed)
Whatever we do, I think it make sense to document the behaviour.
Quoted 9 lines
qmp.c +4
-1+ } + +error_setg (errp,"cannot write configuration file: '%s'" , file); +} --2.13.1.394.g41dd433
Signature · 1 line
Marc-André Lureau
PATCH 2/4 hmp: introduce 'writeconfig' command
In reply to Vadim GalitsynAdd 'writeconfig' command for HMP monitor. This command is a sibling of QMP command 'writeconfig'.
This is a simple way to keep track of current state of VM after series of hotplugs and/or hotunplugs of different devices.
--- hmp.h | 1 + hmp.c | 9 +++++++++ hmp-commands.hx | 17 +++++++++++++++++ 3 files changed, 27 insertions(+)
hmp.h +1 -0
@@ -146,5 +146,6 @@ void hmp_info_ramblock(Monitor *mon, const QDict *qdict);void hmp_hotpluggable_cpus (Monitor *mon,const QDict *qdict);void hmp_info_vm_generation_id (Monitor *mon,const QDict *qdict);void hmp_info_memory_size_summary (Monitor *mon,const QDict *qdict); +void hmp_writeconfig (Monitor *mon,const QDict *qdict);#endif
hmp.c +9 -0
@@ -2901,3 +2901,12 @@ void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict) }hmp_handle_error (mon, &err); } + +void hmp_writeconfig (Monitor *mon,const QDict *qdict) +{ +const char *file =qdict_get_str (qdict,"file" ); +Error *err =NULL ; + +qmp_writeconfig (file, &err); +hmp_handle_error (mon, &err); +}
hmp-commands.hx +17 -0
@@ -1858,6 +1858,23 @@ ETEXI .sub_table = info_cmds, }, + { + .name = "writeconfig", + .args_type = "file:F", + .params = "file", + .help = "dump current configuration into specified file", + .cmd = hmp_writeconfig, + }, + +STEXI +@item writeconfig @var{file} +@findex writeconfig +Dump current configuration into specified @var{file}. +@example +(qemu) writeconfig /tmp/qemu.conf +@end example +ETEXI + STEXI @end table ETEXI
Signature · 1 line
2.13.1.394.g41dd433
Re: [Qemu-devel] [PATCH 2/4] hmp: introduce 'writeconfig' command
Quoted 10 lines · * Vadim Galitsyn ([email protected]) wrote:
Add 'writeconfig' command for HMP monitor. This command is a sibling of QMP command 'writeconfig'.
This is a simple way to keep track of current state of VM after series of hotplugs and/or hotunplugs of different devices.
Signed-off-by Vadim Galitsyn <[email protected]>Signed-off-by Eduardo Otubo <[email protected]>Cc Dr. David Alan Gilbert <[email protected]>
Quoted 65 lines
--- hmp.h | 1 + hmp.c | 9 +++++++++ hmp-commands.hx | 17 +++++++++++++++++ 3 files changed, 27 insertions(+)hmp.h +1
-0@@ -146,5 +146,6 @@ void hmp_info_ramblock(Monitor *mon, const QDict *qdict);void hmp_hotpluggable_cpus (Monitor *mon,const QDict *qdict);void hmp_info_vm_generation_id (Monitor *mon,const QDict *qdict);void hmp_info_memory_size_summary (Monitor *mon,const QDict *qdict); +void hmp_writeconfig (Monitor *mon,const QDict *qdict);#endif hmp.c +9
-0@@ -2901,3 +2901,12 @@ void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict) }hmp_handle_error (mon, &err); } + +void hmp_writeconfig (Monitor *mon,const QDict *qdict) +{ +const char *file =qdict_get_str (qdict,"file" ); +Error *err =NULL ; + +qmp_writeconfig (file, &err); +hmp_handle_error (mon, &err); +}hmp-commands.hx +17
-0@@ -1858,6 +1858,23 @@ ETEXI .sub_table = info_cmds, }, + { + .name = "writeconfig", + .args_type = "file:F", + .params = "file", + .help = "dump current configuration into specified file", + .cmd = hmp_writeconfig, + }, + +STEXI +@item writeconfig @var{file} +@findex writeconfig +Dump current configuration into specified @var{file}. +@example +(qemu) writeconfig /tmp/qemu.conf +@end example +ETEXI + STEXI @end table ETEXISignature · 1 line
2.13.1.394.g41dd433
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Re: [Qemu-devel] [PATCH 2/4] hmp: introduce 'writeconfig' command
In reply to Vadim GalitsynQuoted 76 lines · Vadim Galitsyn
Add 'writeconfig' command for HMP monitor. This command is a sibling of QMP command 'writeconfig'.
This is a simple way to keep track of current state of VM after series of hotplugs and/or hotunplugs of different devices.
Signed-off-by Vadim Galitsyn <[email protected]>Signed-off-by Eduardo Otubo <[email protected]>Cc Dr. David Alan Gilbert <[email protected]>--- hmp.h | 1 + hmp.c | 9 +++++++++ hmp-commands.hx | 17 +++++++++++++++++ 3 files changed, 27 insertions(+)hmp.h +1
-0@@ -146,5 +146,6 @@ void hmp_info_ramblock(Monitor *mon, const QDict *qdict);void hmp_hotpluggable_cpus (Monitor *mon,const QDict *qdict);void hmp_info_vm_generation_id (Monitor *mon,const QDict *qdict);void hmp_info_memory_size_summary (Monitor *mon,const QDict *qdict); +void hmp_writeconfig (Monitor *mon,const QDict *qdict);#endif hmp.c +9
-0@@ -2901,3 +2901,12 @@ void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict) }hmp_handle_error (mon, &err); } + +void hmp_writeconfig (Monitor *mon,const QDict *qdict) +{ +const char *file =qdict_get_str (qdict,"file" ); +Error *err =NULL ; + +qmp_writeconfig (file, &err); +hmp_handle_error (mon, &err); +}hmp-commands.hx +17
-0@@ -1858,6 +1858,23 @@ ETEXI .sub_table = info_cmds, }, + { + .name = "writeconfig", + .args_type = "file:F", + .params = "file", + .help = "dump current configuration into specified file", + .cmd = hmp_writeconfig, + }, + +STEXI +@item writeconfig @var{file} +@findex writeconfig +Dump current configuration into specified @var{file}. +@example +(qemu) writeconfig /tmp/qemu.conf +@end example +ETEXI + STEXI @end table ETEXISignature · 1 line
2.13.1.394.g41dd433
Signature · 1 line
Eduardo Otubo
PATCH 3/4 tests: test-hmp: extend with 'writeconfig' command
In reply to Vadim GalitsynExtend list of test cases with 'writeconfig' command.
--- tests/test-hmp.c | 1 + 1 file changed, 1 insertion(+)
tests/test-hmp.c +1 -0
@@ -68,6 +68,7 @@ static const char *hmp_cmds[] = {"sum 0 512" ,"x /8i 0x100" ,"xp /16x 0" , +"writeconfig /dev/null" , NULL };
Signature · 1 line
2.13.1.394.g41dd433
Re: [Qemu-devel] [PATCH 3/4] tests: test-hmp: extend with 'writeconfig' command
Quoted 25 lines · Vadim Galitsyn
Extend list of test cases with 'writeconfig' command.
Signed-off-by Vadim Galitsyn <[email protected]>Cc Dr. David Alan Gilbert <[email protected]>--- tests/test-hmp.c | 1 + 1 file changed, 1 insertion(+)tests/test-hmp.c +1
-0@@ -68,6 +68,7 @@ static const char *hmp_cmds[] = {"sum 0 512" ,"x /8i 0x100" ,"xp /16x 0" , +"writeconfig /dev/null" , NULL };Signature · 1 line
2.13.1.394.g41dd433
Signature · 1 line
Eduardo Otubo
PATCH 4/4 tests: test-hmp: print command execution result
In reply to Vadim GalitsynProvide HMP monitor command execution result as it would be seen by user who established an HMP monitor session.
Currently many commands may silently fail without any sign of that. This patch let this info to be printed once test is running in verbose mode.
For the future it might be useful to fail the test if command has failed, however it would require a bit of rework inside test engine itself.
A simple example of silent failure without reporting it would to add some non-existent HMP command into 'hmp_cmds' list. In this case test will report it successfully passed without error.
--- tests/test-hmp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
tests/test-hmp.c +5 -2
@@ -79,10 +79,13 @@ static void test_commands(void)int i;for (i =0 ; hmp_cmds[i] !=NULL ; i++) { + response =hmp ("%s" , hmp_cmds[i]);if (verbose) { -fprintf (stderr,"\t%s\n" , hmp_cmds[i]); +fprintf (stderr, +"\texecute HMP command: %s\n" +"\tresult : %s\n" , + hmp_cmds[i], response); } - response =hmp ("%s" , hmp_cmds[i]);g_free (response); }
Signature · 1 line
2.13.1.394.g41dd433
Re: [Qemu-devel] [PATCH 4/4] tests: test-hmp: print command execution result
Quoted 46 lines · Vadim Galitsyn
Provide HMP monitor command execution result as it would be seen by user who established an HMP monitor session.
Currently many commands may silently fail without any sign of that. This patch let this info to be printed once test is running in verbose mode.
For the future it might be useful to fail the test if command has failed, however it would require a bit of rework inside test engine itself.
A simple example of silent failure without reporting it would to add some non-existent HMP command into '
hmp_cmds' list. In this case test will report it successfully passed without error.Signed-off-by Vadim Galitsyn <[email protected]>Cc Dr. David Alan Gilbert <[email protected]>--- tests/test-hmp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)tests/test-hmp.c +5
-2@@ -79,10 +79,13 @@ static void test_commands(void)int i;for (i =0 ; hmp_cmds[i] !=NULL ; i++) { + response =hmp ("%s" , hmp_cmds[i]);if (verbose) { -fprintf (stderr,"\t%s\n" , hmp_cmds[i]); +fprintf (stderr, +"\texecute HMP command: %s\n" +"\tresult : %s\n" , + hmp_cmds[i], response); } - response =hmp ("%s" , hmp_cmds[i]);g_free (response); }Signature · 1 line
2.13.1.394.g41dd433
Signature · 1 line
Eduardo Otubo
Re: [Qemu-devel] [PATCH 4/4] tests: test-hmp: print command execution result
In reply to Vadim GalitsynQuoted 11 lines · * Vadim Galitsyn ([email protected]) wrote:
Provide HMP monitor command execution result as it would be seen by user who established an HMP monitor session.
Currently many commands may silently fail without any sign of that. This patch let this info to be printed once test is running in verbose mode.
For the future it might be useful to fail the test if command has failed, however it would require a bit of rework inside test engine itself.
Quoted 7 lines
A simple example of silent failure without reporting it would to add some non-existent HMP command into '
hmp_cmds' list. In this case test will report it successfully passed without error.Signed-off-by Vadim Galitsyn <[email protected]>Cc Dr. David Alan Gilbert <[email protected]>
This test patch is useful without the rest of the series;
Queued for HMP
Although I do also need to go and fix this tests idea of verbose to get it from GTester rather than it's own env - I'll do that.
For the rest of the set, you need to convince Markus why it's safe.
Dave
Quoted 27 lines
--- tests/test-hmp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)tests/test-hmp.c +5
-2@@ -79,10 +79,13 @@ static void test_commands(void)int i;for (i =0 ; hmp_cmds[i] !=NULL ; i++) { + response =hmp ("%s" , hmp_cmds[i]);if (verbose) { -fprintf (stderr,"\t%s\n" , hmp_cmds[i]); +fprintf (stderr, +"\texecute HMP command: %s\n" +"\tresult : %s\n" , + hmp_cmds[i], response); } - response =hmp ("%s" , hmp_cmds[i]);g_free (response); }Signature · 1 line
2.13.1.394.g41dd433
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Quoted 5 lines · * Vadim Galitsyn ([email protected]) wrote:
Hi Guys,
This thread is a continuation of discussion started in
http://lists.nongnu.org/archive/html/qemu-devel/2017-02/msg03182.html.
Quoted 7 lines
This series introduces ‘writeconfig’ command support for QMP and HMP monitors. This functionality might be useful for live migration for cases when guest configuration was modified in runtime (for example as a result of hot- plug/unplug operations) and actual Qemu command line no longer reflects setup exposed to guest.
Original series has ‘qemu_opts’ patch as well (http://lists.nongnu.org/archive/html/qemu-devel/2017-02/msg03183.html) because HMP’s ‘object_add’ result was not reflected in ‘writeconfig’ output. Later I found that QMP’s ‘object-add’ has the same issue. Anyway, I don’t include ‘qemu_opts’ patches here because Markus mentioned (here http://lists.nongnu.org/archive/html/qemu-devel/2017-02/msg03476.html) that this functionality is going to be reworked in some future and such patches might collide with the rework process.
Markus, could you please post if you have an update on this topic? Current ‘master’ branch (
9993c82dc2f5ce58b41d708b765e1a717ad4281d) still has the issue.Also, Markus mentioned that once configuration was changed during live migration -- it might be an issue because ‘writeconfig’ data became outdated (and might be make sense to think about to embed this data into migration stream itself). In the same time David said that this is another problem which is unrelated to this patch series. What is your current opinion on this topic? Can we consider these patches to be included into ‘master’ taking into account that not all configuration is dumped by ‘writeconfig’ (‘object_add’ problem), but this can be fixed later?
I don't see anything wrong with having a 'writeconfig' command - we already have the command line equivalent - that is assuming hotplug etc all cause the values written to be correct.
The data becoming outdated doesn't sound like a big issue to me; it's the management layer that's doing any hotplugs, it can reissue another 'writeconfig' command.
Dave
Quoted 5 lines
Best regards,
Vadim
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Quoted 12 lines · Dr. David Alan Gilbert
Quoted 11 lines · * Vadim Galitsyn ([email protected]) wrote:
Hi Guys,
This thread is a continuation of discussion started in
http://lists.nongnu.org/archive/html/qemu-devel/2017-02/msg03182.html.This series introduces ‘writeconfig’ command support for QMP and HMP monitors. This functionality might be useful for live migration for cases when guest configuration was modified in runtime (for example as a result of hot- plug/unplug operations) and actual Qemu command line no longer reflects setup exposed to guest.
Quoted 9 lines
Quoted 9 lines
Original series has ‘qemu_opts’ patch as well
(http://lists.nongnu.org/archive/html/qemu-devel/2017-02/msg03183.html)
because HMP’s ‘object_add’ result was not reflected in ‘writeconfig’ output. Later I found that QMP’s ‘object-add’ has the same issue. Anyway, I don’t include ‘qemu_opts’ patches here because Markus mentioned (here
http://lists.nongnu.org/archive/html/qemu-devel/2017-02/msg03476.html)
that this functionality is going to be reworked in some future and such patches might collide with the rework process.
This is item 1 of my reply. Item 3 is more important:
The accuracy of QemuOpts information is doubtful.
Completeness: only certain kinds of configuration are done with QemuOpts. Incompleteness makes -writeconfig less useful than it could be, but it's still useful. Monitor command writeconfig could be similarly useful.
Correctness: configuration gets stored in QemuOpts when we parse KEY=VALUE,... strings. It can also be constructed and updated manually. At certain points in time, bits from QemuOpts are used to actually configure stuff.
Example: -device creates an entry in the "device" configuration group, which is later used to actually create and configure a device object.
My point is: whenever we manipulate the actual objects, we may invalidate information stored in QemuOpts. We can try to keep it in sync, and we do at least sometimes. But this is a game we can only lose, except for the period(s) of time where QemuOpts is all there is, i.e. before actual objects get created. Note that -writeconfig runs before objects get created, so it's not affected by this issue.
Out-of-sync QemuOpts is harmless unless something relies on it being accurate. I know we currently rely on QemuOpts IDs to catch duplicate IDs for some of the configuration groups. I doubt there's much else.
If we add your monitor command, out-of-sync QemuOpts goes from harmless to serious bug. In other words, we'd create a new class of bugs, with an unknown number of existing instances that are probably hard to find and fix. Probably a perpetual source of new instances, too.
Feels like a show stopper to me.
Message-ID: <[email protected]>
Quoted 3 lines
Quoted 3 lines
Markus, could you please post if you have an update on this topic? Current ‘master’ branch (
9993c82dc2f5ce58b41d708b765e1a717ad4281d) still has the issue.
There's my "[RFC PATCH 00/32] Command line QAPIfication"
Message-Id: <[email protected]>
https://lists.nongnu.org/archive/html/qemu-devel/2017-10/msg00209.html
There's also my KVM Forum presentation. Permanent links to slides and hopefully video should appear at
http://www.linux-kvm.org/page/KVM_Forum_2017 "soon". Until then, you can also get my slides from
https://events.linuxfoundation.org/sites/events/files/slides/armbru-qapi-cmdline_1.pdf
Quoted 10 lines
Quoted 9 lines
Also, Markus mentioned that once configuration was changed during live migration -- it might be an issue because ‘writeconfig’ data became outdated (and might be make sense to think about to embed this data into migration stream itself). In the same time David said that this is another problem which is unrelated to this patch series. What is your current opinion on this topic? Can we consider these patches to be included into ‘master’ taking into account that not all configuration is dumped by ‘writeconfig’ (‘object_add’ problem), but this can be fixed later?
Quoted 3 lines
I don't see anything wrong with having a 'writeconfig' command - we already have the command line equivalent - that is assuming hotplug etc all cause the values written to be correct.
In the current state of things, this assumption is somewhere between reckless and wrong. See "this is a game we can only lose" above.
Quoted 3 lines
The data becoming outdated doesn't sound like a big issue to me; it's the management layer that's doing any hotplugs, it can reissue another 'writeconfig' command.
It can, but how would it use the data? It already started the destination QEMU with configuration derived from the first writeconfig, plus -incoming. Source configuration may change until we're ready to pivot from to the destination. A second writeconfig only tells the management application what configuration it has to reach on the destination, but not how it could be done. Perhaps that helps, perhaps it doesn't.
All theoretical, because the data cannot be relied on anyway.
Quoted 5 lines · Vadim Galitsyn
Hi Guys,
This thread is a continuation of discussion started in
http://lists.nongnu.org/archive/html/qemu-devel/2017-02/msg03182.html.
Quoted 7 lines
This series introduces ‘writeconfig’ command support for QMP and HMP monitors. This functionality might be useful for live migration for cases when guest configuration was modified in runtime (for example as a result of hot- plug/unplug operations) and actual Qemu command line no longer reflects setup exposed to guest.
Original series has ‘qemu_opts’ patch as well (http://lists.nongnu.org/archive/html/qemu-devel/2017-02/msg03183.html) because HMP’s ‘object_add’ result was not reflected in ‘writeconfig’ output. Later I found that QMP’s ‘object-add’ has the same issue. Anyway, I don’t include ‘qemu_opts’ patches here because Markus mentioned (here http://lists.nongnu.org/archive/html/qemu-devel/2017-02/msg03476.html) that this functionality is going to be reworked in some future and such patches might collide with the rework process.
Markus, could you please post if you have an update on this topic? Current ‘master’ branch (
9993c82dc2f5ce58b41d708b765e1a717ad4281d) still has the issue.Also, Markus mentioned that once configuration was changed during live migration -- it might be an issue because ‘writeconfig’ data became outdated (and might be make sense to think about to embed this data into migration stream itself). In the same time David said that this is another problem which is unrelated to this patch series. What is your current opinion on this topic? Can we consider these patches to be included into ‘master’ taking into account that not all configuration is dumped by ‘writeconfig’ (‘object_add’ problem), but this can be fixed later?
I don't think we should expose 'writeconfig' via QMP as long as there is still the chance of inconsistent data being written. And I think we have a lot more issues where existing code abuses QemuOpts in ways that current configuration does not match the original command line, but where you cannot easily expose the current configuration in a way that would be reparsed by the command line into the current state. Therefore, I'm not sure this series is worthwhile.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org