If no mirroring-related snapshots exist on the image, it cannot
be determined if the image is primary/non-primary. In the case of
rbd-mirror, this will be the case after a new mirrored image is
created locally but before it can be synced.
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
return m_on_finish;
}
- m_is_primary = (m_promotion_state == PROMOTION_STATE_PRIMARY);
+ m_is_primary = (m_promotion_state == PROMOTION_STATE_PRIMARY ||
+ m_promotion_state == PROMOTION_STATE_UNKNOWN);
if (!m_is_primary && !m_force) {
lderr(cct) << "mirrored image is not primary, "
template <typename I>
void GetInfoRequest<I>::calc_promotion_state(
const std::map<librados::snap_t, SnapInfo> &snap_info) {
- *m_promotion_state = PROMOTION_STATE_PRIMARY;
+ *m_promotion_state = PROMOTION_STATE_UNKNOWN;
*m_primary_mirror_uuid = "";
for (auto it = snap_info.rbegin(); it != snap_info.rend(); it++) {
if (primary != nullptr) {
if (primary->demoted) {
*m_promotion_state = PROMOTION_STATE_ORPHAN;
+ } else {
+ *m_promotion_state = PROMOTION_STATE_PRIMARY;
}
break;
}
namespace mirror {
enum PromotionState {
+ PROMOTION_STATE_UNKNOWN,
PROMOTION_STATE_PRIMARY,
PROMOTION_STATE_NON_PRIMARY,
PROMOTION_STATE_ORPHAN