Permalink
Browse files

Merge branch 'test' into dev

  • Loading branch information...
2 parents 57e992b + 42c5b61 commit 61b966e8f02af6ea5bd661ca48096e16b49046c3 @Licenser Licenser committed Apr 4, 2013
Showing with 31 additions and 9 deletions.
  1. +3 −2 apps/chunter/src/chunter_spec.erl
  2. +27 −1 apps/chunter/src/chunter_vm_fsm.erl
  3. +1 −6 apps/chunter/src/chunter_vmadm.erl
@@ -113,10 +113,11 @@ generate_spec(Package, Dataset, OwnerData) ->
_ ->
0
end,
+ RamShare = round(1024*RamPerc),
Base0 = jsxd:thread([{select, [<<"uuid">>, <<"alias">>]},
{set, <<"resolvers">>, [<<"8.8.8.8">>, <<"8.8.4.4">>]},
- {set, <<"cpu_shares">>, jsxd:get(<<"cpu_shares">>, round((1024*RamPerc)), Package)},
- {set, <<"zfs_io_priority">>, jsxd:get(<<"zfs_io_priority">>, round((2048*RamPerc)), Package)},
+ {set, <<"cpu_shares">>, jsxd:get(<<"cpu_shares">>, RamShare, Package)},
+ {set, <<"zfs_io_priority">>, jsxd:get(<<"zfs_io_priority">>, RamShare, Package)},
{set, [<<"internal_metadata">>, <<"package">>],
jsxd:get(<<"uuid">>, <<"-">>, Package)},
{set, <<"cpu_cap">>, jsxd:get([<<"cpu_cap">>], 100, Package)},
@@ -531,7 +531,29 @@ write_image(Port, UUID, [Idx|R]) ->
write_image(Port, UUID, []) ->
lager:debug("<IMG> done going to wait for imgamd.", []),
port_close(Port),
- Cmd = "zfs list -Hp -t all -r zones/" ++ binary_to_list(UUID),
+ UUIDL = binary_to_list(UUID),
+ %% We need to satisfy imgadm *shakes fist* this seems to be a minimal
+ %% manifest that is enough to not make it throw up.
+
+ {ok, DS} = libsniffle:dataset_get(UUID),
+ Manifest = jsxd:from_list([{<<"manifest">>,
+ [{<<"v">>, 2},
+ {<<"uuid">>, UUID},
+ {<<"disabled">>, false},
+ {<<"type">>, <<"zvol">>},
+ {<<"state">>, <<"active">>}]},
+ {<<"zpool">>, <<"zones">>}]),
+ %% Need to set the correct type
+ Manifest1 = case jsxd:get([<<"type">>], DS) of
+ {ok, <<"zone">>} ->
+ jsxd:set([<<"manifest">>, <<"type">>], <<"zone-dataset">>, Manifest);
+ _ ->
+ Manifest
+ end,
+ %% and write it to zoneamd's new destination folder ...
+ file:write_file("/var/imgadm/images/zones-" ++ UUIDL ++ ".json", jsx:encode(Manifest1)),
+ Cmd = "zfs list -Hp -t all -r zones/" ++ UUIDL,
+
wait_image(0, Cmd).
@@ -540,6 +562,10 @@ wait_image(N, Cmd) when N < 3 ->
wait_image(length(re:split(os:cmd(Cmd), "\n")), Cmd);
wait_image(_, _) ->
+
+
+
+
lager:debug("<IMG> done waiting.", []).
-spec zoneadm(ZUUID::fifo:uuid()) -> [{ID::binary(),
@@ -155,13 +155,8 @@ create(Data) ->
Res = case wait_for_tex(Port) of
ok ->
chunter_vm_fsm:load(UUID);
- {error, 1 = E} ->
- lager:error([{fifi_component, chunter}],
- "vmad:create - Failed: ~p.", [E]),
- chunter_vm_fsm:load(UUID);
{error, E} ->
- chunter_server:unprovision_memory(Mem*1024*1024),
-
+ delete(UUID, Mem*1024*1024),
lager:error([{fifi_component, chunter}],
"vmad:create - Failed: ~p.", [E]),
E

0 comments on commit 61b966e

Please sign in to comment.