Changeset
src/qemu/qemu_capabilities.c                       |  8 +++--
src/qemu/qemu_capabilities.h                       |  1 +
src/qemu/qemu_hotplug.c                            | 12 ++++++--
src/qemu/qemu_monitor.c                            | 21 +++++++++++--
src/qemu/qemu_monitor.h                            |  2 ++
src/qemu/qemu_monitor_json.c                       | 34 ++++++++++++++++++++--
src/qemu/qemu_monitor_json.h                       |  2 ++
tests/qemucapabilitiesdata/caps_1.2.2.x86_64.xml   |  1 +
tests/qemucapabilitiesdata/caps_1.3.1.x86_64.xml   |  1 +
tests/qemucapabilitiesdata/caps_1.4.2.x86_64.xml   |  1 +
tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml   |  1 +
tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml   |  1 +
tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml   |  1 +
tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml   |  1 +
.../caps_2.10.0-gicv2.aarch64.xml                  |  1 +
.../caps_2.10.0-gicv3.aarch64.xml                  |  1 +
tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml   |  1 +
tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml   |  1 +
tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml  |  1 +
tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml   |  1 +
tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml   |  1 +
tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml   |  1 +
.../caps_2.6.0-gicv2.aarch64.xml                   |  1 +
.../caps_2.6.0-gicv3.aarch64.xml                   |  1 +
tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml    |  1 +
tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml   |  1 +
tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml    |  1 +
tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml   |  1 +
tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml    |  1 +
tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml   |  1 +
tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml    |  1 +
tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml    |  1 +
tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml   |  1 +
tests/qemumonitorjsontest.c                        |  2 ++
34 files changed, 98 insertions(+), 10 deletions(-)
Git apply log
Switched to a new branch '20180306144702.17094-1-jferlan@redhat.com'
Applying: qemu: Alter current VNC set password to be legacy
Applying: qemu: Clean up formatting in virQEMUCapsCommands
Applying: qemu: Add change-vnc-password capability
Applying: qemu: Add support for change-vnc-password
To https://github.com/patchew-project/libvirt
 * [new tag]             patchew/20180306144702.17094-1-jferlan@redhat.com -> patchew/20180306144702.17094-1-jferlan@redhat.com
Test passed: syntax-check

loading

[libvirt] [PATCH 0/4] Use and prefer change-vnc-password command
Posted by John Ferlan, 15 weeks ago
While investigating something else - 'change' QMP command for
the cdrom/floppy code, I noted the QMP schema lists the change
command as being deprecated for use with cdrom/floppy and changing
the VNC password. Further digging found that the existing set_password 
QMP command would make the same call to change the password (qemu 
API vnc_display_password) as long as "keep" was defined for connected
(which must be true for VNC). So altered the code to use the newer
command if available.

John Ferlan (4):
  qemu: Alter current VNC set password to be legacy
  qemu: Clean up formatting in virQEMUCapsCommands
  qemu: Add change-vnc-password capability
  qemu: Add support for change-vnc-password

 src/qemu/qemu_capabilities.c                       |  8 +++--
 src/qemu/qemu_capabilities.h                       |  1 +
 src/qemu/qemu_hotplug.c                            | 12 ++++++--
 src/qemu/qemu_monitor.c                            | 21 +++++++++++--
 src/qemu/qemu_monitor.h                            |  2 ++
 src/qemu/qemu_monitor_json.c                       | 34 ++++++++++++++++++++--
 src/qemu/qemu_monitor_json.h                       |  2 ++
 tests/qemucapabilitiesdata/caps_1.2.2.x86_64.xml   |  1 +
 tests/qemucapabilitiesdata/caps_1.3.1.x86_64.xml   |  1 +
 tests/qemucapabilitiesdata/caps_1.4.2.x86_64.xml   |  1 +
 tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml   |  1 +
 tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml   |  1 +
 tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml   |  1 +
 tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml   |  1 +
 .../caps_2.10.0-gicv2.aarch64.xml                  |  1 +
 .../caps_2.10.0-gicv3.aarch64.xml                  |  1 +
 tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml   |  1 +
 tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml   |  1 +
 tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml  |  1 +
 tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml   |  1 +
 tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml   |  1 +
 tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml   |  1 +
 .../caps_2.6.0-gicv2.aarch64.xml                   |  1 +
 .../caps_2.6.0-gicv3.aarch64.xml                   |  1 +
 tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml    |  1 +
 tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml   |  1 +
 tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml    |  1 +
 tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml   |  1 +
 tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml    |  1 +
 tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml   |  1 +
 tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml    |  1 +
 tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml    |  1 +
 tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml   |  1 +
 tests/qemumonitorjsontest.c                        |  2 ++
 34 files changed, 98 insertions(+), 10 deletions(-)

