mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 18:24:07 +00:00
RBD return output in error case
This commit is contained in:
parent
e20a0db159
commit
52c9a3abe2
@ -210,6 +210,7 @@ func (util *RBDUtil) defencing(c rbdCleaner) error {
|
||||
|
||||
func (util *RBDUtil) AttachDisk(b rbdBuilder) error {
|
||||
var err error
|
||||
var output []byte
|
||||
|
||||
devicePath, found := waitForPath(b.Pool, b.Image, 1)
|
||||
if !found {
|
||||
@ -227,18 +228,19 @@ func (util *RBDUtil) AttachDisk(b rbdBuilder) error {
|
||||
mon := b.Mon[i%l]
|
||||
glog.V(1).Infof("rbd: map mon %s", mon)
|
||||
if b.Secret != "" {
|
||||
_, err = b.plugin.execCommand("rbd",
|
||||
output, err = b.plugin.execCommand("rbd",
|
||||
[]string{"map", b.Image, "--pool", b.Pool, "--id", b.Id, "-m", mon, "--key=" + b.Secret})
|
||||
} else {
|
||||
_, err = b.plugin.execCommand("rbd",
|
||||
output, err = b.plugin.execCommand("rbd",
|
||||
[]string{"map", b.Image, "--pool", b.Pool, "--id", b.Id, "-m", mon, "-k", b.Keyring})
|
||||
}
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
glog.V(1).Infof("rbd: map error %v %s", err, string(output))
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("rbd: map failed %v %s", err, string(output))
|
||||
}
|
||||
devicePath, found = waitForPath(b.Pool, b.Image, 10)
|
||||
if !found {
|
||||
|
Loading…
Reference in New Issue
Block a user