Skip to content
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-402921: Relax VIF constraint for PVS proxy #6189

Merged
merged 4 commits into from
Dec 19, 2024

Conversation

robhoes
Copy link
Member

@robhoes robhoes commented Dec 18, 2024

The current constraint is that the VIF used for PVS proxy must have
device number 0. It turned out that this can be relaxed. It is
sufficient to enforce that the VIF is the one with the lowest device
number for the VM.

The current constraint is that the VIF used for PVS proxy must have
device number 0. It turned out that this can be relaxed. It is
sufficient to enforce that the VIF is the one with the lowest device
number for the VM.

Signed-off-by: Rob Hoes <[email protected]>
Comment on lines 306 to 315
let vm_has_pvs_proxy =
List.exists
(fun vif ->
Pvs_proxy_control.find_proxy_for_vif ~__context ~vif <> None
)
all
in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it not enough to check that just the min_device's VIF has a PVS proxy - since otherwise this code wouldn't let a VIF get created? Perhaps the fold_left above would return vif * vif_device instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I can simplify this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this compares strings rather than integers, so have to fix that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed that now.

let vm = Db.VIF.get_VM ~__context ~self:vIF in
Db.VIF.get_records_where ~__context
~expr:(Eq (Field "VM", Literal (Ref.string_of vm)))
|> List.fold_left
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be clearer to define a function minimum that takes a non-empty list of integers.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then we'd have to separately handle the conversion from strings and the empy list case?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

val minimum: min:int -> int list -> int (** minimum of the list or min if the list is empty *)
...
client code like

| hd::tl -> minimum min:hd tl
..

Maybe it's nice but verbose.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO the current fold_left is more to the point.

When creating a new VIF and there is already a VIF with PVS_proxy, check
that the new VIF does not have a lower device number than the PVS_proxy
VIF.

Signed-off-by: Rob Hoes <[email protected]>
@robhoes robhoes added this pull request to the merge queue Dec 19, 2024
Merged via the queue into xapi-project:master with commit e861cb6 Dec 19, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants