Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
50b9c459
Commit
50b9c459
authored
Apr 27, 2018
by
andyzhangx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix formatAndMount func issue on Windows
fix comments
parent
5fa0f561
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletion
+14
-1
mount_windows.go
pkg/util/mount/mount_windows.go
+14
-1
No files found.
pkg/util/mount/mount_windows.go
View file @
50b9c459
...
...
@@ -358,10 +358,23 @@ func (mounter *SafeFormatAndMount) formatAndMount(source string, target string,
glog
.
V
(
4
)
.
Infof
(
"Attempting to formatAndMount disk: %s %s %s"
,
fstype
,
source
,
target
)
if
err
:=
ValidateDiskNumber
(
source
);
err
!=
nil
{
glog
.
Errorf
(
"
azure
Mount: formatAndMount failed, err: %v
\n
"
,
err
)
glog
.
Errorf
(
"
disk
Mount: formatAndMount failed, err: %v
\n
"
,
err
)
return
err
}
if
len
(
fstype
)
==
0
{
// Use 'NTFS' as the default
fstype
=
"NTFS"
}
// format disk if it is unformatted(raw)
cmd
:=
fmt
.
Sprintf
(
"Get-Disk -Number %s | Where partitionstyle -eq 'raw' | Initialize-Disk -PartitionStyle MBR -PassThru"
,
source
)
cmd
+=
fmt
.
Sprintf
(
" | New-Partition -AssignDriveLetter -UseMaximumSize | Format-Volume -FileSystem %s -Confirm:$false"
,
fstype
)
if
output
,
err
:=
mounter
.
Exec
.
Run
(
"powershell"
,
"/c"
,
cmd
);
err
!=
nil
{
return
fmt
.
Errorf
(
"diskMount: format disk failed, error: %v, output: %q"
,
err
,
string
(
output
))
}
glog
.
V
(
4
)
.
Infof
(
"diskMount: Disk successfully formatted, disk: %q, fstype: %q
\n
"
,
source
,
fstype
)
driveLetter
,
err
:=
getDriveLetterByDiskNumber
(
source
,
mounter
.
Exec
)
if
err
!=
nil
{
return
err
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment