Skip to content

Commit

Permalink
B #6319: Execute VNM post operation after revert
Browse files Browse the repository at this point in the history
This affects KVM with libvirt 8.0.0+. As for 8.0.0, libvirt will stop and start a domain when reverting to a snapshot. It appears that this may recreate the Open vSwitch interface, which loses the VLAN configuration placed there by the Open vSwitch Driver.
  • Loading branch information
rsmontero committed Sep 25, 2023
1 parent d59f30c commit 2efd976
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions src/vmm_mad/exec/one_vmm_exec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -817,18 +817,27 @@ def snapshot_create(id, drv_message)
def snapshot_revert(id, drv_message)
xml_data = decode(drv_message)

host = xml_data.elements['HOST'].text
deploy_id = xml_data.elements['DEPLOY_ID'].text

snap_id_xpath = "VM/TEMPLATE/SNAPSHOT[ACTIVE='YES']/HYPERVISOR_ID"
snapshot_name = xml_data.elements[snap_id_xpath].text

do_action("#{deploy_id} #{snapshot_name}",
id,
host,
ACTION[:snapshot_revert],
:script_name => 'snapshot_revert',
:stdin => xml_data.to_s)
action = VmmAction.new(self, id, :snapshot_revert, drv_message)

steps = [
# Run the snapshot_revert action script
{
:driver => :vmm,
:action => :snapshot_revert,
:parameters => [:deploy_id, snapshot_name]
},
# Execute post-boot networking setup
{
:driver => :vnm,
:action => :post,
:parameters => [:deploy_id, :host]
}
]

action.run(steps)
end

#
Expand Down

0 comments on commit 2efd976

Please sign in to comment.