| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This method deletes a client from the DB.
Request:
POST /client/delete
{
"clients": ["192.168.56.30"]
}
Response:
200 OK
Co-authored-by: Javier Sánchez Parra <jsanchez@soleta.eu>
|
|
|
|
|
| |
This adapts the test configuration to the changes made in the commit
fe1ce97c50e575201fe47d7587251e228edf8fdf
|
|
|
|
|
|
| |
This handles changes in:
- The host of the DB.
- New json config file.
|
|
|
|
|
| |
This schema is now adapted to work on this repository instead of the
"OpenGnsys" general repository.
|
| |
|
|
|
|
|
| |
Use og_server_cfg everywhere. Convert port to string to make it easy for the
dbi API since it expects a string. Remove legacy example configuration file.
|
|
|
|
| |
to avoid clash with existing variable cfg in client.c
|
|
|
|
| |
This is convenient for the ogServer to use the new config file.
|
|
|
|
|
|
| |
This patch is a refactor for og_computer and og_dbi_get_computer_info.
It now uses fixed lenght strings to make it more reliable and avoid
errors if the DB is not returning a null ended string.
|
|
|
|
|
| |
This function provides an easy way to copy the content of a json string
into a regular C string.
|
|
|
|
| |
This is /opt/opengnsys/images if not specified.
|
|
|
|
| |
Add getopt parser and use json configuration file instead.
|
|
|
|
| |
ogClient datasize is now in bytes, update format to fix a possible overflow.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit adds GET /images to the ogServer REST API.
This call returns information of all the images in ogServer.
Example response:
{
"images": [
{
"filename": "ubuntu.img",
"datasize": 2150400000,
"size": 613476223,
"modified": "Wed Sep 23 10:37:36 2020",
"permissions": "744"
},
{
"filename": "test.img",
"datasize": 2150400000,
"size": 613236475,
"modified": "Tue Sep 29 08:57:47 2020",
"permissions": "744"
}
],
"disk": {
"total": 52573995008,
"free": 39624544256
}
}
|
|
|
|
|
|
| |
This commit makes configuration variable global.
To use this variable you have to #import "cfg.h".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This method adds a new client. This new client's IP cannot be duplicated
in the DB.
Request:
POST /client/add
{
"boot": "19pxeADMIN",
"center": 0,
"hardware_id": 0,
"id": 2,
"ip": "192.168.56.12",
"livedir": "ogLive",
"mac": "0800270E6512",
"maintenance": true,
"name": "pc12",
"netdriver": "generic",
"netiface": "eth1",
"netmask": "255.255.255.0",
"remote": false,
"repo_id": 1,
"room": 1,
"serial_number": ""
}
Response:
200 OK
|
|
|
|
|
| |
The cfg structure stores pointers to the string in this json tree. Do not
release the json tree, keep it as field in the cfg structure.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This method provides information about a specific client. The request
must contain exactly 1 client's IP.
Request:
GET /client/info
{"client": ["192.168.56.12"]}
Response:
200 OK
{
"boot": "19pxeADMIN",
"center": 0,
"hardware_id": 0,
"id": 2,
"ip": "192.168.56.12",
"livedir": "ogLive",
"mac": "0800280E6871",
"maintenance": true,
"name": "pc12",
"netdriver": "generic",
"netiface": "eth1",
"netmask": "255.255.255.0",
"remote": false,
"repo_id": 1,
"room": 1,
"serial_number": ""
}
|
|
|
|
|
|
| |
For the strings in og_computer we do not need to know the max size in
advance but instead we need to free up memmory using
og_dbi_free_computer_info(...) function.
|
|
|
|
| |
Reuse the existing dbi handler, instead of opening a new one.
|
|
|
|
| |
Move this function to the dbi.{h,c} files.
|
|
|
|
|
| |
src/cfg.c: In function ‘from_json_to_legacy’:
src/cfg.c:161:2: warning: format not a string literal and no format arguments [-Wformat-security]
|
|
|
|
| |
The return array needs to store 1 extra element for the disk setup.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This method provides the partitions setup for a specific client. The
request must contain exactly 1 client's IP.
Request:
GET /client/setup
{'client': ['192.168.56.12']}
Response:
200 OK
{
"partitions": [
{
"disk": 1,
"partition": 0,
"code": 0,
"size": 20971520,
"used_size": 0,
"filesystem": 0,
"os": 0,
"image": 0,
"software": 0
}
]
}
|
|
|
|
| |
reservaMemoria() is only used once, remove it.
|
|
|
|
| |
Remove unused legacy code.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
ogClient now includes more information regarding the new image. This patch
modifies ogServer to support new elements sent in ogClient /image/create
response and store them in the database.
Example of new /image/create response:
{
"disk": "1",
"partition": "1",
"code": "131",
"id": "1",
"name": "ubuntu",
"repository": "192.168.56.10",
"software": "Ubuntu 18.04.5 LTS \naccountsservice 0.6.45\n...",
"clonator": "PARTCLONE",
"compressor": "LZOP",
"filesystem": "EXTFS",
"datasize": 2100000
}
New fields are "clonator", "compressor", "filesystem" and "datasize".
|
|
|
|
| |
og_client_status() should not report busy when probing is going on.
|
|
|
|
|
| |
The 'ip' field is added to the json for scopes that have an IP (i.e.
computers).
|
|
|
|
|
|
| |
This patch selects clients whose modes need to be changed in the current
request. This patch makes POST /mode consistent with the rest of the
REST API where clients are selected and filtered by ip.
|
|
|
|
| |
This API is not supported by ogClient yet and it uses the obsolete socket hydra API.
|
|
|
|
| |
Add wol_socket_open() to initialize the WoL socket
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
CC src/rest.o
src/rest.c: In function ‘og_cmd_post_modes.isra.27’:
src/rest.c:966:4: warning: ‘%s’ directive output may be truncated writing up to 4096 bytes into a region of size between 3018 and 4041 -Wformat-truncation=]
"MODE_FILE='%s'\nMAC='%s'\nDATA='%s'\n"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/rest.c:1085:7:
template_name, scope_name);
~~~~~~~~~~~~~
src/rest.c:967:33: note: format string is defined here
"MODE='PERM'\nTEMPLATE_NAME='%s'",
^~
src/rest.c:965:2: note: ‘snprintf’ output 57 or more bytes (assuming 5176) into a destination of size 4096
snprintf(cmd_params, sizeof(cmd_params),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"MODE_FILE='%s'\nMAC='%s'\nDATA='%s'\n"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"MODE='PERM'\nTEMPLATE_NAME='%s'",
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mode, mac, params, template_name);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
| |
Add syslog and use exit()
|
|
|
|
| |
ogserver process owner (author Roberto Hueso Gómez).
|
|
|
|
|
| |
This patch changes the URI since it is semantically more correct to use
the singular.
|
|
|
|
|
|
|
|
|
|
|
| |
Now POST /modes does not only write to the database, it also uses the
external bash script 'setclientmode' to generate configured PXE
templates for each machine.
NOTE: This fix requires that room and computer names are unique in the
OpenGnsys DB. This behaviour is inherited from the previous
'setclientmode' script but, eventually, it should be replaced for an
actual scope selector.
|
|
|
|
|
| |
Max port number is UINT16_MAX, so this checks whether this config
parameter is in the correct range.
|
|
|
|
|
| |
This patch provides functionality to select a database port. It also adds a
default IP for the database.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch implements HTTP GET /hardware request which returns a list of
the hardware associated with a particular computer.
Request: GET /hardware
{
"scope": {
"id": 6,
"type": "computer"
}
}
Response: 200 OK
{
"hardware": [
{
"type": "Microprocesadores",
"description": "CPU arch:x86 target:x86_64 cores:4"
},
{
"type": "Memorias",
"description": "QEMU 4096MiB"
},
{
"type": "Tarjetas gráficas",
"description": "Red Hat, Inc Virtio GPU"
},
{
"type": "Tarjetas de Red",
"description": "Intel Corporation 82540EM Gigabit Ethernet Controller
QEMU Virtual Machine"
},
{
"type": "Controladores IDE",
"description": "Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
Qemu virtual machine"
}
]
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch implements HTTP POST /modes request which can change the mode of any
particular scope.
Request: POST /modes
{
"scope": {"id": 1,
"type": "computer"},
"mode": "pxe"
}
Response: 200 OK
|
|
|
|
| |
Add wol.c and wol.h that implements WakeOnLan.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some universities have computers in a different subnet where the
ogServer is, but ogServer WoL functionality only supported to send
packet to its own subnets. This commit solves this.
Now ogServer sends two WoL packets per client, one with the broadcast
address of the interface indicated in the config file, the other with
the broadcast address calculated with the address and netmask of the
client.
To ensure that the second WoL works correctly you must configure
correctly the IP and netmask of the clients. Also, you have to configure
the network of your organization to route WoL packet to the correct
subnet.
|
|
|
|
|
|
|
|
|
| |
/usr/bin/ld: src/cfg.o:/home/opengnsys/ogServer/src/ogAdmServer.h:25: multiple definition of `servidoradm'; src/ogAdmServer.o:/home/javi/trabajo/soleta/opengnsys/ogServer/src/ogAdmServer.h:25: first defined here
/usr/bin/ld: src/cfg.o:/home/opengnsys/ogServer/src/ogAdmServer.h:26: multiple definition of `puerto'; src/ogAdmServer.o:/home/javi/trabajo/soleta/opengnsys/ogServer/src/ogAdmServer.h:26: first defined here
/usr/bin/ld: src/cfg.o:/home/opengnsys/ogServer/src/ogAdmServer.h:35: multiple definition of `tbsockets'; src/ogAdmServer.o:/home/javi/trabajo/soleta/opengnsys/ogServer/src/ogAdmServer.h:35: first defined here
/usr/bin/ld: src/cfg.o:/home/opengnsys/ogServer/src/ogAdmLib.h:81: multiple definition of `ndebug'; src/ogAdmServer.o:/home/javi/trabajo/soleta/opengnsys/ogServer/src/ogAdmLib.h:81: first defined here
/usr/bin/ld: src/cfg.o:/home/opengnsys/ogServer/src/ogAdmLib.h:80: multiple definition of `szPathFileLog'; src/ogAdmServer.o:/home/javi/trabajo/soleta/opengnsys/ogServer/src/ogAdmLib.h:80: first defined here
/usr/bin/ld: src/cfg.o:/home/opengnsys/ogServer/src/ogAdmLib.h:80: multiple definition of `szPathFileCfg'; src/ogAdmServer.o:/home/javi/trabajo/soleta/opengnsys/ogServer/src/ogAdmLib.h:80: first defined here
|
|
|
|
|
|
| |
This improves style and fixes some memleaks.
Co-authored-by: OpenGnSys Support Team <soporte-og@soleta.eu>
|
|
|
|
| |
Missing closedir() call.
|
|
|
|
|
| |
If either root or children_root fail to be created but the other one does not,
then reserved memory for the successful one would not be freed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch implements HTTP GET /modes request which returns all modes available
for clients:
Request: GET /modes HTTP/1.0
Response: 200 OK
{
"modes": [
"pxe",
"10",
"13",
"00unknown",
"11",
"19pxeADMIN",
"12"
]
}
|
|
|
|
| |
Use the same folder as in ogClient.
|
|
|
|
| |
if open() fails it returns a negative value.
|