-
Notifications
You must be signed in to change notification settings - Fork 292
CA-285605: Make PIF.set_disallow_unplug idempotent #3503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CA-285605: Make PIF.set_disallow_unplug idempotent #3503
Conversation
Signed-off-by: Akanksha Mathur <akanksha.mathur@citrix.com>
Signed-off-by: Akanksha Mathur <akanksha.mathur@citrix.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.
LGTM, minor comment about a space.
ocaml/xapi/xapi_pif.ml
Outdated
let set_disallow_unplug ~__context ~self ~value = | ||
let network = Db.PIF.get_network ~__context ~self in | ||
if pif_has_clustering_enabled ~__context self network | ||
if ((Db.PIF.get_disallow_unplug ~__context ~self) <> value)&& pif_has_clustering_enabled ~__context self network |
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.
Could you add a space before the &&
?
ocaml/xapi/xapi_pif.ml
Outdated
if pif_has_clustering_enabled ~__context self network | ||
if ((Db.PIF.get_disallow_unplug ~__context ~self) <> value)&& pif_has_clustering_enabled ~__context self network | ||
then raise Api_errors.(Server_error(clustering_enabled_on_network, [Ref.string_of network])) | ||
else Db.PIF.set_disallow_unplug ~__context ~self ~value |
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.
You could skip this if you found it to be equal, but its fine either way.
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.
Yeah, that's a better way to do it.
Signed-off-by: Akanksha Mathur <akanksha.mathur@citrix.com>
Previously,
PIF.set_disallow_unplug
raisedclustering_enabled_on_network
even when trying to set to the same value, if cluster objects were found, causing tests to fail unnecessarily. This PR makesPIF.set_disallow_unplug
idempotent and updates the relevant tests to check this new behaviour.