Commit Graph

350 Commits (7d26f0f69b01016f1a8c563ac734253e2f9c6d5b)
 

Author SHA1 Message Date
Javier Sánchez Parra 147c890617 Fix OgLinuxOperations class params
Commit 621fb7a7 added class initialization with two parameters. These
two parameters were wrongly initialized, "self." was missing. The call
of these params in other functions of the class was also wrong.

This commit fix the initialization of the parameters of
OgLinuxOperations and fix the calls to these params.
2020-05-20 12:04:28 +02:00
Javier Sánchez Parra 6502180fc8 Only import virtual functions when needed.
ogClient may runs on an OS that do not have all the dependencies needed
to use virtual functions.

This commit change the behaviour to only import virtual functions when
the ogClient has to work with Virtual Machines. This way ogClient works
on environments which do not need virtual functions.
2020-05-20 10:33:41 +02:00
Roberto Hueso Gómez 2ab5db74fe Handle other exceptions on virtual /refresh
Ths patch handles different cases when a /refresh request can be made. More
specifically this handles the situation in which the VM is stopped when /refresh
is called but it starts during the processing of /refresh, in this case we just
send the last recorded setup.
2020-05-19 12:40:35 +02:00
Roberto Hueso Gómez de2ce69e46 Refactor OgQMP and adapt operations
This patch:
- Fixes logic errors in the communication with QMP (the order of handshake
  messages was not right).
- Rewrite parts of OgQMP class.
- Enforces better coding practices by using Python's "context managers" to avoid
  forgeting an open socket in case exceptions occur.
- Adapt virtual operations to the use of "context managers" using the "with"
  statement.
2020-05-19 12:34:31 +02:00
Roberto Hueso Gómez 28a25918b2 Update filesystems on /refresh
This updates partitions.json filesystems.
2020-05-18 15:58:22 +02:00
Roberto Hueso Gómez 2e6b73da53 Use virtio-vga to run VMs
This is the device that has the best empirical performance right now and it
seems like it is where most of the qemu development is directed towards for the
future.
2020-05-18 10:28:18 +02:00
Javier Sánchez Parra 621fb7a786 Adapt ogLinuxOperation to work with json config file
ogClient changed its config file format to json. This patch adapts
ogLinuxOperation to use new config file.

Co-authored-by: Roberto Hueso <rhueso@soleta.eu>
2020-05-18 08:33:37 +02:00
Roberto Hueso Gómez efedaa27f1 Fix typo in configuration json 2020-05-15 12:20:50 +02:00
Roberto Hueso Gómez 3c055d198d Wait before polling QMP for host poweroff
This patch waits before polling qemu with QMP so that it has time to be ready
for requests. It also increases wait time in case the host machine is slow.
2020-05-14 17:28:50 +02:00
Roberto Hueso Gómez 32b73c50b1 Fix typo on linux shellrun operation 2020-05-14 17:27:42 +02:00
Roberto Hueso Gómez 269c7b5055 Rename operation 'execCMD' to 'shellrun'
This patch also ignores calls to shellrun when virtual mode is activated.
2020-05-13 17:30:12 +02:00
OpenGnSys Support Team 5f874030f5 remove platform check 2020-05-13 17:01:20 +02:00
Roberto Hueso Gómez b63bd727f9 Change permissions on virtual images for /refresh
Write permission is not needed to get information about each virtual drive so
this patch changes permissions to 'only read'. This can prevent race conditions.
2020-05-13 14:15:44 +02:00
Roberto Hueso Gómez ff988b80b5 Add VNC support for virtual mode VMs
This patch makes possible to interact with guest OS from a remote machine using
VNC.
2020-05-13 14:13:47 +02:00
Roberto Hueso Gómez 38b6d77561 Switch config file to json
This patch makes configuration parsing easier as well as making the full
configuration available in many subclasses.
2020-05-13 14:10:01 +02:00
Roberto Hueso Gómez 404b8c79d0 Extend use of OG_PARTITIONS_CFG_PATH for /setup and /refresh
This is a refactor to consolidate the use of this single variable across all
virtual operations.
2020-05-11 12:13:39 +02:00
Roberto Hueso Gómez 6ca16dd200 Poweroff when no VM and no jobs are running
This patch calls poweroff in virtual mode when no VM is running and no jobs are
being executed. This is useful when the guest OS shutdowns so that the host OS
does not continue to run.
2020-05-11 11:12:11 +02:00
Roberto Hueso Gómez 7bde2a04e9 Add OgVM class to abstract VMs
This patch implements OgVM class. OgVM abstracts VM emulator from its
operations.
2020-04-28 16:40:30 +02:00
Roberto Hueso Gómez c86328181f Poweroff VM before some operations
This patch includes changes to:
- Poweroff VM before running operations that require access to virtual disks.
- Poweroff VM before host system poweroff.
2020-04-28 11:32:05 +02:00
Roberto Hueso Gómez 298e156317 Send last stored setup if VM is running
When virtual mode is activated, send the last stored partitions setup because
it is not possible to access a running virtual drive to get its information.
2020-04-28 11:27:16 +02:00
Roberto Hueso Gómez deb2e075cd Add OgQMP recv method
recv method is useful for receiving information that was not previously
requested (such as "events"). This patch also implements automatic handshake
on OgQMP by sending an "qmp_capabilities" request.
2020-04-28 11:21:49 +02:00
Roberto Hueso Gómez 5444e453ee Fix disk used size calculation
This patch calculates correctly the percentage of disk used. This could cause
an overflow on the ogAdmSever DB.
2020-04-28 11:16:59 +02:00
Roberto Hueso Gómez 1a83ebba23 Control errors in OgQMP for virtual mode
This patch handles possible communication errors between ogclient and Qemu when
making QMP requests.
2020-04-22 13:02:55 +02:00
Javier Sánchez Parra 0807ec76ed Add realtime log menu
We observed that with the new ogClient the ogLive did not show the
realtime log menu*.

