qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Johannes Thumshirn <jthumshirn@suse.com>,
	Stefan Hajnoczi <stefanha@gmail.com>,
	Hannes Reinecke <hare@suse.de>,
	qemu-devel@nongnu.org, Alexander Graf <agraf@suse.de>
Subject: [Qemu-devel] [PATCH 7/8] scsi-disk: Implement 'alua_preferred' option
Date: Fri, 27 Nov 2015 15:59:05 +0100	[thread overview]
Message-ID: <1448636346-24641-8-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1448636346-24641-1-git-send-email-hare@suse.de>

Implement an option to set the 'preferred path' bit in the
REPORT TARGET PORT GROUPS output.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 hw/scsi/scsi-disk.c | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index b3ab890..07e0c28 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -3411,6 +3411,38 @@ out:
     }
 }
 
+static void scsi_disk_get_alua_pref(Object *obj, Visitor *v, void *opaque,
+                                      const char *name, Error **errp)
+{
+    SCSIDiskState *s = OBJECT_CHECK(SCSIDiskState, obj, "scsi-disk");
+    bool pref = !!(s->alua_state & 0x80);
+
+    visit_type_bool(v, &pref, name, errp);
+}
+
+static void scsi_disk_set_alua_pref(Object *obj, Visitor *v, void *opaque,
+                                      const char *name, Error **errp)
+{
+    SCSIDiskState *s = OBJECT_CHECK(SCSIDiskState, obj, "scsi-disk");
+    bool pref;
+    Error *local_err = NULL;
+
+    visit_type_bool(v, &pref, name, &local_err);
+    if (local_err) {
+        goto out;
+    }
+
+    if (pref) {
+        s->alua_state |= 0x80;
+    } else {
+        s->alua_state &= ~0x80;
+    }
+out:
+    if (local_err) {
+        error_propagate(errp, local_err);
+    }
+}
+
 static void scsi_disk_instance_initfn(Object *obj)
 {
     object_property_add(obj, "alua_state", "uint8",
@@ -3421,6 +3453,11 @@ static void scsi_disk_instance_initfn(Object *obj)
                         scsi_disk_get_alua_policy,
                         scsi_disk_set_alua_policy, NULL, NULL, NULL);
     object_property_set_str(obj, "", "alua_policy", NULL);
+
+    object_property_add(obj, "alua_preferred", "bool",
+                        scsi_disk_get_alua_pref,
+                        scsi_disk_set_alua_pref, NULL, NULL, NULL);
+    object_property_set_bool(obj, false, "alua_preferred", NULL);
 }
 
 static const TypeInfo scsi_disk_info = {
-- 
1.8.4.5

  parent reply	other threads:[~2015-11-27 14:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-27 14:58 [Qemu-devel] [PATCH RFC 0/8] scsi-disk: Active/passive ALUA support Hannes Reinecke
2015-11-27 14:58 ` [Qemu-devel] [PATCH 1/8] scsi-disk: Add 'port_group' property Hannes Reinecke
2015-11-27 14:59 ` [Qemu-devel] [PATCH 2/8] scsi-disk: Add 'alua_state' property Hannes Reinecke
2015-11-27 14:59 ` [Qemu-devel] [PATCH 3/8] scsi-disk: Implement 'REPORT TARGET PORT GROUPS' Hannes Reinecke
2015-11-27 14:59 ` [Qemu-devel] [PATCH 4/8] scsi-disk: Implement 'SET " Hannes Reinecke
2015-11-27 14:59 ` [Qemu-devel] [PATCH 5/8] scsi-disk: implement ALUA policy Hannes Reinecke
2015-11-27 14:59 ` [Qemu-devel] [PATCH 6/8] scsi-disk: Allow READ CAPACITY in standby Hannes Reinecke
2015-11-27 14:59 ` Hannes Reinecke [this message]
2015-11-27 14:59 ` [Qemu-devel] [PATCH 8/8] block: Implement 'block_disconnect' HMP command Hannes Reinecke
2015-11-27 18:00   ` Eric Blake
2015-12-10  8:26 ` [Qemu-devel] [PATCH RFC 0/8] scsi-disk: Active/passive ALUA support Stefan Hajnoczi
2015-12-10  9:13   ` Hannes Reinecke
2015-12-14  7:24     ` Stefan Hajnoczi
2015-12-14  7:35       ` Hannes Reinecke
2015-12-15  3:02         ` Stefan Hajnoczi
2015-12-15  6:49           ` Hannes Reinecke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1448636346-24641-8-git-send-email-hare@suse.de \
    --to=hare@suse.de \
    --cc=agraf@suse.de \
    --cc=jthumshirn@suse.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).