#include "conf/storage_conf.h"
#include "virstring.h"
-#define VIRSH_COMMON_OPT_POOL \
- {.name = "pool", \
- .type = VSH_OT_DATA, \
- .flags = VSH_OFLAG_REQ, \
- .help = N_("pool name or uuid") \
- } \
+#define VIRSH_COMMON_OPT_POOL_FULL \
+ VIRSH_COMMON_OPT_POOL(N_("pool name or uuid")) \
#define VIRSH_COMMON_OPT_POOL_FILE \
{.name = "file", \
};
static const vshCmdOptDef opts_pool_autostart[] = {
- VIRSH_COMMON_OPT_POOL,
+ VIRSH_COMMON_OPT_POOL_FULL,
{.name = "disable",
.type = VSH_OT_BOOL,
};
static const vshCmdOptDef opts_pool_build[] = {
- VIRSH_COMMON_OPT_POOL,
+ VIRSH_COMMON_OPT_POOL_FULL,
VIRSH_COMMON_OPT_POOL_NO_OVERWRITE,
VIRSH_COMMON_OPT_POOL_OVERWRITE,
};
static const vshCmdOptDef opts_pool_destroy[] = {
- VIRSH_COMMON_OPT_POOL,
+ VIRSH_COMMON_OPT_POOL_FULL,
{.name = NULL}
};
};
static const vshCmdOptDef opts_pool_delete[] = {
- VIRSH_COMMON_OPT_POOL,
+ VIRSH_COMMON_OPT_POOL_FULL,
{.name = NULL}
};
};
static const vshCmdOptDef opts_pool_refresh[] = {
- VIRSH_COMMON_OPT_POOL,
+ VIRSH_COMMON_OPT_POOL_FULL,
{.name = NULL}
};
};
static const vshCmdOptDef opts_pool_dumpxml[] = {
- VIRSH_COMMON_OPT_POOL,
+ VIRSH_COMMON_OPT_POOL_FULL,
{.name = "inactive",
.type = VSH_OT_BOOL,
};
static const vshCmdOptDef opts_pool_info[] = {
- VIRSH_COMMON_OPT_POOL,
+ VIRSH_COMMON_OPT_POOL_FULL,
{.name = NULL}
};
};
static const vshCmdOptDef opts_pool_name[] = {
- VIRSH_COMMON_OPT_POOL,
+ VIRSH_COMMON_OPT_POOL_FULL,
{.name = NULL}
};
};
static const vshCmdOptDef opts_pool_start[] = {
- VIRSH_COMMON_OPT_POOL,
+ VIRSH_COMMON_OPT_POOL_FULL,
VIRSH_COMMON_OPT_POOL_BUILD,
VIRSH_COMMON_OPT_POOL_NO_OVERWRITE,
VIRSH_COMMON_OPT_POOL_OVERWRITE,
};
static const vshCmdOptDef opts_pool_undefine[] = {
- VIRSH_COMMON_OPT_POOL,
+ VIRSH_COMMON_OPT_POOL_FULL,
{.name = NULL}
};
};
static const vshCmdOptDef opts_pool_uuid[] = {
- VIRSH_COMMON_OPT_POOL,
+ VIRSH_COMMON_OPT_POOL_FULL,
{.name = NULL}
};
};
static const vshCmdOptDef opts_pool_edit[] = {
- VIRSH_COMMON_OPT_POOL,
+ VIRSH_COMMON_OPT_POOL_FULL,
{.name = NULL}
};
#include "virxml.h"
#include "virstring.h"
+#define VIRSH_COMMON_OPT_POOL_FULL \
+ VIRSH_COMMON_OPT_POOL(N_("pool name or uuid")) \
+
+#define VIRSH_COMMON_OPT_POOL_NAME \
+ VIRSH_COMMON_OPT_POOL(N_("pool name")) \
+
+#define VIRSH_COMMON_OPT_POOL_OPTIONAL \
+ {.name = "pool", \
+ .type = VSH_OT_STRING, \
+ .help = N_("pool name or uuid") \
+ } \
+
virStorageVolPtr
virshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd,
const char *optname,
};
static const vshCmdOptDef opts_vol_create_as[] = {
- {.name = "pool",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("pool name")
- },
+ VIRSH_COMMON_OPT_POOL_NAME,
{.name = "name",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
};
static const vshCmdOptDef opts_vol_create[] = {
- {.name = "pool",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("pool name")
- },
+ VIRSH_COMMON_OPT_POOL_NAME,
{.name = "file",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
};
static const vshCmdOptDef opts_vol_create_from[] = {
- {.name = "pool",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("pool name or uuid")
- },
+ VIRSH_COMMON_OPT_POOL_FULL,
{.name = "file",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
.flags = VSH_OFLAG_REQ,
.help = N_("clone name")
},
- {.name = "pool",
- .type = VSH_OT_STRING,
- .help = N_("pool name or uuid")
- },
+ VIRSH_COMMON_OPT_POOL_OPTIONAL,
{.name = "prealloc-metadata",
.type = VSH_OT_BOOL,
.help = N_("preallocate metadata (for qcow2 instead of full allocation)")
.flags = VSH_OFLAG_REQ,
.help = N_("file")
},
- {.name = "pool",
- .type = VSH_OT_STRING,
- .help = N_("pool name or uuid")
- },
+ VIRSH_COMMON_OPT_POOL_OPTIONAL,
{.name = "offset",
.type = VSH_OT_INT,
.help = N_("volume offset to upload to")
.flags = VSH_OFLAG_REQ,
.help = N_("file")
},
- {.name = "pool",
- .type = VSH_OT_STRING,
- .help = N_("pool name or uuid")
- },
+ VIRSH_COMMON_OPT_POOL_OPTIONAL,
{.name = "offset",
.type = VSH_OT_INT,
.help = N_("volume offset to download from")
.flags = VSH_OFLAG_REQ,
.help = N_("vol name, key or path")
},
- {.name = "pool",
- .type = VSH_OT_STRING,
- .help = N_("pool name or uuid")
- },
+ VIRSH_COMMON_OPT_POOL_OPTIONAL,
{.name = "delete-snapshots",
.type = VSH_OT_BOOL,
.help = N_("delete snapshots associated with volume (must be "
.flags = VSH_OFLAG_REQ,
.help = N_("vol name, key or path")
},
- {.name = "pool",
- .type = VSH_OT_STRING,
- .help = N_("pool name or uuid")
- },
+ VIRSH_COMMON_OPT_POOL_OPTIONAL,
{.name = "algorithm",
.type = VSH_OT_STRING,
.help = N_("perform selected wiping algorithm")
.flags = VSH_OFLAG_REQ,
.help = N_("vol name, key or path")
},
- {.name = "pool",
- .type = VSH_OT_STRING,
- .help = N_("pool name or uuid")
- },
+ VIRSH_COMMON_OPT_POOL_OPTIONAL,
{.name = NULL}
};
.flags = VSH_OFLAG_REQ,
.help = N_("new capacity for the vol, as scaled integer (default bytes)")
},
- {.name = "pool",
- .type = VSH_OT_STRING,
- .help = N_("pool name or uuid")
- },
+ VIRSH_COMMON_OPT_POOL_OPTIONAL,
{.name = "allocate",
.type = VSH_OT_BOOL,
.help = N_("allocate the new capacity, rather than leaving it sparse")
.flags = VSH_OFLAG_REQ,
.help = N_("vol name, key or path")
},
- {.name = "pool",
- .type = VSH_OT_STRING,
- .help = N_("pool name or uuid")
- },
+ VIRSH_COMMON_OPT_POOL_OPTIONAL,
{.name = NULL}
};
};
static const vshCmdOptDef opts_vol_list[] = {
- {.name = "pool",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("pool name or uuid")
- },
+ VIRSH_COMMON_OPT_POOL_FULL,
{.name = "details",
.type = VSH_OT_BOOL,
.help = N_("display extended details for volumes")
.flags = VSH_OFLAG_REQ,
.help = N_("volume name or path")
},
- {.name = "pool",
- .type = VSH_OT_STRING,
- .help = N_("pool name or uuid")
- },
+ VIRSH_COMMON_OPT_POOL_OPTIONAL,
{.name = NULL}
};
.flags = VSH_OFLAG_REQ,
.help = N_("volume name or key")
},
- {.name = "pool",
- .type = VSH_OT_STRING,
- .help = N_("pool name or uuid")
- },
+ VIRSH_COMMON_OPT_POOL_OPTIONAL,
{.name = NULL}
};
/*
* virsh.h: a shell to exercise the libvirt API
*
- * Copyright (C) 2005, 2007-2015 Red Hat, Inc.
+ * Copyright (C) 2005, 2007-2016 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
# define VIRSH_CMD_GRP_HOST_AND_HV "Host and Hypervisor"
# define VIRSH_CMD_GRP_VIRSH "Virsh itself"
+/*
+ * Common command options
+ */
+# define VIRSH_COMMON_OPT_POOL(_helpstr) \
+ {.name = "pool", \
+ .type = VSH_OT_DATA, \
+ .flags = VSH_OFLAG_REQ, \
+ .help = _helpstr \
+ } \
+
typedef struct _virshControl virshControl;
typedef virshControl *virshControlPtr;