Re: [libvirt] [PATCH 1/2] util: Add "shareable" field for virSCSIDevice struct

2014-01-23 Thread Osier Yang

On 16/01/14 08:51, John Ferlan wrote:


On 01/08/2014 09:51 AM, Osier Yang wrote:


<...>


diff --git a/src/util/virscsi.c b/src/util/virscsi.c
index 751eaf0..3998c3a 100644
--- a/src/util/virscsi.c
+++ b/src/util/virscsi.c
@@ -58,6 +58,7 @@ struct _virSCSIDevice {
  const char *used_by; /* name of the domain using this dev */
  
  bool readonly;

+bool shareable;
  };
  
  struct _virSCSIDeviceList {

@@ -185,7 +186,8 @@ virSCSIDeviceNew(const char *adapter,
   unsigned int bus,
   unsigned int target,
   unsigned int unit,
- bool readonly)
+ bool readonly,
+ bool shareable)
  {
  virSCSIDevicePtr dev, ret = NULL;
  char *sg = NULL;
@@ -201,6 +203,7 @@ virSCSIDeviceNew(const char *adapter,
  dev->target = target;
  dev->unit = unit;
  dev->readonly = readonly;
+dev->shareable= shareable;
You still didn't add the space here before the "="


ACK if you do. I don't believe this is 1.2.1 material.



This patch is standalone.  Pushed with the indention fixed.

Osier

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 1/2] util: Add "shareable" field for virSCSIDevice struct

2014-01-15 Thread John Ferlan


On 01/08/2014 09:51 AM, Osier Yang wrote:
> Unlike the host devices of other types, SCSI host device XML supports
> "shareable" tag. This patch introduces it for the virSCSIDevice struct
> for a later patch use (to detect if the SCSI device is shareable when
> preparing the SCSI host device in QEMU driver).
> ---
>  src/libvirt_private.syms |  1 +
>  src/qemu/qemu_cgroup.c   |  3 ++-
>  src/qemu/qemu_hostdev.c  |  9 ++---
>  src/security/security_apparmor.c |  3 ++-
>  src/security/security_dac.c  |  6 --
>  src/security/security_selinux.c  |  6 --
>  src/util/virscsi.c   | 11 ++-
>  src/util/virscsi.h   |  4 +++-
>  8 files changed, 32 insertions(+), 11 deletions(-)
> 
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index fbc9e11..65d1bde 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -1674,6 +1674,7 @@ virSCSIDeviceGetDevName;
>  virSCSIDeviceGetName;
>  virSCSIDeviceGetReadonly;
>  virSCSIDeviceGetSgName;
> +virSCSIDeviceGetShareable;
>  virSCSIDeviceGetTarget;
>  virSCSIDeviceGetUnit;
>  virSCSIDeviceGetUsedBy;
> diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
> index a18955e..10b1131 100644
> --- a/src/qemu/qemu_cgroup.c
> +++ b/src/qemu/qemu_cgroup.c
> @@ -295,7 +295,8 @@ qemuSetupHostdevCGroup(virDomainObjPtr vm,
>   dev->source.subsys.u.scsi.bus,
>   dev->source.subsys.u.scsi.target,
>   dev->source.subsys.u.scsi.unit,
> - dev->readonly)) == NULL)
> + dev->readonly,
> + dev->shareable)) == NULL)
>  goto cleanup;
>  
>  if (virSCSIDeviceFileIterate(scsi,
> diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
> index dee61e7..86a463a 100644
> --- a/src/qemu/qemu_hostdev.c
> +++ b/src/qemu/qemu_hostdev.c
> @@ -267,7 +267,8 @@ qemuUpdateActiveScsiHostdevs(virQEMUDriverPtr driver,
>hostdev->source.subsys.u.scsi.bus,
>hostdev->source.subsys.u.scsi.target,
>hostdev->source.subsys.u.scsi.unit,
> -  hostdev->readonly)))
> +  hostdev->readonly,
> +  hostdev->shareable)))
>  goto cleanup;
>  
>  virSCSIDeviceSetUsedBy(scsi, def->name);
> @@ -1097,7 +1098,8 @@ qemuPrepareHostdevSCSIDevices(virQEMUDriverPtr driver,
>hostdev->source.subsys.u.scsi.bus,
>hostdev->source.subsys.u.scsi.target,
>hostdev->source.subsys.u.scsi.unit,
> -  hostdev->readonly)))
> +  hostdev->readonly,
> +  hostdev->shareable)))
>  goto cleanup;
>  
>  if (scsi && virSCSIDeviceListAdd(list, scsi) < 0) {
> @@ -1395,7 +1397,8 @@ qemuDomainReAttachHostScsiDevices(virQEMUDriverPtr 
> driver,
>hostdev->source.subsys.u.scsi.bus,
>hostdev->source.subsys.u.scsi.target,
>hostdev->source.subsys.u.scsi.unit,
> -  hostdev->readonly))) {
> +  hostdev->readonly,
> +  hostdev->shareable))) {
>  VIR_WARN("Unable to reattach SCSI device %s:%d:%d:%d on domain 
> %s",
>   hostdev->source.subsys.u.scsi.adapter,
>   hostdev->source.subsys.u.scsi.bus,
> diff --git a/src/security/security_apparmor.c 
> b/src/security/security_apparmor.c
> index a9f04d2..86a033f 100644
> --- a/src/security/security_apparmor.c
> +++ b/src/security/security_apparmor.c
> @@ -833,7 +833,8 @@ AppArmorSetSecurityHostdevLabel(virSecurityManagerPtr mgr,
>   dev->source.subsys.u.scsi.bus,
>   dev->source.subsys.u.scsi.target,
>   dev->source.subsys.u.scsi.unit,
> - dev->readonly);
> + dev->readonly,
> + dev->shareable);
>  
>   if (!scsi)
>   goto done;
> diff --git a/src/security/security_dac.c b/src/security/security_dac.c
> index cb7d322..0952df9 100644
> --- a/src/security/security_dac.c
> +++ b/src/security/security_dac.c
> @@ -536,7 +536,8 @@ 
> virSecurityDACSetSecurityHostdevLabel(virSecurityManagerPtr mgr,
>   dev->source.subsys.u.scsi.bus,
>   dev->source.subsys.u.scsi.

[libvirt] [PATCH 1/2] util: Add "shareable" field for virSCSIDevice struct

2014-01-08 Thread Osier Yang
Unlike the host devices of other types, SCSI host device XML supports
"shareable" tag. This patch introduces it for the virSCSIDevice struct
for a later patch use (to detect if the SCSI device is shareable when
preparing the SCSI host device in QEMU driver).
---
 src/libvirt_private.syms |  1 +
 src/qemu/qemu_cgroup.c   |  3 ++-
 src/qemu/qemu_hostdev.c  |  9 ++---
 src/security/security_apparmor.c |  3 ++-
 src/security/security_dac.c  |  6 --
 src/security/security_selinux.c  |  6 --
 src/util/virscsi.c   | 11 ++-
 src/util/virscsi.h   |  4 +++-
 8 files changed, 32 insertions(+), 11 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index fbc9e11..65d1bde 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1674,6 +1674,7 @@ virSCSIDeviceGetDevName;
 virSCSIDeviceGetName;
 virSCSIDeviceGetReadonly;
 virSCSIDeviceGetSgName;
+virSCSIDeviceGetShareable;
 virSCSIDeviceGetTarget;
 virSCSIDeviceGetUnit;
 virSCSIDeviceGetUsedBy;
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index a18955e..10b1131 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -295,7 +295,8 @@ qemuSetupHostdevCGroup(virDomainObjPtr vm,
  dev->source.subsys.u.scsi.bus,
  dev->source.subsys.u.scsi.target,
  dev->source.subsys.u.scsi.unit,
- dev->readonly)) == NULL)
+ dev->readonly,
+ dev->shareable)) == NULL)
 goto cleanup;
 
 if (virSCSIDeviceFileIterate(scsi,
diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index dee61e7..86a463a 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -267,7 +267,8 @@ qemuUpdateActiveScsiHostdevs(virQEMUDriverPtr driver,
   hostdev->source.subsys.u.scsi.bus,
   hostdev->source.subsys.u.scsi.target,
   hostdev->source.subsys.u.scsi.unit,
-  hostdev->readonly)))
+  hostdev->readonly,
+  hostdev->shareable)))
 goto cleanup;
 
 virSCSIDeviceSetUsedBy(scsi, def->name);
