提交 7c5c51d1 编写于 作者: P Peter Krempa

virsh-nodedev: Update node device commands to use vshCommandOptStringReq

上级 56dc64cf
...@@ -67,7 +67,7 @@ cmdNodeDeviceCreate(vshControl *ctl, const vshCmd *cmd) ...@@ -67,7 +67,7 @@ cmdNodeDeviceCreate(vshControl *ctl, const vshCmd *cmd)
bool ret = true; bool ret = true;
char *buffer; char *buffer;
if (vshCommandOptString(cmd, "file", &from) <= 0) if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
return false; return false;
if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0) if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0)
...@@ -115,7 +115,7 @@ cmdNodeDeviceDestroy(vshControl *ctl, const vshCmd *cmd) ...@@ -115,7 +115,7 @@ cmdNodeDeviceDestroy(vshControl *ctl, const vshCmd *cmd)
bool ret = true; bool ret = true;
const char *name = NULL; const char *name = NULL;
if (vshCommandOptString(cmd, "name", &name) <= 0) if (vshCommandOptStringReq(ctl, cmd, "name", &name) < 0)
return false; return false;
dev = virNodeDeviceLookupByName(ctl->conn, name); dev = virNodeDeviceLookupByName(ctl->conn, name);
...@@ -488,7 +488,7 @@ cmdNodeDeviceDumpXML(vshControl *ctl, const vshCmd *cmd) ...@@ -488,7 +488,7 @@ cmdNodeDeviceDumpXML(vshControl *ctl, const vshCmd *cmd)
virNodeDevicePtr device; virNodeDevicePtr device;
char *xml; char *xml;
if (vshCommandOptString(cmd, "device", &name) <= 0) if (vshCommandOptStringReq(ctl, cmd, "device", &name) < 0)
return false; return false;
if (!(device = virNodeDeviceLookupByName(ctl->conn, name))) { if (!(device = virNodeDeviceLookupByName(ctl->conn, name))) {
vshError(ctl, "%s '%s'", _("Could not find matching device"), name); vshError(ctl, "%s '%s'", _("Could not find matching device"), name);
...@@ -533,7 +533,7 @@ cmdNodeDeviceDetach(vshControl *ctl, const vshCmd *cmd) ...@@ -533,7 +533,7 @@ cmdNodeDeviceDetach(vshControl *ctl, const vshCmd *cmd)
virNodeDevicePtr device; virNodeDevicePtr device;
bool ret = true; bool ret = true;
if (vshCommandOptString(cmd, "device", &name) <= 0) if (vshCommandOptStringReq(ctl, cmd, "device", &name) < 0)
return false; return false;
if (!(device = virNodeDeviceLookupByName(ctl->conn, name))) { if (!(device = virNodeDeviceLookupByName(ctl->conn, name))) {
vshError(ctl, "%s '%s'", _("Could not find matching device"), name); vshError(ctl, "%s '%s'", _("Could not find matching device"), name);
...@@ -578,7 +578,7 @@ cmdNodeDeviceReAttach(vshControl *ctl, const vshCmd *cmd) ...@@ -578,7 +578,7 @@ cmdNodeDeviceReAttach(vshControl *ctl, const vshCmd *cmd)
virNodeDevicePtr device; virNodeDevicePtr device;
bool ret = true; bool ret = true;
if (vshCommandOptString(cmd, "device", &name) <= 0) if (vshCommandOptStringReq(ctl, cmd, "device", &name) < 0)
return false; return false;
if (!(device = virNodeDeviceLookupByName(ctl->conn, name))) { if (!(device = virNodeDeviceLookupByName(ctl->conn, name))) {
vshError(ctl, "%s '%s'", _("Could not find matching device"), name); vshError(ctl, "%s '%s'", _("Could not find matching device"), name);
...@@ -621,7 +621,7 @@ cmdNodeDeviceReset(vshControl *ctl, const vshCmd *cmd) ...@@ -621,7 +621,7 @@ cmdNodeDeviceReset(vshControl *ctl, const vshCmd *cmd)
virNodeDevicePtr device; virNodeDevicePtr device;
bool ret = true; bool ret = true;
if (vshCommandOptString(cmd, "device", &name) <= 0) if (vshCommandOptStringReq(ctl, cmd, "device", &name) < 0)
return false; return false;
if (!(device = virNodeDeviceLookupByName(ctl->conn, name))) { if (!(device = virNodeDeviceLookupByName(ctl->conn, name))) {
vshError(ctl, "%s '%s'", _("Could not find matching device"), name); vshError(ctl, "%s '%s'", _("Could not find matching device"), name);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册