use context to store disk, partition and image id that is requested to client
and handle refresh response from ogclient to update database, otherwise, an
explicit refresh from web frontend is required.
partition code is already in decimal as integer, appending 0x to this decimal
results in an incorrect hexadecimal conversion when storing it to the database.
The web frontend bogusly displays "Empty" as partition type until a refresh
happens.
Send image/update instead of only image/create for both update
and create operations. A failed update operation using the
error handler of OG_CMD_IMAGE_CREATE results in the deletion
of the image from database.
Fail if the image already exists for an image create operation.
Fix partition code parse from strng to integer in
og_update_client_disk_info(), forcing a positive partition format
detection every refresh. This caused the unlink of images in every
partition during a refresh command.
Remove image idimagen=0 SQL instruction from software inventory.
Prevent image unlink during a sofware inventory command for a specific
partition.
Remove 'is_default' column from 'lives' database table and add
column 'priority' of type INT. This new value can store a priority
value but the actual design only stores 1 or 0.
Update GET oglive/list to use the new 'priority' database value.
Add POST oglive/default.
Set the database column 'priority' to 1 if the new default
exists in the database. Set the others to priority 0.
Modify legacy ogliveinfo.json if the new default coresponds to a
live not found in the database. Edit the field 'default' of the
file's json.
Use http error code to improve better error reporting:
- 404 Not Found
+ object is not found
- 409 Conflict
+ object already exists
- 423 Locked
+ object is in use
- 500 Internal Server Error:
+ database query fails
+ out of memory
- 501 Service Unavailable
+ Cannot connect to database
- 507 Insufficient Storage
+ Disk is full
Remove legacy "echo" parameter.
Add boolean "inline" parameter to determine if the execution is
an inline command or a predefined script in /opt/opengnsys/shell/
Add built-in ogrelive grub2 boot mode template and use it to generate the grub2
boot file for each computer for the new live system.
Use grub2 http to download vmlinuz, initrd.img.
Use live support to download filesystem.squashfs through http.
check for vmlinuz in cache, as usual, otherwise fallback to network boot.
Check the parent node along with the folder name to identify if
the folder already exists.
Fix error when using a folder name defined in any other folder.
Add API to register and delete oglives from the database.
POST /oglive/add
Register an installed oglive in the database, if the entry already
exists update its creation date.
Example request payload:
{"name": "ogrelive-6.1.0-26"}
POST /oglive/delete
Remove an installed oglive from the database
Example request payload:
{"name": "ogrelive-6.1.0-26"}
Add last client command context that is used in the request to client.
This allows to remove the stub image entry in the database in case that the
image creation fails.
if center is removed, leave images in place, image belongs to
repository, not to center.
This comes from b4870733 ('#942 Add REST POST /center/delete method')
Add safe_strtoull to validate the execution of strtoull.
Definining the base of the number is required becase partition
codes are base 16 but they lack the 0x prefix.
Replace uses of atoi and strtoull/strtoul and log the conversion
errors.
Some equipment reports this error:
Error 28: Selected item cannot fit into memory
because line is too long, revert this commit until there is a better way
to add fetch= only on new live images.
Extend database table ordenadores_particiones to add new "used_size" and "free_size" fields.
FIELD TYPE
| tamano | bigint |
| uso | tinyint |
| used_size | bigint |
| free_size | bigint |
"tamano" is the field storing the total size of the partition.
"uso" is a field storing the integer percentage of use, it is preserved for backwards compatibility with scritps that access the database.
"used_size" and "free_size" contain the used and free partition
size in bytes.
Old response from ogClient for /cache/delete, /cache/fetch
and /image/restore:
{
'cache': [
{'name': 'windows.img', 'size': 2432370213, checksum: '5d4dcc677bc19f40a647d0002f4ade90'},
{'name': 'linux.img', 'size': 243234534213, checksum: '3eb22f888f88a55ad954f55644e1192e'}
]
}
New response:
{
'cache': {
'used_size': 4520232322423,
'free_size': 48273465287452945,
'images': [
{'name': 'windows.img', 'size': 2432370213, checksum: '5d4dcc677bc19f40a647d0002f4ade90'},
{'name': 'linux.img', 'size': 243234534213, checksum: '3eb22f888f88a55ad954f55644e1192e'}
]
}
}
Parse the new "free_size" and "used_size" fields of each partition data in the response payload of /refresh
Parse "free_size" and "used_size" fields of the cache data in the reponse payload of /image/restore, /cache/delete and /cache/fetch
Replace "used_size" field of GET /client/setup with the value
of the new database field "used_size"
Reimplement the legacy funcion actualizaConfiguracion with
og_update_client_config in src/client.c
if disk does not exist, add it, otherwise update disk contents.
if partition size, code, filesystem or os is different, reset image id,
otherwise update partition usage only.
delete partitions that are gone at the end.