[OpenAFS] Vos functions and clones and shadows

Dan Hyde Dan Hyde <drh@umich.edu>
Tue, 24 Jul 2007 11:46:32 -0400

> According to the FAQ, shadow volumes which are not live do not appear
> in the VLDB.  Clones created by 'vos clone' are in the VLDB, but
> they will be removed from the VLDB if a volume is deleted by
> 'vos remove'.  My question is, given a non-live shadow volume, or
> a 'dangling clone', how do these behave when you run either
> 'vos syncserv' or 'vos syncvldb'?  I would guess that 'vos syncvldb'
> ignores the shadow volumes (since their 'live' bit is not set)
> and puts dangling clone volumes into the VLDB.  I would guess that
> 'vos syncserv' would remove a shadow which isn't live from the VLDB
> if it found it there, but otherwise won't do anything.  Is that
> what actually happens?

The -live flag applies to vos move, copy, and shadow operations.  If
you specify it, then a move-clone, copy-clone, a shadow-clone is not
make of the source volume, and the data is transfered from the (locked)
source volume.  The trade off is means you lock the source volume, but
save an additional volume id.  I'm not sure what we're going to see and
want to do when we start using shadow volume's in production.

Our interest in shadow volumes is disaster recovery.  As such, we were
interested in promoting a shadow into a replacement rw volume in the
event the original volume went away.  We also didn't want to do this by
mistake.  So, we added a vosIsShadow bit in the volume header, and vos
syncvldb ignores such a volume unless -force (or -forceshadows) is
specified.  I just tried it, and vos syncserv ignores shadows, as a
syncserv is vldb driven and never notices there's a shadow.

> What if you create a shadow volume which has the same name as a
> volume which exists elsewhere?  I assume that this would normally
> work, since the shadow doesn't get into the VLDB.  If then you
> made the shadow volume live, would it delete the VLDB entry for
> the original volume?  Perhaps without deleting it from the other
> disk?  If the shadow were on the same disk, would it not need to
> delete the volume if the shadow with the same name became live?
> or can you have a shadow with the same name on the same disk?

By default (and what you want to have happen), a shadow volume has the
same volume id, and since the name is in the vldb, it has the same name
as the source volume.  You are right, the original source volume is not
touched when doing a vos syncvldb -force; presumably, it is already
gone.  The original source volume (if it still existed) would simply
not be in the vldb, and cleanup by hand would be a Good Idea(tm).

> I would experiment, but things like this seem to have a good
> chance of screwing up the VLDB, and I didn't much enjoy straightening
> that out when it happened.

You should have seen what happened before the copyvolume bug was fixed
-- the cleanup on error code didn't delete the shadow-clone (as was
intended), it deleted the original source volume instead!