---
# System prepended metadata

title: Status Spec

---


- `Status.State` will only have following values:
  - `Primary`
  - `Secondary`

- `Status.State.Conditons` will reflect different aspects of `Primary` and `Secondary` volume states.

  These can be:
  - Completed
        Reason: [Success] [FailedToPromote|FailedToDemote]
        Status: [True] [False]
  - Degraded:
        Reason: [Error] [Healthy]
        Status: [True] [False]
  - Resynching:
        Reason: [ResyncTriggered] [FailedToResync|NotResyncing]
        Status: [True] [False]


# Status Spec

```go
// State captures the latest state of the replication operation
type State string

const (
    // Primary means the image state is changed to Primary
    Primary State = "Primary"

    // Secondary means the image state is changed to Secondary
    Secondary State = "Secondary"
)

type VolumeReplicationStatus struct {
    State              State        `json:"state,omitempty"`
    Message            string       `json:"message,omitempty"`
    Conditions         []Condition  `json:"conditions,omitempty"`
    LastStartTime      *metav1.Time `json:"lastStartTime,omitempty"`
    LastCompletionTime *metav1.Time `json:"lastCompletionTime,omitempty"`
}
```


# Scenario:

## Image State: Primary
- `Resyncing` condition would always be `false` and `NotResyncing` for Primary

## Success: Successfully promoted image

```go
status
    state: Primary
    message: volume is marked primary
    conditioins:
        - type: Completed
          reason: Success
          status: true
          lastHeartbeatTime: "2021-03-29T07:44:15Z"
          lastTransitionTime: "2021-03-29T07:44:15Z"
        - type: Degraded
          reason: Healthy
          status: false
          lastHeartbeatTime: "2021-03-29T07:44:15Z"
          lastTransitionTime: "2021-03-29T07:44:15Z"
        - type: Resyncing
          reason: NotResyncing
          status: false
          lastHeartbeatTime: "2021-03-29T07:44:15Z"
          lastTransitionTime: "2021-03-29T07:44:15Z"
    lastStartTime:"2021-03-29T07:44:14Z"
    LastCompletionTime:"2021-03-29T07:44:15Z"
```

## Failure: Failed to promote image

```go
status
    state: Primary
    message: <actual failure reason>
    conditioins:
        - type: Completed
          reason: FailedToPromote
          satus: false
          lastHeartbeatTime: "2021-03-29T07:44:15Z"
          lastTransitionTime: "2021-03-29T07:44:15Z"
        - type: Degraded
          reason: Error
          status: true
          lastHeartbeatTime: "2021-03-29T07:44:15Z"
          lastTransitionTime: "2021-03-29T07:44:15Z"
        - type: Resyncing
          reason: NotResyncing
          status: false
          lastHeartbeatTime: "2021-03-29T07:44:15Z"
          lastTransitionTime: "2021-03-29T07:44:15Z"
    lastStartTime:"2021-03-29T07:44:14Z"
    lastCompletionTime:"2021-03-29T07:44:15Z"
```

## Image State: Secondary

## Success: Image demoted successfully and resync was triggered

```go
status
    state: Secondary
    message: volume is marked secondary
    conditioins:
        - type: Completed
          reason: Success
          status: true
          lastHeartbeatTime: "2021-03-29T07:44:15Z"
          lastTransitionTime: "2021-03-29T07:44:15Z"
        - type: Degraded
          reason: Healthy
          status: false
          lastHeartbeatTime: "2021-03-29T07:44:15Z"
          lastTransitionTime: "2021-03-29T07:44:15Z"
        - type: Resynching
          reason: ResyncTriggered
          status: true
          lastHeartbeatTime: "2021-03-29T07:44:15Z"
          lastTransitionTime: "2021-03-29T07:44:15Z"
    lastStartTime:"2021-03-29T07:44:14Z"
    lastCompletionTime:"2021-03-29T07:44:15Z"
```

## failure: Image demotion failed

