top.py: also print total idle time

on a 4-cpu guest, top.py currently prints something like this:

	idle:  94%  75%  92%  92%

Where the first CPU is 94% idle, and the second CPU is 75% idle,
and so on. This patch adds another statistic, the sum of the CPUs'
idle times:

	idle:  94%  75%  92%  92%  (total 353%)

The number "353%" means that 353% of the strength of one CPU are idle.
This is often a useful statistic - on a fully loaded guest, we want to
see this get near to 0%.

The reason why we print the total idle percentage (353%) and not the
average (353/4 = 88%) is to keep all percentages in top.py consistent
in that they are of a single CPU, not of the total CPUs. If we start
printing both types of percentages on the same screen, it will be too
confusing.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
release-ec2: add --image-size option

Add --image-size option its suggest fs_size_mb when build image

Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: KANATSU Minoru <icc.pot.tyew272@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
x64/misc.bin: openssl libraries

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Http Server: Add optional configuration file

This adds an optional configuration file under /etc/httpserver.conf

The configuration file is a Yaml formated file, with the optional server
configuration. It is been read before the server starts.

Configuration priority is now as follow, first configuration file,
second command line parameters are taken (though it is not very common
in httpserver) and last the default values.

This patch removes the default values from main, and leave it to be added
last in run method.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Cloud init: Add httpserver-module

httperver module allows setting the httpserver configuration by the cloud
init.

For example to set the port to 4000 and allow cross site access

httpserver:
  access-allow: true
  port: 4000

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Cloud-init: Change from a run command to a model

Include functionality should be identical regardless of the data source.
To make it clearer, that include is not only of script commands. The
include functionality was moved to its own module.

This patch also moves the load-from-cloud functionality to the include.

Now the local init file can have an option to read from cloud source.
This way it is possible to set an image with local configuration but
without attempting to call cloud source.

Cloud source has an option to decide how to handle missing cloud source.

This functionality was dropped when the cloud source were introduce and
is now put back.

The following options can be used with the include module:

include:
    - load-from-cloud:
        ignore-missing-source: true
    - file: /usr/mgmt/tmp.yaml
    - remote:
        server: 254.1.1.1
        path: /usr/data

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
httpserver: Export thread CPU via the API

Export the CPU which the thread is running on and display that in top.py.

Example top.py output looks like this:

301 threads on 4 CPUs; idle:  99%  99% 100% 100%  (total 398%)

   ID CPU  %CPU    TIME NAME
    2   1   1.1    0.74 page-access-sca
  264   0   0.1    0.02 >>>>>java.so
   45   0   0.1    0.03 rand_harvestq
  266   0   0.1    0.03 >>>>>java.so
  411   0   0.1    0.02 >>>>>java.so
  269   0   0.1    0.02 >>>>>java.so
  239   1   0.1    0.01 /libhttpserver.
   42   0   0.1    0.01 virtio-rng
  405   0   0.1    0.00 >>>>>java.so
  408   0   0.1    0.00 >>>>>java.so
  409   0   0.1    0.00 >>>>>java.so
  253   0   0.0    0.43 >>java.so
  254   1   0.0    0.35 >>java.so
  242   1   0.0    0.26 >java.so
  394   1   0.0    0.13 >>>>>java.so
  271   0   0.0    0.11 >>>>>java.so
  272   1   0.0    0.05 >>>>>java.so
  277   0   0.0    0.04 >>>>>java.so
  275   0   0.0    0.02 >>>>>java.so
   38   1   0.0    0.01 >init

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
top.py: Fix typo

Fix a typo in top.py that slipped in with commit 0911e53 ("httpserver: Export
thread CPU via the API").

Spotted by Nadav.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
elf: Fix SIGSEGV if dynamic table section is missing

If an ELF object does not have a dynamic table section, throw a proper
exception from _dynamic_tag() instead of faulting on nullptr.

Spotted while trying to run a static ELF binary.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
tests: Add test case for static ELF binaries

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
elf: Fix object::load_needed() to work with static binaries

If the DT_NEEDED tag does not exist, bail out from object::needed()
early and don't call dynamic_str_array() which will thrown an exception.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
elf: Fix object::lookup_symbol_old() to work with static binaries

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
app: Add support for static binaries

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Use a constant for kernel base address

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Move kernel image to 20 MB mark

Make some room for static binaries to load themselves...

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>