| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Translate old legacy grub scripts into grub.py
Implement ogGrubInstallMbr as install_main_grub() and
ogGrubInstallPartition as install_linux_grub().
Add grub configuration file generator through the classes
GrubConfig and MenuEntry.
Ensure EFI tree structure compatibility with legacy code.
The structure of the created folders in the ESP is non-standard,
efi binaries are usually located in the folder below the EFI/
directory.
Structure used by ogClient:
EFI/
├── grub/
│ └── Boot/
│ ├── BOOTX64.CSV
│ ├── grub.cfg
│ ├── mmx64.efi
│ ├── shimx64.efi
│ ├── BOOTX64.EFI
│ ├── grubx64.efi
│ └── ogloader.efi
...
The function _mangle_efi_folder handles the folder structure after
grub-install to comply with the location expected by ogLive.
install_linux_grub() installs a grub local to each Linux install
to enable chainloading, each grub is located in EFI/Part-xx-yy/ in
UEFI. The local linux BIOS grub in legacy scripts is unreliable,
grub-install reports a failure during the install process.
install_main_grub() installs a global grub in EFI/grub/ to show a
grub menu when the pxe boot fails. The global grub contains entries
to every installed os. No global grub is installed for BIOS
systems, a Boot partition would be required to store the grub
configuration.
|
|
|
|
|
| |
Use cxt.label.name instead of cxt.label to identify if the disk is
GPT or MBR. This way is more used in other parts of the codebase.
|
|
|
|
|
| |
Use the intended linuz_dir instead of initrd_dir in the function
get_vmlinuz_path.
|
|
|
|
|
| |
Fix log error message when _find_efi_loader does not find any
EFI loader in the ESP.
|
|
|
|
|
| |
Check against GRUB_CMDLINE_LINUX_DEFAULT instead of
GRUB_CMDLINE_LINUE_DEFAULT.
|
|
|
|
|
|
|
|
|
|
| |
python-libfdisk does not close file descriptor until the cxt
object goes out of scope.
Define get_partition_data and get_disk_data functions to isolate
the python-libfdisk logic and return the data as an object.
Improve error handling of libfdisk operaions in refresh.
|
|
|
|
| |
Report the partition number of the missing partition.
|
|
|
|
|
|
|
| |
Mount cache in image_create() image_restore() and cache_fetch().
Remove init_cache() and ensure /opt/opengnsys/images/ exists
within the cache mountpoint if it does not exists in cache_mount().
|
|
|
|
| |
this never returns -1 on error, an exception is rised instead
|
|
|
|
|
|
|
|
|
|
| |
Add compute_md5 function in src/utils/fs.py
Remove identical md5 functions from src/live/ogOperations.py and
src/utils/tiptorrent.py
Move error checks from ogOperations.py into compute_md5 function in
src/utils/fs.py
|
|
|
|
|
|
|
| |
Mount the system partition in readonly mode and check for the
hiberfil.sys file if the target system is a Windows.
Fail the image creation process if the target system is hibernated.
|
|
|
|
| |
Add CLI flag to override the server IP defined in the config file.
|
|
|
|
|
|
| |
- enable WoL
- check for poweroff and reboot before checking for busybox.
- call new shutdown method
|
|
|
|
| |
tip_client_get() needs f-string to display error
|
|
|
|
|
|
|
|
|
|
|
|
| |
python-libfdisk does not close file descriptor to /dev/sda after completing
partitioning. This results EBUSY errors when formatting partitions with mkfs
in newer kernels. Encapsulate code to partition in method so python garbage
collection knows ctx objects can be release then close file descritor to
/dev/sda.
ogRest is not accessible from _partition(), remove check to ogRest.terminated,
actually no need to terminate inmediately when formatting is ongoing, better
leave things in consistent state when stop command is received.
|
|
|
|
| |
Log the correct partition size unit. Use MiB instead of MB.
|
|
|
|
|
|
| |
Use a python function to obtain the main net interface. Detect
the first ethernet inferface in use.
Stop using the DEVICE environment variable.
|
|
|
|
| |
unused since ogserver's commit 87be2ce08 #980 Change initial probe to refresh
|
| |
|
|
|
|
|
| |
Add shutils.which checks before every browser operations to
skip the subprocess call if the binary is missing.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add "used_size" and "free_size" to the partition data and the
cache data.
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'}
]
}
}
|
|
|
|
|
|
|
|
| |
Reuse os_probe() function from probe.py and change the fallback
case to "unknown" to prevent OS id mismatch in ogserver.
The OS id mismatch causes the images to stop being associated with
partitions after the /refresh command.
|
|
|
|
|
|
|
| |
Don't send the efi data in the /refresh payload if efibootmgr
is missing any of the json keys.
Log the missing keys in case of missing some.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add python implementation of the legacy ogWindowsRegisterPartition
function.
This function configures the system partition to be considered the
new C drive after a Windows image restore.
The drive letter configuration is stored in the SYSTEM hive of
the windows registry. The node MountedDevices contains all the
configuration as key-value pairs.
The C drive key \DosDevices\C: contains a different value based on
the partitioning type.
GPT
the value is DMIO:ID: followed by the 16 byte GUID of the
partition.
Example: DMIO:ID:\xc9\xfc\x1c\x86\x13\x11O\t\xa2\x9c{/\xf1\xdf\xe4)
MBR
The value is a little endian byte sequence with 2 parts.
The first 4 bytes correspond to the disk id. The second part is
the byte offset start of the partition in that disk.
Example: \xe1\\\x9cP\x00\x00\x10j\x18\x00\x00\x00
If we format the MBR value in a more readable way we get
e1 5c 9c 50 00 00 10 6a 18 00 00 00
In this case the disk ID is 509c5ce1.
The partition offset is 186a100000.
This patch adds the following helper functions to:
- get_disk_id_bytes(): to obtain the disk identifier.
- get_part_id_bytes(): to obtain a partition identifier as UUID
for MBR or DMIO:ID format for GPT.
- get_sector_size(): to query the sector size of a specific disk.
Read /sys/class/block/{device_name}/queue/hw_sector_size to obtain the value.
This is MBR specific.
- get_partition_start_offset(): to query the start sector of a specific
partition and disk. Use sfdisk with the -J argument to get fdisk data in
json format. This is MBR specific.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add 'efi' key into the refresh payload. The value for that key
has the following structure:
'efi': {
'entries': [
{
"order": 0,
"name": "Boot0000",
"active": false,
"description": "grub"
},
{
"order": 1,
"name": "Boot0001",
"active": true,
"description": "UEFI: PXE IP4 Realtek PCIe GBE Family Controller"
}
]
}
If the client is not a EFI system it won't add the 'efi' field.
If an entry is not in the boot order it won't have the 'order' field.
|
|
|
|
| |
Ignore recovery disable if no Recovery node is found in the BCD.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
fe40f9c5 ('src: add POST cache/fetch method') broke unicast cache restore.
(2024-09-09 10:05:22) ogClient: [ERROR] - name 'image_name' is not defined
Traceback (most recent call last):
File "/opt/opengnsys/ogClient/src/ogRest.py", line 175, in image_restore
payload = ogRest.operations.image_restore(request, ogRest)
File "/opt/opengnsys/ogClient/src/live/ogOperations.py", line 520, in image_restore
self._restore_image_unicast(repo, name, partdev, cache)
File "/opt/opengnsys/ogClient/src/live/ogOperations.py", line 242, in _restore_image_unicast
image_path = f'{OG_CACHE_IMAGE_PATH}{image_name}.img'
NameError: name 'image_name' is not defined
|
|
|
|
|
| |
f2a2f5307464 ('live: remove file from cache with no checksum file') broke
indentation which breaks ogClient.
|
|
|
|
|
| |
Add disk index bounds checks for setup() and image_create().
Prevent backtrace logging when an invalid disk index is used.
|
|
|
|
|
| |
Maybe result of a partial download? then, remove it to leave cache in consistent
state.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implement configure_fstab() as a replacement of ogConfigureFstab.
Create src/utils/fstab.py to implement the main fstab
configuration functions. Define two fstab helper classes,
FstabBuilder and FstabEntry.
FstabEntry
Represents each line in the fstab file.
Has the values: device, mountpoint, fstype, options, dump_code
and pass_code.
FstabBuilder
Contains a list of FstabEntry. Handles loading of a
preexisting fstab file and the serialization of multiple
FstabEntry into a file.
The fstab configuration has 3 main steps:
Root partition:
- Update the device field with the device where
the new system is installed.
Swap partition:
- Preserve all the swapfile entries in every case.
- If the filesystem has a swap partition: update the device field
in the first fstab swap entry and remove the rest swap entries
pointing to a swap partition. Only one swap partition is supported.
Create a new fstab entry if no preexisting swap entry exists.
- If the system has no swap partition remove every swap partition
entry.
EFI partition:
- Update the device field of the EFI fstab entry if it exists.
Create a new fstab entry if no preexisting EFI entry exists.
Add get_filesystem_id to disk.py to obtain the UUID.
Define every device field as a UUID. That method is more robust
than a plain device path as it works after disks being added or
removed.
|
|
|
|
|
| |
legacy scripts are not reliable, legacy scripts continue processing on errors,
warn on errors until they are converted to native code instead.
|
| |
|
|
|
|
|
|
|
| |
logging.warn() is deprecated since 3.3.
And use .error() instead when command is unsupported or client is busy, that
should not ever happen.
|
|
|
|
|
| |
MBR requires manual bcdedit invocation to generalize image before creation.
Report via logging that no BCD update occurs.
|
| |
|
|
|
|
|
| |
if image file and checksum are not found in the cache, then report checksum
validation has failed so it can proceed to fetch new files from server.
|
|
|
|
| |
remove call to custom version of legacy script, display warning.
|
|
|
|
| |
Remove image files after a failed image copy operation.
|
|
|
|
|
|
| |
Don't log a backtrace when a not implemented function is called
in ogClient.
Log a "Function not implemented" message.
|
|
|
|
| |
Remove the use of shell=True.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add API REST method to fetch an image.
Consolidate image fetch loging for cache/fetch and image/restore.
Resquest payload structure:
{
'image': 'linux.img'
'type': 'TIPTORRENT'
'repository': '12.141.10.2'
}
The client will try to fetch'image' from 'repository' into cache.
Resquest response structure:
{
'cache': [
{'name': 'windows.img', 'size': 2432370213, checksum: '5d4dcc677bc19f40a647d0002f4ade90'},
{'name': 'linux.img', 'size': 243234534213, checksum: '3eb22f888f88a55ad954f55644e1192e'}
]
}
|
|
|
|
| |
output is never consumed.
|
|
|
|
| |
log that image restoration has entered OS configuration stage.
|
|
|
|
| |
just a clean up.
|
| |
|
|
|
|
| |
s/nor/not
|
|
|
|
|
|
|
|
|
| |
As per:
$ getconf HOST_NAME_MAX
64
truncate it to the maximum.
|
| |
|
|
|
|
| |
instead of using info to report errors.
|