-
Notifications
You must be signed in to change notification settings - Fork 296
Supported image formats #6712
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
gthvn1
wants to merge
5
commits into
xapi-project:master
Choose a base branch
from
xcp-ng:gtn-image-formats
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
Supported image formats #6712
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
da4765e
Datamodel: add supported_image_format field to SM object
gthvn1 699df3e
Allow selection of image format during migration
gthvn1 2905460
Add new parameter to VM.migrate_send in GO SDK
gthvn1 9a3b7a4
Bumping database schema version
gthvn1 d3f45c6
quicktest: add VDI migration test
gthvn1 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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| let local_vdi_migration rpc session_id vm_template | ||
| ((src_sr_info, dst_sr_info) : Qt.sr_info * Qt.sr_info) () = | ||
| let open Client in | ||
| Printf.printf "Testing migration from %s to %s\n" | ||
| (Client.SR.get_name_label ~rpc ~session_id ~self:src_sr_info.sr) | ||
| (Client.SR.get_name_label ~rpc ~session_id ~self:dst_sr_info.sr) ; | ||
|
|
||
| (* Create a VDI on src *) | ||
| let vdi = | ||
| Client.VDI.create ~rpc ~session_id ~name_label:"[QT] testing migration" | ||
| ~name_description:__FILE__ ~sR:src_sr_info.sr ~virtual_size:2097152L | ||
| ~_type:`user ~sharable:false ~read_only:false ~other_config:[] | ||
| ~xenstore_data:[] ~sm_config:[] ~tags:[] | ||
| in | ||
|
|
||
| (* Track which VDI must be destroyed at cleanup time. After migration, ownership | ||
| moves from the original VDI to the migrated one. *) | ||
| let final_vdi = ref vdi in | ||
|
|
||
| Xapi_stdext_pervasives.Pervasiveext.finally | ||
| (fun () -> | ||
| (* We can now create the VM and perform the migration *) | ||
| Qt.VM.with_new rpc session_id ~template:vm_template (fun vm -> | ||
| (* Attach the VDI *) | ||
| Client.VBD.create ~rpc ~session_id ~vM:vm ~vDI:vdi ~device:"" | ||
| ~userdevice:"0" ~bootable:false ~mode:`RW ~_type:`Disk | ||
| ~unpluggable:true ~empty:false ~other_config:[] | ||
| ~qos_algorithm_type:"" ~qos_algorithm_params:[] | ||
| ~currently_attached:true | ||
| |> ignore ; | ||
|
|
||
| let migrated_vdi = | ||
| Client.VDI.pool_migrate ~rpc ~session_id ~vdi ~sr:dst_sr_info.sr | ||
| ~options:[("dest-img-format", "vhd")] | ||
| in | ||
|
|
||
| final_vdi := migrated_vdi ; | ||
|
|
||
| let new_sr = Client.VDI.get_SR ~rpc ~session_id ~self:migrated_vdi in | ||
| let actual = Client.SR.get_uuid ~rpc ~session_id ~self:new_sr in | ||
| let expected = | ||
| Client.SR.get_uuid ~rpc ~session_id ~self:dst_sr_info.sr | ||
| in | ||
|
|
||
| Alcotest.(check string) | ||
| "VDI migrated to destination SR" expected actual | ||
| ) | ||
| ) | ||
| (fun () -> | ||
| try Client.VDI.destroy ~rpc ~session_id ~self:!final_vdi with _ -> () | ||
| ) | ||
|
|
||
| let tests () = | ||
| let smapiv1_mig = | ||
| Qt_filter.SR.( | ||
| all | ||
| |> not_iso | ||
| |> smapiv1 | ||
| |> allowed_operations [`vdi_mirror; `vdi_snapshot] | ||
| ) | ||
| in | ||
| let smapiv3_mig = | ||
| Qt_filter.SR.(all |> not_iso |> smapiv3 |> allowed_operations [`vdi_mirror]) | ||
| in | ||
|
|
||
| let open Qt_filter in | ||
| [ | ||
| [("SMAPIv1 migration test", `Slow, local_vdi_migration)] | ||
| |> conn | ||
| |> vm_template Qt.VM.Template.other | ||
| |> migration_path smapiv1_mig | ||
| ; [("SMAPIv3 migration test", `Slow, local_vdi_migration)] | ||
| |> conn | ||
| |> vm_template Qt.VM.Template.other | ||
| |> migration_path smapiv3_mig | ||
| ] | ||
| |> List.concat |
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
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
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 |
|---|---|---|
|
|
@@ -1625,6 +1625,7 @@ let rec cmdtable_data : (string * cmd_spec) list = | |
| ; "compress" | ||
| ; "vif:" | ||
| ; "vdi:" | ||
| ; "image-format:" | ||
| ] | ||
| ; help= | ||
| "Migrate the selected VM(s). The parameter '--live' will migrate the \ | ||
|
|
@@ -1638,7 +1639,9 @@ let rec cmdtable_data : (string * cmd_spec) list = | |
| 'copy=true' will enable the copy mode so that a stopped vm can be \ | ||
| copied, instead of migrating, to the destination pool. The vif and \ | ||
| vdi mapping parameters take the form 'vif:<source vif uuid>=<dest \ | ||
| network uuid>' and 'vdi:<source vdi uuid>=<dest sr uuid>'. \ | ||
| network uuid>' and 'vdi:<source vdi uuid>=<dest sr uuid>'. You can \ | ||
| also specify the destination image format of the VDI using \ | ||
| 'image-format:<source vdi uuid>=<destination image format>'. \ | ||
| Unfortunately, destination uuids cannot be tab-completed." | ||
| ; implementation= No_fd Cli_operations.vm_migrate | ||
| ; flags= [Standard; Vm_selectors] | ||
|
|
@@ -2480,10 +2483,10 @@ let rec cmdtable_data : (string * cmd_spec) list = | |
| ; ( "vdi-pool-migrate" | ||
| , { | ||
| reqd= ["uuid"; "sr-uuid"] | ||
| ; optn= [] | ||
| ; optn= ["dest-img-format"] | ||
| ; help= | ||
| "Migrate a VDI to a specified SR, while the VDI is attached to a \ | ||
| running guest." | ||
| "Migrate a VDI to a specified SR, while it is attached to a running \ | ||
| guest. You can specify the image format for the destination." | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add what format is allowed: RAW, VHD and QCow2 |
||
| ; implementation= No_fd Cli_operations.vdi_pool_migrate | ||
| ; flags= [] | ||
| } | ||
|
|
||
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably want to be consistent with VM.pool-migrate that uses "img-format" ?