-
Notifications
You must be signed in to change notification settings - Fork 88
Updates for libvirt image removal and use directory #1722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
SimonFair
wants to merge
67
commits into
unraid:master
Choose a base branch
from
SimonFair:Remove-Vm-Image
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
67 commits
Select commit
Hold shift + click to select a range
8b495f8
Updates for image removal
SimonFair 6663975
Update VMSettings.page
SimonFair 12da995
Update rc.libvirt
SimonFair 81dd45a
Add libvirt_update script
SimonFair c1cf813
Make script executable
SimonFair ea49630
Update rc.libvirt
SimonFair f2822c7
Changes to VM Settings
SimonFair 28ec848
revert rc.libvirt changes
SimonFair de53cf4
Initial moving libvirt image to folder and vice versa.
SimonFair 3ffebdf
Update help text
SimonFair a9d8167
Merge remote-tracking branch 'upstream/master' into Remove-Vm-Image
SimonFair 7b03382
Remove secondary path.
SimonFair fca221a
Remove secondary code.
SimonFair d5d3bad
Merge remote-tracking branch 'upstream/master' into Remove-Vm-Image
SimonFair 79e2e53
Merge remote-tracking branch 'upstream/master' into Remove-Vm-Image
SimonFair 7256297
Create location file.
SimonFair 00ed5d2
Make script executable
SimonFair d13e6b2
XML movements
SimonFair a41622b
Make script executable
SimonFair 092af90
Udates to XML movement.
SimonFair 6d7c50c
Updates
SimonFair 5287435
Add XML processing to save configs in vm dir.
SimonFair 111f3d0
Update libvirt.php
SimonFair 75ffb61
Update libvirt.php
SimonFair eab65bf
Update emhttp/languages/en_US/helptext.txt
SimonFair f82fc7b
Update emhttp/plugins/dynamix.vm.manager/VMSettings.page
SimonFair 3b4139b
Update emhttp/plugins/dynamix.vm.manager/include/fs_helpers.php
SimonFair ab766fb
Update emhttp/plugins/dynamix.vm.manager/scripts/libvirt_init
SimonFair 2e45d29
Update emhttp/plugins/dynamix.vm.manager/scripts/libvirt_init
SimonFair 4e7b667
Update emhttp/plugins/dynamix.vm.manager/scripts/libvirtcopy
SimonFair 80b04cb
Update etc/rc.d/rc.libvirt
SimonFair 835b348
Update emhttp/plugins/dynamix.vm.manager/scripts/libvirtmigrate
SimonFair 9668907
Update emhttp/plugins/dynamix.vm.manager/scripts/libvirtrestore
SimonFair 62629a1
Update emhttp/plugins/dynamix.vm.manager/scripts/savehook.php
SimonFair a9c4b21
Update libvirt.php
SimonFair 1b1f4f4
Merge branch 'Remove-Vm-Image' of https://github.com/SimonFair/webgui…
SimonFair a640587
Update libvirtmigrate
SimonFair 0f4cda7
Coderabbit updates
SimonFair c2533c6
check for new model flag and change paths
SimonFair b1ae311
Update libvirt_paths.php
SimonFair 43d6d87
Create rc.libvirt.conf
SimonFair b689eab
Merge remote-tracking branch 'upstream/master' into Remove-Vm-Image
SimonFair 560ed51
Make script executable
SimonFair 0f8de49
Path changes.
SimonFair 3283bfe
Path processing.
SimonFair e0524d9
Fix delete issue.
SimonFair 9ff9afb
fix snapshot GPF
SimonFair 6fff228
fix nvram creation issue and snapshotdb location.
SimonFair f0f671a
fix nvram processing.
SimonFair 28de0ee
add delete all option
SimonFair 62a461f
remove debug logging
SimonFair c9ec4dd
Code rabbit changes
SimonFair 36b7e58
further updates
SimonFair cae0c9c
Updates
SimonFair 5c10559
Remove nvram for block commit.
SimonFair 6569d17
purge nvram during block operations if removed by qemu
SimonFair 091bb18
Remove directory if empty.
SimonFair 44d7fcf
refactor by creating single is_vm_new_model
SimonFair e6bba6b
code rabbit updates.
SimonFair 23dd144
Migrate to new model
SimonFair fbcc6db
Update libvirt_init
SimonFair 7203a1f
Update libvirt.php
SimonFair 9d745cc
Update libvirt.php
SimonFair 827c65a
Update libvirt.php
SimonFair e0cae04
Update migration process.
SimonFair 05dae8f
Update rc.libvirt
SimonFair b9c7a1b
fix snapshot lookups
SimonFair File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
emhttp/plugins/dynamix.vm.manager/include/fs_helpers.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| <?php | ||
| /* Filesystem helper utilities for dynamix.vm.manager | ||
| * - files_identical($a,$b) | ||
| * - copy_if_different($src,$dst, $dry_run=false) | ||
| * - dir_copy($src,$dst) (recursive, skips identical files) | ||
| * - dir_remove($dir) (recursive remove) | ||
| */ | ||
|
|
||
| function files_identical($a, $b) { | ||
| if (!file_exists($a) || !file_exists($b)) return false; | ||
| if (filesize($a) !== filesize($b)) return false; | ||
| $ha = @md5_file($a); | ||
| $hb = @md5_file($b); | ||
| if ($ha === false || $hb === false) return false; | ||
| return $ha === $hb; | ||
| } | ||
|
|
||
| function copy_if_different($src, $dst, $dry_run = false) { | ||
| $result = [ | ||
| 'src' => $src, | ||
| 'dst' => $dst, | ||
| 'would_copy' => false, | ||
| 'copied' => false, | ||
| 'error' => null | ||
| ]; | ||
|
|
||
| if (!file_exists($src)) { | ||
| $result['error'] = 'source not found'; | ||
| return $result; | ||
| } | ||
|
|
||
| $dst_dir = dirname($dst); | ||
| if (!is_dir($dst_dir)) { | ||
| if ($dry_run) { | ||
| $result['would_copy'] = true; | ||
| return $result; | ||
| } | ||
| if (!@mkdir($dst_dir, 0755, true)) { | ||
| $result['error'] = 'failed to create dest dir'; | ||
| return $result; | ||
| } | ||
| } | ||
|
|
||
| if (file_exists($dst)) { | ||
| if (files_identical($src, $dst)) { | ||
| return $result; // identical, nothing to do | ||
| } | ||
| $result['would_copy'] = true; | ||
| } else { | ||
| $result['would_copy'] = true; | ||
| } | ||
|
|
||
| if ($dry_run) return $result; | ||
|
|
||
| if (@copy($src, $dst)) { | ||
| $result['copied'] = true; | ||
| } else { | ||
| $result['error'] = 'copy_failed'; | ||
| } | ||
|
|
||
| return $result; | ||
| } | ||
|
|
||
| function dir_copy($src, $dst) { | ||
| if (!is_dir($src)) return false; | ||
| if (!is_dir($dst)) { | ||
| if (!@mkdir($dst, 0755, true)) return false; | ||
| } | ||
| $items = scandir($src); | ||
| foreach ($items as $item) { | ||
| if ($item === '.' || $item === '..') continue; | ||
| $s = $src . DIRECTORY_SEPARATOR . $item; | ||
| $d = $dst . DIRECTORY_SEPARATOR . $item; | ||
| if (is_dir($s)) { | ||
| if (!dir_copy($s, $d)) return false; | ||
| } else { | ||
| if (file_exists($d)) { | ||
| if (files_identical($s, $d)) continue; | ||
| } | ||
| if (!@copy($s, $d)) return false; | ||
| } | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
| function dir_remove($dir) { | ||
| if (!is_dir($dir)) return false; | ||
| $items = scandir($dir); | ||
| if ($items === false) return false; | ||
| foreach ($items as $item) { | ||
| if ($item === '.' || $item === '..') continue; | ||
| $path = $dir . DIRECTORY_SEPARATOR . $item; | ||
| if (is_dir($path)) { | ||
| if (!dir_remove($path)) return false; | ||
| } else { | ||
| if (!@unlink($path)) return false; | ||
| } | ||
| } | ||
| return @rmdir($dir); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.