On Mon, Mar 15, 2010 at 10:13:31PM -0400, David Allan wrote: > --- > tools/virsh.c | 42 ++++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 42 insertions(+), 0 deletions(-) > > diff --git a/tools/virsh.c b/tools/virsh.c > index aa85ee6..37ff471 100644 > --- a/tools/virsh.c > +++ b/tools/virsh.c > @@ -5271,6 +5271,47 @@ cmdVolDelete(vshControl *ctl, const vshCmd *cmd) > > > /* > + * "vol-wipe" command > + */ > +static const vshCmdInfo info_vol_wipe[] = { > + {"help", gettext_noop("wipe a vol")}, > + {"desc", gettext_noop("Ensure data previously on a volume is not accessible to future reads")}, > + {NULL, NULL} > +}; > + > +static const vshCmdOptDef opts_vol_wipe[] = { > + {"pool", VSH_OT_STRING, 0, gettext_noop("pool name or uuid")}, > + {"vol", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("vol name, key or path")}, > + {NULL, 0, 0, NULL} > +}; > + > +static int > +cmdVolWipe(vshControl *ctl, const vshCmd *cmd) > +{ > + virStorageVolPtr vol; > + int ret = TRUE; > + char *name; > + > + if (!vshConnectionUsability(ctl, ctl->conn, TRUE)) > + return FALSE; > + > + if (!(vol = vshCommandOptVol(ctl, cmd, "vol", "pool", &name))) { > + return FALSE; > + } > + > + if (virStorageVolWipe(vol, 0) == 0) { > + vshPrint(ctl, _("Vol %s wiped\n"), name); > + } else { > + vshError(ctl, _("Failed to wipe vol %s"), name); > + ret = FALSE; > + } > + > + virStorageVolFree(vol); > + return ret; > +} > + > + > +/* > * "vol-info" command > */ > static const vshCmdInfo info_vol_info[] = { > @@ -7809,6 +7850,7 @@ static const vshCmdDef commands[] = { > {"vol-create-as", cmdVolCreateAs, opts_vol_create_as, info_vol_create_as}, > {"vol-clone", cmdVolClone, opts_vol_clone, info_vol_clone}, > {"vol-delete", cmdVolDelete, opts_vol_delete, info_vol_delete}, > + {"vol-wipe", cmdVolWipe, opts_vol_wipe, info_vol_wipe}, > {"vol-dumpxml", cmdVolDumpXML, opts_vol_dumpxml, info_vol_dumpxml}, > {"vol-info", cmdVolInfo, opts_vol_info, info_vol_info}, > {"vol-list", cmdVolList, opts_vol_list, info_vol_list}, ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@xxxxxxxxxxxx | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list