Signed-off-by: Lin Ma <lma(a)suse.com>
---
tools/virsh-completer-domain.c | 20 ++++++++++++++++++++
tools/virsh-completer-domain.h | 6 ++++++
tools/virsh-domain.c | 2 ++
3 files changed, 28 insertions(+)
diff --git a/tools/virsh-completer-domain.c b/tools/virsh-completer-domain.c
index 256ac0b593..14e4d95ec3 100644
--- a/tools/virsh-completer-domain.c
+++ b/tools/virsh-completer-domain.c
@@ -35,6 +35,7 @@
#include "virkeynametable_linux.h"
#include "virkeynametable_osx.h"
#include "virkeynametable_win32.h"
+#include "conf/storage_conf.h"
char **
virshDomainNameCompleter(vshControl *ctl,
@@ -976,3 +977,22 @@ virshDomainMigrateCompMethodsCompleter(vshControl *ctl,
return virshCommaStringListComplete(method, methods);
}
+
+
+char **
+virshDomainStorageFileFormatCompleter(vshControl *ctl G_GNUC_UNUSED,
+ const vshCmd *cmd G_GNUC_UNUSED,
+ unsigned int flags)
+{
+ char **ret = NULL;
+ size_t i;
+
+ virCheckFlags(0, NULL);
+
+ ret = g_new0(char *, VIR_STORAGE_FILE_LAST + 1);
+
+ for (i = 0; i < VIR_STORAGE_FILE_LAST; i++)
+ ret[i] = g_strdup(virStorageFileFormatTypeToString(i));
+
+ return ret;
+}
diff --git a/tools/virsh-completer-domain.h b/tools/virsh-completer-domain.h
index 5d56090504..45380906f9 100644
--- a/tools/virsh-completer-domain.h
+++ b/tools/virsh-completer-domain.h
@@ -132,3 +132,9 @@ char **
virshDomainMigrateCompMethodsCompleter(vshControl *ctl,
const vshCmd *cmd,
unsigned int flags);
+
+
+char **
+virshDomainStorageFileFormatCompleter(vshControl *ctl,
+ const vshCmd *cmd,
+ unsigned int flags);
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index b3aa52b8a8..183f53f913 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -2235,6 +2235,8 @@ static const vshCmdOptDef opts_blockcopy[] = {
},
{.name = "format",
.type = VSH_OT_STRING,
+ .flags = VSH_OFLAG_NONE,
+ .completer = virshDomainStorageFileFormatCompleter,
.help = N_("format of the destination file")
},
{.name = "granularity",
--
2.26.2