mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-21 13:34:06 +03:00
virsh: Provide completer for vol-wipe algorithms
Related issue: https://gitlab.com/libvirt/libvirt/-/issues/9 Signed-off-by: Haonan Wang <hnwanga1@gmail.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
688a2c0897
commit
35ba60be36
@ -26,6 +26,7 @@
|
|||||||
#include "virsh-pool.h"
|
#include "virsh-pool.h"
|
||||||
#include "virsh.h"
|
#include "virsh.h"
|
||||||
#include "virstring.h"
|
#include "virstring.h"
|
||||||
|
#include "virsh-volume.h"
|
||||||
|
|
||||||
char **
|
char **
|
||||||
virshStorageVolNameCompleter(vshControl *ctl,
|
virshStorageVolNameCompleter(vshControl *ctl,
|
||||||
@ -116,3 +117,21 @@ virshStorageVolKeyCompleter(vshControl *ctl,
|
|||||||
virshStoragePoolListFree(list);
|
virshStoragePoolListFree(list);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char **
|
||||||
|
virshStorageVolWipeAlgorithmCompleter(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_VOL_WIPE_ALG_LAST + 1);
|
||||||
|
|
||||||
|
for (i = 0; i < VIR_STORAGE_VOL_WIPE_ALG_LAST; i++)
|
||||||
|
ret[i] = g_strdup(virshStorageVolWipeAlgorithmTypeToString(i));
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
@ -33,3 +33,9 @@ char **
|
|||||||
virshStorageVolKeyCompleter(vshControl *ctl,
|
virshStorageVolKeyCompleter(vshControl *ctl,
|
||||||
const vshCmd *cmd,
|
const vshCmd *cmd,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
|
|
||||||
|
|
||||||
|
char **
|
||||||
|
virshStorageVolWipeAlgorithmCompleter(vshControl *ctl,
|
||||||
|
const vshCmd *cmd,
|
||||||
|
unsigned int flags);
|
||||||
|
@ -902,12 +902,12 @@ static const vshCmdOptDef opts_vol_wipe[] = {
|
|||||||
VIRSH_COMMON_OPT_POOL_OPTIONAL,
|
VIRSH_COMMON_OPT_POOL_OPTIONAL,
|
||||||
{.name = "algorithm",
|
{.name = "algorithm",
|
||||||
.type = VSH_OT_STRING,
|
.type = VSH_OT_STRING,
|
||||||
|
.completer = virshStorageVolWipeAlgorithmCompleter,
|
||||||
.help = N_("perform selected wiping algorithm")
|
.help = N_("perform selected wiping algorithm")
|
||||||
},
|
},
|
||||||
{.name = NULL}
|
{.name = NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
VIR_ENUM_DECL(virshStorageVolWipeAlgorithm);
|
|
||||||
VIR_ENUM_IMPL(virshStorageVolWipeAlgorithm,
|
VIR_ENUM_IMPL(virshStorageVolWipeAlgorithm,
|
||||||
VIR_STORAGE_VOL_WIPE_ALG_LAST,
|
VIR_STORAGE_VOL_WIPE_ALG_LAST,
|
||||||
"zero", "nnsa", "dod", "bsi", "gutmann", "schneier",
|
"zero", "nnsa", "dod", "bsi", "gutmann", "schneier",
|
||||||
|
@ -33,3 +33,5 @@ virStorageVolPtr virshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd,
|
|||||||
VIRSH_BYUUID | VIRSH_BYNAME)
|
VIRSH_BYUUID | VIRSH_BYNAME)
|
||||||
|
|
||||||
extern const vshCmdDef storageVolCmds[];
|
extern const vshCmdDef storageVolCmds[];
|
||||||
|
|
||||||
|
VIR_ENUM_DECL(virshStorageVolWipeAlgorithm);
|
||||||
|
Loading…
Reference in New Issue
Block a user