From 7266685a03b12ca03c247623e7ffdc054a017382 Mon Sep 17 00:00:00 2001 From: Michael Meffie Date: Mon, 29 Sep 2014 12:14:24 -0400 Subject: [PATCH] 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 Change-Id: If7ffcf84a983046c10d9d215d672a6a1ba1f9400 Reviewed-on: http://gerrit.openafs.org/11516 Tested-by: BuildBot Reviewed-by: Daria Brashear --- src/volser/vsprocs.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/volser/vsprocs.c b/src/volser/vsprocs.c index 2735f78..6e8df65 100644 --- a/src/volser/vsprocs.c +++ b/src/volser/vsprocs.c @@ -4818,6 +4818,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]; @@ -4927,6 +4929,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; @@ -4965,9 +4969,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; -- 1.9.4