On Tue, Mar 02, 2010 at 05:13:34PM -0500, 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 a6a637d..e52b011 100644 > --- a/tools/virsh.c > +++ b/tools/virsh.c > @@ -5221,6 +5221,47 @@ cmdVolDelete(vshControl *ctl, const vshCmd *cmd) > > > /* > + * "vol-zero-out" command > + */ > +static const vshCmdInfo info_vol_zero_out[] = { > + {"help", gettext_noop("zero out a vol")}, > + {"desc", gettext_noop("Ensure further reads from a volume return zeroes.")}, > + {NULL, NULL} > +}; > + > +static const vshCmdOptDef opts_vol_zero_out[] = { > + {"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 > +cmdVolZeroOut(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 (virStorageVolZeroOut(vol, 0) == 0) { > + vshPrint(ctl, _("Vol %s zeroed out\n"), name); > + } else { > + vshError(ctl, _("Failed to zero out vol %s"), name); > + ret = FALSE; > + } > + > + virStorageVolFree(vol); > + return ret; > +} > + > + > +/* > * "vol-info" command > */ > static const vshCmdInfo info_vol_info[] = { > @@ -7758,6 +7799,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-zero-out", cmdVolZeroOut, opts_vol_zero_out, info_vol_zero_out}, Following my API name suggestion, I'd call this 'vol-wipe' too > {"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}, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list