Bug #2005
closedtime-slider zfs-send plugin no working
90%
Description
The time-slider zfs-send plugin is not working on oi151a.
(PS: when using time-slider on oi15a you might also be intereseted in: http://illumos.org/issues/1013
I managed to get time-slider/plugin:zfs-send working by digging through the code and solve the issues:
zfssend.py:
- zfssend.py imports time_slider.util, time_slider.smf and time_slider.zfs but the code is actually referring to util.*, smf.* and zfs.* instead of time_slider.util.*, time_slider.smf.*, etc. So either the search path and import should be changed, or "time_slider." should be added before {util,smf,zfs}.*.
- The code will check for a previous snapshot in order to send an incremental stream. The name of the previous send snapshot is stored as a zfs user property, and retrieved with get_user_property(propname). The problem is that this will read a inherited property instead of a local property. So it will either read "-" or a wrong label. It should use get_user_property(propname, True) to get the local instead of the inherited property.
I don't know if there is a place where I can upload or commit te changes I made, but here's a diff:
/usr/share/time-slider/lib/plugin/zfssend/zfssend.py
60,61c60,61 < cmd = [smf.SVCPROPCMD, "-p", verboseprop, pluginfmri] < outdata,errdata = util.run_command(cmd) --- > cmd = [time_slider.smf.SVCPROPCMD, "-p", verboseprop, pluginfmri] > outdata,errdata = time_slider.util.run_command(cmd) 98c98 < datasets = zfs.Datasets() --- > datasets = time_slider.zfs.Datasets() 110c110 < snapshot = zfs.Snapshot(snap) --- > snapshot = time_slider.zfs.Snapshot(snap) 115c115 < util.debug("Placing hold on %s" % (snap), verbose) --- > time_slider.util.debug("Placing hold on %s" % (snap), verbose) 124,125c124,125 < cmd = [smf.SVCPROPCMD, "-c", "-p", "receive/command", pluginfmri] < outdata,errdata = util.run_command(cmd) --- > cmd = [time_slider.smf.SVCPROPCMD, "-c", "-p", "receive/command", pluginfmri] > outdata,errdata = time_slider.util.run_command(cmd) 151,152c151,152 < ds = zfs.ReadableDataset(dataset) < prevlabel = ds.get_user_property(propname) --- > ds = time_slider.zfs.ReadableDataset(dataset) > prevlabel = ds.get_user_property(propname, True) 157,158c157,158 < sendcmd = [zfs.ZFSCMD, "send", snapname] < util.debug("No previous backup registered for %s" % ds.name, verbose) --- > sendcmd = [time_slider.zfs.ZFSCMD, "send", snapname] > time_slider.util.debug("No previous backup registered for %s" % ds.name, verbose) 163,164c163,164 < util.debug("Previously sent snapshot: %s" % prevsnapname, verbose) < prevsnap = zfs.Snapshot(prevsnapname) --- > time_slider.util.debug("Previously sent snapshot: %s" % prevsnapname, verbose) > prevsnap = time_slider.zfs.Snapshot(prevsnapname) 166c166 < sendcmd = [zfs.ZFSCMD, "send", "-i", prevsnapname, snapname] --- > sendcmd = [time_slider.zfs.ZFSCMD, "send", "-i", prevsnapname, snapname] 183,184c183,184 < sendcmd.insert(0, smf.PFCMD) < recvcmd.insert(0, smf.PFCMD) --- > sendcmd.insert(0, time_slider.smf.PFCMD) > recvcmd.insert(0, time_slider.smf.PFCMD) 211,213c211,213 < util.debug("Releasing hold on %s" % (prevsnapname), verbose) < snapshot = zfs.Snapshot(prevsnapname) < util.debug("Releasing hold on previous snapshot: %s" \ --- > time_slider.util.debug("Releasing hold on %s" % (prevsnapname), verbose) > snapshot = time_slider.zfs.Snapshot(prevsnapname) > time_slider.util.debug("Releasing hold on previous snapshot: %s" \ 228c228 < util.debug("Sending of \"%s\"snapshot streams completed" \ --- > time_slider.util.debug("Sending of \"%s\"snapshot streams completed" \ 235c235 < cmd = [smf.SVCADMCMD, "mark", "maintenance", svcfmri] --- > cmd = [time_slider.smf.SVCADMCMD, "mark", "maintenance", svcfmri]
Running OpenIndiana 151a with time-slider;
pkg://openindiana.org/desktop/time-slider@0.2.97,5.11-0.151.1:20110912T022507Z