Martin Polednik has uploaded a new change for review.
Change subject: vdsm hostdev: add support for SCSI devices ......................................................................
vdsm hostdev: add support for SCSI devices
Libvirt allows passthrough of SCSI devices - this patch exposes the functionality in vdsm
Change-Id: Ia953bcd5eda1b97235a8dd2f5f9593d8f302e5d6 Signed-off-by: Martin Polednik mpoledni@redhat.com --- M vdsm/caps.py M vdsm/rpc/vdsmapi-schema.json M vdsm/virt/vm.py 3 files changed, 51 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/58/29058/1
diff --git a/vdsm/caps.py b/vdsm/caps.py index 8c16af6..6112763 100644 --- a/vdsm/caps.py +++ b/vdsm/caps.py @@ -530,7 +530,7 @@ # back that we could use to uniquely identify and initiate a device continue
- if capability in ('pci', 'usb_device'): + if capability in ('pci', 'usb_device', 'scsi'): # Libvirt only allows to attach USB device with capability 'usb', # but the bus identifies itself as 'usb' while device as # 'usb_device' diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json index ac10144..52f20c1 100644 --- a/vdsm/rpc/vdsmapi-schema.json +++ b/vdsm/rpc/vdsmapi-schema.json @@ -3180,9 +3180,11 @@ # # @usb: USB device # +# @scsi: SCSI device +# # Since: 4.16.0 ## -{'enum': 'HostDeviceCapability', 'data': ['pci', 'usb']} +{'enum': 'HostDeviceCapability', 'data': ['pci', 'usb', 'scsi']}
## # @HostDeviceSpecParams: @@ -3200,11 +3202,18 @@ # @startupPolicy: #optional Possible boot handling with attached device # (for @usb) # +# @readonly #optional If present, indicates that the device is read +# only (for @scsi) +# +# @shareable #optional If present, this indicates the device is +# expected to be shared between domains (for @scsi) +# # Since: 4.16.0 ## {'type': 'HostDeviceSpecParams', 'data': {'*bootorder': 'int', '*bar': 'bool', '*file': 'str', - '*startupPolicy': 'StartupPolicy'}} + '*startupPolicy': 'StartupPolicy', '*shareable': 'bool', + '*readonly*': 'bool'}}
## # @HostDevice: diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py index 6a6978e..3cb2eb9 100644 --- a/vdsm/virt/vm.py +++ b/vdsm/virt/vm.py @@ -1670,6 +1670,33 @@ addr['vendor_id'], addr['bus'], addr['device']) return addr
+ def getScsiAddr(self): + capsxml = self._parsecaps() + addr = {} + + addr['type'] = 'scsi' + addr['bus'] = capsxml.getElementsByTagName('bus')[0].firstChild. \ + nodeValue + addr['target'] = capsxml.getElementsByTagName('target')[0]. \ + firstChild.nodeValue + addr['unit'] = capsxml.getElementsByTagName('lun')[0]. \ + firstChild.nodeValue + + self.log.debug('SCSI device %s at address ' + '{bus: %s, target: %s, unit: %s}', + self.name, addr['bus'], addr['target'], addr['unit'], + addr['device']) + return addr + + def getScsiAdapter(self): + capsxml = self._parsecaps() + + adapter = 'scsi_host{}'.format( + capsxml.getElementsByTagName('host')[0].firstChild.nodeValue) + + self.log.debug('SCSI device %s adapter %s', self.name, adapter) + return adapter + def getXML(self): """ Create domxml for a hostdev device. @@ -1717,6 +1744,18 @@ if 'startupPolicy' in self.specParams: source.setAttrs(startupPolicy=self.specParams['startupPolicy'])
+ elif self.capability == 'scsi': + source.appendChildWithArgs('address', None, + **self.getScsiHost()) + source.appendChildWithArgs('adapter', None, + **self.getScsiAdapter()) + + if 'readonly' in self.specParams: + hostdev.appendChild('readonly') + + if 'shareable' in self.specParams: + hostdev.appendChild('shareable') + return hostdev
oVirt Jenkins CI Server has posted comments on this change.
Change subject: vdsm hostdev: add support for SCSI devices ......................................................................
Patch Set 1:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/9532/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/10316/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit/10473/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_verify-error-codes_merged/5398/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_merged/3556/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_virt_functional_tests_gerrit/954/ : There was an infra issue, please contact infra@ovirt.org
oVirt Jenkins CI Server has posted comments on this change.
Change subject: vdsm hostdev: add support for SCSI devices ......................................................................
Patch Set 2:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/9540/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/10324/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit/10481/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_verify-error-codes_merged/5406/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_merged/3564/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_virt_functional_tests_gerrit/962/ : There was an infra issue, please contact infra@ovirt.org
oVirt Jenkins CI Server has posted comments on this change.
Change subject: vdsm hostdev: add support for SCSI devices ......................................................................
Patch Set 3:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/9549/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/10333/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit/10490/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_verify-error-codes_merged/5415/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_merged/3573/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_virt_functional_tests_gerrit/963/ : SUCCESS
Francesco Romani has posted comments on this change.
Change subject: vdsm hostdev: add support for SCSI devices ......................................................................
Patch Set 3:
(3 comments)
http://gerrit.ovirt.org/#/c/29058/3/vdsm/rpc/vdsmapi-schema.json File vdsm/rpc/vdsmapi-schema.json:
Line 3202: # @startupPolicy: #optional Possible boot handling with attached device Line 3203: # (for @usb) Line 3204: # Line 3205: # @shareable: #optional If present, this indicates the device is Line 3206: # expected to be shared between domains (for @scsi) second line is underindented Line 3207: # Line 3208: # @readonly: #optional If present, indicates that the device is read Line 3209: # only (for @scsi) Line 3210: #
Line 3205: # @shareable: #optional If present, this indicates the device is Line 3206: # expected to be shared between domains (for @scsi) Line 3207: # Line 3208: # @readonly: #optional If present, indicates that the device is read Line 3209: # only (for @scsi) ditto Line 3210: # Line 3211: # Since: 4.16.0 Line 3212: ## Line 3213: {'type': 'HostDeviceSpecParams',
http://gerrit.ovirt.org/#/c/29058/3/vdsm/virt/vm.py File vdsm/virt/vm.py:
Line 1746: source.setAttrs(startupPolicy=self.specParams['startupPolicy']) Line 1747: Line 1748: elif self.capability == 'scsi': Line 1749: source.appendChildWithArgs('address', None, Line 1750: **self.getScsiHost()) getScsiAddr maybe? or maybe rename getScsiAddr to getScsiHost Line 1751: source.appendChildWithArgs('adapter', None, Line 1752: **self.getScsiAdapter()) Line 1753: Line 1754: if 'readonly' in self.specParams:
oVirt Jenkins CI Server has posted comments on this change.
Change subject: vdsm hostdev: add support for SCSI devices ......................................................................
Patch Set 4:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/10408/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/11193/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_virt_functional_tests_gerrit/1363/ : There was an infra issue, please contact infra@ovirt.org
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/11350/ : FAILURE
oVirt Jenkins CI Server has posted comments on this change.
Change subject: vdsm hostdev: add support for SCSI devices ......................................................................
Patch Set 5: Code-Review-1 Verified-1
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/10410/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/11195/ : UNSTABLE
http://jenkins.ovirt.org/job/vdsm_master_virt_functional_tests_gerrit/1364/ : There was an infra issue, please contact infra@ovirt.org
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/11352/ : FAILURE
Francesco Romani has posted comments on this change.
Change subject: vdsm hostdev: add support for SCSI devices ......................................................................
Patch Set 5:
(2 comments)
initial comments
http://gerrit.ovirt.org/#/c/29058/5/vdsm/hostdev.py File vdsm/hostdev.py:
Line 55: return {'type': addr['type'], 'bus': addr['bus'], 'target': addr['target'], Line 56: 'unit': addr['lun']} Line 57: Line 58: def getScsiAdapter(self): Line 59: host = 'scsi_host{0}'.format(self._parseCaps(['host'])['host']) unneeded temporary Line 60: Line 61: return {'name': host} Line 62: Line 63: def _parseCaps(self, elements):
Line 70: ret[element] = capsxml.getElementsByTagName(element)[0].\ Line 71: firstChild.nodeValue Line 72: Line 73: try: Line 74: ret[element] = hex(int(ret[element])) why do we need this dance? Line 75: except: Line 76: pass Line 77: Line 78: return ret
Martin Polednik has abandoned this change.
Change subject: vdsm hostdev: add support for SCSI devices ......................................................................
Abandoned
automation@ovirt.org has posted comments on this change.
Change subject: vdsm hostdev: add support for SCSI devices ......................................................................
Patch Set 5:
* Update tracker::IGNORE, no Bug-Url found
vdsm-patches@lists.fedorahosted.org