All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Sage Weil <sage@newdream.net>
Cc: libvir-list@redhat.com, ceph-devel@vger.kernel.org
Subject: Re: [libvirt] [PATCH 0/5 v2] Improve Ceph Qemu+RBD support
Date: Wed, 12 Oct 2011 17:33:18 +0100	[thread overview]
Message-ID: <20111012163318.GA3444@redhat.com> (raw)
In-Reply-To: <1316492023-17749-1-git-send-email-sage@newdream.net>

On Mon, Sep 19, 2011 at 09:13:38PM -0700, Sage Weil wrote:
> The current support for qemu and Ceph RBD (rados block device) has two 
> main deficiencies: authentication doesn't work, and it relies on 
> environment variables (which don't work with latest upstream). This 
> patch set addresses both those problems.
> 
> The first two patches update the xml schemas and conf to add a Ceph 
> secret type and to specify authentication information along with the rbd 
> disk.
>
> The next two patches make some libvirt changes.  We pass virConnectPtr 
> down into the Domain{Attach,Detach} methods (needed to access secrets 
> while building the qemu command), and add a helper that will escape 
> arbitrary characters.
> 
> The final patch replaces the current RBD qemu code and uses the new conf 
> info to do authentication properly.  (We still need to make a change 
> there to avoid having the authentication key show up on qemu command 
> line; I'll clean that up shortly.)
> 
> Comments on this approach?

Ok, I've finally got myself a Ceph cluster up & running, with RBD
exports to a QEMU guest[1], so I can give more sensible answers to
these patches :-)


Overall you are taking the current XML for a disk:

  <disk type='network' device='disk'>
    <driver name='qemu' type='raw'/>
    <source protocol='rbd' name='demo/wibble'>
      <host name='lettuce.example.org' port='6798'/>
      <host name='mustard.example.org' port='6798'/>
      <host name='avocado.example.org' port='6798'/>
    </source>
    <target dev='vdb' bus='virtio'/>
  </disk>

and adding one new element <auth> such that we get

  <disk type='network' device='disk'>
    <driver name='qemu' type='raw'/>
    <source protocol='rbd' name='demo/wibble'>
      <auth id='admin' domain='clustername'/>
      <host name='lettuce.example.org' port='6798'/>
      <host name='mustard.example.org' port='6798'/>
      <host name='avocado.example.org' port='6798'/>
    </source>
    <target dev='vdb' bus='virtio'/>
  </disk>

together with some secret XML that looks like:

  <secret ephemeral='no' private='no'>
    <uuid>0a81f5b2-8403-7b23-c8d6-21ccc2f80d6f</uuid>
    <usage type='ceph'>
      <auth id='admin' domain='clustername'/>
    </usage>
  </secret>

When starting a guest the auth id + domain are concatenated to find
the secret. The 'id' is also used as the username to pass to QEMU.
The 'domain' is only ever used for the secret lookup part, never
passed to QEMU, since the host IP addrs do that job.

By comparison, QCow2 encryption disks are done with:

  <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/home/berrange/VirtualMachines/demo.qcow2'/>
      <target dev='hda' bus='ide'/>
      <encryption format='qcow'>
        <secret type='passphrase' uuid='0a81f5b2-8403-7b23-c8d6-21ccc2f80d6f'/>
      </encryption>
  </disk>

And the secret with:

  <secret ephemeral='no' private='no'>
    <uuid>0a81f5b2-8403-7b23-c8d6-21ccc2f80d6f</uuid>
    <usage type='volume'>
      <volume>/home/berrange/VirtualMachines/demo.qcow2</volume>
    </usage>
  </secret>

When starting a guest, the secret UUID is used to find the passphrase.


So we have a difference in the way the secrets are linked to the disks
between Ceph and QCow2 here.

I can see the appeal of doing it the way you have, but at the same time
I would like to have consistency with the QCow2 approach, and UUIDs are
a stronger identifier IMHO.

Also, although the secret XML is exposed auth id + domain as separate
attributes in the XML, internally they're processed as a concatenated
string, likewise the public API uses a concatenated string form. So
I think the XML ought to use that form too, and not split them.

Finally, I think the concept of authentication credentials for
disks, could be more generally useful than just for Ceph or other
network block devs, so I'm somewhat inclined to move it outside the
<source> element


Thus I would propose a slight variation on what you've done:

  <disk type='network' device='disk'>
    <driver name='qemu' type='raw'/>
    <auth username='admin'>
       <secret type='passphrase' uuid='0a81f5b2-8403-7b23-c8d6-21ccc2f80d6f'/>
    </auth>
    <source protocol='rbd' name='demo/wibble'>
      <host name='lettuce.example.org' port='6798'/>
      <host name='mustard.example.org' port='6798'/>
      <host name='avocado.example.org' port='6798'/>
    </source>
    <target dev='vdb' bus='virtio'/>
  </disk>


And in the secret XML:

  <secret ephemeral='no' private='no'>
    <uuid>0a81f5b2-8403-7b23-c8d6-21ccc2f80d6f</uuid>
    <usage type='ceph'>
      <domain>some.cluster.name/admin</domain>
    </usage>
  </secret>


Though I think the UUID based lookup should be primary, I would also
accept an optional alternate syntax based on usage strings, if you
think that's important:

  <disk type='network' device='disk'>
    <driver name='qemu' type='raw'/>
    <auth username='admin'>
       <secret type='passphrase' usage='some.cluster.name/admin'/>
    </auth>
    <source protocol='rbd' name='demo/wibble'>
      <host name='lettuce.example.org' port='6798'/>
      <host name='mustard.example.org' port='6798'/>
      <host name='avocado.example.org' port='6798'/>
    </source>
    <target dev='vdb' bus='virtio'/>
  </disk>


Regards,
Daniel

[1] http://berrange.com/posts/2011/10/12/setting-up-a-ceph-cluster-and-exporting-a-rbd-volume-to-a-kvm-guest/
-- 
|: 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 :|

  parent reply	other threads:[~2011-10-12 16:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-20  4:13 [PATCH 0/5 v2] Improve Ceph Qemu+RBD support Sage Weil
2011-09-20  4:13 ` [PATCH 1/5] secret: add Ceph secret type Sage Weil
2011-10-12 16:36   ` [libvirt] " Daniel P. Berrange
2011-09-20  4:13 ` [PATCH 2/5] storage: add authId, authDomain to virDomainDiskDef Sage Weil
2011-10-12 16:38   ` [libvirt] " Daniel P. Berrange
2011-09-20  4:13 ` [PATCH 3/5] qemu: pass virConnectPtr into Domain{Attach,Detach}* Sage Weil
2011-10-12 16:40   ` [libvirt] [PATCH 3/5] qemu: pass virConnectPtr into Domain{Attach, Detach}* Daniel P. Berrange
2011-09-20  4:13 ` [PATCH 4/5] buf: implement generic virBufferEscape Sage Weil
2011-10-11 10:39   ` [libvirt] " Daniel P. Berrange
2011-10-12 17:09     ` Eric Blake
2011-09-20  4:13 ` [PATCH 5/5] qemu/rbd: improve rbd device specification Sage Weil
2011-10-12 16:48   ` [libvirt] " Daniel P. Berrange
2011-09-27 20:40 ` [PATCH 0/5 v2] Improve Ceph Qemu+RBD support Sage Weil
2011-10-07 11:39 ` Wido den Hollander
2011-10-07 12:17   ` [libvirt] " Daniel P. Berrange
2011-10-12 16:33 ` Daniel P. Berrange [this message]
2011-10-12 16:45   ` Sage Weil

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=20111012163318.GA3444@redhat.com \
    --to=berrange@redhat.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=libvir-list@redhat.com \
    --cc=sage@newdream.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.