@@ -1097,7 +1098,8 @@ qemuPrepareHostdevSCSIDevices(virQEMUDriverPtr driver,
   hostdev->source.subsys.u.scsi.bus,
   hostdev->source.subsys.u.scsi.target,
   hostdev->source.subsys.u.scsi.unit,
-  hostdev->readonly)))
+  hostdev->readonly,
+  hostdev->shareable)))
 goto cleanup;
 
 if (scsi && virSCSIDeviceListAdd(list, scsi) < 0) {
@@ -1395,7 +1397,8 @@ qemuDomainReAttachHostScsiDevices(virQEMUDriverPtr driver,
   hostdev->source.subsys.u.scsi.bus,
   hostdev->source.subsys.u.scsi.target,
   hostdev->source.subsys.u.scsi.unit,
-  hostdev->readonly))) {
+  hostdev->readonly,
+  hostdev->shareable))) {
 VIR_WARN("Unable to reattach SCSI device %s:%d:%d:%d on domain %s",
  hostdev->source.subsys.u.scsi.adapter,
  hostdev->source.subsys.u.scsi.bus,
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index a9f04d2..86a033f 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -833,7 +833,8 @@ AppArmorSetSecurityHostdevLabel(virSecurityManagerPtr mgr,
  dev->source.subsys.u.scsi.bus,
  dev->source.subsys.u.scsi.target,
  dev->source.subsys.u.scsi.unit,
- dev->readonly);
+ dev->readonly,
+ dev->shareable);
 
  if (!scsi)
  goto done;
diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index cb7d322..0952df9 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -536,7 +536,8 @@ virSecurityDACSetSecurityHostdevLabel(virSecurityManagerPtr 
mgr,
  dev->source.subsys.u.scsi.bus,
  dev->source.subsys.u.scsi.target,
  dev->source.subsys.u.scsi.unit,
- dev->readonly);
+ dev->readonly,
+ dev->shareable);
 
 if (!scsi)
 goto

