mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 18:21:39 +01:00
xend: Fix vscsi assignment when XenAPI is available
When XenAPI is available, xm scsi-attach fails. Also xm new and xm create fail if a vscsi parameter is defined into domain configuration files. Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
This commit is contained in:
1 parent
34bbd7a252
commit
84b150afdb
4 files changed
+15
-5
No files matched your search
@@ -1848,8 +1848,11 @@ class XendConfig(dict):
|
||||
vscsi_be = vscsi_dict.get('backend', None)
|
||||
|
||||
# destroy existing XenAPI DSCSI objects
|
||||
vscsi_devid = int(dev_info['devs'][0]['devid'])
|
||||
for dscsi_uuid in XendDSCSI.get_by_VM(self['uuid']):
|
||||
XendAPIStore.deregister(dscsi_uuid, "DSCSI")
|
||||
dscsi_inst = XendAPIStore.get(dscsi_uuid, 'DSCSI')
|
||||
if vscsi_devid == dscsi_inst.get_virtual_host():
|
||||
XendAPIStore.deregister(dscsi_uuid, "DSCSI")
|
||||
|
||||
# create XenAPI DSCSI objects.
|
||||
for vscsi_dev in vscsi_devs:
|
||||
|
||||
@@ -3703,7 +3703,8 @@ class XendDomainInfo:
|
||||
['v-dev', xenapi_dscsi.get('virtual_HCTL')],
|
||||
['state', xenbusState['Initialising']],
|
||||
['uuid', dscsi_uuid]
|
||||
]
|
||||
],
|
||||
['feature-host', 0]
|
||||
]
|
||||
|
||||
if self._stateGet() != XEN_API_VM_POWER_STATE_RUNNING:
|
||||
@@ -3716,7 +3717,7 @@ class XendDomainInfo:
|
||||
raise XendError('Failed to create device')
|
||||
|
||||
else:
|
||||
new_vscsi_sxp = ['vscsi']
|
||||
new_vscsi_sxp = ['vscsi', ['feature-host', 0]]
|
||||
for existing_dev in sxp.children(cur_vscsi_sxp, 'dev'):
|
||||
new_vscsi_sxp.append(existing_dev)
|
||||
new_vscsi_sxp.append(sxp.child0(target_vscsi_sxp, 'dev'))
|
||||
@@ -3810,7 +3811,7 @@ class XendDomainInfo:
|
||||
dev_uuid = sxp.child_value(cur_vscsi_sxp, 'uuid')
|
||||
|
||||
target_dev = None
|
||||
new_vscsi_sxp = ['vscsi']
|
||||
new_vscsi_sxp = ['vscsi', ['feature-host', 0]]
|
||||
for dev in sxp.children(cur_vscsi_sxp, 'dev'):
|
||||
if vHCTL == sxp.child_value(dev, 'v-dev'):
|
||||
target_dev = dev
|
||||
@@ -3821,7 +3822,7 @@ class XendDomainInfo:
|
||||
raise XendError('Failed to destroy device')
|
||||
|
||||
target_dev.append(['state', xenbusState['Closing']])
|
||||
target_vscsi_sxp = ['vscsi', target_dev]
|
||||
target_vscsi_sxp = ['vscsi', target_dev, ['feature-host', 0]]
|
||||
|
||||
if self._stateGet() != XEN_API_VM_POWER_STATE_RUNNING:
|
||||
|
||||
|
||||
@@ -738,6 +738,9 @@ def configure_vscsis(config_devs, vals):
|
||||
|
||||
feature_host = 0
|
||||
if v_dev == 'host':
|
||||
if serverType == SERVER_XEN_API:
|
||||
# TODO
|
||||
raise ValueError("SCSI devices assignment by HBA is not implemeted")
|
||||
feature_host = 1
|
||||
scsi_info = []
|
||||
devid = get_devid(p_hctl)
|
||||
|
||||
@@ -2539,6 +2539,9 @@ def parse_scsi_configuration(p_scsi, v_hctl, state):
|
||||
if p_scsi is not None:
|
||||
# xm scsi-attach
|
||||
if v_hctl == "host":
|
||||
if serverType == SERVER_XEN_API:
|
||||
# TODO
|
||||
raise OptionError("SCSI devices assignment by HBA is not implemeted")
|
||||
host_mode = 1
|
||||
scsi_devices = vscsi_util.vscsi_get_scsidevices()
|
||||
elif len(v_hctl.split(':')) != 4:
|
||||
|
||||