]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: Require --xpath for *dumpxml
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 8 Jul 2022 10:45:42 +0000 (12:45 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 25 Jul 2022 07:50:21 +0000 (09:50 +0200)
Historically, the dumpxml command reject any unknown arguments,
for instance:

    virsh dumpxml fedora xxx

However, after v8.5.0-rc1~31 the second argument ('xxx') is
treated as an XPath, but it's not that clearly visible.
Therefore, require the --xpath switch, like this:

    virsh dumpxml fedora --xpath xxx

Yes, this breaks already released virsh, but I think we can argue
that the pool of users of this particular function is very small.
We also document the argument being mandatory:

   dumpxml [--inactive] [--security-info] [--update-cpu] [--migratable]
           [--xpath EXPRESSION] [--wrap] domain

The sooner we do this change, the better.

The same applies for other *dumpxml functions (net-dumpxml,
pool-dumpxml, vol-dumpxl to name a few).

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2103524
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
tools/virsh-backup.c
tools/virsh-checkpoint.c
tools/virsh-domain.c
tools/virsh-interface.c
tools/virsh-network.c
tools/virsh-nodedev.c
tools/virsh-nwfilter.c
tools/virsh-pool.c
tools/virsh-secret.c
tools/virsh-snapshot.c
tools/virsh-volume.c

index db122abc0979c67ed7b61bd10cbd2395f40f5dd1..1bb2c63113150e537138d424ddf824bcf0ad34a2 100644 (file)
@@ -117,6 +117,7 @@ static const vshCmdOptDef opts_backup_dumpxml[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
     {.name = "xpath",
      .type = VSH_OT_STRING,
+     .flags = VSH_OFLAG_REQ_OPT,
      .completer = virshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
index a7ef39849d6427a0286d904cfa5770043d7ea6ee..9605c893af6de6268bd68db6daf86ddc7a1e5377 100644 (file)
@@ -854,6 +854,7 @@ static const vshCmdOptDef opts_checkpoint_dumpxml[] = {
     },
     {.name = "xpath",
      .type = VSH_OT_STRING,
+     .flags = VSH_OFLAG_REQ_OPT,
      .completer = virshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
index da63cc95fff632f291e02194aec4fecf5c892840..76d12d2b7019f61f6e39606d1b2d2deaa49befe8 100644 (file)
@@ -4529,6 +4529,7 @@ static const vshCmdOptDef opts_save_image_dumpxml[] = {
     },
     {.name = "xpath",
      .type = VSH_OT_STRING,
+     .flags = VSH_OFLAG_REQ_OPT,
      .completer = virshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
@@ -4961,6 +4962,7 @@ static const vshCmdOptDef opts_managed_save_dumpxml[] = {
     },
     {.name = "xpath",
      .type = VSH_OT_STRING,
+     .flags = VSH_OFLAG_REQ_OPT,
      .completer = virshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
@@ -10469,6 +10471,7 @@ static const vshCmdOptDef opts_dumpxml[] = {
     },
     {.name = "xpath",
      .type = VSH_OT_STRING,
+     .flags = VSH_OFLAG_REQ_OPT,
      .completer = virshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
index b29ffc9bef2d183a16306b21ed5dc8577a298be7..39ea53ec9da2cf5e2368ef9dc07b133476d343d0 100644 (file)
@@ -472,6 +472,7 @@ static const vshCmdOptDef opts_interface_dumpxml[] = {
     },
     {.name = "xpath",
      .type = VSH_OT_STRING,
+     .flags = VSH_OFLAG_REQ_OPT,
      .completer = virshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
index 99ced6ccc6b2e3c65edb9f343eb8f83e87410b6c..004719dad6d0f4c3e6ff0e4c6c97322dfb7139da 100644 (file)
@@ -351,6 +351,7 @@ static const vshCmdOptDef opts_network_dumpxml[] = {
     },
     {.name = "xpath",
      .type = VSH_OT_STRING,
+     .flags = VSH_OFLAG_REQ_OPT,
      .completer = virshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
@@ -1556,6 +1557,7 @@ static const vshCmdOptDef opts_network_port_dumpxml[] = {
     VIRSH_COMMON_OPT_NETWORK_PORT(0),
     {.name = "xpath",
      .type = VSH_OT_STRING,
+     .flags = VSH_OFLAG_REQ_OPT,
      .completer = virshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
index 37e361c701590a74fc4b9bc9f443a5c311dc4ec9..2adcad9c1079402e67a29c12bb79b79754ffc239 100644 (file)
@@ -567,6 +567,7 @@ static const vshCmdOptDef opts_node_device_dumpxml[] = {
     },
     {.name = "xpath",
      .type = VSH_OT_STRING,
+     .flags = VSH_OFLAG_REQ_OPT,
      .completer = virshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
index ff7f6f40265e6bea545628bfc36ecfd81e0a96f5..d4112c8620ca19301348cb9d9772079136c945ab 100644 (file)
@@ -188,6 +188,7 @@ static const vshCmdOptDef opts_nwfilter_dumpxml[] = {
     },
     {.name = "xpath",
      .type = VSH_OT_STRING,
+     .flags = VSH_OFLAG_REQ_OPT,
      .completer = virshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
@@ -610,6 +611,7 @@ static const vshCmdOptDef opts_nwfilter_binding_dumpxml[] = {
     },
     {.name = "xpath",
      .type = VSH_OT_STRING,
+     .flags = VSH_OFLAG_REQ_OPT,
      .completer = virshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
index 820a61f8897fe9c8d7f97614b306489ab876eaea..8a98c6ae402b289e138189ad1abac731812becfd 100644 (file)
@@ -777,6 +777,7 @@ static const vshCmdOptDef opts_pool_dumpxml[] = {
     },
     {.name = "xpath",
      .type = VSH_OT_STRING,
+     .flags = VSH_OFLAG_REQ_OPT,
      .completer = virshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
index 79fa3faf5aca189a9363c04b312a7f1db5dad0ad..17d2bbd88dc527fb5ec7df59628d051ea6cbaf19 100644 (file)
@@ -140,6 +140,7 @@ static const vshCmdOptDef opts_secret_dumpxml[] = {
     },
     {.name = "xpath",
      .type = VSH_OT_STRING,
+     .flags = VSH_OFLAG_REQ_OPT,
      .completer = virshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
index 83fdfb96165893d4f0627307377e5690968cdaac..8fa64ba903c2ec671295cae4c02763628cbe11ea 100644 (file)
@@ -1609,6 +1609,7 @@ static const vshCmdOptDef opts_snapshot_dumpxml[] = {
     },
     {.name = "xpath",
      .type = VSH_OT_STRING,
+     .flags = VSH_OFLAG_REQ_OPT,
      .completer = virshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
index bf72d8135f5e2637a387706e7c906f9433d31a95..300a0aa8e56b5a968abb9734f3947be58a72307b 100644 (file)
@@ -1161,6 +1161,7 @@ static const vshCmdOptDef opts_vol_dumpxml[] = {
     VIRSH_COMMON_OPT_POOL_OPTIONAL,
     {.name = "xpath",
      .type = VSH_OT_STRING,
+     .flags = VSH_OFLAG_REQ_OPT,
      .completer = virshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },