[lxc-devel] [PATCH] Add remove_snapshots_entry() (rebased - v2)

Serge Hallyn serge.hallyn at ubuntu.com
Tue Sep 15 00:27:24 UTC 2015


Quoting Christian Brauner (christianvanbrauner at gmail.com):
> On Mon, Sep 14, 2015 at 10:54:34PM +0000, Serge Hallyn wrote:
> > Does it help if we simply define c->delete_with_snapshot_clones(), and have
> > src/lxc/destroy.c use that?  Then we can contain mod_all_rdeps to being a
> > static function in src/lxc/lxccontainer.c  If not, remind me where else we
> > would've needed the mod_all_rdeps?
> 
> lxc_destroy.c does not call mod_all_rdeps() directly at all. It reads in the
> lxc_snapshots file from the container all at once and finds each container
> listed in it and passes it to c->destroy(c). So we should be good regarding
> locks on this side. Here is the relevant bit from lxc_destroy.c (omitting the
> reading in part of the lxc_snapshots file):
> 
> 		while ((lxcpath = strtok_r(!counter ? buf : NULL, "\n", &scratch))) {
> 			if (!(lxcname = strtok_r(NULL, "\n", &scratch)))
> 				break;
> 			c1 = lxc_container_new(lxcname, lxcpath);
> 			if (!c1)
> 				goto next;
> 			if (!c1->destroy(c1)) {
> 				fprintf(stderr, "Destroying snapshot %s of %s failed\n", lxcname, my_args.name);
> 				lxc_container_put(c1);
> 				free(buf);
> 				return -1;
> 			}
> 			lxc_container_put(c1);
> next:
> 			counter++;
> 		}
> 
> What I was worried about is the implementation in start.c:

Oh, right.

All right let's go back to your original patch.  I'd like to avoid,
if we end up changing the file format again, having to chase down
all the places where lxc_depends and rdepends are updated.  So let's
come up with a small internal api for getting and updating those.
We don't have to do that immediately, so I'll go ahead and re-review
your patch (and presumably ack it).

thanks, Christian.
-serge


More information about the lxc-devel mailing list