Browse Source

Print user friendly warning when target sr unknown

Signed-off-by: Robert Breker <robert.breker@citrix.com>
getsshkeypath_pr
Robert Breker 8 years ago
parent
commit
aabf8f6965
  1. 8
      xenserver/xenserver.go

8
xenserver/xenserver.go

@ -5,6 +5,7 @@ import (
"bytes" "bytes"
"crypto/rand" "crypto/rand"
"crypto/tls" "crypto/tls"
"errors"
"fmt" "fmt"
"io" "io"
"io/ioutil" "io/ioutil"
@ -325,6 +326,13 @@ func (d *Driver) Create() error {
var sr *xsclient.SR var sr *xsclient.SR
if d.SR == "" { if d.SR == "" {
sr, err = c.GetDefaultSR() sr, err = c.GetDefaultSR()
if sr.Ref == "OpaqueRef:NULL" {
err := errors.New("No default SR found. Please configure a " +
"default or specify the SR explicitly using " +
"--xenserver-sr-label.")
log.Errorf("%v", err)
return err
}
} else { } else {
sr, err = c.GetUniqueSRByNameLabel(d.SR) sr, err = c.GetUniqueSRByNameLabel(d.SR)
} }

Loading…
Cancel
Save