omniosorg / zadm

zone management tool
https://omnios.org/setup/zadm
GNU General Public License v3.0
24 stars 8 forks source link

zadm pull on a local image is a no-op? #101

Closed justledbetter closed 2 years ago

justledbetter commented 2 years ago

I'm trying to create a local image that I can use with zadm on my own systems, and am trying to figure out how it works. If I'm reading the code correctly, it seems like this operation isn't supported yet (the return {} seems to make the program exit without doing anything). Am I missing something? Or is this not yet implemented? And if the latter, how can I help implement it? :)

https://github.com/omniosorg/zadm/blob/e67f42405e39ba00287b8c90eb30b7f0175cdc0e/lib/Zadm/Image.pm#L30

    # check if uuid points to a local image
    my $abspath = Mojo::File->new($uuid)->to_abs;
    if (-r $abspath) {
        $self->image({ _file => $abspath });

        return {};
    }
hadfl commented 2 years ago

I am not sure I understand what you are trying to accomplish. zadm pull was introduced for remote providers, so images can be downloaded to the local zadm image cache before using them to install zones; avoiding an "install delay" due to the download for the first zone the image is used for (for local images zadm pull is indeed a no-op).

If you have local images you can just directly install from them (e.g. zadm create -i /path/to/my/local/image ...).

justledbetter commented 2 years ago

I saw that it was used to pull images in, but thought it was intended for use with local images as well as remote. The default documentation on the commandline doesn't mention the -i flag to zadm create, sorry for missing that in the man page!

For anyone else that may be confused about this, the -i flag expects a tarball or zvol (either compressed or raw). In the case of the latter (for bhyve or kvm zones), the image you specify will be written to the /(basepath)/root volume for the zone during the installation phase.

Loving this tool, loving OmniOS, loving Illumos - Thanks for the correction!

hadfl commented 2 years ago

You can always get brand specific synopsis on the command line (the default will show the synopsis for native brands like ipkg, lipkg, ...).

$ zadm help -b bhyve
...
        create -b <brand> [-i <image_uuid|image_path_or_uri>] [-t <template_path>] <zone_name>
...

where it will show the -i option if available for that specific brand