[libvirt] [PATCH v2 sandbox] virt-sandbox-image: switch to use URI to identify templates
Cedric Bosdonnat
cbosdonnat at suse.com
Tue Sep 22 11:25:32 UTC 2015
On Tue, 2015-09-22 at 11:26 +0100, Daniel P. Berrange wrote:
> On Tue, Sep 22, 2015 at 10:19:03AM +0100, Daniel P. Berrange wrote:
> > On Mon, Sep 21, 2015 at 10:11:48PM +0200, Cedric Bosdonnat wrote:
> > > On Mon, 2015-09-21 at 15:45 +0100, Daniel P. Berrange wrote:
> > > > Currently the CLI syntax is somewhat docker specific requiring
> > > > inclusion of --registry arg to identify the docker download
> > > > server. Other app containers have a notion of download server,
> > > > but don't separate it from the template name.
> > > >
> > > > This patch removes that docker-ism by changing to use a URI
> > > > for identifying the template image. So instead of
> > > >
> > > > virt-sandbox-image download \
> > > > --source docker --registry index.docker.io
> > > > --username dan --password 123456 ubuntu:15.04
> > > >
> > > > You can use
> > > >
> > > > virt-sandbox-image download docker://dan:123456@index.docker.io/ubuntu?tag=15.04
> > > >
> > > > The only mandatory part is the source prefix and image name, so
> > > > that can shorten to just
> > > >
> > > > virt-sandbox-image download docker:///ubuntu
> > > >
> > > > to pull down the latest ubuntu image, from the default registry
> > > > using no authentication.
> > > > ---
> > > >
> > > > Changed in v2:
> > > >
> > > > - Rebase against master, instead of (unpushed) docker volume patch
> > > >
> > > > libvirt-sandbox/image/cli.py | 71 +++++--------
> > > > libvirt-sandbox/image/sources/DockerSource.py | 142 ++++++++++++++------------
> > > > libvirt-sandbox/image/sources/Source.py | 29 +++---
> > > > libvirt-sandbox/image/template.py | 110 ++++++++++++++++++++
> > >
> > > Missing change in libvirt-sandbox/image/Makefile.am to add template.py.
> > > As is that file isn't installed.
> > >
> > > I'm also just realizing that we didn't add Eren't commit for the
> > > virt-sandbox-image man page. Adding it later is fine, but we need to
> > > keep that on our radar.
> >
> > Yep, that's in my tree to update & pyush.
> >
> > > > @@ -151,7 +150,7 @@ def run(args):
> > > >
> > > > def requires_template(parser):
> > > > parser.add_argument("template",
> > > > - help=_("name of the template"))
> > > > + help=_("URI of the template"))
> > >
> > > Shouldn't we provide some examples here? As those URIs can't be invented
> > > we need to give the user some chances to discover them without having to
> > > read our code ;)
> >
> > I wasn't sure this was the best place. We'll certainly put examples in
> > the man pages though.
>
> I found out how to add an epilog to the help output, so we can get text
> that looks like this:
>
> $ virt-sandbox-image download --help
> usage: virt-sandbox-image download [-h] [-t TEMPLATE_DIR] template
>
> positional arguments:
> template URI of the template
>
> optional arguments:
> -h, --help show this help message and exit
> -t TEMPLATE_DIR, --template-dir TEMPLATE_DIR
> Template directory for saving templates
>
> Example supported URI formats:
>
> docker:///ubuntu?tag=15.04
> docker://username:password@index.docker.io/private/image
> docker://registry.access.redhat.com/rhel6
>
Sounds nice.
--
Cedric
More information about the libvir-list
mailing list