Skip to content

Commit

Permalink
ensure volume snapshot naming consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
sagor999 committed May 18, 2022
1 parent a1749c1 commit e78658b
Show file tree
Hide file tree
Showing 61 changed files with 403 additions and 410 deletions.
12 changes: 6 additions & 6 deletions components/content-service-api/go/initializer.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/content-service-api/initializer.proto
Expand Up @@ -124,7 +124,7 @@ message PrebuildInitializer {
// FromBackupInitializer initializes content from a previously made backup
message FromBackupInitializer {
string checkout_location = 1;
bool from_snapshot_volume = 2;
bool from_volume_snapshot = 2;
}

// GitStatus describes the current Git working copy status, akin to a combination of "git status" and "git branch"
Expand Down
Expand Up @@ -300,8 +300,8 @@ export namespace PrebuildInitializer {
export class FromBackupInitializer extends jspb.Message {
getCheckoutLocation(): string;
setCheckoutLocation(value: string): FromBackupInitializer;
getFromSnapshotVolume(): boolean;
setFromSnapshotVolume(value: boolean): FromBackupInitializer;
getFromVolumeSnapshot(): boolean;
setFromVolumeSnapshot(value: boolean): FromBackupInitializer;

serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): FromBackupInitializer.AsObject;
Expand All @@ -316,7 +316,7 @@ export class FromBackupInitializer extends jspb.Message {
export namespace FromBackupInitializer {
export type AsObject = {
checkoutLocation: string,
fromSnapshotVolume: boolean,
fromVolumeSnapshot: boolean,
}
}

Expand Down
12 changes: 6 additions & 6 deletions components/content-service-api/typescript/src/initializer_pb.js
Expand Up @@ -2323,7 +2323,7 @@ proto.contentservice.FromBackupInitializer.prototype.toObject = function(opt_inc
proto.contentservice.FromBackupInitializer.toObject = function(includeInstance, msg) {
var f, obj = {
checkoutLocation: jspb.Message.getFieldWithDefault(msg, 1, ""),
fromSnapshotVolume: jspb.Message.getBooleanFieldWithDefault(msg, 2, false)
fromVolumeSnapshot: jspb.Message.getBooleanFieldWithDefault(msg, 2, false)
};

if (includeInstance) {
Expand Down Expand Up @@ -2366,7 +2366,7 @@ proto.contentservice.FromBackupInitializer.deserializeBinaryFromReader = functio
break;
case 2:
var value = /** @type {boolean} */ (reader.readBool());
msg.setFromSnapshotVolume(value);
msg.setFromVolumeSnapshot(value);
break;
default:
reader.skipField();
Expand Down Expand Up @@ -2404,7 +2404,7 @@ proto.contentservice.FromBackupInitializer.serializeBinaryToWriter = function(me
f
);
}
f = message.getFromSnapshotVolume();
f = message.getFromVolumeSnapshot();
if (f) {
writer.writeBool(
2,
Expand Down Expand Up @@ -2433,10 +2433,10 @@ proto.contentservice.FromBackupInitializer.prototype.setCheckoutLocation = funct


/**
* optional bool from_snapshot_volume = 2;
* optional bool from_volume_snapshot = 2;
* @return {boolean}
*/
proto.contentservice.FromBackupInitializer.prototype.getFromSnapshotVolume = function() {
proto.contentservice.FromBackupInitializer.prototype.getFromVolumeSnapshot = function() {
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false));
};

Expand All @@ -2445,7 +2445,7 @@ proto.contentservice.FromBackupInitializer.prototype.getFromSnapshotVolume = fun
* @param {boolean} value
* @return {!proto.contentservice.FromBackupInitializer} returns this
*/
proto.contentservice.FromBackupInitializer.prototype.setFromSnapshotVolume = function(value) {
proto.contentservice.FromBackupInitializer.prototype.setFromVolumeSnapshot = function(value) {
return jspb.Message.setProto3BooleanField(this, 2, value);
};

Expand Down
6 changes: 3 additions & 3 deletions components/content-service/pkg/initializer/initializer.go
Expand Up @@ -173,18 +173,18 @@ func newFromBackupInitializer(loc string, rs storage.DirectDownloader, req *csap
return &fromBackupInitializer{
Location: loc,
RemoteStorage: rs,
FromSnapshotVolume: req.FromSnapshotVolume,
FromVolumeSnapshot: req.FromVolumeSnapshot,
}, nil
}

type fromBackupInitializer struct {
Location string
RemoteStorage storage.DirectDownloader
FromSnapshotVolume bool
FromVolumeSnapshot bool
}

func (bi *fromBackupInitializer) Run(ctx context.Context, mappings []archive.IDMapping) (src csapi.WorkspaceInitSource, err error) {
if bi.FromSnapshotVolume {
if bi.FromVolumeSnapshot {
return csapi.WorkspaceInitFromBackup, nil
}

Expand Down
2 changes: 1 addition & 1 deletion components/content-service/pkg/layer/provider.go
Expand Up @@ -269,7 +269,7 @@ func (s *Provider) GetContentLayerPVC(ctx context.Context, owner, workspaceID st
return l, manifest, nil
}

if initializer.GetBackup() != nil && initializer.GetBackup().FromSnapshotVolume {
if initializer.GetBackup() != nil && initializer.GetBackup().FromVolumeSnapshot {
layer, err = contentDescriptorToLayerPVC([]byte{})
if err != nil {
return nil, nil, err
Expand Down
2 changes: 1 addition & 1 deletion components/gitpod-protocol/src/wsready.ts
Expand Up @@ -4,7 +4,7 @@
* See License-AGPL.txt in the project root for license information.
*/

// generated using github.com/32leaves/bel on 2022-05-10 18:14:25.691876738 +0000 UTC m=+0.006851101
// generated using github.com/32leaves/bel on 2022-05-18 18:19:49.011672619 +0000 UTC m=+0.006607361
// DO NOT MODIFY

export enum WorkspaceInitSource {
Expand Down
12 changes: 6 additions & 6 deletions components/server/src/workspace/workspace-starter.ts
Expand Up @@ -86,7 +86,7 @@ import {
StartWorkspaceRequest,
WorkspaceMetadata,
WorkspaceType,
PvcSnapshotVolumeInfo,
PvcVolumeSnapshotInfo,
} from "@gitpod/ws-manager/lib/core_pb";
import * as crypto from "crypto";
import { inject, injectable } from "inversify";
Expand Down Expand Up @@ -1266,13 +1266,13 @@ export class WorkspaceStarter {
}
}

let volumeSnapshotInfo = new PvcSnapshotVolumeInfo();
let volumeSnapshotInfo = new PvcVolumeSnapshotInfo();
const volumeSnapshots = await this.workspaceDb
.trace(traceCtx)
.findVolumeSnapshotById(lastValidWorkspaceInstanceId);
if (volumeSnapshots !== undefined) {
volumeSnapshotInfo.setSnapshotVolumeName(volumeSnapshots.id);
volumeSnapshotInfo.setSnapshotVolumeHandle(volumeSnapshots.volumeHandle);
volumeSnapshotInfo.setVolumeSnapshotName(volumeSnapshots.id);
volumeSnapshotInfo.setVolumeSnapshotHandle(volumeSnapshots.volumeHandle);
}

const initializerPromise = this.createInitializer(
Expand Down Expand Up @@ -1313,7 +1313,7 @@ export class WorkspaceStarter {
spec.setTimeout(this.userService.workspaceTimeoutToDuration(await userTimeoutPromise));
}
spec.setAdmission(admissionLevel);
spec.setVolumeSnapshot(volumeSnapshotInfo);
spec.setPvcVolumeSnapshot(volumeSnapshotInfo);
return spec;
}

Expand Down Expand Up @@ -1442,7 +1442,7 @@ export class WorkspaceStarter {
if (CommitContext.is(context)) {
backup.setCheckoutLocation(context.checkoutLocation || "");
}
backup.setFromSnapshotVolume(hasVolumeSnapshot);
backup.setFromVolumeSnapshot(hasVolumeSnapshot);
result.setBackup(backup);
} else if (SnapshotContext.is(context)) {
const snapshot = new SnapshotInitializer();
Expand Down
20 changes: 10 additions & 10 deletions components/ws-manager-api/core.proto
Expand Up @@ -337,13 +337,13 @@ enum PortVisibility {
PORT_VISIBILITY_PUBLIC = 1;
}

// PvcSnapshotVolumeInfo defines snapshot volume information
message PvcSnapshotVolumeInfo {
// snapshot_volume_name is the name of snapshot volume
string snapshot_volume_name = 1;
// VolumeSnapshotInfo defines volume snapshot information
message VolumeSnapshotInfo {
// volume_snapshot_name is the name of volume snapshot
string volume_snapshot_name = 1;

// snapshot_volume_handle is a handle that is used to restore snapshot volume
string snapshot_volume_handle = 2;
// volume_snapshot_handle is a handle that is used to restore volume snapshot
string volume_snapshot_handle = 2;
}

// WorkspaceCondition gives more detailed information as to the state of the workspace. Which condition actually
Expand Down Expand Up @@ -383,8 +383,8 @@ message WorkspaceConditions {
// stopped_by_request is true if the workspace was stopped using a StopWorkspace call
WorkspaceConditionBool stopped_by_request = 11;

// pvc_snapshot_volume contains info about snapshot volume that was used to save persistent volume
PvcSnapshotVolumeInfo pvc_snapshot_volume = 12;
// volume_snapshot contains info about volume snapshot that was used to save persistent volume
VolumeSnapshotInfo volume_snapshot = 12;
}

// WorkspaceConditionBool is a trinary bool: true/false/empty
Expand Down Expand Up @@ -512,8 +512,8 @@ message StartWorkspaceSpec {
// Class denotes the class of the workspace we ought to start
string class = 13;

// volume_snapshot_id to use to restore PVC from, if set
PvcSnapshotVolumeInfo volume_snapshot = 14;
// volume_snapshot to use to restore PVC from, if set
VolumeSnapshotInfo volume_snapshot = 14;
}

// WorkspaceFeatureFlag enable non-standard behaviour in workspaces
Expand Down

0 comments on commit e78658b

Please sign in to comment.