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

refactor: virtwrap: remove/improve some code #11548

Closed
wants to merge 5 commits into from

Commits on Mar 20, 2024

  1. nichotplug: use function type for the argument

    Also breaks the arguments per line, just to reduce the line length.
    
    Signed-off-by: Victor Toso <victortoso@redhat.com>
    victortoso committed Mar 20, 2024
    Configuration menu
    Copy the full SHA
    565a30e View commit details
    Browse the repository at this point in the history
  2. nichotplug: early return on special cases

    This simplify the logic around withNetworkIfacesResources() as on
    appendPlaceholderInterfacesToTheDomain(), in this two conditionals, we
    would return domainSpec which would make the follow up check of len()
    of Interfaces to be always true.
    
    Now we return early and appendPlaceholderInterfacesToTheDomain() is
    called only when we need to add placeholder interfaces.
    
    Signed-off-by: Victor Toso <victortoso@redhat.com>
    victortoso committed Mar 20, 2024
    Configuration menu
    Copy the full SHA
    b40f027 View commit details
    Browse the repository at this point in the history
  3. nichotplug: refactor: don't DeepCopy

    No real need for DeepCopy as we can keep using domainSpec.
    
    Signed-off-by: Victor Toso <victortoso@redhat.com>
    victortoso committed Mar 20, 2024
    Configuration menu
    Copy the full SHA
    574a7ff View commit details
    Browse the repository at this point in the history
  4. virtwrap: drop return of api.Domain in preStartHook()

    The api.Domain is passed by reference and set by the function.
    
    In SyncVMI() we ignore the return value and we can do the same with
    prepareMigrationTarget(), making better usage of the `domain` variable
    already existing.
    
    Signed-off-by: Victor Toso <victortoso@redhat.com>
    victortoso committed Mar 20, 2024
    Configuration menu
    Copy the full SHA
    55cb71c View commit details
    Browse the repository at this point in the history
  5. virtwrap: remove unneeded call to OnDefineDomain

    This is just calling hooks OnDefineDomain without doing anything with
    the resulting Domain XML. If this was really needed, it should be
    using SetDomainSpecStrWithHooks() instead, which is what SyncVMI()
    does. Note that this happens later, when SyncVirtualMachine() from
    Launcher is called.
    
    Signed-off-by: Victor Toso <victortoso@redhat.com>
    victortoso committed Mar 20, 2024
    Configuration menu
    Copy the full SHA
    ebbfa47 View commit details
    Browse the repository at this point in the history