Skip to content

Commit

Permalink
Use scratch space as the default option for most imports
Browse files Browse the repository at this point in the history
Since we dropped the use of nbdkit we've started prioritizing the use of scratch space for most import flows.

However, this new behavior introduced minor differences such as stop converting raw images, which caused inconsistencies in some tests.

This commit improves the importer flow to better determine whether to use scratch space or not.

Signed-off-by: Alvaro Romero <alromero@redhat.com>
  • Loading branch information
alromeros committed Apr 23, 2024
1 parent efa362f commit 684ba92
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
6 changes: 3 additions & 3 deletions pkg/importer/format-readers.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,15 @@ func (fr *FormatReaders) fileFormatSelector(hdr *image.Header) {
fr.Archived = true
fr.ArchiveZstd = true
}
case "qcow2":
r, err = fr.qcow2NopReader(hdr)
fr.Convert = true
case "xz":
r, err = fr.xzReader()
if err == nil {
fr.Archived = true
fr.ArchiveXz = true
}
case "qcow2":
r, err = fr.qcow2NopReader(hdr)
fr.Convert = true
case "vmdk":
r = nil
fr.Convert = true
Expand Down
6 changes: 0 additions & 6 deletions pkg/importer/http-datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,13 @@ func (hs *HTTPDataSource) Info() (ProcessingPhase, error) {
if hs.contentType == cdiv1.DataVolumeArchive {
return ProcessingPhaseTransferDataDir, nil
}
if !hs.readers.Convert {
return ProcessingPhaseTransferDataFile, nil
}
if pullMethod, _ := util.ParseEnvVar(common.ImporterPullMethod, false); pullMethod == string(cdiv1.RegistryPullNode) {
hs.url, _ = url.Parse(fmt.Sprintf("nbd+unix:///?socket=%s", nbdkitSocket))
if err = hs.n.StartNbdkit(hs.endpoint.String()); err != nil {
return ProcessingPhaseError, err
}
return ProcessingPhaseConvert, nil
}
// removing check for hs.brokenForQemuImg, and always assuming it is true
// revert once we are able to get nbdkit 1.35.8, which contains a fix for the
// slow download speed.
return ProcessingPhaseTransferScratch, nil
}

Expand Down

0 comments on commit 684ba92

Please sign in to comment.