Re: [libvirt] [PATCH 1/2] util: Add "shareable" field for virSCSIDevice struct

2014-01-06 Thread John Ferlan


On 01/02/2014 09:45 AM, Osier Yang wrote:
> Unlike the host devices of other types, SCSI host device XML supports
> "shareable" tag. This patch introduces it for the virSCSIDevice struct
> for a later patch use (to detect if the SCSI device is shareable when
> preparing the SCSI host device in QEMU driver).
> ---
>  src/libvirt_private.syms |  1 +
>  src/qemu/qemu_cgroup.c   |  3 ++-
>  src/qemu/qemu_hostdev.c  |  9 ++---
>  src/security/security_apparmor.c |  3 ++-
>  src/security/security_dac.c  |  6 --
>  src/security/security_selinux.c  |  6 --
>  src/util/virscsi.c   | 11 ++-
>  src/util/virscsi.h   |  4 +++-
>  8 files changed, 32 insertions(+), 11 deletions(-)
> 
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index 2dbb8f8..68ca5da 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -1671,6 +1671,7 @@ virSCSIDeviceGetDevName;
>  virSCSIDeviceGetName;
>  virSCSIDeviceGetReadonly;
>  virSCSIDeviceGetSgName;
> +virSCSIDeviceGetShareable;
>  virSCSIDeviceGetTarget;
>  virSCSIDeviceGetUnit;
>  virSCSIDeviceGetUsedBy;
> diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
> index a18955e..10b1131 100644
> --- a/src/qemu/qemu_cgroup.c
> +++ b/src/qemu/qemu_cgroup.c
> @@ -295,7 +295,8 @@ qemuSetupHostdevCGroup(virDomainObjPtr vm,
>   dev->source.subsys.u.scsi.bus,
>   dev->source.subsys.u.scsi.target,
>   dev->source.subsys.u.scsi.unit,
> - dev->readonly)) == NULL)
> + dev->readonly,
> + dev->shareable)) == NULL)
>  goto cleanup;
>  
>  if (virSCSIDeviceFileIterate(scsi,
> diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
> index dee61e7..86a463a 100644
> --- a/src/qemu/qemu_hostdev.c
> +++ b/src/qemu/qemu_hostdev.c
> @@ -267,7 +267,8 @@ qemuUpdateActiveScsiHostdevs(virQEMUDriverPtr driver,
>hostdev->source.subsys.u.scsi.bus,
>hostdev->source.subsys.u.scsi.target,
>hostdev->source.subsys.u.scsi.unit,
> -  hostdev->readonly)))
> +  hostdev->readonly,
> +  hostdev->shareable)))
>  goto cleanup;
>  
>  virSCSIDeviceSetUsedBy(scsi, def->name);
> @@ -1097,7 +1098,8 @@ qemuPrepareHostdevSCSIDevices(virQEMUDriverPtr driver,
>hostdev->source.subsys.u.scsi.bus,
>hostdev->source.subsys.u.scsi.target,
>hostdev->source.subsys.u.scsi.unit,
> -  hostdev->readonly)))
> +  hostdev->readonly,
> +  hostdev->shareable)))
>  goto cleanup;
>  
>  if (scsi && virSCSIDeviceListAdd(list, scsi) < 0) {
> @@ -1395,7 +1397,8 @@ qemuDomainReAttachHostScsiDevices(virQEMUDriverPtr 
> driver,
>hostdev->source.subsys.u.scsi.bus,
>hostdev->source.subsys.u.scsi.target,
>hostdev->source.subsys.u.scsi.unit,
> -  hostdev->readonly))) {
> +  hostdev->readonly,
> +  hostdev->shareable))) {
>  VIR_WARN("Unable to reattach SCSI device %s:%d:%d:%d on domain 
> %s",
>   hostdev->source.subsys.u.scsi.adapter,
>   hostdev->source.subsys.u.scsi.bus,
> diff --git a/src/security/security_apparmor.c 
> b/src/security/security_apparmor.c
> index a9f04d2..86a033f 100644
> --- a/src/security/security_apparmor.c
> +++ b/src/security/security_apparmor.c
> @@ -833,7 +833,8 @@ AppArmorSetSecurityHostdevLabel(virSecurityManagerPtr mgr,
>   dev->source.subsys.u.scsi.bus,
>   dev->source.subsys.u.scsi.target,
>   dev->source.subsys.u.scsi.unit,
> - dev->readonly);
> + dev->readonly,
> + dev->shareable);
>  
>   if (!scsi)
>   goto done;
> diff --git a/src/security/security_dac.c b/src/security/security_dac.c
> index cb7d322..0952df9 100644
> --- a/src/security/security_dac.c
> +++ b/src/security/security_dac.c
> @@ -536,7 +536,8 @@ 
> virSecurityDACSetSecurityHostdevLabel(virSecurityManagerPtr mgr,
>   dev->source.subsys.u.scsi.bus,
>   dev->source.subsys.u.scsi.

[libvirt] [PATCH 1/2] util: Add "shareable" field for virSCSIDevice struct

2014-01-02 Thread Osier Yang
Unlike the host devices of other types, SCSI host device XML supports
"shareable" tag. This patch introduces it for the virSCSIDevice struct
for a later patch use (to detect if the SCSI device is shareable when
preparing the SCSI host device in QEMU driver).
---
 src/libvirt_private.syms |  1 +
 src/qemu/qemu_cgroup.c   |  3 ++-
 src/qemu/qemu_hostdev.c  |  9 ++---
 src/security/security_apparmor.c |  3 ++-
 src/security/security_dac.c  |  6 --
 src/security/security_selinux.c  |  6 --
 src/util/virscsi.c   | 11 ++-
 src/util/virscsi.h   |  4 +++-
 8 files changed, 32 insertions(+), 11 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 2dbb8f8..68ca5da 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1671,6 +1671,7 @@ virSCSIDeviceGetDevName;
 virSCSIDeviceGetName;
 virSCSIDeviceGetReadonly;
 virSCSIDeviceGetSgName;
+virSCSIDeviceGetShareable;
 virSCSIDeviceGetTarget;
 virSCSIDeviceGetUnit;
 virSCSIDeviceGetUsedBy;
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index a18955e..10b1131 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -295,7 +295,8 @@ qemuSetupHostdevCGroup(virDomainObjPtr vm,
  dev->source.subsys.u.scsi.bus,
  dev->source.subsys.u.scsi.target,
  dev->source.subsys.u.scsi.unit,
- dev->readonly)) == NULL)
+ dev->readonly,
+ dev->shareable)) == NULL)
 goto cleanup;
 
 if (virSCSIDeviceFileIterate(scsi,
diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index dee61e7..86a463a 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -267,7 +267,8 @@ qemuUpdateActiveScsiHostdevs(virQEMUDriverPtr driver,
   hostdev->source.subsys.u.scsi.bus,
   hostdev->source.subsys.u.scsi.target,
   hostdev->source.subsys.u.scsi.unit,
-  hostdev->readonly)))
+  hostdev->readonly,
+  hostdev->shareable)))
 goto cleanup;
 
 virSCSIDeviceSetUsedBy(scsi, def->name);
