Skip to content

Commit 123ca04

Browse files
committed
Make Manager insertion of a duplicate UUID a warning instead of an error
1 parent 1e9be53 commit 123ca04

File tree

1 file changed

+30
-9
lines changed

1 file changed

+30
-9
lines changed

src/dbus/manager/mod.rs

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,16 @@ impl Manager {
8585
Err(StratisError::Msg(format!("Attempted to add path {path}, UUID {uuid} for pool but path {p}, UUID {u} pair already exists")))
8686
}
8787
}
88-
(Some(u), _) => Err(StratisError::Msg(format!(
89-
"Attempted to add path {path}, UUID {uuid} for pool but path {path}, UUID {u} pair already exists"
90-
))),
88+
(Some(u), _) => {
89+
warn!(
90+
"Attempted to add path {path}, UUID {uuid} for pool but UUID {u} already exists"
91+
);
92+
self.pool_path_to_uuid
93+
.insert(OwnedObjectPath::from(path.clone()), uuid);
94+
self.pool_uuid_to_path
95+
.insert(uuid, OwnedObjectPath::from(path.clone()));
96+
Ok(())
97+
},
9198
(_, Some(p)) => Err(StratisError::Msg(format!(
9299
"Attempted to add path {path}, UUID {uuid} for pool but path {p}, UUID {uuid} pair already exists"
93100
))),
@@ -117,9 +124,16 @@ impl Manager {
117124
Err(StratisError::Msg(format!("Attempted to add path {path}, UUID {uuid} for filesystem but path {p}, UUID {u} pair already exists")))
118125
}
119126
}
120-
(Some(u), _) => Err(StratisError::Msg(format!(
121-
"Attempted to add path {path}, UUID {uuid} for filesystem but path {path}, UUID {u} pair already exists"
122-
))),
127+
(Some(u), _) => {
128+
warn!(
129+
"Attempted to add path {path}, UUID {uuid} for filesystem but UUID {u} already exists"
130+
);
131+
self.filesystem_path_to_uuid
132+
.insert(OwnedObjectPath::from(path.clone()), uuid);
133+
self.filesystem_uuid_to_path
134+
.insert(uuid, OwnedObjectPath::from(path.clone()));
135+
Ok(())
136+
},
123137
(_, Some(p)) => Err(StratisError::Msg(format!(
124138
"Attempted to add path {path}, UUID {uuid} for filesystem but path {p}, UUID {uuid} pair already exists"
125139
))),
@@ -145,9 +159,16 @@ impl Manager {
145159
Err(StratisError::Msg(format!("Attempted to add path {path}, UUID {uuid} for blockdev but path {p}, UUID {u} pair already exists")))
146160
}
147161
}
148-
(Some(u), _) => Err(StratisError::Msg(format!(
149-
"Attempted to add path {path}, UUID {uuid} for blockdev but path {path}, UUID {u} pair already exists"
150-
))),
162+
(Some(u), _) => {
163+
warn!(
164+
"Attempted to add path {path}, UUID {uuid} for blockdev but UUID {u} already exists"
165+
);
166+
self.blockdev_path_to_uuid
167+
.insert(OwnedObjectPath::from(path.clone()), uuid);
168+
self.blockdev_uuid_to_path
169+
.insert(uuid, OwnedObjectPath::from(path.clone()));
170+
Ok(())
171+
},
151172
(_, Some(p)) => Err(StratisError::Msg(format!(
152173
"Attempted to add path {path}, UUID {uuid} for blockdev but path {p}, UUID {uuid} pair already exists"
153174
))),

0 commit comments

Comments
 (0)