9bd84112f9
virt-manager.spec - bnc#801987 - virt-manager is not able to create new VM in qemu Updated virtman-vminstall.diff - fate##314135: Support PVSCSI on XEN and VirtioSCSI on KVM - Implement pass through block device - fate##313076: HBA passthrough for kvm virtman-git-scsi.diff virtman-git-scsi-lun.diff OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=111
104 lines
4.4 KiB
Diff
104 lines
4.4 KiB
Diff
|
|
Subject: Add virtio-scsi disk bus option
|
|
From: ChenHanxiao chenhanxiao@cn.fujitsu.com Fri Dec 7 18:21:38 2012 +0800
|
|
Date: Sun Dec 9 14:28:42 2012 -0500:
|
|
Git: ad1b24e885670d36b4ffd3a96434fd19dbe2ce98
|
|
|
|
This patch will add virtio-scsi bus option on "Add New Virtual
|
|
Hardware" GUI page. It will support users to add a virtual disk
|
|
using SCSI bus with a controller model virtio-scsi.
|
|
If there is no SCSI controller existed, a new SCSI controller by
|
|
model 'virtio-scsi' will be added automatically.
|
|
|
|
Signed-off-by: ChenHanxiao <chenhanxiao@cn.fujitsu.com>
|
|
|
|
(crobinso: add Chen to AUTHORS, some cosmetic tweaks)
|
|
|
|
Index: virt-manager-0.9.4/AUTHORS
|
|
===================================================================
|
|
--- virt-manager-0.9.4.orig/AUTHORS
|
|
+++ virt-manager-0.9.4/AUTHORS
|
|
@@ -81,6 +81,7 @@ Further patches have been submitted by:
|
|
Nathan Bird <nathan-at-acceleration-dot-net>
|
|
Guannan Ren <gren-at-redhat-dot-com>
|
|
Eduardo Elias Ferreira <edusf-at-linux-dot-vnet-dot-ibm-dot-com>
|
|
+ ChenHanxiao <chenhanxiao-at-cn-dot-fujitsu-dot-com>
|
|
|
|
<...send a patch & get your name here...>
|
|
|
|
Index: virt-manager-0.9.4/src/virtManager/addhardware.py
|
|
===================================================================
|
|
--- virt-manager-0.9.4.orig/src/virtManager/addhardware.py
|
|
+++ virt-manager-0.9.4/src/virtManager/addhardware.py
|
|
@@ -28,6 +28,7 @@ from virtinst import (VirtualCharDevice,
|
|
VirtualVideoDevice, VirtualWatchdog,
|
|
VirtualFilesystem, VirtualSmartCardDevice,
|
|
VirtualRedirDevice)
|
|
+from virtinst.VirtualController import VirtualControllerSCSI
|
|
|
|
import virtManager.util as util
|
|
import virtManager.uihelpers as uihelpers
|
|
@@ -539,6 +540,8 @@ class vmmAddHardware(vmmGObjectUI):
|
|
if self.vm.get_hv_type() == "kvm":
|
|
add_dev("sata", virtinst.VirtualDisk.DEVICE_DISK, "SATA disk")
|
|
add_dev("virtio", virtinst.VirtualDisk.DEVICE_DISK, "Virtio disk")
|
|
+ add_dev("virtio-scsi", virtinst.VirtualDisk.DEVICE_DISK,
|
|
+ _("Virtio SCSI disk"))
|
|
if self.conn.is_xen():
|
|
add_dev("xen", virtinst.VirtualDisk.DEVICE_DISK, "Virtual disk")
|
|
|
|
@@ -1151,9 +1154,15 @@ class vmmAddHardware(vmmGObjectUI):
|
|
self._dev.get_xml_config()
|
|
logging.debug("Adding device:\n" + self._dev.get_xml_config())
|
|
|
|
+ controller = getattr(self._dev, "vmm_controller", None)
|
|
+ if controller is not None:
|
|
+ logging.debug("Adding controller:\n%s",
|
|
+ self._dev.vmm_controller.get_xml_config())
|
|
# Hotplug device
|
|
attach_err = False
|
|
try:
|
|
+ if controller is not None:
|
|
+ self.vm.attach_device(self._dev.vmm_controller)
|
|
self.vm.attach_device(self._dev)
|
|
except Exception, e:
|
|
logging.debug("Device could not be hotplugged: %s", str(e))
|
|
@@ -1176,6 +1185,8 @@ class vmmAddHardware(vmmGObjectUI):
|
|
|
|
# Alter persistent config
|
|
try:
|
|
+ if controller is not None:
|
|
+ self.vm.add_device(self._dev.vmm_controller)
|
|
self.vm.add_device(self._dev)
|
|
except Exception, e:
|
|
self.err.show_err(_("Error adding device: %s" % str(e)))
|
|
@@ -1221,6 +1232,10 @@ class vmmAddHardware(vmmGObjectUI):
|
|
bus, device = self.get_config_disk_target()
|
|
cache = self.get_config_disk_cache()
|
|
fmt = self.get_config_disk_format()
|
|
+ controller_model = None
|
|
+ if bus == "virtio-scsi":
|
|
+ bus = "scsi"
|
|
+ controller_model = "virtio-scsi"
|
|
|
|
# Make sure default pool is running
|
|
if self.is_default_storage():
|
|
@@ -1315,6 +1330,17 @@ class vmmAddHardware(vmmGObjectUI):
|
|
uihelpers.check_path_search_for_qemu(self.topwin,
|
|
self.conn, disk.path)
|
|
|
|
+ # Add a SCSI controller with model virtio-scsi if needed
|
|
+ disk.vmm_controller = None
|
|
+ if (controller_model == "virtio-scsi") and (bus == "scsi"):
|
|
+ controllers = self.vm.get_controller_devices()
|
|
+ controller = VirtualControllerSCSI(conn = self.conn.vmm)
|
|
+ controller.set_model(controller_model)
|
|
+ disk.vmm_controller = controller
|
|
+ for d in controllers:
|
|
+ if controller_model == d.model:
|
|
+ disk.vmm_controller = None
|
|
+
|
|
self._dev = disk
|
|
return True
|
|
|