mirror of
https://github.com/rwinkhart/go-winio.git
synced 2026-09-06 00:57:19 -04:00
Remove error if ATTACH_VIRTUAL_DISK_PARAMETERS wasn't version 2
* Version 2 didn't exist in RS5 so it's a bit silly to error out in this case. Signed-off-by: Daniel Canter <dcanter@microsoft.com>
This commit is contained in:
+3
-4
@@ -176,9 +176,7 @@ func DetachVhd(path string) error {
|
|||||||
|
|
||||||
// AttachVirtualDisk attaches a virtual hard disk for use.
|
// AttachVirtualDisk attaches a virtual hard disk for use.
|
||||||
func AttachVirtualDisk(handle syscall.Handle, attachVirtualDiskFlag AttachVirtualDiskFlag, parameters *AttachVirtualDiskParameters) (err error) {
|
func AttachVirtualDisk(handle syscall.Handle, attachVirtualDiskFlag AttachVirtualDiskFlag, parameters *AttachVirtualDiskParameters) (err error) {
|
||||||
if parameters.Version != 2 {
|
// Supports both version 1 and 2 of the attach parameters as version 2 wasn't present in RS5.
|
||||||
return fmt.Errorf("only version 2 VHDs are supported, found version: %d", parameters.Version)
|
|
||||||
}
|
|
||||||
if err := attachVirtualDisk(
|
if err := attachVirtualDisk(
|
||||||
handle,
|
handle,
|
||||||
nil,
|
nil,
|
||||||
@@ -192,7 +190,8 @@ func AttachVirtualDisk(handle syscall.Handle, attachVirtualDiskFlag AttachVirtua
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// AttachVhd attaches a virtual hard disk at `path` for use.
|
// AttachVhd attaches a virtual hard disk at `path` for use. Attaches using version 2
|
||||||
|
// of the ATTACH_VIRTUAL_DISK_PARAMETERS.
|
||||||
func AttachVhd(path string) (err error) {
|
func AttachVhd(path string) (err error) {
|
||||||
handle, err := OpenVirtualDisk(
|
handle, err := OpenVirtualDisk(
|
||||||
path,
|
path,
|
||||||
|
|||||||
Reference in New Issue
Block a user