struct _virDomainMemoryStat stats[VIR_DOMAIN_MEMORY_STAT_NR];
unsigned int nr_stats, i;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
return false;
bool ret = true;
const char *device = NULL;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
details = vshCommandOptBool(cmd, "details");
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
if (vshCommandOptBool(cmd, "inactive"))
flags |= VIR_DOMAIN_XML_INACTIVE;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
xmlNodePtr cur = NULL;
xmlXPathObjectPtr obj = NULL;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
bool ret = true;
virDomainControlInfo info;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
bool ret = false;
bool human = vshCommandOptBool(cmd, "human"); /* human readable output */
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
return false;
const char *name = NULL, *device = NULL;
struct _virDomainInterfaceStats stats;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
return false;
int count;
bool ret = false;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
char *str, uuid[VIR_UUID_STRING_BUFLEN];
int has_managed_save = 0;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
bool showReason = vshCommandOptBool(cmd, "reason");
int state, reason;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
if (!optUUID && !optName)
optTable = true;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(list = vshDomainListCollect(ctl, flags)))
goto cleanup;
int ret;
unsigned int flags;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
char *xml;
struct stat st;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto cleanup;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
goto cleanup;
virBuffer buf = VIR_BUFFER_INITIALIZER;
char *xml;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto cleanup;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
goto cleanup;
const char *name;
int autostart;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
return false;
flags |= VIR_DOMAIN_AFFECT_LIVE;
}
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto cleanup;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
goto cleanup;
flags |= VIR_DOMAIN_AFFECT_LIVE;
}
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
const char *base = NULL;
unsigned int flags = 0;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto cleanup;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
goto cleanup;
unsigned int flags = 0;
int ret = false;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (vshCommandOptString(cmd, "path", (const char **) &path) < 0) {
vshError(ctl, "%s", _("Path must not be empty"));
return false;
unsigned int flags = 0;
const char *name = NULL;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
xmlNodePtr cur = NULL;
xmlBufferPtr xml_buf = NULL;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
flags |= VIR_DOMAIN_AFFECT_LIVE;
}
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
return false;
const char *name;
bool ret = true;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
return false;
unsigned int suspendTarget;
unsigned long long duration = 0;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
return false;
bool ret = false;
unsigned int flags = 0;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
return false;
snapshots_safe = true;
}
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
return false;
unsigned int flags = VIR_DOMAIN_NONE;
int rc;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomainBy(ctl, cmd, NULL,
VSH_BYNAME | VSH_BYUUID)))
return false;
if (pthread_sigmask(SIG_BLOCK, &sigmask, &oldsigmask) < 0)
goto out_sig;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto out;
-
if (vshCommandOptString(cmd, "file", &to) <= 0)
goto out;
if (vshCommandOptBool(cmd, "security-info"))
flags |= VIR_DOMAIN_XML_SECURE;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (vshCommandOptString(cmd, "file", &file) <= 0)
return false;
if (vshCommandOptBool(cmd, "paused"))
flags |= VIR_DOMAIN_SAVE_PAUSED;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (vshCommandOptString(cmd, "file", &file) <= 0)
return false;
return false;
}
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (vshCommandOptString(cmd, "file", &file) <= 0)
return false;
if (pthread_sigmask(SIG_BLOCK, &sigmask, &oldsigmask) < 0)
goto out_sig;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto out;
-
if (vshCommandOptBool(cmd, "bypass-cache"))
flags |= VIR_DOMAIN_SAVE_BYPASS_CACHE;
if (vshCommandOptBool(cmd, "running"))
bool ret = false;
int hassave;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
return false;
flags |= VIR_DOMAIN_AFFECT_LIVE;
}
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
const char *xmlfile = NULL;
char *xml = NULL;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (vshCommandOptString(cmd, "file", &from) <= 0)
return false;
if (pthread_sigmask(SIG_BLOCK, &sigmask, &oldsigmask) < 0)
goto out_sig;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto out;
-
if (vshCommandOptString(cmd, "file", &to) <= 0)
goto out;
const char *ext = NULL;
char *ret = NULL;
- /* We should be already connected, but doesn't
- * hurt to check */
- if (!vshConnectionUsability(ctl, ctl->conn))
- return NULL;
-
if (!dom) {
vshError(ctl, "%s", _("Invalid domain supplied"));
return NULL;
bool generated = false;
char *mime = NULL;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (vshCommandOptString(cmd, "file", (const char **) &file) < 0) {
vshError(ctl, "%s", _("file must not be empty"));
return false;
bool ret = true;
const char *name;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
return false;
int flags = 0;
int rv;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (vshCommandOptString(cmd, "mode", &mode) < 0) {
vshError(ctl, "%s", _("Invalid type"));
return false;
const char *mode = NULL;
int flags = 0;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (vshCommandOptString(cmd, "mode", &mode) < 0) {
vshError(ctl, "%s", _("Invalid type"));
return false;
bool ret = true;
const char *name;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
return false;
virDomainPtr dom;
bool ret = true;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
virDomainPtr dom;
bool ret = true;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
return false;
}
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
vcpus = virConnectGetMaxVcpus(ctl->conn, type);
if (vcpus < 0)
return false;
return false;
}
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
bool ret = true;
int n, m;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
flags = -1;
}
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
flags = -1;
}
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
flags = -1;
}
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
xmlBufferPtr xml_buf = NULL;
xmlNodePtr node;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (vshCommandOptString(cmd, "file", &from) <= 0)
return false;
virBuffer buf = VIR_BUFFER_INITIALIZER;
int i;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (vshCommandOptString(cmd, "file", &from) <= 0)
return false;
bool show_total = false, show_per_cpu = false;
unsigned int flags = 0;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
#endif
unsigned int flags = VIR_DOMAIN_NONE;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (vshCommandOptString(cmd, "file", &from) <= 0)
return false;
bool ret = true;
char *buffer;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (vshCommandOptString(cmd, "file", &from) <= 0)
return false;
unsigned int flags = 0;
int result;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
return false;
flags |= VIR_DOMAIN_AFFECT_LIVE;
}
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
virDomainPtr dom;
int ret = true;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
int keycode;
unsigned int keycodes[VIR_DOMAIN_SEND_KEY_MAX_KEYS];
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
flags = -1;
}
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
flags = -1;
}
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
flags |= VIR_DOMAIN_AFFECT_LIVE;
}
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
flags |= VIR_DOMAIN_AFFECT_LIVE;
}
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
if (update)
flags |= VIR_DOMAIN_XML_UPDATE_CPU;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
char *xmlData;
unsigned int flags = 0;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (vshCommandOptString(cmd, "format", &format) < 0 ||
vshCommandOptString(cmd, "config", &configFile) < 0)
return false;
char *xmlData;
unsigned int flags = 0;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (vshCommandOptString(cmd, "format", &format) < 0
|| vshCommandOptString(cmd, "xml", &xmlFile) < 0)
return false;
{
virDomainPtr dom;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
if (!(dom = vshCommandOptDomainBy(ctl, cmd, NULL,
VSH_BYID|VSH_BYUUID)))
return false;
virDomainPtr dom;
unsigned int id;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
if (!(dom = vshCommandOptDomainBy(ctl, cmd, NULL,
VSH_BYNAME|VSH_BYUUID)))
return false;
virDomainPtr dom;
char uuid[VIR_UUID_STRING_BUFLEN];
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
if (!(dom = vshCommandOptDomainBy(ctl, cmd, NULL,
VSH_BYNAME|VSH_BYID)))
return false;
if (pthread_sigmask(SIG_BLOCK, &sigmask, &oldsigmask) < 0)
goto out_sig;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto out;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
goto out;
long long downtime = 0;
bool ret = false;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
unsigned long bandwidth = 0;
bool ret = false;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
unsigned long bandwidth;
bool ret = false;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
int tmp;
int flags = 0;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
char *doc = NULL;
char *listen_addr = NULL;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
bool ret = false;
char *doc;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
virDomainPtr dom;
bool ret = false;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
bool funcRet = false;
unsigned int flags;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
int ret;
unsigned int flags;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
int functionReturn = false;
unsigned int flags;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto cleanup;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
goto cleanup;
unsigned int flags;
xmlNodePtr disk_node = NULL;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto cleanup;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
goto cleanup;
virDomainPtr dom_edited = NULL;
unsigned int flags = VIR_DOMAIN_XML_SECURE | VIR_DOMAIN_XML_INACTIVE;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto cleanup;
-
dom = vshCommandOptDomain(ctl, cmd, NULL);
if (dom == NULL)
goto cleanup;
if (force)
flags |= VIR_DOMAIN_DEVICE_MODIFY_FORCE;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto cleanup;
-
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
goto cleanup;
{
char *caps;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if ((caps = virConnectGetCapabilities(ctl->conn)) == NULL) {
vshError(ctl, "%s", _("failed to get capabilities"));
return false;
xmlDocPtr xml = NULL;
xmlXPathContextPtr ctxt = NULL;
-
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if ( (cell_given = vshCommandOptInt(cmd, "cellno", &cell)) < 0) {
vshError(ctl, "%s", _("cell number has to be a number"));
goto cleanup;
{
virNodeInfo info;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (virNodeGetInfo(ctl->conn, &info) < 0) {
vshError(ctl, "%s", _("failed to get node information"));
return false;
double user_time, sys_time, idle_time, iowait_time, total_time;
double usage;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (vshCommandOptInt(cmd, "cpu", &cpuNum) < 0) {
vshError(ctl, "%s", _("Invalid value of cpuNum"));
return false;
virNodeMemoryStatsPtr params = NULL;
bool ret = false;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (vshCommandOptInt(cmd, "cell", &cellNum) < 0) {
vshError(ctl, "%s", _("Invalid value of cellNum"));
return false;
long long duration;
unsigned int flags = 0;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (vshCommandOptString(cmd, "target", &target) < 0) {
vshError(ctl, _("Invalid target argument"));
return false;
virBuffer buf = VIR_BUFFER_INITIALIZER;
bool pad = false;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto cleanup;
-
dom = vshCommandOptDomain(ctl, cmd, NULL);
if (dom == NULL)
goto cleanup;
unsigned int flags = 0;
unsigned int pid_value; /* API uses unsigned int, not pid_t */
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto cleanup;
-
if (vshCommandOptUInt(cmd, "pid", &pid_value) <= 0) {
vshError(ctl, "%s", _("missing pid value"));
goto cleanup;
virBuffer buf = VIR_BUFFER_INITIALIZER;
bool pad = false;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto cleanup;
-
dom = vshCommandOptDomain(ctl, cmd, NULL);
if (dom == NULL)
goto cleanup;
{
char *sysinfo;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
sysinfo = virConnectGetSysinfo(ctl->conn, 0);
if (sysinfo == NULL) {
vshError(ctl, "%s", _("failed to get sysinfo"));
{
char *hostname;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
hostname = virConnectGetHostname(ctl->conn);
if (hostname == NULL) {
vshError(ctl, "%s", _("failed to get hostname"));
{
char *uri;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
uri = virConnectGetURI(ctl->conn);
if (uri == NULL) {
vshError(ctl, "%s", _("failed to get URI"));
unsigned int minor;
unsigned int rel;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
hvType = virConnectGetType(ctl->conn);
if (hvType == NULL) {
vshError(ctl, "%s", _("failed to get hypervisor type"));
virInterfacePtr iface_edited = NULL;
unsigned int flags = VIR_INTERFACE_XML_INACTIVE;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto cleanup;
-
iface = vshCommandOptInterface(ctl, cmd, NULL);
if (iface == NULL)
goto cleanup;
char **activeNames = NULL, **inactiveNames = NULL;
inactive |= all;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (active) {
maxactive = virConnectNumOfInterfaces(ctl->conn);
if (maxactive < 0) {
{
virInterfacePtr iface;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
if (!(iface = vshCommandOptInterfaceBy(ctl, cmd, NULL, NULL,
VSH_BYMAC)))
return false;
{
virInterfacePtr iface;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
if (!(iface = vshCommandOptInterfaceBy(ctl, cmd, NULL, NULL,
VSH_BYNAME)))
return false;
if (inactive)
flags |= VIR_INTERFACE_XML_INACTIVE;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(iface = vshCommandOptInterface(ctl, cmd, NULL)))
return false;
bool ret = true;
char *buffer;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (vshCommandOptString(cmd, "file", &from) <= 0)
return false;
bool ret = true;
const char *name;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(iface = vshCommandOptInterface(ctl, cmd, &name)))
return false;
bool ret = true;
const char *name;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(iface = vshCommandOptInterface(ctl, cmd, &name)))
return false;
bool ret = true;
const char *name;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(iface = vshCommandOptInterface(ctl, cmd, &name)))
return false;
static bool
cmdInterfaceBegin(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
{
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (virInterfaceChangeBegin(ctl->conn, 0) < 0) {
vshError(ctl, "%s", _("Failed to begin network config change transaction"));
return false;
static bool
cmdInterfaceCommit(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
{
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (virInterfaceChangeCommit(ctl->conn, 0) < 0) {
vshError(ctl, "%s", _("Failed to commit network config change transaction"));
return false;
static bool
cmdInterfaceRollback(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
{
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (virInterfaceChangeRollback(ctl->conn, 0) < 0) {
vshError(ctl, "%s", _("Failed to rollback network config change transaction"));
return false;
xmlXPathContextPtr ctxt = NULL;
xmlNodePtr top_node, br_node, if_node, cur;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto cleanup;
-
/* Get a handle to the original device */
if (!(if_handle = vshCommandOptInterfaceBy(ctl, cmd, "interface",
&if_name, VSH_BYNAME))) {
xmlXPathContextPtr ctxt = NULL;
xmlNodePtr top_node, br_node, if_node, cur;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto cleanup;
-
/* Get a handle to the original device */
if (!(br_handle = vshCommandOptInterfaceBy(ctl, cmd, "bridge",
&br_name, VSH_BYNAME))) {
const char *name;
int autostart;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(network = vshCommandOptNetwork(ctl, cmd, &name)))
return false;
bool ret = true;
char *buffer;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (vshCommandOptString(cmd, "file", &from) <= 0)
return false;
bool ret = true;
char *buffer;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (vshCommandOptString(cmd, "file", &from) <= 0)
return false;
bool ret = true;
const char *name;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(network = vshCommandOptNetwork(ctl, cmd, &name)))
return false;
unsigned int flags = 0;
int inactive;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(network = vshCommandOptNetwork(ctl, cmd, NULL)))
return false;
int active = -1;
char *bridge = NULL;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(network = vshCommandOptNetwork(ctl, cmd, NULL)))
return false;
char **activeNames = NULL, **inactiveNames = NULL;
inactive |= all;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (active) {
maxactive = virConnectNumOfNetworks(ctl->conn);
if (maxactive < 0) {
{
virNetworkPtr network;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
if (!(network = vshCommandOptNetworkBy(ctl, cmd, NULL,
VSH_BYUUID)))
return false;
bool ret = true;
const char *name = NULL;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(network = vshCommandOptNetwork(ctl, cmd, &name)))
return false;
bool ret = true;
const char *name;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(network = vshCommandOptNetwork(ctl, cmd, &name)))
return false;
virNetworkPtr network;
char uuid[VIR_UUID_STRING_BUFLEN];
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(network = vshCommandOptNetworkBy(ctl, cmd, NULL,
VSH_BYNAME)))
return false;
virNetworkPtr network = NULL;
virNetworkPtr network_edited = NULL;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto cleanup;
-
network = vshCommandOptNetwork(ctl, cmd, NULL);
if (network == NULL)
goto cleanup;
bool ret = true;
char *buffer;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (vshCommandOptString(cmd, "file", &from) <= 0)
return false;
bool ret = true;
const char *name = NULL;
- if (!vshConnectionUsability(ctl, ctl->conn)) {
- return false;
- }
-
if (vshCommandOptString(cmd, "name", &name) <= 0)
return false;
bool tree = vshCommandOptBool(cmd, "tree");
bool ret = true;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (vshCommandOptString(cmd, "cap", &cap) <= 0)
cap = NULL;
virNodeDevicePtr device;
char *xml;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
if (vshCommandOptString(cmd, "device", &name) <= 0)
return false;
if (!(device = virNodeDeviceLookupByName(ctl->conn, name))) {
virNodeDevicePtr device;
bool ret = true;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
if (vshCommandOptString(cmd, "device", &name) <= 0)
return false;
if (!(device = virNodeDeviceLookupByName(ctl->conn, name))) {
virNodeDevicePtr device;
bool ret = true;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
if (vshCommandOptString(cmd, "device", &name) <= 0)
return false;
if (!(device = virNodeDeviceLookupByName(ctl->conn, name))) {
virNodeDevicePtr device;
bool ret = true;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
if (vshCommandOptString(cmd, "device", &name) <= 0)
return false;
if (!(device = virNodeDeviceLookupByName(ctl->conn, name))) {
bool ret = true;
char *buffer;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (vshCommandOptString(cmd, "file", &from) <= 0)
return false;
bool ret = true;
const char *name;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(nwfilter = vshCommandOptNWFilter(ctl, cmd, &name)))
return false;
bool ret = true;
char *dump;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(nwfilter = vshCommandOptNWFilter(ctl, cmd, NULL)))
return false;
char **names;
char uuid[VIR_UUID_STRING_BUFLEN];
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
numfilters = virConnectNumOfNWFilters(ctl->conn);
if (numfilters < 0) {
vshError(ctl, "%s", _("Failed to list network filters"));
virNWFilterPtr nwfilter = NULL;
virNWFilterPtr nwfilter_edited = NULL;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto cleanup;
-
nwfilter = vshCommandOptNWFilter(ctl, cmd, NULL);
if (nwfilter == NULL)
goto cleanup;
const char *name;
int autostart;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(pool = vshCommandOptPool(ctl, cmd, "pool", &name)))
return false;
bool ret = true;
char *buffer;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (vshCommandOptString(cmd, "file", &from) <= 0)
return false;
char *xml;
bool printXML = vshCommandOptBool(cmd, "print-xml");
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!buildPoolXML(cmd, &name, &xml))
return false;
bool ret = true;
char *buffer;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (vshCommandOptString(cmd, "file", &from) <= 0)
return false;
char *xml;
bool printXML = vshCommandOptBool(cmd, "print-xml");
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!buildPoolXML(cmd, &name, &xml))
return false;
const char *name;
unsigned int flags = 0;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(pool = vshCommandOptPool(ctl, cmd, "pool", &name)))
return false;
bool ret = true;
const char *name;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(pool = vshCommandOptPool(ctl, cmd, "pool", &name)))
return false;
bool ret = true;
const char *name;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(pool = vshCommandOptPool(ctl, cmd, "pool", &name)))
return false;
bool ret = true;
const char *name;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(pool = vshCommandOptPool(ctl, cmd, "pool", &name)))
return false;
if (inactive)
flags |= VIR_STORAGE_XML_INACTIVE;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(pool = vshCommandOptPool(ctl, cmd, "pool", NULL)))
return false;
bool active = !inactive || all;
inactive |= all;
- /* Check the connection to libvirtd daemon is still working */
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
/* Retrieve the number of active storage pools */
if (active) {
numActivePools = virConnectNumOfStoragePools(ctl->conn);
return false;
}
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (host) {
const char *port = NULL;
virBuffer buf = VIR_BUFFER_INITIALIZER;
return false;
}
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (srcSpecFile && virFileReadAll(srcSpecFile, VSH_MAX_XML_FILE,
&srcSpec) < 0)
return false;
bool ret = true;
char uuid[VIR_UUID_STRING_BUFLEN];
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(pool = vshCommandOptPool(ctl, cmd, "pool", NULL)))
return false;
{
virStoragePoolPtr pool;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
if (!(pool = vshCommandOptPoolBy(ctl, cmd, "pool", NULL,
VSH_BYUUID)))
return false;
bool ret = true;
const char *name = NULL;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(pool = vshCommandOptPool(ctl, cmd, "pool", &name)))
return false;
bool ret = true;
const char *name;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(pool = vshCommandOptPool(ctl, cmd, "pool", &name)))
return false;
virStoragePoolPtr pool;
char uuid[VIR_UUID_STRING_BUFLEN];
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(pool = vshCommandOptPoolBy(ctl, cmd, "pool", NULL,
VSH_BYNAME)))
return false;
unsigned int flags = VIR_STORAGE_XML_INACTIVE;
char *tmp_desc = NULL;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto cleanup;
-
pool = vshCommandOptPool(ctl, cmd, "pool", NULL);
if (pool == NULL)
goto cleanup;
virSecretPtr res;
char uuid[VIR_UUID_STRING_BUFLEN];
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (vshCommandOptString(cmd, "file", &from) <= 0)
return false;
bool ret = false;
char *xml;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
secret = vshCommandOptSecret(ctl, cmd, NULL);
if (secret == NULL)
return false;
int res;
bool ret = false;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
secret = vshCommandOptSecret(ctl, cmd, NULL);
if (secret == NULL)
return false;
size_t value_size;
bool ret = false;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
secret = vshCommandOptSecret(ctl, cmd, NULL);
if (secret == NULL)
return false;
bool ret = false;
const char *uuid;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
secret = vshCommandOptSecret(ctl, cmd, &uuid);
if (secret == NULL)
return false;
int maxuuids = 0, i;
char **uuids = NULL;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
maxuuids = virConnectNumOfSecrets(ctl->conn);
if (maxuuids < 0) {
vshError(ctl, "%s", _("Failed to list secrets"));
if (vshCommandOptBool(cmd, "atomic"))
flags |= VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto cleanup;
-
dom = vshCommandOptDomain(ctl, cmd, NULL);
if (dom == NULL)
goto cleanup;
if (vshCommandOptBool(cmd, "atomic"))
flags |= VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto cleanup;
-
dom = vshCommandOptDomain(ctl, cmd, NULL);
if (dom == NULL)
goto cleanup;
vshCommandOptBool(cmd, "snapshotname"))
define_flags |= VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
dom = vshCommandOptDomain(ctl, cmd, NULL);
if (dom == NULL)
goto cleanup;
if (vshCommandOptBool(cmd, "security-info"))
flags |= VIR_DOMAIN_XML_SECURE;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto cleanup;
-
dom = vshCommandOptDomain(ctl, cmd, &domname);
if (dom == NULL)
goto cleanup;
int current;
int metadata;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
dom = vshCommandOptDomain(ctl, cmd, NULL);
if (dom == NULL)
return false;
virDomainSnapshotPtr start = NULL;
vshSnapshotListPtr snaplist = NULL;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto cleanup;
-
dom = vshCommandOptDomain(ctl, cmd, NULL);
if (dom == NULL)
goto cleanup;
if (vshCommandOptBool(cmd, "security-info"))
flags |= VIR_DOMAIN_XML_SECURE;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto cleanup;
-
dom = vshCommandOptDomain(ctl, cmd, NULL);
if (dom == NULL)
goto cleanup;
virDomainSnapshotPtr snapshot = NULL;
char *parent = NULL;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto cleanup;
-
dom = vshCommandOptDomain(ctl, cmd, NULL);
if (dom == NULL)
goto cleanup;
if (vshCommandOptBool(cmd, "force"))
force = true;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto cleanup;
-
dom = vshCommandOptDomain(ctl, cmd, NULL);
if (dom == NULL)
goto cleanup;
virDomainSnapshotPtr snapshot = NULL;
unsigned int flags = 0;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto cleanup;
-
dom = vshCommandOptDomain(ctl, cmd, NULL);
if (dom == NULL)
goto cleanup;
unsigned long long capacity, allocation = 0;
virBuffer buf = VIR_BUFFER_INITIALIZER;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(pool = vshCommandOptPoolBy(ctl, cmd, "pool", NULL,
VSH_BYNAME)))
return false;
bool ret = true;
char *buffer;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(pool = vshCommandOptPoolBy(ctl, cmd, "pool", NULL,
VSH_BYNAME)))
return false;
bool ret = false;
char *buffer = NULL;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto cleanup;
-
if (!(pool = vshCommandOptPool(ctl, cmd, "pool", NULL)))
goto cleanup;
xmlChar *newxml = NULL;
bool ret = false;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto cleanup;
-
if (!(origvol = vshCommandOptVol(ctl, cmd, "vol", "pool", NULL)))
goto cleanup;
const char *name = NULL;
unsigned long long offset = 0, length = 0;
- if (!vshConnectionUsability(ctl, ctl->conn))
- goto cleanup;
-
if (vshCommandOptULongLong(cmd, "offset", &offset) < 0) {
vshError(ctl, _("Unable to parse integer"));
return false;
unsigned long long offset = 0, length = 0;
bool created = false;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (vshCommandOptULongLong(cmd, "offset", &offset) < 0) {
vshError(ctl, _("Unable to parse integer"));
return false;
bool ret = true;
const char *name;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(vol = vshCommandOptVol(ctl, cmd, "vol", "pool", &name))) {
return false;
}
int algorithm = VIR_STORAGE_VOL_WIPE_ALG_ZERO;
int funcRet;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(vol = vshCommandOptVol(ctl, cmd, "vol", "pool", &name))) {
return false;
}
virStorageVolPtr vol;
bool ret = true;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(vol = vshCommandOptVol(ctl, cmd, "vol", "pool", NULL)))
return false;
if (vshCommandOptBool(cmd, "shrink"))
flags |= VIR_STORAGE_VOL_RESIZE_SHRINK;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(vol = vshCommandOptVol(ctl, cmd, "vol", "pool", NULL)))
return false;
bool ret = true;
char *dump;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(vol = vshCommandOptVol(ctl, cmd, "vol", "pool", NULL)))
return false;
};
struct volInfoText *volInfoTexts = NULL;
- /* Check the connection to libvirtd daemon is still working */
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
/* Look up the pool information given to us by the user */
if (!(pool = vshCommandOptPool(ctl, cmd, "pool", NULL)))
return false;
{
virStorageVolPtr vol;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(vol = vshCommandOptVolBy(ctl, cmd, "vol", NULL, NULL,
VSH_BYUUID)))
return false;
virStorageVolPtr vol;
char uuid[VIR_UUID_STRING_BUFLEN];
- /* Check the connection to libvirtd daemon is still working */
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
/* Use the supplied string to locate the volume */
if (!(vol = vshCommandOptVolBy(ctl, cmd, "vol", NULL, NULL,
VSH_BYUUID))) {
{
virStorageVolPtr vol;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(vol = vshCommandOptVol(ctl, cmd, "vol", "pool", NULL)))
return false;
virStorageVolPtr vol;
char * StorageVolPath;
- if (!vshConnectionUsability(ctl, ctl->conn))
- return false;
-
if (!(vol = vshCommandOptVol(ctl, cmd, "vol", "pool", NULL))) {
return false;
}
return found;
}
+static bool
+vshConnectionUsability(vshControl *ctl, virConnectPtr conn)
+{
+ if (!conn ||
+ virConnectIsAlive(conn) == 0) {
+ vshError(ctl, "%s", _("no valid connection"));
+ return false;
+ }
+
+ /* The connection is considered dead only if
+ * virConnectIsAlive() successfuly says so.
+ */
+ vshResetLibvirtError();
+
+ return true;
+}
+
/*
* Executes command(s) and returns return code from last command
*/
return NULL;
}
-bool
-vshConnectionUsability(vshControl *ctl, virConnectPtr conn)
-{
- if (!conn ||
- virConnectIsAlive(conn) == 0) {
- vshError(ctl, "%s", _("no valid connection"));
- return false;
- }
-
- /* The connection is considered dead only if
- * virConnectIsAlive() successfuly says so.
- */
- vshResetLibvirtError();
-
- return true;
-}
-
void
vshDebug(vshControl *ctl, int level, const char *format, ...)
{
int vshNameSorter(const void *a, const void *b);
int vshDomainState(vshControl *ctl, virDomainPtr dom, int *reason);
-bool vshConnectionUsability(vshControl *ctl, virConnectPtr conn);
virTypedParameterPtr vshFindTypedParamByName(const char *name,
virTypedParameterPtr list,
int count);