From: Michael Meffie Date: Mon, 29 Sep 2014 16:14:24 +0000 (-0400) Subject: vos: preserve cloneId and backupId when restoring X-Git-Tag: upstream/1.6.17^2~41 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=5d5879f469ce2f950a3d99ee85a6142476d02aaf;p=packages%2Fo%2Fopenafs.git vos: preserve cloneId and backupId when restoring Preserve the volume clone and backup ids in the volume header when restoring over an existing volume, instead of always setting the clone and backup ids to zero. For example, before this change, restoring over a volume resets the ROnly and Backup ids reported in the volume header section of vos examine. $ vos examine xyzzy xyzzy 536871023 RW 3 K On-line myhost /vicepa RWrite 536871023 ROnly 536871024 Backup 536871025 ... RWrite: 536871023 ROnly: 536871024 Backup: 536871025 number of sites -> 2 server myhost partition /vicepa RW Site server myhost partition /vicepa RO Site $ cat /tmp/xyzzy.dump | vos restore myhost a xyzzy -overwrite incremental Restoring volume xyzzy Id 536871023 on server myhost partition /vicepa .. done Restored volume xyzzy on myhost /vicepa $ vos examine xyzzy xyzzy 536871023 RW 3 K On-line myhost /vicepa RWrite 536871023 ROnly 0 Backup 0 ... RWrite: 536871023 ROnly: 536871024 Backup: 536871025 number of sites -> 2 server myhost partition /vicepa RW Site server myhost partition /vicepa RO Site Reviewed-on: http://gerrit.openafs.org/11516 Tested-by: BuildBot Reviewed-by: Daria Brashear (cherry picked from commit 7266685a03b12ca03c247623e7ffdc054a017382) Change-Id: Iad0ef8f2d3fa1ef87b87bcbf9f74735ede1c2140 Reviewed-on: http://gerrit.openafs.org/12082 Tested-by: BuildBot Reviewed-by: Mark Vitale Reviewed-by: Benjamin Kaduk Reviewed-by: Stephan Wiesand --- diff --git a/src/volser/vsprocs.c b/src/volser/vsprocs.c index 01f871ae5..845af9eae 100644 --- a/src/volser/vsprocs.c +++ b/src/volser/vsprocs.c @@ -4629,6 +4629,8 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid, int reuseID; afs_int32 volflag, voltype, volsertype; afs_int32 oldCreateDate, oldUpdateDate, newCreateDate, newUpdateDate; + VolumeId oldCloneId = 0; + VolumeId oldBackupId = 0; int index, same, errcode; char apartName[10]; char hoststr[16]; @@ -4740,6 +4742,8 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid, } oldCreateDate = tstatus.creationDate; oldUpdateDate = tstatus.updateDate; + oldCloneId = tstatus.cloneID; + oldBackupId = tstatus.backupID; } else { oldCreateDate = 0; oldUpdateDate = 0; @@ -4778,9 +4782,10 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid, error = code; goto refail; } - code = AFSVolSetIdsTypes(toconn, totid, tovolreal, voltype, pparentid, 0, 0); + code = AFSVolSetIdsTypes(toconn, totid, tovolreal, voltype, pparentid, + oldCloneId, oldBackupId); if (code) { - fprintf(STDERR, "Could not set the right type and ID on %lu\n", + fprintf(STDERR, "Could not set the right type and IDs on %lu\n", (unsigned long)pvolid); error = code; goto refail;