qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: John Ferlan <jferlan@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org,
	Peter Lieven <pl@kamp.de>, Pino Toscano <ptoscano@redhat.com>,
	Ronnie Sahlberg <ronniesahlberg@gmail.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 for-2.6] block: convert iscsi target to a valid ID for -iscsi arg lookup
Date: Thu, 14 Apr 2016 09:25:42 +0100	[thread overview]
Message-ID: <20160414082542.GA20251@redhat.com> (raw)
In-Reply-To: <570EF562.8030309@redhat.com>

On Wed, Apr 13, 2016 at 09:41:54PM -0400, John Ferlan wrote:
> 
> 
> On 04/13/2016 12:17 PM, Daniel P. Berrange wrote:
> > The iSCSI block driver has a very strange approach whereby it
> > does not accept options directly as part of the -drive arg,
> > but instead takes them indirectly from a -iscsi arg. To make
> > up -driver and -iscsi args, it takes the iSCSI target name
> > and uses that as an ID value for the -iscsi arg lookup.
> > 
> > For example, given a -drive arg that looks like
> > 
> >  -drive file=iscsi://192.168.122.1:3260/iqn.2013-12.com.example%3Aiscsi-chap-netpool/1,format=raw,if=none,id=drive-virtio-disk0
> > 
> > The iSCSI driver will try to find the -iscsi arg with an
> > id of "iqn.2013-12.com.example:iscsi-chap-netpool" eg it
> > expects
> > 
> >   -iscsi id=iqn.2013-12.com.example:iscsi-chap-netpool,user=fred,password-secret=secret0
> > 
> > Unfortunately this is impossible to actually do in practice
> > because almost all iSCSI target names contain a ':' which
> > is not a valid ID character for QEMU:
> > 
> >  $ qemu-system-x86_64: -iscsi id=iqn.2013-12.com.example:iscsi-chap-netpool,user=redhat,password=123456: Parameter 'id' expects an identifier
> >  Identifiers consist of letters, digits, '-', '.', '_', starting with a letter.
> > 
> > So for this to work we need to remove the invalid characters
> > in some manner. This patch takes the simplest possible approach
> > of just converting all invalid characters into underscores. eg
> > you can now use
> > 
> >  $ qemu-system-x86_64: -iscsi id=iqn.2013-12.com.example_iscsi-chap-netpool,user=redhat,password=123456: Parameter 'id' expects an identifier
> > 
> > There is theoretically the possibility for collison with this
> > approach if there were 2 iSCSI luns attached to the same VM
> > with target names that clash on the escaped char: eg
> > 
> >   iqn.2013-12.com.example:iscsi-chap-netpool
> >   iqn.2013-12.com.example_iscsi-chap-netpool
> > 
> > but in reality this will never happen. In addition in QEMU 2.7
> > the need to use the -iscsi arg will be removed by allowing all
> > the desired options to be listed directly with -drive. IOW this
> > quick stripping of invalid characters is just a short term fix
> > that will ultimately go away. For this reason it is not thought
> > worthwhile to invent a full collision-free escaping syntax for
> > iSCSI target IDs.
> > 
> > Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> > ---
> > 
> 
> Figured I'd chime in since I tripped across this today...
> 
> I think the one thing that concerns me about this '_' approach is we'd
> be "stuck" with it. Eventually if 'initiator-name' is added to the
> -drive command (as well as being able to parse the 'user=' and
> 'password-secret='), then needing to add -iscsi wouldn't be required for
> libvirt. Whether this patch would be required after -drive is modified
> was the other question rattling around. So I figured I'd see if I can
> get things to work without it...
> 
> Using the v1 of this patch series did work for libvirt if I passed the
> "id=" shown above using the '_' instead of ':'; however, taking the Pino
> Toscano's series in mind, I can also start a domain using the
> "initiator-name=" and "id=" parameters for '-iscsi' as follows:
> 
> ...
> -object
> secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain-3-jaf/master-key.aes
> 
> ...
> -iscsi
> id=iscsi-chap-netpool,initiator-name=iqn.2013-12.com.example,user=redhat,password-secret=virtio-disk1-ivKey0
> -drive
> file=iscsi://192.168.122.1:3260/iqn.2013-12.com.example%3Aiscsi-chap-netpool/1,format=raw,if=none,id=drive-virtio-disk1
> -device
> virtio-blk-pci,scsi=off,bus=pci.0,addr=0x9,drive=drive-virtio-disk1,id=virtio-disk1,bootindex=1
>

I don't believe that is doing what you think it is doing.

QEMU will still be using the "iqn.2013-12.com.example:iscsi-chap-netpool"
string as an ID to lookup the corresponding -iscsi arg. It will not
find it because your arg uses ID of "iscsi-chap-netpool". So, the code
will now be falling backk to just using the /first/  -iscsi arg in the
list.

IOW, if you add multiple iSCSI disks to the VM, they will all be using
the first -iscsi arg, which is certainly not what we want

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

  reply	other threads:[~2016-04-14  8:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-13 16:17 [Qemu-devel] [PATCH v2 for-2.6] block: convert iscsi target to a valid ID for -iscsi arg lookup Daniel P. Berrange
2016-04-14  1:41 ` John Ferlan
2016-04-14  8:25   ` Daniel P. Berrange [this message]
2016-04-14 11:22     ` John Ferlan

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=20160414082542.GA20251@redhat.com \
    --to=berrange@redhat.com \
    --cc=jferlan@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=pl@kamp.de \
    --cc=ptoscano@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=ronniesahlberg@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).