agent: Add start/stop resource to rust agent #2146
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 3 files at r1.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @utopiabound)
iml-agent/src/action_plugins/high_availability/mod.rs, line 82 at r1 (raw file):
fn resource_status(tree: Element) -> Result<HashMap<String, String>, ImlAgentError> { let resources = tree.find("resources").unwrap(); Ok(resources
Wrapping tens of lines in the returned value reads weird
iml-agent/src/action_plugins/high_availability/mod.rs, line 90 at r1 (raw file):
"resource" => e.get_attr("role").map(|r| vec![(id, r)]), "clone" => { // "Started" -> "Starting" -> "Stopping" -> "Stopped"
Typo?
I expected Starting
to be first
iml-agent/src/action_plugins/high_availability/mod.rs, line 95 at r1 (raw file):
.max_by(|x, y| { if x == y { return Ordering::Equal;
This is too much nesting IMO...
iml-agent/src/action_plugins/high_availability/mod.rs, line 98 at r1 (raw file):
} match (*x, *y) { (_, "Stopped") => Ordering::Greater,
This should go to impl Ord
I think. Complement with impl From<&str> for State
for ease of use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Format check is failing
Why does this supplement the python |
Because of all the other work that |
Signed-off-by: Nathaniel Clark <nclark@whamcloud.com>
Signed-off-by: Nathaniel Clark <nclark@whamcloud.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments about Result
Signed-off-by: Nathaniel Clark <nclark@whamcloud.com>
Signed-off-by: Nathaniel Clark <nclark@whamcloud.com>
Signed-off-by: Nathaniel Clark <nclark@whamcloud.com>
Looks like there is a failure in the integration tests. |
} | ||
|
||
fn resource_status(tree: Element) -> HashMap<String, String> { | ||
let resources = tree.find("resources").unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: this is similar to what I'm doing in terms of reading crm_mon resources. We should consolidate our changes.
This is to suppliment python agent
start_target
. It does not do any movement if the resources is started, nor does it try to force a start in a particular place.Related #1464
Signed-off-by: Nathaniel Clark nclark@whamcloud.com
This change is