diff --git a/controller/volume_controller.go b/controller/volume_controller.go index d116faa245..15a0df7c31 100644 --- a/controller/volume_controller.go +++ b/controller/volume_controller.go @@ -3657,9 +3657,9 @@ func (c *VolumeController) getBackupVolumeInfo(v *longhorn.Volume) (string, stri return "", "", "", errors.Wrapf(err, "failed to get backup %v for restoring volume %v", backupName, v.Name) } - backupVolume, err := c.ds.GetBackupVolumeWithBackupTargetAndVolumeRO(backup.Spec.BackupTargetName, remoteBackupVolumeName) + backupVolume, err := c.ds.GetBackupVolumeWithBackupTargetAndVolumeRO(backup.Status.BackupTarget, remoteBackupVolumeName) if err != nil { - return "", "", "", errors.Wrapf(err, "failed to get backup volume %v with backup target %v for restoring volume %v", remoteBackupVolumeName, backup.Spec.BackupTargetName, v.Name) + return "", "", "", errors.Wrapf(err, "failed to get backup volume %v with backup target %v for restoring volume %v", remoteBackupVolumeName, backup.Status.BackupTarget, v.Name) } return remoteBackupVolumeName, backupVolume.Name, backupName, nil diff --git a/k8s/crds.yaml b/k8s/crds.yaml index b6cc71217c..2e1609fe61 100644 --- a/k8s/crds.yaml +++ b/k8s/crds.yaml @@ -564,8 +564,9 @@ spec: ownerID: type: string realSize: - description: Real size of image in bytes, which may be smaller than the size - when the file is a sparse file. Will be zero until known (e.g. while a backing image is uploading) + description: Real size of image in bytes, which may be smaller than + the size when the file is a sparse file. Will be zero until known + (e.g. while a backing image is uploading) format: int64 type: integer size: @@ -574,8 +575,9 @@ spec: uuid: type: string virtualSize: - description: Virtual size of image in bytes, which may be larger than physical - size. Will be zero until known (e.g. while a backing image is uploading) + description: Virtual size of image in bytes, which may be larger than + physical size. Will be zero until known (e.g. while a backing image + is uploading) format: int64 type: integer type: object @@ -653,8 +655,9 @@ spec: backing image backup properties: backingImage: - description: The backing image name.. - nullable: true + description: |- + The backing image name. + Required type: string backupTargetName: description: The backup target name. @@ -677,6 +680,7 @@ spec: Required type: boolean required: + - backingImage - userCreated type: object status: @@ -732,7 +736,8 @@ spec: description: Record the secret if this backup backing image is encrypted type: string secretNamespace: - description: Record the secret namespace if this backup backing image is encrypted + description: Record the secret namespace if this backup backing image + is encrypted type: string size: description: The backing image size. @@ -878,6 +883,7 @@ spec: - full - incremental - "" + type: string backupTargetName: description: The backup target name. nullable: true @@ -1119,9 +1125,6 @@ spec: description: The interval that the cluster needs to run sync with the backup target. type: string - readOnly: - description: ReadOnly indicates if it can create a backup on the remote backup target or not. - type: boolean syncRequestedAt: description: The time to request run sync the remote backup target. format: date-time @@ -4214,7 +4217,8 @@ spec: - gzip type: string backupTargetName: - description: 'The backup target name that the volume will be backed up to or is synced.' + description: The backup target name that the volume will be backed + up to or is synced. type: string dataEngine: enum: