-
Notifications
You must be signed in to change notification settings - Fork 292
VDI.snapshot: check that SM has this capability #3029
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
VDI.snapshot: check that SM has this capability #3029
Conversation
On a
|
762f374
to
6b18c34
Compare
I find it more readable if we keep using the pattern matching instead of nesting if/else: | `snapshot when not Smint.(has_capability Vdi_snapshot sm_features) ->
Some (Api_errors.sr_operation_not_supported, [Ref.string_of sr])
| `snapshot when (record.Db_actions.vDI_sharable) ->
Some (Api_errors.vdi_is_sharable, [ _ref ])
| `snapshot when reset_on_boot ->
Some (Api_errors.vdi_on_boot_mode_incompatible_with_operation, [])
| `snapshot ->
if List.exists (fun (_, op) -> op = `copy) current_ops
then Some (Api_errors.operation_not_allowed, ["Snapshot operation not allowed during copy."])
else None |
It seems that this capability is reported by SM for most SR types. Signed-off-by: Gabor Igloi <gabor.igloi@citrix.com>
6b18c34
to
1315fa6
Compare
Thanks, updated. |
I am happy with it but I think @jonludlam should have a look |
Looks fine to me... but why have we not seen a bug from this? Maybe we don't have a test-case that tries to snapshot a VDI backed by an SR type that doesn't support it... or do we have a check somewhere else? Have you tried out making a snapshot of an iSCSI or ISO VDI to see what happens without this change? |
@thomassa it throws an error:
|
What is the output of the new code for the same command? |
@mseri exactly the same thing:
|
I am going to merge. If you intend to add tests, we can get them in a separate PR |
No description provided.