mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-04 12:14:00 +00:00
issue 7237: add pvc namespace to backup describe
Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
This commit is contained in:
@@ -585,6 +585,7 @@ func retrieveCSISnapshotLegacy(ctx context.Context, kbClient kbclient.Client, ba
|
||||
|
||||
if *vs.Status.BoundVolumeSnapshotContentName == vsc.Name {
|
||||
volInfo.PVCName = *vs.Spec.Source.PersistentVolumeClaimName
|
||||
volInfo.PVCNamespace = vs.Namespace
|
||||
}
|
||||
}
|
||||
|
||||
@@ -639,7 +640,7 @@ func describeCSISnapshots(d *Describer, details bool, infos []*volume.VolumeInfo
|
||||
}
|
||||
|
||||
func describeCSISnapshot(d *Describer, details bool, info *volume.VolumeInfo) {
|
||||
d.Printf("\t\t%s:\n", info.PVCName)
|
||||
d.Printf("\t\t%s:\n", fmt.Sprintf("%s/%s", info.PVCNamespace, info.PVCName))
|
||||
|
||||
describeLocalSnapshot(d, details, info)
|
||||
describeDataMovement(d, details, info)
|
||||
|
||||
@@ -397,6 +397,7 @@ func TestCSISnapshots(t *testing.T) {
|
||||
volumeInfo: []*volume.VolumeInfo{
|
||||
{
|
||||
BackupMethod: volume.CSISnapshot,
|
||||
PVCNamespace: "pvc-ns-1",
|
||||
PVCName: "pvc-1",
|
||||
PreserveLocalSnapshot: true,
|
||||
OperationID: "fake-operation-1",
|
||||
@@ -409,7 +410,7 @@ func TestCSISnapshots(t *testing.T) {
|
||||
},
|
||||
},
|
||||
expect: ` CSI Snapshots:
|
||||
pvc-1:
|
||||
pvc-ns-1/pvc-1:
|
||||
Snapshot: included, specify --details for more information
|
||||
`,
|
||||
},
|
||||
@@ -418,6 +419,7 @@ func TestCSISnapshots(t *testing.T) {
|
||||
volumeInfo: []*volume.VolumeInfo{
|
||||
{
|
||||
BackupMethod: volume.CSISnapshot,
|
||||
PVCNamespace: "pvc-ns-2",
|
||||
PVCName: "pvc-2",
|
||||
PreserveLocalSnapshot: true,
|
||||
OperationID: "fake-operation-2",
|
||||
@@ -431,7 +433,7 @@ func TestCSISnapshots(t *testing.T) {
|
||||
},
|
||||
inputDetails: true,
|
||||
expect: ` CSI Snapshots:
|
||||
pvc-2:
|
||||
pvc-ns-2/pvc-2:
|
||||
Snapshot:
|
||||
Operation ID: fake-operation-2
|
||||
Snapshot Content Name: vsc-2
|
||||
@@ -445,6 +447,7 @@ func TestCSISnapshots(t *testing.T) {
|
||||
volumeInfo: []*volume.VolumeInfo{
|
||||
{
|
||||
BackupMethod: volume.CSISnapshot,
|
||||
PVCNamespace: "pvc-ns-3",
|
||||
PVCName: "pvc-3",
|
||||
SnapshotDataMoved: true,
|
||||
OperationID: "fake-operation-3",
|
||||
@@ -456,7 +459,7 @@ func TestCSISnapshots(t *testing.T) {
|
||||
},
|
||||
},
|
||||
expect: ` CSI Snapshots:
|
||||
pvc-3:
|
||||
pvc-ns-3/pvc-3:
|
||||
Data Movement: included, specify --details for more information
|
||||
`,
|
||||
},
|
||||
@@ -465,6 +468,7 @@ func TestCSISnapshots(t *testing.T) {
|
||||
volumeInfo: []*volume.VolumeInfo{
|
||||
{
|
||||
BackupMethod: volume.CSISnapshot,
|
||||
PVCNamespace: "pvc-ns-4",
|
||||
PVCName: "pvc-4",
|
||||
SnapshotDataMoved: true,
|
||||
OperationID: "fake-operation-4",
|
||||
@@ -477,7 +481,7 @@ func TestCSISnapshots(t *testing.T) {
|
||||
},
|
||||
inputDetails: true,
|
||||
expect: ` CSI Snapshots:
|
||||
pvc-4:
|
||||
pvc-ns-4/pvc-4:
|
||||
Data Movement:
|
||||
Operation ID: fake-operation-4
|
||||
Data Mover: velero
|
||||
@@ -489,6 +493,7 @@ func TestCSISnapshots(t *testing.T) {
|
||||
volumeInfo: []*volume.VolumeInfo{
|
||||
{
|
||||
BackupMethod: volume.CSISnapshot,
|
||||
PVCNamespace: "pvc-ns-5",
|
||||
PVCName: "pvc-5",
|
||||
SnapshotDataMoved: true,
|
||||
OperationID: "fake-operation-5",
|
||||
@@ -500,7 +505,7 @@ func TestCSISnapshots(t *testing.T) {
|
||||
},
|
||||
inputDetails: true,
|
||||
expect: ` CSI Snapshots:
|
||||
pvc-5:
|
||||
pvc-ns-5/pvc-5:
|
||||
Data Movement:
|
||||
Operation ID: fake-operation-5
|
||||
Data Mover: velero
|
||||
|
||||
@@ -407,7 +407,7 @@ func describeCSISnapshotInSF(details bool, info *volume.VolumeInfo, snapshotDeta
|
||||
describeLocalSnapshotInSF(details, info, snapshotDetail)
|
||||
describeDataMovementInSF(details, info, snapshotDetail)
|
||||
|
||||
snapshotDetails[info.PVCName] = snapshotDetail
|
||||
snapshotDetails[fmt.Sprintf("%s/%s", info.PVCNamespace, info.PVCName)] = snapshotDetail
|
||||
}
|
||||
|
||||
// describeVSCInSF describes CSI volume snapshot contents in structured format.
|
||||
|
||||
@@ -357,6 +357,7 @@ func TestDescribeCSISnapshotsInSF(t *testing.T) {
|
||||
volumeInfo: []*volume.VolumeInfo{
|
||||
{
|
||||
BackupMethod: volume.CSISnapshot,
|
||||
PVCNamespace: "pvc-ns-1",
|
||||
PVCName: "pvc-1",
|
||||
PreserveLocalSnapshot: true,
|
||||
OperationID: "fake-operation-1",
|
||||
@@ -370,7 +371,7 @@ func TestDescribeCSISnapshotsInSF(t *testing.T) {
|
||||
},
|
||||
expect: map[string]interface{}{
|
||||
"csiSnapshots": map[string]interface{}{
|
||||
"pvc-1": map[string]interface{}{
|
||||
"pvc-ns-1/pvc-1": map[string]interface{}{
|
||||
"snapshot": "included, specify --details for more information",
|
||||
},
|
||||
},
|
||||
@@ -381,6 +382,7 @@ func TestDescribeCSISnapshotsInSF(t *testing.T) {
|
||||
volumeInfo: []*volume.VolumeInfo{
|
||||
{
|
||||
BackupMethod: volume.CSISnapshot,
|
||||
PVCNamespace: "pvc-ns-2",
|
||||
PVCName: "pvc-2",
|
||||
PreserveLocalSnapshot: true,
|
||||
OperationID: "fake-operation-2",
|
||||
@@ -395,7 +397,7 @@ func TestDescribeCSISnapshotsInSF(t *testing.T) {
|
||||
inputDetails: true,
|
||||
expect: map[string]interface{}{
|
||||
"csiSnapshots": map[string]interface{}{
|
||||
"pvc-2": map[string]interface{}{
|
||||
"pvc-ns-2/pvc-2": map[string]interface{}{
|
||||
"snapshot": map[string]interface{}{
|
||||
"operationID": "fake-operation-2",
|
||||
"snapshotContentName": "vsc-2",
|
||||
@@ -412,6 +414,7 @@ func TestDescribeCSISnapshotsInSF(t *testing.T) {
|
||||
volumeInfo: []*volume.VolumeInfo{
|
||||
{
|
||||
BackupMethod: volume.CSISnapshot,
|
||||
PVCNamespace: "pvc-ns-3",
|
||||
PVCName: "pvc-3",
|
||||
SnapshotDataMoved: true,
|
||||
OperationID: "fake-operation-3",
|
||||
@@ -424,7 +427,7 @@ func TestDescribeCSISnapshotsInSF(t *testing.T) {
|
||||
},
|
||||
expect: map[string]interface{}{
|
||||
"csiSnapshots": map[string]interface{}{
|
||||
"pvc-3": map[string]interface{}{
|
||||
"pvc-ns-3/pvc-3": map[string]interface{}{
|
||||
"dataMovement": "included, specify --details for more information",
|
||||
},
|
||||
},
|
||||
@@ -435,6 +438,7 @@ func TestDescribeCSISnapshotsInSF(t *testing.T) {
|
||||
volumeInfo: []*volume.VolumeInfo{
|
||||
{
|
||||
BackupMethod: volume.CSISnapshot,
|
||||
PVCNamespace: "pvc-ns-4",
|
||||
PVCName: "pvc-4",
|
||||
SnapshotDataMoved: true,
|
||||
OperationID: "fake-operation-4",
|
||||
@@ -448,7 +452,7 @@ func TestDescribeCSISnapshotsInSF(t *testing.T) {
|
||||
inputDetails: true,
|
||||
expect: map[string]interface{}{
|
||||
"csiSnapshots": map[string]interface{}{
|
||||
"pvc-4": map[string]interface{}{
|
||||
"pvc-ns-4/pvc-4": map[string]interface{}{
|
||||
"dataMovement": map[string]interface{}{
|
||||
"operationID": "fake-operation-4",
|
||||
"dataMover": "velero",
|
||||
@@ -463,6 +467,7 @@ func TestDescribeCSISnapshotsInSF(t *testing.T) {
|
||||
volumeInfo: []*volume.VolumeInfo{
|
||||
{
|
||||
BackupMethod: volume.CSISnapshot,
|
||||
PVCNamespace: "pvc-ns-4",
|
||||
PVCName: "pvc-4",
|
||||
SnapshotDataMoved: true,
|
||||
OperationID: "fake-operation-4",
|
||||
@@ -475,7 +480,7 @@ func TestDescribeCSISnapshotsInSF(t *testing.T) {
|
||||
inputDetails: true,
|
||||
expect: map[string]interface{}{
|
||||
"csiSnapshots": map[string]interface{}{
|
||||
"pvc-4": map[string]interface{}{
|
||||
"pvc-ns-4/pvc-4": map[string]interface{}{
|
||||
"dataMovement": map[string]interface{}{
|
||||
"operationID": "fake-operation-4",
|
||||
"dataMover": "velero",
|
||||
|
||||
Reference in New Issue
Block a user