Skip to content

Commit

Permalink
Bug fix kimchi-project#1073: Re-attach device to host when detaching …
Browse files Browse the repository at this point in the history
…it from guest

Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com>
  • Loading branch information
alinefm committed Jan 4, 2017
1 parent 6288c73 commit 8fce3b1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions model/vmhostdevs.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,13 @@ def _event_devices(self, conn, dom, alias, opaque):
return

wok_log.info("Device %s removed successfuly" % alias)
# Re-attach device to host
try:
dev = conn.get().nodeDeviceLookupByName(alias)
dev.reAttach()
except libvirt.libvirtError, e:
wok_log.error("Unable to attach device %s back to host. Error: %s",
alias, e.message)
opaque._cb('OK', True)

def _detach_device(self, cb, params):
Expand Down

0 comments on commit 8fce3b1

Please sign in to comment.