Beispiel #1
0
        private void RestoreClone(SnapSession snapSession)
        {
            Task.Run(async() =>
            {
                log.Info($"Trying to restore DB for application  {snapSession.AppName}. SnapSession: {snapSession.toString()}");
                SnapCenter snapClient = await SnapCenter.NewSnapCenterSession(snapSession);
                BackUp b = snapClient.GetCloneSnapshot(snapSession);
                this.log.Info($"GetCloneSnapshot existed and b is not null: {b != null}");
                if (b != null)
                {
                    //restore snapshot
                    snapSession.BackupName = b.BackupName;
                    string answer          = await snapClient.RestoreClone(snapSession);
                    this.log.Info($"Clone restore complete. Response: {answer}");
                }
                else
                {
                    this.log.Info($"No snapshots found proceding to cloning the original.");
                    await snapClient.CloneOriginal(snapSession);

                    string snapshotID = await snapClient.SnapshotClone(snapSession);
                    this.log.Info($"Clone backup complete. ID: {snapshotID}");
                }
            }).GetAwaiter().GetResult();
        }
Beispiel #2
0
        private BackUp FindSnapshot(SnapSession snapSession)
        {
            BackUp b = null;

            Task.Run(async() =>
            {
                this.log.Info($"Obtaining DB key {snapSession.DbName}.");
                SnapCenter snapClient = await SnapCenter.NewSnapCenterSession(snapSession);
                b = snapClient.GetCloneSnapshot(snapSession);
            }).GetAwaiter().GetResult();
            return(b);
        }