Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'test' into dev

  • Loading branch information...
commit 7fb738f4b21e985935fd907366364f194ba7fb41 2 parents 73add5f + 99080da
@Licenser Licenser authored
View
2  apps/chunter/src/chunter.app.src
@@ -1,6 +1,6 @@
{application, chunter,
[{description, "SmartOS hypervisor manager."},
- {vsn, "0.3.7"},
+ {vsn, "0.3.8"},
{registered, []},
{applications, [
kernel,
View
17 apps/chunter/src/chunter_spec.erl
@@ -119,7 +119,7 @@ generate_spec(Package, Dataset, OwnerData) ->
{set, <<"zfs_io_priority">>, jsxd:get(<<"zfs_io_priority">>, round((2048*RamPerc)), Package)},
{set, [<<"internal_metadata">>, <<"package">>],
jsxd:get(<<"uuid">>, <<"-">>, Package)},
- {merge, jsxd:select([<<"cpu_cap">>], Package)},
+ {set, <<"cpu_cap">>, jsxd:get([<<"cpu_cap">>], 100, Package)},
{merge, jsxd:select([<<"nic_driver">>,
<<"disk_driver">>], Dataset)}],
OwnerData),
@@ -278,6 +278,7 @@ type_test() ->
InD = jsxd:from_list([{<<"type">>, <<"zone">>}, {<<"dataset">>, <<"d">>}]),
InO = jsxd:from_list([{<<"alias">>, <<"a">>}, {<<"hostname">>, <<"h">>}, {<<"uuid">>, <<"z">>}]),
In = jsxd:thread([{merge, InP}, {merge, InD},
+ {set, <<"cpu_cap">>, 100},
{set, <<"resolvers">>, [<<"8.8.8.8">>, <<"8.8.4.4">>]},
{delete, <<"name">>},
{set, <<"package">>, <<"p">>},
@@ -294,6 +295,8 @@ disk_driver_test() ->
{<<"disk_driver">>, <<"virtio">>}]),
InO = jsxd:from_list([{<<"uuid">>, <<"z">>}]),
In = jsxd:thread([{merge, InP}, {merge, InD},
+ {set, <<"cpu_cap">>, 100},
+ {set, <<"vcpus">>, 1},
{set, <<"resolvers">>, [<<"8.8.8.8">>, <<"8.8.4.4">>]},
{delete, <<"name">>},
{set, <<"disks">>,
@@ -316,6 +319,8 @@ created_at_test() ->
InD = jsxd:from_list([{<<"type">>, <<"kvm">>}, {<<"dataset">>, <<"d">>}]),
InO = jsxd:from_list([{<<"uuid">>, <<"z">>}]),
In = jsxd:thread([{merge, InP}, {merge, InD},
+ {set, <<"cpu_cap">>, 100},
+ {set, <<"vcpus">>, 1},
{set, <<"resolvers">>, [<<"8.8.8.8">>, <<"8.8.4.4">>]},
{delete, <<"name">>},
{set, <<"disks">>,
@@ -342,6 +347,8 @@ nic_driver_test() ->
{<<"nic_driver">>, <<"virtio">>}]),
InO = jsxd:from_list([{<<"uuid">>, <<"z">>}]),
In = jsxd:thread([{merge, InP}, {merge, InD},
+ {set, <<"cpu_cap">>, 100},
+ {set, <<"vcpus">>, 1},
{set, <<"resolvers">>, [<<"8.8.8.8">>, <<"8.8.4.4">>]},
{delete, <<"name">>},
{set, <<"disks">>,
@@ -362,6 +369,7 @@ zone_ram_test() ->
InD = jsxd:from_list([{<<"type">>, <<"zone">>}, {<<"dataset">>, <<"d">>}]),
InO = jsxd:from_list([{<<"uuid">>, <<"z">>}]),
In = jsxd:thread([{merge, InP}, {merge, InD},
+ {set, <<"cpu_cap">>, 100},
{set, <<"resolvers">>, [<<"8.8.8.8">>, <<"8.8.4.4">>]},
{delete, <<"name">>},
{set, <<"package">>, <<"p">>},
@@ -378,6 +386,8 @@ kvm_ram_test() ->
InD = jsxd:from_list([{<<"type">>, <<"kvm">>}, {<<"dataset">>, <<"d">>}]),
InO = jsxd:from_list([{<<"uuid">>, <<"z">>}]),
In = jsxd:thread([{merge, InP}, {merge, InD},
+ {set, <<"cpu_cap">>, 100},
+ {set, <<"vcpus">>, 1},
{set, <<"resolvers">>, [<<"8.8.8.8">>, <<"8.8.4.4">>]},
{delete, <<"name">>},
{set, <<"disks">>,
@@ -504,6 +514,7 @@ resolver_test() ->
InD = jsxd:from_list([{<<"type">>, <<"zone">>}, {<<"dataset">>, <<"d">>}]),
InO = jsxd:from_list([{<<"uuid">>, <<"z">>}, {<<"resolvers">>, [<<"8.8.8.8">>]}]),
In = jsxd:thread([{merge, InP},
+ {set, <<"cpu_cap">>, 100},
{delete, <<"name">>},
{set, <<"package">>, <<"p">>},
{merge, InD},
@@ -520,6 +531,7 @@ ssh_test() ->
{<<"ssh_keys">>,
<<"ssh-rsa">>}]),
In = jsxd:thread([{merge, InP},
+ {set, <<"cpu_cap">>, 100},
{delete, <<"name">>},
{set, <<"package">>, <<"p">>},
{set, <<"resolvers">>, [<<"8.8.8.8">>, <<"8.8.4.4">>]},
@@ -537,6 +549,7 @@ passwd_test() ->
{<<"admin_pw">>, <<"admin">>},
{<<"root_pw">>, <<"root">>}]),
In = jsxd:thread([{merge, InP},
+ {set, <<"cpu_cap">>, 100},
{delete, <<"name">>},
{set, <<"package">>, <<"p">>},
{set, <<"resolvers">>, [<<"8.8.8.8">>, <<"8.8.4.4">>]},
@@ -554,6 +567,7 @@ metadata_test() ->
{<<"admin_pw">>, <<"admin">>},
{<<"metadata">>, [{<<"key">>, <<"value">>}]}]),
In = jsxd:thread([{merge, InP},
+ {set, <<"cpu_cap">>, 100},
{delete, <<"name">>},
{set, <<"package">>, <<"p">>},
{set, <<"resolvers">>, [<<"8.8.8.8">>, <<"8.8.4.4">>]},
@@ -571,6 +585,7 @@ nics_test() ->
{<<"nic_tag">>, <<"admin">>}]]}]),
InO = jsxd:from_list([{<<"uuid">>, <<"z">>}]),
In = jsxd:thread([{merge, InP},
+ {set, <<"cpu_cap">>, 100},
{delete, <<"name">>},
{set, <<"resolvers">>, [<<"8.8.8.8">>, <<"8.8.4.4">>]},
{set, <<"package">>, <<"p">>},
View
4 apps/chunter/src/chunter_vm_fsm.erl
@@ -529,9 +529,9 @@ write_image(Port, UUID, [Idx|R]) ->
write_image(Port, UUID, R);
write_image(Port, _UUID, []) ->
- lager:debug("<IMG> done going to wait 5s.", []),
+ lager:debug("<IMG> done going to wait 3s.", []),
port_close(Port),
- timer:sleep(5000),
+ timer:sleep(30000),
lager:debug("<IMG> done waiting.", []).
-spec zoneadm(ZUUID::fifo:uuid()) -> [{ID::binary(),
View
37 apps/chunter/src/chunter_vmadm.erl
@@ -38,7 +38,9 @@ start(UUID) ->
Cmd = <<"/usr/sbin/vmadm start ", UUID/binary>>,
lager:debug([{fifi_component, chunter}],
"vmadm:cmd - ~s.", [Cmd]),
- os:cmd(binary_to_list(Cmd)).
+ R = os:cmd(binary_to_list(Cmd)),
+ lager:debug("[vmadm] ~s", [R]),
+ R.
-spec start(UUID::fifo:uuid(), Image::binary()) -> list().
@@ -48,7 +50,9 @@ start(UUID, Image) ->
Cmd = <<"/usr/sbin/vmadm start ", UUID/binary>>,
lager:debug([{fifi_component, chunter}],
"vmadm:cmd - ~s.", [Cmd]),
- os:cmd(binary_to_list(Cmd)).
+ R = os:cmd(binary_to_list(Cmd)),
+ lager:debug("[vmadm] ~s", [R]),
+ R.
-spec delete(UUID::fifo:uuid(), Mem::binary()) -> ok.
@@ -59,6 +63,8 @@ delete(UUID, Mem) ->
lager:debug([{fifi_component, chunter}],
"vmadm:cmd - ~s.", [Cmd]),
os:cmd(binary_to_list(Cmd)),
+ R = os:cmd(binary_to_list(Cmd)),
+ lager:debug("[vmadm] ~s", [R]),
chunter_server:unprovision_memory(Mem),
chunter_vm_fsm:remove(UUID).
@@ -85,7 +91,9 @@ stop(UUID) ->
Cmd = <<"/usr/sbin/vmadm stop ", UUID/binary>>,
lager:debug([{fifi_component, chunter}],
"vmadm:cmd - ~s.", [Cmd]),
- os:cmd(binary_to_list(Cmd)).
+ R = os:cmd(binary_to_list(Cmd)),
+ lager:debug("[vmadm] ~s", [R]),
+ R.
-spec force_stop(UUID::fifo:uuid()) -> list().
@@ -95,7 +103,9 @@ force_stop(UUID) ->
Cmd = <<"/usr/sbin/vmadm stop ", UUID/binary, " -F">>,
lager:debug([{fifi_component, chunter}],
"vmadm:cmd - ~s.", [Cmd]),
- os:cmd(binary_to_list(Cmd)).
+ R = os:cmd(binary_to_list(Cmd)),
+ lager:debug("[vmadm] ~s", [R]),
+ R.
-spec reboot(UUID::fifo:uuid()) -> list().
@@ -105,7 +115,9 @@ reboot(UUID) ->
Cmd = <<"/usr/sbin/vmadm reboot ", UUID/binary>>,
lager:debug([{fifi_component, chunter}],
"vmadm:cmd - ~s.", [Cmd]),
- os:cmd(binary_to_list(Cmd)).
+ R = os:cmd(binary_to_list(Cmd)),
+ lager:debug("[vmadm] ~s", [R]),
+ R.
-spec force_reboot(UUID::fifo:uuid()) -> list().
@@ -116,7 +128,9 @@ force_reboot(UUID) ->
Cmd = <<"/usr/sbin/vmadm reboot ", UUID/binary, " -F">>,
lager:debug([{fifi_component, chunter}],
"vmadm:cmd - ~s.", [Cmd]),
- os:cmd(binary_to_list(Cmd)).
+ R = os:cmd(binary_to_list(Cmd)),
+ lager:debug("[vmadm] ~s", [R]),
+ R.
-spec create(UUID::fifo:vm_config()) -> ok |
{error, binary() |
@@ -166,6 +180,10 @@ update(UUID, Data) ->
port_command(Port, jsx:to_json(Data)),
port_command(Port, "\nEOF\n"),
receive
+ {Port, {data, {eol, Data}}} ->
+ lager:debug("[vmadm] ~s", [Data]);
+ {Port, {data, Data}} ->
+ lager:debug("vmadm output: ~s", [Data]);
{Port, {exit_status, _}} ->
chunter_vm_fsm:load(UUID)
after
@@ -181,10 +199,17 @@ update(UUID, Data) ->
unknown}.
wait_for_tex(Port) ->
receive
+ {Port, {data, {eol, Data}}} ->
+ lager:debug("[vmadm] ~s", [Data]);
+ {Port, {data, Data}} ->
+ lager:debug("[vmadm] ~s", [Data]);
{Port,{exit_status, 0}} ->
ok;
{Port,{exit_status, S}} ->
{error, S}
+ after
+ 60000 ->
+ lager:debug("[vmadm] timeout after 10m")
end.
%%%===================================================================
View
2  rel/pkg/Makefile
@@ -1,4 +1,4 @@
-VERSION=0.3.7
+VERSION=0.3.8
COMPONENT=chunter
SUFFIX:=$(shell echo $(SUFFIX))
BASENAME:=$(COMPONENT)-$(VERSION)$(SUFFIX)
View
2  rel/reltool.config
@@ -1,6 +1,6 @@
{sys, [
{lib_dirs, ["../deps", "../apps"]},
- {rel, "chunter", "0.3.7",
+ {rel, "chunter", "0.3.8",
[
kernel,
stdlib,
Please sign in to comment.
Something went wrong with that request. Please try again.