virsh: remove unneeded usage of vshConnectionUsability()

Now that vshCommandRun() checks for the connection automaticaly, remove
all of the redundant checks in the code.

vshConnectionUsability() no longer needs to be exported and this patch
marks it static.
This commit is contained in:
Peter Krempa
2012-08-24 13:57:01 +02:00
parent 70e608918e
commit 67f83cd497
13 changed files with 17 additions and 572 deletions

View File

@@ -306,9 +306,6 @@ cmdDomMemStat(vshControl *ctl, const vshCmd *cmd)
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;
@@ -365,9 +362,6 @@ cmdDomblkinfo(vshControl *ctl, const vshCmd *cmd)
bool ret = true;
const char *device = NULL;
if (!vshConnectionUsability(ctl, ctl->conn))
return false;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
@@ -426,9 +420,6 @@ cmdDomblklist(vshControl *ctl, const vshCmd *cmd)
details = vshCommandOptBool(cmd, "details");
if (!vshConnectionUsability(ctl, ctl->conn))
return false;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
@@ -530,9 +521,6 @@ cmdDomiflist(vshControl *ctl, const vshCmd *cmd)
if (vshCommandOptBool(cmd, "inactive"))
flags |= VIR_DOMAIN_XML_INACTIVE;
if (!vshConnectionUsability(ctl, ctl->conn))
return false;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
@@ -632,9 +620,6 @@ cmdDomIfGetLink(vshControl *ctl, const vshCmd *cmd)
xmlNodePtr cur = NULL;
xmlXPathObjectPtr obj = NULL;
if (!vshConnectionUsability(ctl, ctl->conn))
return false;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
@@ -747,9 +732,6 @@ cmdDomControl(vshControl *ctl, const vshCmd *cmd)
bool ret = true;
virDomainControlInfo info;
if (!vshConnectionUsability(ctl, ctl->conn))
return false;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
@@ -843,9 +825,6 @@ cmdDomblkstat(vshControl *ctl, const vshCmd *cmd)
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;
@@ -968,9 +947,6 @@ cmdDomIfstat(vshControl *ctl, const vshCmd *cmd)
const char *name = NULL, *device = NULL;
struct _virDomainInterfaceStats stats;
if (!vshConnectionUsability(ctl, ctl->conn))
return false;
if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
return false;
@@ -1037,9 +1013,6 @@ cmdDomBlkError(vshControl *ctl, const vshCmd *cmd)
int count;
bool ret = false;
if (!vshConnectionUsability(ctl, ctl->conn))
return false;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
@@ -1101,9 +1074,6 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd)
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;
@@ -1233,9 +1203,6 @@ cmdDomstate(vshControl *ctl, const vshCmd *cmd)
bool showReason = vshCommandOptBool(cmd, "reason");
int state, reason;
if (!vshConnectionUsability(ctl, ctl->conn))
return false;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
@@ -1630,9 +1597,6 @@ cmdList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
if (!optUUID && !optName)
optTable = true;
if (!vshConnectionUsability(ctl, ctl->conn))
return false;
if (!(list = vshDomainListCollect(ctl, flags)))
goto cleanup;