This commit changes the ogClient to launch the browser and show the
realtime log menu when some commands are executed.

* The realtime log menu is a menu that shows current status and info
  about the command that the ogLive is executing.
2020-04-22 10:39:02 +02:00
Roberto Hueso Gómez b576836e43 Avoid killing ogclient in virtual mode 2020-04-20 09:14:52 +02:00
Roberto Hueso Gómez 2e3d47b7b8 Avoid writting /software output to a file 2020-04-17 16:59:48 +02:00
Roberto Hueso Gómez 7ccc498014 Use samba for create and restore virtual partitions
This requires to configure user and password for samba repositories.
2020-04-17 15:50:35 +02:00
Roberto Hueso Gómez dfb69e9dd5 Use libguestfs for virtual setup 2020-04-17 15:49:21 +02:00
Roberto Hueso Gómez 84e02462c0 Use libguestfs for virtual refresh 2020-04-17 15:49:21 +02:00
Roberto Hueso Gómez 8ec8572da2 Transform absolute paths into relative paths for virtual mode 2020-04-17 15:49:21 +02:00
Javier Sánchez Parra eec50f777c Increase HTML menu regeneration cases
We have observed that the ogLive browser did not show the changes when
an image restoration o script execution was called. The problem was that
the HTML menu was not updated/regenerated in these cases.

This commit adds the call to the HTML regeneration function to image
restore and script execution commands. This way, when the browser is
restarted it loads the updated HTML menu.
2020-04-16 13:53:13 +02:00
Javier Sánchez Parra f0c550ee2a Change browser behaviour
We have observed that the browser did not show changes. This happens
because the ogClient opens the browser at the beginning and forget
about it. To show correctly the changes ogClient had to restart the
browser every time the menu html changes.

This commit changes the behaviour to restart the browser when the menu
html has changed.
2020-04-16 13:29:06 +02:00
Roberto Hueso Gómez a32bf4071e Change default server port 2020-04-16 10:15:29 +02:00
OpenGnSys Support Team 439e5db7b7 wait for 1 second if connection is refused 2020-04-14 12:05:15 +02:00
Roberto Hueso Gomez 8a927a352d Sleep 1 second to avoid high CPU load 2020-04-14 11:48:13 +02:00
Roberto Hueso Gomez d6c5f2443a Avoid connection status infinite print loop
This patch avoids infinite writting of connection status messages to the log.
2020-04-14 11:31:22 +02:00
Roberto Hueso Gomez f56065a438 Fix reboot and poweroff threads args 2020-04-13 15:16:52 +02:00
Roberto Hueso Gomez 0ddf3f287a Add placeholder for virtual execCMD 2020-04-13 12:38:45 +02:00
Alvaro Neira Ayuso 1212040df1 Rename ogClient to ogclient in config path 2020-04-12 20:27:49 +02:00
Alvaro Neira Ayuso 058c2b5413 Launch browser only in linux configuration 2020-04-12 20:27:48 +02:00
Roberto Hueso Gomez 7f646fc468 Use 75% of disk space in virtual mode 2020-04-08 13:35:34 +02:00
Roberto Hueso Gomez 4f03c31f85 Add mode selection for ogClient 2020-04-08 13:31:45 +02:00
Roberto Hueso Gomez 99ae598fbd Encapsulate operations in classes 2020-04-08 13:30:16 +02:00
Roberto Hueso Gomez c279325919 Add virtual operations 2020-04-07 13:55:09 +02:00
OpenGnSys Support Team 99f2951395 add shebang to python3 and update permission 2020-03-31 20:15:32 +02:00
Javier Sanchez Parra f11e345dbf Rename config file
This commit changes the name of the config file from ogagent.cfg to
ogclient.cfg.
2020-03-24 08:06:02 +01:00
OpenGnSys Support Team 2cd7f5b4fc missing update to use ogConfig.OG_PATH in linux/ogOperations.py 2020-03-20 15:11:02 +01:00
Javier Sanchez Parra 4cd87e9875 Make OG_PATH public
This commit changes the OG_PATH to a public varible of the class
ogConfig. This way we improve the configurability of the path.
2020-03-20 14:53:07 +01:00
OpenGnSys Support Team d69841ed97 rename getURI to get_uri in restRequest 2020-03-09 18:10:57 +01:00
OpenGnSys Support Team 5964e48df9 rename execcmd to shellrun 2020-03-09 18:10:54 +01:00