Skip to content

Commit

Permalink
Merge pull request #650 from xkwangcn/master
Browse files Browse the repository at this point in the history
Create coreos ignition guestfs upload directory for s390 platform
  • Loading branch information
MalloZup committed Sep 27, 2019
2 parents 3a11558 + 60a702f commit 1c8597d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions libvirt/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,13 @@ func guestfishExecution(rootPath string, fileToUpload string) error {
return fmt.Errorf("Mount failed: %v, %s", err, getStderr(stderr))
}

// guestfish --remote -- mkdir-p /ignition
cmd = execCommand("guestfish", "--remote", "--", "mkdir-p", "/ignition")
err = cmd.Run()
if err != nil {
return fmt.Errorf("Mkdir failed: %v, %s", err, getStderr(stderr))
}

// This is the real command that upload the file from current location (the local file system)
// to remote file location (the coreos file system)
// guestfish --remote -- upload $4 $3/$4
Expand Down
13 changes: 13 additions & 0 deletions libvirt/guestfish_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ var supportedCommands = [][]string{
{
"guestfish", "--remote", "--", "mount", "*", "/",
},
{
"guestfish", "--remote", "--", "mkdir-p", "/ignition",
},
{
"guestfish", "--remote", "--", "upload", "*.ign", "/ignition/config.ign",
},
Expand Down Expand Up @@ -68,6 +71,9 @@ var supportedCommandTree = map[string]interface{}{
"/": nil,
},
},
"mkdir-p": map[string]interface{}{
"/ignition": nil,
},
"upload": map[string]interface{}{
".*.ign": map[string]interface{}{
"/ignition/config.ign": nil,
Expand Down Expand Up @@ -189,6 +195,13 @@ func validateCommandSemanticsAndGenerateOutput(args ...string) (bool, string) {
return false, errMsg
}

if newArgs[3] == "mkdir-p" {
if Mounted == currentGuestfishStatus {
return true, ""
}
return false, errMsg
}

if newArgs[3] == "upload" {
if Mounted == currentGuestfishStatus {
return true, ""
Expand Down

0 comments on commit 1c8597d

Please sign in to comment.