On Wed, Mar 12, 2025 at 11:40 PM Patrick Robb <pr...@iol.unh.edu> wrote:

>
> +    def create_vfs(self, pf_port: Port) -> None:
> +        """Overrides :meth:`~.os_session.OSSession.create_vfs`.
> +
> +        Raises:
> +            InternalError: If the number of VFs is greater than 0 but
> less than the
> +            maximum for `pf_port`.
> +        """
> +        sys_bus_path = f"/sys/bus/pci/devices/{pf_port.pci}".replace(":",
> "\\:")
> +        curr_num_vfs = int(self.send_command(f"cat
> {sys_bus_path}/sriov_numvfs").stdout)
> +        max_num_vfs = int(
> +            self.send_command(f"cat {sys_bus_path}/sriov_totalvfs",
> privileged=True).stdout
> +        )
> +        if 0 < curr_num_vfs < max_num_vfs:
> +            raise InternalError("There are existing VFs on the port which
> must be deleted.")
>

Maybe in this situation we should just delete all VFs, and then create the
new set of VFs.

Reply via email to