X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=mclu_boot.ml;h=451beb8125c7c48463a3433298e14ff0667fb4a0;hb=f2a17d80287a2afc8f2204035536c81950649e2e;hp=5bf742fa2e28918b5f04b26a7587cbe8ae8c859a;hpb=0bd1243eec67647186f4153ea3f395d77b979ba5;p=mclu.git diff --git a/mclu_boot.ml b/mclu_boot.ml index 5bf742f..451beb8 100644 --- a/mclu_boot.ml +++ b/mclu_boot.ml @@ -71,6 +71,18 @@ Try `mclu list --templates' to list all known templates.\n" template; (* Probe the template for various features. *) let template_info = Template.probe ~verbose template_filename in + (* Check --size is not too small. *) + let size = + match !size, template_info.Template.minimum_size with + | 0L, None -> 0L (* virt-builder default *) + | 0L, Some min_size -> (* go with template minimum size *) + min_size + | size, Some min_size when size < min_size -> + eprintf "mclu: --size parameter is smaller than the minimum specified by the template (%s).\n" + (human_size min_size); + exit 1 + | size, _ -> size in (* go with user-specified size *) + (* Decide how much RAM we will give the guest. This affects our * choice of node, so do it early. *) @@ -267,7 +279,7 @@ Try: `mclu on %s'\n" hostname hostname; fpf "export format=%s\n" (quote format); fpf "export name=%s\n" (quote name); fpf "export output=%s\n" (quote remote_image); - (match !size with + (match size with | 0L -> () | size -> fpf "export size=%s\n" (quote (sprintf "--size %Ldb" size)) );