mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
xend: Revert 15252:31ee1768e911 ("Make device detach wait for detach to complete").
Has a bad interaction with 12520 in destroyDevice(), where devid is not an integer as expected. I'm not sure which of these changesets is really the bogus one, but this one went in later so it loses. :-) Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
1 parent
46689ef0a9
commit
dd34063f08
3 files changed
+5
-75
No files matched your search
@@ -1274,21 +1274,6 @@ class XendConfig(dict):
|
||||
|
||||
return False
|
||||
|
||||
def device_remove(self, dev_uuid):
|
||||
"""Remove an existing device referred by dev_uuid.
|
||||
"""
|
||||
|
||||
if dev_uuid in self['devices']:
|
||||
dev_config = self['devices'].get(dev_uuid)
|
||||
dev_type = dev_config[0]
|
||||
|
||||
del self['devices'][dev_uuid]
|
||||
# Remove dev references for certain device types (see device_add)
|
||||
if dev_type in ('vif', 'vbd', 'vtpm'):
|
||||
param = '%s_refs' % dev_type
|
||||
if param in self:
|
||||
if dev_uuid in self[param]:
|
||||
self[param].remove(dev_uuid)
|
||||
|
||||
def device_sxpr(self, dev_uuid = None, dev_type = None, dev_info = None):
|
||||
"""Get Device SXPR by either giving the device UUID or (type, config).
|
||||
|
||||
@@ -557,23 +557,7 @@ class XendDomainInfo:
|
||||
return None
|
||||
|
||||
log.debug("dev = %s", dev)
|
||||
|
||||
dev_control = self.getDeviceController(deviceClass)
|
||||
dev_uuid = dev_control.readBackend(dev, 'uuid')
|
||||
|
||||
ret = None
|
||||
|
||||
try:
|
||||
ret = dev_control.destroyDevice(dev, force)
|
||||
except EnvironmentError:
|
||||
# We failed to detach the device
|
||||
raise VmError("Failed to detach device %d" % dev)
|
||||
|
||||
# update XendConfig
|
||||
if dev_uuid:
|
||||
self.info.device_remove(dev_uuid)
|
||||
|
||||
return ret
|
||||
return self.getDeviceController(deviceClass).destroyDevice(dev, force)
|
||||
|
||||
def getDeviceSxprs(self, deviceClass):
|
||||
if self._stateGet() in (DOM_STATE_RUNNING, DOM_STATE_PAUSED):
|
||||
@@ -587,6 +571,7 @@ class XendDomainInfo:
|
||||
dev_num += 1
|
||||
return sxprs
|
||||
|
||||
|
||||
def setMemoryTarget(self, target):
|
||||
"""Set the memory target of this domain.
|
||||
@param target: In MiB.
|
||||
|
||||
@@ -29,7 +29,6 @@ from xen.xend.xenstore.xswatch import xswatch
|
||||
import os
|
||||
|
||||
DEVICE_CREATE_TIMEOUT = 100
|
||||
DEVICE_DESTROY_TIMEOUT = 10
|
||||
HOTPLUG_STATUS_NODE = "hotplug-status"
|
||||
HOTPLUG_ERROR_NODE = "hotplug-error"
|
||||
HOTPLUG_STATUS_ERROR = "error"
|
||||
@@ -212,34 +211,17 @@ class DevController:
|
||||
|
||||
devid = int(devid)
|
||||
|
||||
frontpath = self.frontendPath(devid)
|
||||
if frontpath:
|
||||
backpath = xstransact.Read(frontpath, "backend")
|
||||
|
||||
# Modify online status /before/ updating state (latter is watched by
|
||||
# drivers, so this ordering avoids a race).
|
||||
self.writeBackend(devid, 'online', "0")
|
||||
self.writeBackend(devid, 'state', str(xenbusState['Closing']))
|
||||
|
||||
if force:
|
||||
frontpath = self.frontendPath(devid)
|
||||
backpath = xstransact.Read(frontpath, "backend")
|
||||
if backpath:
|
||||
xstransact.Remove(backpath)
|
||||
if frontpath:
|
||||
xstransact.Remove(frontpath)
|
||||
return
|
||||
|
||||
# Wait till both frontpath and backpath are removed from
|
||||
# xenstore, or timed out
|
||||
if frontpath:
|
||||
status = self.waitUntilDestroyed(frontpath)
|
||||
if status == Timeout:
|
||||
# Exception will be caught by destroyDevice in XendDomainInfo.py
|
||||
raise EnvironmentError
|
||||
if backpath:
|
||||
status = self.waitUntilDestroyed(backpath)
|
||||
if status == Timeout:
|
||||
# Exception will be caught by destroyDevice in XendDomainInfo.py
|
||||
raise EnvironmentError
|
||||
xstransact.Remove(frontpath)
|
||||
|
||||
self.vm._removeVm("device/%s/%d" % (self.deviceClass, devid))
|
||||
|
||||
@@ -526,16 +508,6 @@ class DevController:
|
||||
return (Missing, None)
|
||||
|
||||
|
||||
def waitUntilDestroyed(self, path):
|
||||
ev = Event()
|
||||
result = { 'path': path, 'status': Timeout }
|
||||
|
||||
xswatch(path, destroyCallback, ev, result)
|
||||
|
||||
ev.wait(DEVICE_DESTROY_TIMEOUT)
|
||||
return result['status']
|
||||
|
||||
|
||||
def backendPath(self, backdom, devid):
|
||||
"""Construct backend path given the backend domain and device id.
|
||||
|
||||
@@ -565,18 +537,6 @@ class DevController:
|
||||
self.deviceClass)
|
||||
|
||||
|
||||
def destroyCallback(devPath, ev, result):
|
||||
log.debug("destroyCallback %s.", devPath)
|
||||
|
||||
list = xstransact.List(result['path'])
|
||||
if list:
|
||||
return 1
|
||||
|
||||
result['status'] = Missing
|
||||
ev.set()
|
||||
log.debug("destroyCallback %s is destroyed", result['path'])
|
||||
return 0
|
||||
|
||||
def hotplugStatusCallback(statusPath, ev, result):
|
||||
log.debug("hotplugStatusCallback %s.", statusPath)
|
||||
|
||||
|
||||