提交 2de8aa8f 编写于 作者: S Supriya Kannery 提交者: Eric Blake

virsh: Avoid using magic numbers for logging

Replace magic numbers with loglevel variables.
Signed-off-by: NSupriya Kannery <supriyak@in.ibm.com>
上级 3e75c5ec
...@@ -22,3 +22,4 @@ ...@@ -22,3 +22,4 @@
<cardoe@cardoe.com> <cardoe@gentoo.org> <cardoe@cardoe.com> <cardoe@gentoo.org>
<fsimonce@redhat.com> <federico.simoncelli@gmail.com> <fsimonce@redhat.com> <federico.simoncelli@gmail.com>
<marcandre.lureau@redhat.com> <marcandre.lureau@gmail.com> <marcandre.lureau@redhat.com> <marcandre.lureau@gmail.com>
<supriyak@linux.vnet.ibm.com> <supriyak@in.ibm.com>
...@@ -169,7 +169,7 @@ Patches have also been contributed by: ...@@ -169,7 +169,7 @@ Patches have also been contributed by:
Richard Laager <rlaager@wiktel.com> Richard Laager <rlaager@wiktel.com>
Mark Wu <dwu@redhat.com> Mark Wu <dwu@redhat.com>
Yufang Zhang <yuzhang@redhat.com> Yufang Zhang <yuzhang@redhat.com>
Supriya Kannery <supriyak@in.ibm.com> Supriya Kannery <supriyak@linux.vnet.ibm.com>
Dirk Herrendoerfer <d.herrendoerfer@herrendoerfer.name> Dirk Herrendoerfer <d.herrendoerfer@herrendoerfer.name>
Taisuke Yamada <tai@rakugaki.org> Taisuke Yamada <tai@rakugaki.org>
Heath Petersen <HeathPetersen@Kandre.com> Heath Petersen <HeathPetersen@Kandre.com>
......
...@@ -2377,7 +2377,8 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd) ...@@ -2377,7 +2377,8 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd)
/* Check and display whether the domain is persistent or not */ /* Check and display whether the domain is persistent or not */
persistent = virDomainIsPersistent(dom); persistent = virDomainIsPersistent(dom);
vshDebug(ctl, 5, "Domain persistent flag value: %d\n", persistent); vshDebug(ctl, VSH_ERR_DEBUG, "Domain persistent flag value: %d\n",
persistent);
if (persistent < 0) if (persistent < 0)
vshPrint(ctl, "%-15s %s\n", _("Persistent:"), _("unknown")); vshPrint(ctl, "%-15s %s\n", _("Persistent:"), _("unknown"));
else else
...@@ -3289,7 +3290,7 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd) ...@@ -3289,7 +3290,7 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
/* If the --maximum flag was given, we need to ensure only the /* If the --maximum flag was given, we need to ensure only the
--config flag is in effect as well */ --config flag is in effect as well */
if (maximum) { if (maximum) {
vshDebug(ctl, 5, "--maximum flag was given\n"); vshDebug(ctl, VSH_ERR_DEBUG, "--maximum flag was given\n");
/* If neither the --config nor --live flags were given, OR /* If neither the --config nor --live flags were given, OR
if just the --live flag was given, we need to error out if just the --live flag was given, we need to error out
...@@ -4620,7 +4621,8 @@ repoll: ...@@ -4620,7 +4621,8 @@ repoll:
if ( timeout && ((int)(curr.tv_sec - start.tv_sec) * 1000 + \ if ( timeout && ((int)(curr.tv_sec - start.tv_sec) * 1000 + \
(int)(curr.tv_usec - start.tv_usec) / 1000) > timeout * 1000 ) { (int)(curr.tv_usec - start.tv_usec) / 1000) > timeout * 1000 ) {
/* suspend the domain when migration timeouts. */ /* suspend the domain when migration timeouts. */
vshDebug(ctl, 5, "suspend the domain when migration timeouts\n"); vshDebug(ctl, VSH_ERR_DEBUG,
"suspend the domain when migration timeouts\n");
virDomainSuspend(dom); virDomainSuspend(dom);
timeout = 0; timeout = 0;
} }
...@@ -6851,7 +6853,8 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED) ...@@ -6851,7 +6853,8 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
/* Retrieve the persistence status of the pool */ /* Retrieve the persistence status of the pool */
if (details) { if (details) {
persistent = virStoragePoolIsPersistent(pool); persistent = virStoragePoolIsPersistent(pool);
vshDebug(ctl, 5, "Persistent flag value: %d\n", persistent); vshDebug(ctl, VSH_ERR_DEBUG, "Persistent flag value: %d\n",
persistent);
if (persistent < 0) if (persistent < 0)
poolInfoTexts[i].persistent = vshStrdup(ctl, _("unknown")); poolInfoTexts[i].persistent = vshStrdup(ctl, _("unknown"));
else else
...@@ -7042,19 +7045,19 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED) ...@@ -7042,19 +7045,19 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
availStrLength = stringLength; availStrLength = stringLength;
/* Display the string lengths for debugging. */ /* Display the string lengths for debugging. */
vshDebug(ctl, 5, "Longest name string = %lu chars\n", vshDebug(ctl, VSH_ERR_DEBUG, "Longest name string = %lu chars\n",
(unsigned long) nameStrLength); (unsigned long) nameStrLength);
vshDebug(ctl, 5, "Longest state string = %lu chars\n", vshDebug(ctl, VSH_ERR_DEBUG, "Longest state string = %lu chars\n",
(unsigned long) stateStrLength); (unsigned long) stateStrLength);
vshDebug(ctl, 5, "Longest autostart string = %lu chars\n", vshDebug(ctl, VSH_ERR_DEBUG, "Longest autostart string = %lu chars\n",
(unsigned long) autostartStrLength); (unsigned long) autostartStrLength);
vshDebug(ctl, 5, "Longest persistent string = %lu chars\n", vshDebug(ctl, VSH_ERR_DEBUG, "Longest persistent string = %lu chars\n",
(unsigned long) persistStrLength); (unsigned long) persistStrLength);
vshDebug(ctl, 5, "Longest capacity string = %lu chars\n", vshDebug(ctl, VSH_ERR_DEBUG, "Longest capacity string = %lu chars\n",
(unsigned long) capStrLength); (unsigned long) capStrLength);
vshDebug(ctl, 5, "Longest allocation string = %lu chars\n", vshDebug(ctl, VSH_ERR_DEBUG, "Longest allocation string = %lu chars\n",
(unsigned long) allocStrLength); (unsigned long) allocStrLength);
vshDebug(ctl, 5, "Longest available string = %lu chars\n", vshDebug(ctl, VSH_ERR_DEBUG, "Longest available string = %lu chars\n",
(unsigned long) availStrLength); (unsigned long) availStrLength);
/* Create the output template. Each column is sized according to /* Create the output template. Each column is sized according to
...@@ -7326,7 +7329,8 @@ cmdPoolInfo(vshControl *ctl, const vshCmd *cmd) ...@@ -7326,7 +7329,8 @@ cmdPoolInfo(vshControl *ctl, const vshCmd *cmd)
/* Check and display whether the pool is persistent or not */ /* Check and display whether the pool is persistent or not */
persistent = virStoragePoolIsPersistent(pool); persistent = virStoragePoolIsPersistent(pool);
vshDebug(ctl, 5, "Pool persistent flag value: %d\n", persistent); vshDebug(ctl, VSH_ERR_DEBUG, "Pool persistent flag value: %d\n",
persistent);
if (persistent < 0) if (persistent < 0)
vshPrint(ctl, "%-15s %s\n", _("Persistent:"), _("unknown")); vshPrint(ctl, "%-15s %s\n", _("Persistent:"), _("unknown"));
else else
...@@ -7334,7 +7338,8 @@ cmdPoolInfo(vshControl *ctl, const vshCmd *cmd) ...@@ -7334,7 +7338,8 @@ cmdPoolInfo(vshControl *ctl, const vshCmd *cmd)
/* Check and display whether the pool is autostarted or not */ /* Check and display whether the pool is autostarted or not */
virStoragePoolGetAutostart(pool, &autostart); virStoragePoolGetAutostart(pool, &autostart);
vshDebug(ctl, 5, "Pool autostart flag value: %d\n", autostart); vshDebug(ctl, VSH_ERR_DEBUG, "Pool autostart flag value: %d\n",
autostart);
if (autostart < 0) if (autostart < 0)
vshPrint(ctl, "%-15s %s\n", _("Autostart:"), _("no autostart")); vshPrint(ctl, "%-15s %s\n", _("Autostart:"), _("no autostart"));
else else
...@@ -7535,31 +7540,37 @@ cmdVolCreateAs(vshControl *ctl, const vshCmd *cmd) ...@@ -7535,31 +7540,37 @@ cmdVolCreateAs(vshControl *ctl, const vshCmd *cmd)
if (snapshotStrVol) { if (snapshotStrVol) {
/* Lookup snapshot backing volume. Try the backing-vol /* Lookup snapshot backing volume. Try the backing-vol
* parameter as a name */ * parameter as a name */
vshDebug(ctl, 5, "%s: Look up backing store volume '%s' as name\n", vshDebug(ctl, VSH_ERR_DEBUG,
"%s: Look up backing store volume '%s' as name\n",
cmd->def->name, snapshotStrVol); cmd->def->name, snapshotStrVol);
virStorageVolPtr snapVol = virStorageVolLookupByName(pool, snapshotStrVol); virStorageVolPtr snapVol = virStorageVolLookupByName(pool, snapshotStrVol);
if (snapVol) if (snapVol)
vshDebug(ctl, 5, "%s: Backing store volume found using '%s' as name\n", vshDebug(ctl, VSH_ERR_DEBUG,
"%s: Backing store volume found using '%s' as name\n",
cmd->def->name, snapshotStrVol); cmd->def->name, snapshotStrVol);
if (snapVol == NULL) { if (snapVol == NULL) {
/* Snapshot backing volume not found by name. Try the /* Snapshot backing volume not found by name. Try the
* backing-vol parameter as a key */ * backing-vol parameter as a key */
vshDebug(ctl, 5, "%s: Look up backing store volume '%s' as key\n", vshDebug(ctl, VSH_ERR_DEBUG,
"%s: Look up backing store volume '%s' as key\n",
cmd->def->name, snapshotStrVol); cmd->def->name, snapshotStrVol);
snapVol = virStorageVolLookupByKey(ctl->conn, snapshotStrVol); snapVol = virStorageVolLookupByKey(ctl->conn, snapshotStrVol);
if (snapVol) if (snapVol)
vshDebug(ctl, 5, "%s: Backing store volume found using '%s' as key\n", vshDebug(ctl, VSH_ERR_DEBUG,
"%s: Backing store volume found using '%s' as key\n",
cmd->def->name, snapshotStrVol); cmd->def->name, snapshotStrVol);
} }
if (snapVol == NULL) { if (snapVol == NULL) {
/* Snapshot backing volume not found by key. Try the /* Snapshot backing volume not found by key. Try the
* backing-vol parameter as a path */ * backing-vol parameter as a path */
vshDebug(ctl, 5, "%s: Look up backing store volume '%s' as path\n", vshDebug(ctl, VSH_ERR_DEBUG,
"%s: Look up backing store volume '%s' as path\n",
cmd->def->name, snapshotStrVol); cmd->def->name, snapshotStrVol);
snapVol = virStorageVolLookupByPath(ctl->conn, snapshotStrVol); snapVol = virStorageVolLookupByPath(ctl->conn, snapshotStrVol);
if (snapVol) if (snapVol)
vshDebug(ctl, 5, "%s: Backing store volume found using '%s' as path\n", vshDebug(ctl, VSH_ERR_DEBUG,
"%s: Backing store volume found using '%s' as path\n",
cmd->def->name, snapshotStrVol); cmd->def->name, snapshotStrVol);
} }
if (snapVol == NULL) { if (snapVol == NULL) {
...@@ -8496,11 +8507,16 @@ cmdVolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED) ...@@ -8496,11 +8507,16 @@ cmdVolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
allocStrLength = stringLength; allocStrLength = stringLength;
/* Display the string lengths for debugging */ /* Display the string lengths for debugging */
vshDebug(ctl, 5, "Longest name string = %zu chars\n", nameStrLength); vshDebug(ctl, VSH_ERR_DEBUG,
vshDebug(ctl, 5, "Longest path string = %zu chars\n", pathStrLength); "Longest name string = %zu chars\n", nameStrLength);
vshDebug(ctl, 5, "Longest type string = %zu chars\n", typeStrLength); vshDebug(ctl, VSH_ERR_DEBUG,
vshDebug(ctl, 5, "Longest capacity string = %zu chars\n", capStrLength); "Longest path string = %zu chars\n", pathStrLength);
vshDebug(ctl, 5, "Longest allocation string = %zu chars\n", allocStrLength); vshDebug(ctl, VSH_ERR_DEBUG,
"Longest type string = %zu chars\n", typeStrLength);
vshDebug(ctl, VSH_ERR_DEBUG,
"Longest capacity string = %zu chars\n", capStrLength);
vshDebug(ctl, VSH_ERR_DEBUG,
"Longest allocation string = %zu chars\n", allocStrLength);
/* Create the output template */ /* Create the output template */
ret = virAsprintf(&outputStr, ret = virAsprintf(&outputStr,
...@@ -12495,7 +12511,7 @@ vshCommandOptDomainBy(vshControl *ctl, const vshCmd *cmd, ...@@ -12495,7 +12511,7 @@ vshCommandOptDomainBy(vshControl *ctl, const vshCmd *cmd,
if (vshCommandOptString(cmd, optname, &n) <= 0) if (vshCommandOptString(cmd, optname, &n) <= 0)
return NULL; return NULL;
vshDebug(ctl, 5, "%s: found option <%s>: %s\n", vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s\n",
cmd->def->name, optname, n); cmd->def->name, optname, n);
if (name) if (name)
...@@ -12504,20 +12520,21 @@ vshCommandOptDomainBy(vshControl *ctl, const vshCmd *cmd, ...@@ -12504,20 +12520,21 @@ vshCommandOptDomainBy(vshControl *ctl, const vshCmd *cmd,
/* try it by ID */ /* try it by ID */
if (flag & VSH_BYID) { if (flag & VSH_BYID) {
if (virStrToLong_i(n, NULL, 10, &id) == 0 && id >= 0) { if (virStrToLong_i(n, NULL, 10, &id) == 0 && id >= 0) {
vshDebug(ctl, 5, "%s: <%s> seems like domain ID\n", vshDebug(ctl, VSH_ERR_DEBUG,
"%s: <%s> seems like domain ID\n",
cmd->def->name, optname); cmd->def->name, optname);
dom = virDomainLookupByID(ctl->conn, id); dom = virDomainLookupByID(ctl->conn, id);
} }
} }
/* try it by UUID */ /* try it by UUID */
if (dom==NULL && (flag & VSH_BYUUID) && strlen(n)==VIR_UUID_STRING_BUFLEN-1) { if (dom==NULL && (flag & VSH_BYUUID) && strlen(n)==VIR_UUID_STRING_BUFLEN-1) {
vshDebug(ctl, 5, "%s: <%s> trying as domain UUID\n", vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as domain UUID\n",
cmd->def->name, optname); cmd->def->name, optname);
dom = virDomainLookupByUUIDString(ctl->conn, n); dom = virDomainLookupByUUIDString(ctl->conn, n);
} }
/* try it by NAME */ /* try it by NAME */
if (dom==NULL && (flag & VSH_BYNAME)) { if (dom==NULL && (flag & VSH_BYNAME)) {
vshDebug(ctl, 5, "%s: <%s> trying as domain NAME\n", vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as domain NAME\n",
cmd->def->name, optname); cmd->def->name, optname);
dom = virDomainLookupByName(ctl->conn, n); dom = virDomainLookupByName(ctl->conn, n);
} }
...@@ -12541,7 +12558,7 @@ vshCommandOptNetworkBy(vshControl *ctl, const vshCmd *cmd, ...@@ -12541,7 +12558,7 @@ vshCommandOptNetworkBy(vshControl *ctl, const vshCmd *cmd,
if (vshCommandOptString(cmd, optname, &n) <= 0) if (vshCommandOptString(cmd, optname, &n) <= 0)
return NULL; return NULL;
vshDebug(ctl, 5, "%s: found option <%s>: %s\n", vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s\n",
cmd->def->name, optname, n); cmd->def->name, optname, n);
if (name) if (name)
...@@ -12549,13 +12566,13 @@ vshCommandOptNetworkBy(vshControl *ctl, const vshCmd *cmd, ...@@ -12549,13 +12566,13 @@ vshCommandOptNetworkBy(vshControl *ctl, const vshCmd *cmd,
/* try it by UUID */ /* try it by UUID */
if ((flag & VSH_BYUUID) && (strlen(n) == VIR_UUID_STRING_BUFLEN-1)) { if ((flag & VSH_BYUUID) && (strlen(n) == VIR_UUID_STRING_BUFLEN-1)) {
vshDebug(ctl, 5, "%s: <%s> trying as network UUID\n", vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as network UUID\n",
cmd->def->name, optname); cmd->def->name, optname);
network = virNetworkLookupByUUIDString(ctl->conn, n); network = virNetworkLookupByUUIDString(ctl->conn, n);
} }
/* try it by NAME */ /* try it by NAME */
if (network==NULL && (flag & VSH_BYNAME)) { if (network==NULL && (flag & VSH_BYNAME)) {
vshDebug(ctl, 5, "%s: <%s> trying as network NAME\n", vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as network NAME\n",
cmd->def->name, optname); cmd->def->name, optname);
network = virNetworkLookupByName(ctl->conn, n); network = virNetworkLookupByName(ctl->conn, n);
} }
...@@ -12580,7 +12597,7 @@ vshCommandOptNWFilterBy(vshControl *ctl, const vshCmd *cmd, ...@@ -12580,7 +12597,7 @@ vshCommandOptNWFilterBy(vshControl *ctl, const vshCmd *cmd,
if (vshCommandOptString(cmd, optname, &n) <= 0) if (vshCommandOptString(cmd, optname, &n) <= 0)
return NULL; return NULL;
vshDebug(ctl, 5, "%s: found option <%s>: %s\n", vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s\n",
cmd->def->name, optname, n); cmd->def->name, optname, n);
if (name) if (name)
...@@ -12588,13 +12605,13 @@ vshCommandOptNWFilterBy(vshControl *ctl, const vshCmd *cmd, ...@@ -12588,13 +12605,13 @@ vshCommandOptNWFilterBy(vshControl *ctl, const vshCmd *cmd,
/* try it by UUID */ /* try it by UUID */
if ((flag & VSH_BYUUID) && (strlen(n) == VIR_UUID_STRING_BUFLEN-1)) { if ((flag & VSH_BYUUID) && (strlen(n) == VIR_UUID_STRING_BUFLEN-1)) {
vshDebug(ctl, 5, "%s: <%s> trying as nwfilter UUID\n", vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as nwfilter UUID\n",
cmd->def->name, optname); cmd->def->name, optname);
nwfilter = virNWFilterLookupByUUIDString(ctl->conn, n); nwfilter = virNWFilterLookupByUUIDString(ctl->conn, n);
} }
/* try it by NAME */ /* try it by NAME */
if (nwfilter == NULL && (flag & VSH_BYNAME)) { if (nwfilter == NULL && (flag & VSH_BYNAME)) {
vshDebug(ctl, 5, "%s: <%s> trying as nwfilter NAME\n", vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as nwfilter NAME\n",
cmd->def->name, optname); cmd->def->name, optname);
nwfilter = virNWFilterLookupByName(ctl->conn, n); nwfilter = virNWFilterLookupByName(ctl->conn, n);
} }
...@@ -12618,7 +12635,7 @@ vshCommandOptInterfaceBy(vshControl *ctl, const vshCmd *cmd, ...@@ -12618,7 +12635,7 @@ vshCommandOptInterfaceBy(vshControl *ctl, const vshCmd *cmd,
if (vshCommandOptString(cmd, optname, &n) <= 0) if (vshCommandOptString(cmd, optname, &n) <= 0)
return NULL; return NULL;
vshDebug(ctl, 5, "%s: found option <%s>: %s\n", vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s\n",
cmd->def->name, optname, n); cmd->def->name, optname, n);
if (name) if (name)
...@@ -12626,13 +12643,13 @@ vshCommandOptInterfaceBy(vshControl *ctl, const vshCmd *cmd, ...@@ -12626,13 +12643,13 @@ vshCommandOptInterfaceBy(vshControl *ctl, const vshCmd *cmd,
/* try it by NAME */ /* try it by NAME */
if ((flag & VSH_BYNAME)) { if ((flag & VSH_BYNAME)) {
vshDebug(ctl, 5, "%s: <%s> trying as interface NAME\n", vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as interface NAME\n",
cmd->def->name, optname); cmd->def->name, optname);
iface = virInterfaceLookupByName(ctl->conn, n); iface = virInterfaceLookupByName(ctl->conn, n);
} }
/* try it by MAC */ /* try it by MAC */
if ((iface == NULL) && (flag & VSH_BYMAC)) { if ((iface == NULL) && (flag & VSH_BYMAC)) {
vshDebug(ctl, 5, "%s: <%s> trying as interface MAC\n", vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as interface MAC\n",
cmd->def->name, optname); cmd->def->name, optname);
iface = virInterfaceLookupByMACString(ctl->conn, n); iface = virInterfaceLookupByMACString(ctl->conn, n);
} }
...@@ -12653,7 +12670,7 @@ vshCommandOptPoolBy(vshControl *ctl, const vshCmd *cmd, const char *optname, ...@@ -12653,7 +12670,7 @@ vshCommandOptPoolBy(vshControl *ctl, const vshCmd *cmd, const char *optname,
if (vshCommandOptString(cmd, optname, &n) <= 0) if (vshCommandOptString(cmd, optname, &n) <= 0)
return NULL; return NULL;
vshDebug(ctl, 5, "%s: found option <%s>: %s\n", vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s\n",
cmd->def->name, optname, n); cmd->def->name, optname, n);
if (name) if (name)
...@@ -12661,13 +12678,13 @@ vshCommandOptPoolBy(vshControl *ctl, const vshCmd *cmd, const char *optname, ...@@ -12661,13 +12678,13 @@ vshCommandOptPoolBy(vshControl *ctl, const vshCmd *cmd, const char *optname,
/* try it by UUID */ /* try it by UUID */
if ((flag & VSH_BYUUID) && (strlen(n) == VIR_UUID_STRING_BUFLEN-1)) { if ((flag & VSH_BYUUID) && (strlen(n) == VIR_UUID_STRING_BUFLEN-1)) {
vshDebug(ctl, 5, "%s: <%s> trying as pool UUID\n", vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as pool UUID\n",
cmd->def->name, optname); cmd->def->name, optname);
pool = virStoragePoolLookupByUUIDString(ctl->conn, n); pool = virStoragePoolLookupByUUIDString(ctl->conn, n);
} }
/* try it by NAME */ /* try it by NAME */
if (pool == NULL && (flag & VSH_BYNAME)) { if (pool == NULL && (flag & VSH_BYNAME)) {
vshDebug(ctl, 5, "%s: <%s> trying as pool NAME\n", vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as pool NAME\n",
cmd->def->name, optname); cmd->def->name, optname);
pool = virStoragePoolLookupByName(ctl->conn, n); pool = virStoragePoolLookupByName(ctl->conn, n);
} }
...@@ -12699,7 +12716,7 @@ vshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd, ...@@ -12699,7 +12716,7 @@ vshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd,
if (p) if (p)
pool = vshCommandOptPoolBy(ctl, cmd, pooloptname, name, flag); pool = vshCommandOptPoolBy(ctl, cmd, pooloptname, name, flag);
vshDebug(ctl, 5, "%s: found option <%s>: %s\n", vshDebug(ctl, VSH_ERR_DEBUG, "%s: found option <%s>: %s\n",
cmd->def->name, optname, n); cmd->def->name, optname, n);
if (name) if (name)
...@@ -12707,19 +12724,19 @@ vshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd, ...@@ -12707,19 +12724,19 @@ vshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd,
/* try it by name */ /* try it by name */
if (pool && (flag & VSH_BYNAME)) { if (pool && (flag & VSH_BYNAME)) {
vshDebug(ctl, 5, "%s: <%s> trying as vol name\n", vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as vol name\n",
cmd->def->name, optname); cmd->def->name, optname);
vol = virStorageVolLookupByName(pool, n); vol = virStorageVolLookupByName(pool, n);
} }
/* try it by key */ /* try it by key */
if (vol == NULL && (flag & VSH_BYUUID)) { if (vol == NULL && (flag & VSH_BYUUID)) {
vshDebug(ctl, 5, "%s: <%s> trying as vol key\n", vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as vol key\n",
cmd->def->name, optname); cmd->def->name, optname);
vol = virStorageVolLookupByKey(ctl->conn, n); vol = virStorageVolLookupByKey(ctl->conn, n);
} }
/* try it by path */ /* try it by path */
if (vol == NULL && (flag & VSH_BYUUID)) { if (vol == NULL && (flag & VSH_BYUUID)) {
vshDebug(ctl, 5, "%s: <%s> trying as vol path\n", vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as vol path\n",
cmd->def->name, optname); cmd->def->name, optname);
vol = virStorageVolLookupByPath(ctl->conn, n); vol = virStorageVolLookupByPath(ctl->conn, n);
} }
...@@ -12746,7 +12763,8 @@ vshCommandOptSecret(vshControl *ctl, const vshCmd *cmd, const char **name) ...@@ -12746,7 +12763,8 @@ vshCommandOptSecret(vshControl *ctl, const vshCmd *cmd, const char **name)
if (vshCommandOptString(cmd, optname, &n) <= 0) if (vshCommandOptString(cmd, optname, &n) <= 0)
return NULL; return NULL;
vshDebug(ctl, 5, "%s: found option <%s>: %s\n", cmd->def->name, optname, n); vshDebug(ctl, VSH_ERR_DEBUG,
"%s: found option <%s>: %s\n", cmd->def->name, optname, n);
if (name != NULL) if (name != NULL)
*name = n; *name = n;
...@@ -12951,7 +12969,7 @@ get_data: ...@@ -12951,7 +12969,7 @@ get_data:
last->next = arg; last->next = arg;
last = arg; last = arg;
vshDebug(ctl, 4, "%s: %s(%s): %s\n", vshDebug(ctl, VSH_ERR_INFO, "%s: %s(%s): %s\n",
cmd->name, cmd->name,
opt->name, opt->name,
opt->type != VSH_OT_BOOL ? _("optdata") : _("bool"), opt->type != VSH_OT_BOOL ? _("optdata") : _("bool"),
...@@ -14065,7 +14083,7 @@ vshParseArgv(vshControl *ctl, int argc, char **argv) ...@@ -14065,7 +14083,7 @@ vshParseArgv(vshControl *ctl, int argc, char **argv)
/* parse command */ /* parse command */
ctl->imode = false; ctl->imode = false;
if (argc - optind == 1) { if (argc - optind == 1) {
vshDebug(ctl, 2, "commands: \"%s\"\n", argv[optind]); vshDebug(ctl, VSH_ERR_INFO, "commands: \"%s\"\n", argv[optind]);
return vshCommandStringParse(ctl, argv[optind]); return vshCommandStringParse(ctl, argv[optind]);
} else { } else {
return vshCommandArgvParse(ctl, argc - optind, argv + optind); return vshCommandArgvParse(ctl, argc - optind, argv + optind);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册