-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 1/4] qemu: Alter current VNC set password to be legacy
Posted by John Ferlan, 15 weeks ago
The QEMU "change" QMP command interface is being deprecated
according to qapi-schema.json, so this patch will keep the
current API available for legacy/older QEMU binaries with a
future patch introducing the newer change-vnc-password QMP
command interface.

Signed-off-by: John Ferlan <jferlan@redhat.com>
---
 src/qemu/qemu_hotplug.c      | 2 +-
 src/qemu/qemu_monitor.c      | 6 +++---
 src/qemu/qemu_monitor.h      | 4 ++--
 src/qemu/qemu_monitor_json.c | 6 ++++--
 src/qemu/qemu_monitor_json.h | 4 ++--
 tests/qemumonitorjsontest.c  | 4 ++--
 6 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index e0a5300f0..0ee9b2bfc 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -5341,7 +5341,7 @@ qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver,
                            _("Graphics password only supported for VNC"));
             ret = -1;
         } else {
-            ret = qemuMonitorSetVNCPassword(priv->mon, password);
+            ret = qemuMonitorSetVNCPasswordLegacy(priv->mon, password);
         }
     }
     if (ret != 0)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 1d67a9778..56c8345d5 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2370,8 +2370,8 @@ qemuMonitorBlockResize(qemuMonitorPtr mon,
 
 
 int
-qemuMonitorSetVNCPassword(qemuMonitorPtr mon,
-                          const char *password)
+qemuMonitorSetVNCPasswordLegacy(qemuMonitorPtr mon,
+                                const char *password)
 {
     VIR_DEBUG("password=%p", password);
 
@@ -2381,7 +2381,7 @@ qemuMonitorSetVNCPassword(qemuMonitorPtr mon,
         password = "";
 
     if (mon->json)
-        return qemuMonitorJSONSetVNCPassword(mon, password);
+        return qemuMonitorJSONSetVNCPasswordLegacy(mon, password);
     else
         return qemuMonitorTextSetVNCPassword(mon, password);
 }
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index adfa87aba..cf9ab7cb3 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -595,8 +595,8 @@ int qemuMonitorBlockStatsUpdateCapacity(qemuMonitorPtr mon,
 int qemuMonitorBlockResize(qemuMonitorPtr mon,
                            const char *dev_name,
                            unsigned long long size);
-int qemuMonitorSetVNCPassword(qemuMonitorPtr mon,
-                              const char *password);
+int qemuMonitorSetVNCPasswordLegacy(qemuMonitorPtr mon,
+                                    const char *password);
 int qemuMonitorSetPassword(qemuMonitorPtr mon,
                            int type,
                            const char *password,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 08dfffdf6..ad81b70db 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2356,8 +2356,10 @@ int qemuMonitorJSONBlockResize(qemuMonitorPtr mon,
     return ret;
 }
 
-int qemuMonitorJSONSetVNCPassword(qemuMonitorPtr mon,
-                                  const char *password)
+
+int
+qemuMonitorJSONSetVNCPasswordLegacy(qemuMonitorPtr mon,
+                                    const char *password)
 {
     int ret = -1;
     virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("change",
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index ec243becc..dec7a5cf9 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -92,8 +92,8 @@ int qemuMonitorJSONBlockResize(qemuMonitorPtr mon,
                                const char *devce,
                                unsigned long long size);
 
-int qemuMonitorJSONSetVNCPassword(qemuMonitorPtr mon,
-                                  const char *password);
+int qemuMonitorJSONSetVNCPasswordLegacy(qemuMonitorPtr mon,
+                                        const char *password);
 int qemuMonitorJSONSetPassword(qemuMonitorPtr mon,
                                const char *protocol,
                                const char *password,
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 908ec3a3c..f9c59f2f0 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -1316,7 +1316,7 @@ cleanup: \
 
 GEN_TEST_FUNC(qemuMonitorJSONSetLink, "vnet0", VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN)
 GEN_TEST_FUNC(qemuMonitorJSONBlockResize, "vda", 123456)
-GEN_TEST_FUNC(qemuMonitorJSONSetVNCPassword, "secret_password")
+GEN_TEST_FUNC(qemuMonitorJSONSetVNCPasswordLegacy, "secret_password")
 GEN_TEST_FUNC(qemuMonitorJSONSetPassword, "spice", "secret_password", "disconnect")
 GEN_TEST_FUNC(qemuMonitorJSONExpirePassword, "spice", "123456")
 GEN_TEST_FUNC(qemuMonitorJSONSetBalloon, 1024)
@@ -2905,7 +2905,7 @@ mymain(void)
     DO_TEST_SIMPLE("rtc-reset-reinjection", qemuMonitorJSONRTCResetReinjection);
     DO_TEST_GEN(qemuMonitorJSONSetLink);
     DO_TEST_GEN(qemuMonitorJSONBlockResize);
-    DO_TEST_GEN(qemuMonitorJSONSetVNCPassword);
+    DO_TEST_GEN(qemuMonitorJSONSetVNCPasswordLegacy);
     DO_TEST_GEN(qemuMonitorJSONSetPassword);
     DO_TEST_GEN(qemuMonitorJSONExpirePassword);
     DO_TEST_GEN(qemuMonitorJSONSetBalloon);
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 2/4] qemu: Clean up formatting in virQEMUCapsCommands
Posted by John Ferlan, 15 weeks ago
Alter a couple of the definitions to be follow the syntax of
previous definitions.

Signed-off-by: John Ferlan <jferlan@redhat.com>
---
 src/qemu/qemu_capabilities.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index b5eb8cf46..7821789c2 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1577,9 +1577,9 @@ struct virQEMUCapsStringFlags virQEMUCapsCommands[] = {
     { "migrate-incoming", QEMU_CAPS_INCOMING_DEFER },
     { "query-hotpluggable-cpus", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS },
     { "query-qmp-schema", QEMU_CAPS_QUERY_QMP_SCHEMA },
-    { "query-cpu-model-expansion", QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION},
-    { "query-cpu-definitions", QEMU_CAPS_QUERY_CPU_DEFINITIONS},
-    { "query-named-block-nodes", QEMU_CAPS_QUERY_NAMED_BLOCK_NODES}
+    { "query-cpu-model-expansion", QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION },
+    { "query-cpu-definitions", QEMU_CAPS_QUERY_CPU_DEFINITIONS },
+    { "query-named-block-nodes", QEMU_CAPS_QUERY_NAMED_BLOCK_NODES },
 };
 
 struct virQEMUCapsStringFlags virQEMUCapsMigration[] = {
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 3/4] qemu: Add change-vnc-password capability
Posted by John Ferlan, 15 weeks ago
Add the capability for the change-vnc-password command via
checking for the presence of the command.

Signed-off-by: John Ferlan <jferlan@redhat.com>
---
 src/qemu/qemu_capabilities.c                             | 2 ++
 src/qemu/qemu_capabilities.h                             | 1 +
 tests/qemucapabilitiesdata/caps_1.2.2.x86_64.xml         | 1 +
 tests/qemucapabilitiesdata/caps_1.3.1.x86_64.xml         | 1 +
 tests/qemucapabilitiesdata/caps_1.4.2.x86_64.xml         | 1 +
 tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml         | 1 +
 tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml         | 1 +
 tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml         | 1 +
 tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml         | 1 +
 tests/qemucapabilitiesdata/caps_2.10.0-gicv2.aarch64.xml | 1 +
 tests/qemucapabilitiesdata/caps_2.10.0-gicv3.aarch64.xml | 1 +
 tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml         | 1 +
 tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml         | 1 +
 tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml        | 1 +
 tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml         | 1 +
 tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml         | 1 +
 tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml         | 1 +
 tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml  | 1 +
 tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml  | 1 +
 tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml          | 1 +
 tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml         | 1 +
 tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml          | 1 +
 tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml         | 1 +
 tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml          | 1 +
 tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml         | 1 +
 tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml          | 1 +
 tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml          | 1 +
 tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml         | 1 +
 28 files changed, 29 insertions(+)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 7821789c2..cccce33c9 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -459,6 +459,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
               "pl011",
               "machine.pseries.max-cpu-compat",
               "dump-completed",
+              "change-vnc-password",
     );
 
 
@@ -1580,6 +1581,7 @@ struct virQEMUCapsStringFlags virQEMUCapsCommands[] = {
     { "query-cpu-model-expansion", QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION },
     { "query-cpu-definitions", QEMU_CAPS_QUERY_CPU_DEFINITIONS },
     { "query-named-block-nodes", QEMU_CAPS_QUERY_NAMED_BLOCK_NODES },
+    { "change-vnc-password", QEMU_CAPS_CHANGE_VNC_PASSWORD },
 };
 
 struct virQEMUCapsStringFlags virQEMUCapsMigration[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index c2ec2be19..67df6fabc 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -444,6 +444,7 @@ typedef enum {
     QEMU_CAPS_DEVICE_PL011, /* -device pl011 (not user-instantiable) */
     QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT, /* -machine pseries,max-cpu-compat= */
     QEMU_CAPS_DUMP_COMPLETED, /* DUMP_COMPLETED event */
+    QEMU_CAPS_CHANGE_VNC_PASSWORD, /* change-vnc-password command */
 
     QEMU_CAPS_LAST /* this must always be the last item */
 } virQEMUCapsFlags;
diff --git a/tests/qemucapabilitiesdata/caps_1.2.2.x86_64.xml b/tests/qemucapabilitiesdata/caps_1.2.2.x86_64.xml
index 3001d487c..45c3da0b9 100644
--- a/tests/qemucapabilitiesdata/caps_1.2.2.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_1.2.2.x86_64.xml
@@ -110,6 +110,7 @@
   <flag name='display'/>
   <flag name='query-cpu-definitions'/>
   <flag name='isa-serial'/>
+  <flag name='change-vnc-password'/>
   <version>1002002</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>26900</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_1.3.1.x86_64.xml b/tests/qemucapabilitiesdata/caps_1.3.1.x86_64.xml
index 283f30ef0..756c3eefa 100644
--- a/tests/qemucapabilitiesdata/caps_1.3.1.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_1.3.1.x86_64.xml
@@ -128,6 +128,7 @@
   <flag name='display'/>
   <flag name='query-cpu-definitions'/>
   <flag name='isa-serial'/>
+  <flag name='change-vnc-password'/>
   <version>1003001</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>30198</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_1.4.2.x86_64.xml b/tests/qemucapabilitiesdata/caps_1.4.2.x86_64.xml
index 200069ae8..eb68c4a7d 100644
--- a/tests/qemucapabilitiesdata/caps_1.4.2.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_1.4.2.x86_64.xml
@@ -129,6 +129,7 @@
   <flag name='display'/>
   <flag name='query-cpu-definitions'/>
   <flag name='isa-serial'/>
+  <flag name='change-vnc-password'/>
   <version>1004002</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>30915</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml b/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml
index e02c0961c..14193a2f4 100644
--- a/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml
@@ -141,6 +141,7 @@
   <flag name='query-cpu-definitions'/>
   <flag name='kernel-irqchip'/>
   <flag name='isa-serial'/>
+  <flag name='change-vnc-password'/>
   <version>1005003</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>47019</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml
index e3896685e..2322c4a03 100644
--- a/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml
@@ -146,6 +146,7 @@
   <flag name='query-cpu-definitions'/>
   <flag name='kernel-irqchip'/>
   <flag name='isa-serial'/>
+  <flag name='change-vnc-password'/>
   <version>1006000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>45248</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml
index 5b4d1ea66..d822d67c8 100644
--- a/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml
@@ -148,6 +148,7 @@
   <flag name='query-cpu-definitions'/>
   <flag name='kernel-irqchip'/>
   <flag name='isa-serial'/>
+  <flag name='change-vnc-password'/>
   <version>1007000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>50692</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml
index 200e57ada..8171838a1 100644
--- a/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml
@@ -164,6 +164,7 @@
   <flag name='query-named-block-nodes'/>
   <flag name='kernel-irqchip'/>
   <flag name='isa-serial'/>
+  <flag name='change-vnc-password'/>
   <version>2001001</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>59488</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.10.0-gicv2.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.10.0-gicv2.aarch64.xml
index 588bb0d4d..d35f2b947 100644
--- a/tests/qemucapabilitiesdata/caps_2.10.0-gicv2.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.10.0-gicv2.aarch64.xml
@@ -186,6 +186,7 @@
   <flag name='isa-serial'/>
   <flag name='pl011'/>
   <flag name='dump-completed'/>
+  <flag name='change-vnc-password'/>
   <version>2010000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>304138</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.10.0-gicv3.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.10.0-gicv3.aarch64.xml
index a88a4609d..34710eef6 100644
--- a/tests/qemucapabilitiesdata/caps_2.10.0-gicv3.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.10.0-gicv3.aarch64.xml
@@ -186,6 +186,7 @@
   <flag name='isa-serial'/>
   <flag name='pl011'/>
   <flag name='dump-completed'/>
+  <flag name='change-vnc-password'/>
   <version>2010000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>304138</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml
index 04e2e7709..335af2748 100644
--- a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml
@@ -185,6 +185,7 @@
   <flag name='isa-serial'/>
   <flag name='machine.pseries.max-cpu-compat'/>
   <flag name='dump-completed'/>
+  <flag name='change-vnc-password'/>
   <version>2010000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>383421</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml
index bbd351c0a..681e670a0 100644
--- a/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml
+++ b/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml
@@ -146,6 +146,7 @@
   <flag name='disk-share-rw'/>
   <flag name='iscsi.password-secret'/>
   <flag name='dump-completed'/>
+  <flag name='change-vnc-password'/>
   <version>2010000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>304153</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml
index 91ab3b083..77a6fbee5 100644
--- a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml
@@ -229,6 +229,7 @@
   <flag name='iscsi.password-secret'/>
   <flag name='isa-serial'/>
   <flag name='dump-completed'/>
+  <flag name='change-vnc-password'/>
   <version>2010000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>345185</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml
index f7f102fe4..3d79f7b9f 100644
--- a/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml
+++ b/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml
@@ -146,6 +146,7 @@
   <flag name='disk-share-rw'/>
   <flag name='iscsi.password-secret'/>
   <flag name='dump-completed'/>
+  <flag name='change-vnc-password'/>
   <version>2011000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>341724</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml
index 9b315aecf..07f63e592 100644
--- a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml
@@ -189,6 +189,7 @@
   <flag name='chardev-reconnect'/>
   <flag name='virtio-gpu.max_outputs'/>
   <flag name='isa-serial'/>
+  <flag name='change-vnc-password'/>
   <version>2004000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>75653</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml
index 3096eadf7..81b3d491e 100644
--- a/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml
@@ -195,6 +195,7 @@
   <flag name='chardev-reconnect'/>
   <flag name='virtio-gpu.max_outputs'/>
   <flag name='isa-serial'/>
+  <flag name='change-vnc-password'/>
   <version>2005000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>216775</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml
index 7f8721bec..824ad2d6c 100644
--- a/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml
@@ -175,6 +175,7 @@
   <flag name='isa-serial'/>
   <flag name='pl011'/>
   <flag name='dump-completed'/>
+  <flag name='change-vnc-password'/>
   <version>2006000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>228838</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml
index a6ba48ec7..85318b8ae 100644
--- a/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml
@@ -175,6 +175,7 @@
   <flag name='isa-serial'/>
   <flag name='pl011'/>
   <flag name='dump-completed'/>
+  <flag name='change-vnc-password'/>
   <version>2006000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>228838</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml
index eb6c63c6e..d0d671780 100644
--- a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml
@@ -170,6 +170,7 @@
   <flag name='spapr-vty'/>
   <flag name='isa-serial'/>
   <flag name='dump-completed'/>
+  <flag name='change-vnc-password'/>
   <version>2006000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>263602</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml
index e7a43ed3e..51dab449a 100644
--- a/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml
@@ -206,6 +206,7 @@
   <flag name='virtio-gpu.max_outputs'/>
   <flag name='isa-serial'/>
   <flag name='dump-completed'/>
+  <flag name='change-vnc-password'/>
   <version>2006000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>227579</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml
index c881cf326..edb3f5938 100644
--- a/tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml
+++ b/tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml
@@ -137,6 +137,7 @@
   <flag name='virtio-blk.num-queues'/>
   <flag name='sclplmconsole'/>
   <flag name='dump-completed'/>
+  <flag name='change-vnc-password'/>
   <version>2007000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>217559</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml
index 6e868d544..8089289c5 100644
--- a/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml
@@ -210,6 +210,7 @@
   <flag name='virtio-blk.num-queues'/>
   <flag name='isa-serial'/>
   <flag name='dump-completed'/>
+  <flag name='change-vnc-password'/>
   <version>2007000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>239276</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml
index efed9881d..97e665ad3 100644
--- a/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml
+++ b/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml
@@ -139,6 +139,7 @@
   <flag name='virtio-blk.num-queues'/>
   <flag name='sclplmconsole'/>
   <flag name='dump-completed'/>
+  <flag name='change-vnc-password'/>
   <version>2007093</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>242460</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml
index 4018f5868..7e4da42de 100644
--- a/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml
@@ -212,6 +212,7 @@
   <flag name='virtio-blk.num-queues'/>
   <flag name='isa-serial'/>
   <flag name='dump-completed'/>
+  <flag name='change-vnc-password'/>
   <version>2008000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>255931</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml
index 97adc3856..cd746ffc8 100644
--- a/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml
@@ -178,6 +178,7 @@
   <flag name='iscsi.password-secret'/>
   <flag name='isa-serial'/>
   <flag name='dump-completed'/>
+  <flag name='change-vnc-password'/>
   <version>2009000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>347135</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml
index 3ba8e1043..06d03003b 100644
--- a/tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml
+++ b/tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml
@@ -142,6 +142,7 @@
   <flag name='disk-share-rw'/>
   <flag name='iscsi.password-secret'/>
   <flag name='dump-completed'/>
+  <flag name='change-vnc-password'/>
   <version>2009000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>265878</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
index b6ecf7fbd..cdab2d2ff 100644
--- a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
@@ -225,6 +225,7 @@
   <flag name='iscsi.password-secret'/>
   <flag name='isa-serial'/>
   <flag name='dump-completed'/>
+  <flag name='change-vnc-password'/>
   <version>2009000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>321194</microcodeVersion>
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 4/4] qemu: Add support for change-vnc-password
Posted by John Ferlan, 15 weeks ago
Rather than use the to be deprecated "change" command, use the
change-vnc-password command to perform VNC password changes instead
of the set_password command. Since changing VNC password only
accepts "keep" for connect and that's the default, no sense in
vectoring through "set_password" as we've already checked that the
XML 'connected' was set to "keep" in virDomainGraphicsAuthDefParseXML.

Signed-off-by: John Ferlan <jferlan@redhat.com>
---
 src/qemu/qemu_hotplug.c      | 10 +++++++++-
 src/qemu/qemu_monitor.c      | 15 +++++++++++++++
 src/qemu/qemu_monitor.h      |  2 ++
 src/qemu/qemu_monitor_json.c | 28 ++++++++++++++++++++++++++++
 src/qemu/qemu_monitor_json.h |  2 ++
 tests/qemumonitorjsontest.c  |  2 ++
 6 files changed, 58 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 0ee9b2bfc..a012b3dcd 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -5333,7 +5333,15 @@ qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver,
 
     if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
         goto cleanup;
-    ret = qemuMonitorSetPassword(priv->mon, type, password, connected);
+
+    /* The connected parameter can only be keep for VNC, thus QMP command
+     * set_password makes the same call hence if available just use the
+     * newer change-vnc-password command. */
+    if (type == VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
+        virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_CHANGE_VNC_PASSWORD))
+        ret = qemuMonitorSetVNCPassword(priv->mon, password);
+    else
+        ret = qemuMonitorSetPassword(priv->mon, type, password, connected);
 
     if (ret == -2) {
         if (type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 56c8345d5..c88634a38 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2387,6 +2387,21 @@ qemuMonitorSetVNCPasswordLegacy(qemuMonitorPtr mon,
 }
 
 
+int
+qemuMonitorSetVNCPassword(qemuMonitorPtr mon,
+                          const char *password)
+{
+    VIR_DEBUG("password=%p", password);
+
+    QEMU_CHECK_MONITOR_JSON(mon);
+
+    if (!password)
+        password = "";
+
+    return qemuMonitorJSONSetVNCPassword(mon, password);
+}
+
+
 static const char *
 qemuMonitorTypeToProtocol(int type)
 {
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index cf9ab7cb3..eeae72928 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -597,6 +597,8 @@ int qemuMonitorBlockResize(qemuMonitorPtr mon,
                            unsigned long long size);
 int qemuMonitorSetVNCPasswordLegacy(qemuMonitorPtr mon,
                                     const char *password);
+int qemuMonitorSetVNCPassword(qemuMonitorPtr mon,
+                              const char *password);
 int qemuMonitorSetPassword(qemuMonitorPtr mon,
                            int type,
                            const char *password,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index ad81b70db..f8131ac4d 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2384,6 +2384,34 @@ qemuMonitorJSONSetVNCPasswordLegacy(qemuMonitorPtr mon,
     return ret;
 }
 
+
+int
+qemuMonitorJSONSetVNCPassword(qemuMonitorPtr mon,
+                              const char *password)
+{
+    int ret = -1;
+    virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("change-vnc-password",
+                                                     "s:password", password,
+                                                     NULL);
+    virJSONValuePtr reply = NULL;
+
+    if (!cmd)
+        return -1;
+
+    if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
+        goto cleanup;
+
+    if (qemuMonitorJSONCheckError(cmd, reply) < 0)
+        goto cleanup;
+
+    ret = 0;
+ cleanup:
+    virJSONValueFree(cmd);
+    virJSONValueFree(reply);
+    return ret;
+}
+
+
 /* Returns -1 on error, -2 if not supported */
 int qemuMonitorJSONSetPassword(qemuMonitorPtr mon,
                                const char *protocol,
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index dec7a5cf9..b3254ac05 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -94,6 +94,8 @@ int qemuMonitorJSONBlockResize(qemuMonitorPtr mon,
 
 int qemuMonitorJSONSetVNCPasswordLegacy(qemuMonitorPtr mon,
                                         const char *password);
+int qemuMonitorJSONSetVNCPassword(qemuMonitorPtr mon,
+                                  const char *password);
 int qemuMonitorJSONSetPassword(qemuMonitorPtr mon,
                                const char *protocol,
                                const char *password,
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index f9c59f2f0..6d33333a0 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -1317,6 +1317,7 @@ cleanup: \
 GEN_TEST_FUNC(qemuMonitorJSONSetLink, "vnet0", VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN)
 GEN_TEST_FUNC(qemuMonitorJSONBlockResize, "vda", 123456)
 GEN_TEST_FUNC(qemuMonitorJSONSetVNCPasswordLegacy, "secret_password")
+GEN_TEST_FUNC(qemuMonitorJSONSetVNCPassword, "secret_password")
 GEN_TEST_FUNC(qemuMonitorJSONSetPassword, "spice", "secret_password", "disconnect")
 GEN_TEST_FUNC(qemuMonitorJSONExpirePassword, "spice", "123456")
 GEN_TEST_FUNC(qemuMonitorJSONSetBalloon, 1024)
@@ -2906,6 +2907,7 @@ mymain(void)
     DO_TEST_GEN(qemuMonitorJSONSetLink);
     DO_TEST_GEN(qemuMonitorJSONBlockResize);
     DO_TEST_GEN(qemuMonitorJSONSetVNCPasswordLegacy);
+    DO_TEST_GEN(qemuMonitorJSONSetVNCPassword);
     DO_TEST_GEN(qemuMonitorJSONSetPassword);
     DO_TEST_GEN(qemuMonitorJSONExpirePassword);
     DO_TEST_GEN(qemuMonitorJSONSetBalloon);
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 4/4] qemu: Add support for change-vnc-password
Posted by Daniel P. Berrangé, 15 weeks ago
On Tue, Mar 06, 2018 at 09:47:02AM -0500, John Ferlan wrote:
> Rather than use the to be deprecated "change" command, use the
> change-vnc-password command to perform VNC password changes instead
> of the set_password command. Since changing VNC password only
> accepts "keep" for connect and that's the default, no sense in
> vectoring through "set_password" as we've already checked that the
> XML 'connected' was set to "keep" in virDomainGraphicsAuthDefParseXML.

This explanation doesn't make any sense to me.

Currently, we try 'set_password' first, and if that's not present
we fallback to the legacy "change" method. This is fine because
all QEMU since 0.14 have supported "set_password", so we only
need 'change' for really ancient QEMU.   "set_password" works with
both SPICE and VNC.

The "change-vnc-password" method was only introduced in 1.1 QEMU,
so there's never a situation where we would not have "set_password"
and yet have "change-vnc-password".

I'm rather puzzelled why  "change-vnc-password" was added to QEMU
at all, since it seems to be entirely less functional than
'set_password' which already exists.  Thus I don't see any benefit
in using it from libvirt.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 4/4] qemu: Add support for change-vnc-password
Posted by John Ferlan, 15 weeks ago

On 03/06/2018 10:07 AM, Daniel P. Berrangé wrote:
> On Tue, Mar 06, 2018 at 09:47:02AM -0500, John Ferlan wrote:
>> Rather than use the to be deprecated "change" command, use the
>> change-vnc-password command to perform VNC password changes instead
>> of the set_password command. Since changing VNC password only
>> accepts "keep" for connect and that's the default, no sense in
>> vectoring through "set_password" as we've already checked that the
>> XML 'connected' was set to "keep" in virDomainGraphicsAuthDefParseXML.
> 
> This explanation doesn't make any sense to me.
> 
> Currently, we try 'set_password' first, and if that's not present
> we fallback to the legacy "change" method. This is fine because
> all QEMU since 0.14 have supported "set_password", so we only
> need 'change' for really ancient QEMU.   "set_password" works with
> both SPICE and VNC.
> 
> The "change-vnc-password" method was only introduced in 1.1 QEMU,
> so there's never a situation where we would not have "set_password"
> and yet have "change-vnc-password".

FWIW: When set_password was introduced, rather than go with capability
checking - the code checks for error of CommandNotFound and falls back
to the old "change" command.

> 
> I'm rather puzzelled why  "change-vnc-password" was added to QEMU
> at all, since it seems to be entirely less functional than
> 'set_password' which already exists.  Thus I don't see any benefit
> in using it from libvirt.
> 

Having the value of connected as "keep" is the only way set_password
works for VNC:

set_password(...)
...
    if (strcmp(protocol, "vnc") == 0) {
        if (fail_if_connected || disconnect_if_connected) {
            /* vnc supports "connected=keep" only */
            error_setg(errp, QERR_INVALID_PARAMETER, "connected");
            return;
        }
...

I can only assume the change-vnc-password was introduced to avoid the
need to use set_password and passing "keep" for connected if provided.
Maybe a secondary goal is/was to allow VNC password processing not have
to worry about other changes in set_password. Who knows - my desire to
chase that history is next to nil.

I can drop the series - it doesn't really matter beyond just seeing the
"change" is deprecated. In the long run both have the same
functionality, it's just the change-vnc-password is more direct. The
virDomainGraphicsAuthDefParseXML also checks for "keep", so in the long
run everything is a wash.  In the hindsight of hypervisor specific
checks the ParseXML check probably should be in some qemu specific checker.

John

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list