fix invalid esx5 path separator in windows
before, this code had joining path elements by filepath module. filepath module generate path string with backslash-joined in Windows. but ESX require path string with slash-joined. it means that this code generate illegal path string in windows. illegal path string raised "Error creating disk". this patch fixes path separator from backslash to slash in windows. from this, creating disk would succeed without error.
This commit is contained in:
parent
25ff0f04e6
commit
982e523ba2
|
@ -64,7 +64,7 @@ func (d *ESX5Driver) Stop(vmxPathLocal string) error {
|
|||
}
|
||||
|
||||
func (d *ESX5Driver) Register(vmxPathLocal string) error {
|
||||
vmxPath := filepath.Join(d.outputDir, filepath.Base(vmxPathLocal))
|
||||
vmxPath := filepath.ToSlash(filepath.Join(d.outputDir, filepath.Base(vmxPathLocal)))
|
||||
if err := d.upload(vmxPath, vmxPathLocal); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ func (d *ESX5Driver) UploadISO(localPath string) (string, error) {
|
|||
}
|
||||
|
||||
finalPath := d.datastorePath(targetFile)
|
||||
if err := d.mkdir(filepath.Dir(finalPath)); err != nil {
|
||||
if err := d.mkdir(filepath.ToSlash(filepath.Dir(finalPath))); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
|
@ -233,7 +233,7 @@ func (d *ESX5Driver) ListFiles() ([]string, error) {
|
|||
continue
|
||||
}
|
||||
|
||||
files = append(files, filepath.Join(d.outputDir, string(line)))
|
||||
files = append(files, filepath.ToSlash(filepath.Join(d.outputDir, string(line))))
|
||||
}
|
||||
|
||||
return files, nil
|
||||
|
@ -261,7 +261,7 @@ func (d *ESX5Driver) String() string {
|
|||
|
||||
func (d *ESX5Driver) datastorePath(path string) string {
|
||||
baseDir := filepath.Base(filepath.Dir(path))
|
||||
return filepath.Join("/vmfs/volumes", d.Datastore, baseDir, filepath.Base(path))
|
||||
return filepath.ToSlash(filepath.Join("/vmfs/volumes", d.Datastore, baseDir, filepath.Base(path)))
|
||||
}
|
||||
|
||||
func (d *ESX5Driver) connect() error {
|
||||
|
|
Loading…
Reference in New Issue