<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Wed, Mar 12, 2025 at 11:40 PM Patrick Robb <<a href="mailto:probb@iol.unh.edu">probb@iol.unh.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
+ def create_vfs(self, pf_port: Port) -> None:<br>
+ """Overrides :meth:`~.os_session.OSSession.create_vfs`.<br>
+<br>
+ Raises:<br>
+ InternalError: If the number of VFs is greater than 0 but less than the<br>
+ maximum for `pf_port`.<br>
+ """<br>
+ sys_bus_path = f"/sys/bus/pci/devices/{pf_port.pci}".replace(":", "\\:")<br>
+ curr_num_vfs = int(self.send_command(f"cat {sys_bus_path}/sriov_numvfs").stdout)<br>
+ max_num_vfs = int(<br>
+ self.send_command(f"cat {sys_bus_path}/sriov_totalvfs", privileged=True).stdout<br>
+ )<br>
+ if 0 < curr_num_vfs < max_num_vfs:<br>
+ raise InternalError("There are existing VFs on the port which must be deleted.")<br></blockquote><div><br></div><div>Maybe in this situation we should just delete all VFs, and then create the new set of VFs.</div><div> </div></div></div>