Skip to content

Commit

Permalink
Kludge to add headers to code path
Browse files Browse the repository at this point in the history
  • Loading branch information
msantos committed Sep 15, 2012
1 parent 5b9221d commit 276b1db
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 4 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,32 @@ environment variables before running the script:
VERX_QEMU_BIN : path to the qemu binary (default: /usr/bin/kvm)
VERX_BRIDGE_INTERFACE : bridge interface (default: user networking)

## TESTING EVERYTHING WORKS

To quickly test everything works, you can try running `bin/verx`, an
escript that provides a simple command line interface to the verx library.

You'll have to set up the ERL\_LIBS environment variable first, e.g.,
if verx is checked out in ~/src:

export ERL_LIBS=$ERL_LIBS:~/src

Then run:

bin/verx

To create the example VM:

bin/verx create priv/example.xml

To see all the VMs (if you have TLS set up):

bin/verx list --all --transport verx_client_tls

To connect to example VM's console using the Unix transport:

bin/verx console localvm # control-C to exit

## HOW TO USE IT

## libvirt documentation
Expand Down
4 changes: 2 additions & 2 deletions bin/verx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
%%% Command line interface using the libvirt remote protocol
%%%
-include_lib("kernel/include/file.hrl").
-include("$PWD/include/verx.hrl").
-include_lib("verx/include/verx.hrl").

main(Opt) ->
% load verx
Expand Down Expand Up @@ -390,6 +390,6 @@ console_read(Ref) ->
io:format("~s", [Buf]),
console_read(Ref);
{tty_read, Buf} ->
verx_client:send(Ref, [Buf]),
verx_client:send(Ref, Buf),
console_read(Ref)
end.
3 changes: 1 addition & 2 deletions include/verx.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
%% LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
%% ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
%% POSSIBILITY OF SUCH DAMAGE.
%-include("include/remote_protocol.hrl").
-include("$PWD/include/remote_protocol.hrl").
-include_lib("verx/include/remote_protocol.hrl").

-define(LIBVIRT_SOCK_PATH, <<"/var/run/libvirt/libvirt-sock">>).
-define(LIBVIRT_TCP_PORT, 16509).
Expand Down
2 changes: 2 additions & 0 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@
"src/remote_protocol.x",
"src/remote_protocol.hrl"
]}.

{lib_dirs, ["../"]}.
2 changes: 2 additions & 0 deletions src/verx_client.erl
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ cast(Ref, Proc, Arg, Timeout)
when is_pid(Ref), is_atom(Proc), is_list(Arg) ->
gen_server:call(Ref, {call, Proc, Arg}, Timeout).

send(Ref, Buf) when is_binary(Buf) ->
send(Ref, [Buf]);
send(_Ref, []) ->
ok;
send(Ref, [Buf|Rest]) when is_binary(Buf) ->
Expand Down

0 comments on commit 276b1db

Please sign in to comment.