@@ -1097,7 +1098,8 @@ qemuPrepareHostdevSCSIDevices(virQEMUDriverPtr driver,
   hostdev->source.subsys.u.scsi.bus,
   hostdev->source.subsys.u.scsi.target,
   hostdev->source.subsys.u.scsi.unit,
-  hostdev->readonly)))
+  hostdev->readonly,
+  hostdev->shareable)))
 goto cleanup;
 
 if (scsi && virSCSIDeviceListAdd(list, scsi) < 0) {
@@ -1395,7 +1397,8 @@ qemuDomainReAttachHostScsiDevices(virQEMUDriverPtr driver,
   hostdev->source.subsys.u.scsi.bus,
   hostdev->source.subsys.u.scsi.target,
   hostdev->source.subsys.u.scsi.unit,
-  hostdev->readonly))) {
+  hostdev->readonly,
+  hostdev->shareable))) {
 VIR_WARN("Unable to reattach SCSI device %s:%d:%d:%d on domain %s",
  hostdev->source.subsys.u.scsi.adapter,
  hostdev->source.subsys.u.scsi.bus,
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index a9f04d2..86a033f 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -833,7 +833,8 @@ AppArmorSetSecurityHostdevLabel(virSecurityManagerPtr mgr,
  dev->source.subsys.u.scsi.bus,
  dev->source.subsys.u.scsi.target,
  dev->source.subsys.u.scsi.unit,
- dev->readonly);
+ dev->readonly,
+ dev->shareable);
 
  if (!scsi)
  goto done;
diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index cb7d322..0952df9 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -536,7 +536,8 @@ virSecurityDACSetSecurityHostdevLabel(virSecurityManagerPtr 
mgr,
  dev->source.subsys.u.scsi.bus,
  dev->source.subsys.u.scsi.target,
  dev->source.subsys.u.scsi.unit,
- dev->readonly);
+ dev->readonly,
+ dev->shareable);
 
 if (!scsi)
 goto