```go
status
    state: Secondary
    message: <actual failure reason>
    conditioins:
        - type: Completed
          reason: FailedToDemote
          status: false
          lastHeartbeatTime: "2021-03-29T07:44:15Z"
          lastTransitionTime: "2021-03-29T07:44:15Z"
        - type: Degraded
          reason: Error
          status: true
          lastHeartbeatTime: "2021-03-29T07:44:15Z"
          lastTransitionTime: "2021-03-29T07:44:15Z"
        - type: Resynching
          reason: NotResyncing
          status: false
          lastHeartbeatTime: "2021-03-29T07:44:15Z"
          lastTransitionTime: "2021-03-29T07:44:15Z"
    lastStartTime:"2021-03-29T07:44:14Z"
    lastCompletionTime:"2021-03-29T07:44:15Z"
```

## failure: Image demoted but resyc failed

```go
status
    state: Secondary
    message: <actual resync failure reason>
    conditioins:
        - type: Completed:
          reason: FailedToResync
          satus: false
          lastHeartbeatTime: "2021-03-29T07:44:15Z"
          lastTransitionTime: "2021-03-29T07:44:15Z"
        - type: Degraded:
          reason: Error
          status: true
          lastHeartbeatTime: "2021-03-29T07:44:15Z"
          lastTransitionTime: "2021-03-29T07:44:15Z"
        - type: Resynching:
          reason: FailedToResync
          status: false
          lastHeartbeatTime: "2021-03-29T07:44:15Z"
          lastTransitionTime: "2021-03-29T07:44:15Z"
    lastStartTime:"2021-03-29T07:44:14Z"
    lastCompletionTime:"2021-03-29T07:44:15Z"
```


## Image State: Resync

## Success: Resync was triggered successfully. 
- `State` will remain `Secondary`

```go
status
    state: Secondary
    message: Successfully triggered resync on the image
    conditioins:
        - type: Completed:
          reason: Success
          satus: true
          lastHeartbeatTime: "2021-03-29T07:44:15Z"
          lastTransitionTime: "2021-03-29T07:44:15Z"
        - type: Degraded:
          reason: Healthy
          status: false
          lastHeartbeatTime: "2021-03-29T07:44:15Z"
          lastTransitionTime: "2021-03-29T07:44:15Z"
        - type: Resynching:
          reason: ResyncTriggered
          status: true
          lastHeartbeatTime: "2021-03-29T07:44:15Z"
          lastTransitionTime: "2021-03-29T07:44:15Z"
    lastStartTime:"2021-03-29T07:44:14Z"
    lastCompletionTime:"2021-03-29T07:44:15Z"
```

## failure: resync operation failed

```go
status
    state: Secondary
    message: <actual resync failure reason>
    conditioins:
        - type: Completed:
          reason: FailedToResync
          satus: false
          lastHeartbeatTime: "2021-03-29T07:44:15Z"
          lastTransitionTime: "2021-03-29T07:44:15Z"
        - type: Degraded:
          reason: Error
          status: true
          lastHeartbeatTime: "2021-03-29T07:44:15Z"
          lastTransitionTime: "2021-03-29T07:44:15Z"
        - type: Resyncing:
          reason: FailedToResync
          status: false
          lastHeartbeatTime: "2021-03-29T07:44:15Z"
          lastTransitionTime: "2021-03-29T07:44:15Z"
    lastStartTime:"2021-03-29T07:44:14Z"
    lastCompletionTime:"2021-03-29T07:44:15Z"
```


# Other scenarios:

## attempting resync operation on a Primary image

```go
status
    state: Primary
    message: resync operation can not be performed on a primary image
    conditioins:
        - type: Completed
          reason: FailedToResync
          status: true
          lastHeartbeatTime: "2021-03-29T07:44:15Z"
          lastTransitionTime: "2021-03-29T07:44:15Z"
        - type: Degraded
          reason: Error
          status: true
          lastHeartbeatTime: "2021-03-29T07:44:15Z"
          lastTransitionTime: "2021-03-29T07:44:15Z"
        - type: Resyncing
          reason: FailedToResync
          status: false
          lastHeartbeatTime: "2021-03-29T07:44:15Z"
          lastTransitionTime: "2021-03-29T07:44:15Z"
    lastStartTime:"2021-03-29T07:44:14Z"
    lastCompletionTime:"2021-03-29T07:44:15Z"
```


# Open questions:

1. Do we need to remove the `resync` volume state from the spec?
2. If last state was already `resync`, how will the user trigger resync again?
3. How to show the time when last resyc operation was performed? (use `LastStartTime`??)