2015-06-21 07:36:07 -04:00
|
|
|
// Copyright (c) Microsoft Open Technologies, Inc.
|
|
|
|
// All Rights Reserved.
|
|
|
|
// Licensed under the Apache License, Version 2.0.
|
|
|
|
// See License.txt in the project root for license information.
|
|
|
|
package common
|
|
|
|
|
|
|
|
// A driver is able to talk to HyperV and perform certain
|
|
|
|
// operations with it. Some of the operations on here may seem overly
|
|
|
|
// specific, but they were built specifically in mind to handle features
|
|
|
|
// of the HyperV builder for Packer, and to abstract differences in
|
|
|
|
// versions out of the builder steps, so sometimes the methods are
|
|
|
|
// extremely specific.
|
|
|
|
type Driver interface {
|
|
|
|
|
|
|
|
// Checks if the VM named is running.
|
|
|
|
IsRunning(string) (bool, error)
|
|
|
|
|
2015-10-30 04:23:30 -04:00
|
|
|
// Checks if the VM named is off.
|
|
|
|
IsOff(string) (bool, error)
|
|
|
|
|
|
|
|
//How long has VM been on
|
|
|
|
Uptime(vmName string) (uint64, error)
|
|
|
|
|
2015-06-21 07:36:07 -04:00
|
|
|
// Start starts a VM specified by the name given.
|
|
|
|
Start(string) error
|
|
|
|
|
|
|
|
// Stop stops a VM specified by the name given.
|
|
|
|
Stop(string) error
|
|
|
|
|
|
|
|
// Verify checks to make sure that this driver should function
|
|
|
|
// properly. If there is any indication the driver can't function,
|
|
|
|
// this will return an error.
|
2015-06-27 17:36:39 -04:00
|
|
|
Verify() error
|
|
|
|
|
2015-06-21 07:36:07 -04:00
|
|
|
// Finds the MAC address of the NIC nic0
|
|
|
|
Mac(string) (string, error)
|
|
|
|
|
|
|
|
// Finds the IP address of a VM connected that uses DHCP by its MAC address
|
|
|
|
IpAddress(string) (string, error)
|
2015-06-27 17:36:39 -04:00
|
|
|
|
2015-10-30 04:23:30 -04:00
|
|
|
// Finds the hostname for the ip address
|
|
|
|
GetHostName(string) (string, error)
|
|
|
|
|
2015-06-27 17:36:39 -04:00
|
|
|
// Finds the IP address of a host adapter connected to switch
|
|
|
|
GetHostAdapterIpAddressForSwitch(string) (string, error)
|
|
|
|
|
|
|
|
// Type scan codes to virtual keyboard of vm
|
|
|
|
TypeScanCodes(string, string) error
|
2015-10-30 04:23:30 -04:00
|
|
|
|
|
|
|
//Get the ip address for network adaptor
|
|
|
|
GetVirtualMachineNetworkAdapterAddress(string) (string, error)
|
|
|
|
|
|
|
|
//Set the vlan to use for switch
|
|
|
|
SetNetworkAdapterVlanId(string, string) error
|
|
|
|
|
|
|
|
//Set the vlan to use for machine
|
|
|
|
SetVirtualMachineVlanId(string, string) error
|
|
|
|
|
|
|
|
UntagVirtualMachineNetworkAdapterVlan(string, string) error
|
|
|
|
|
|
|
|
CreateExternalVirtualSwitch(string, string) error
|
|
|
|
|
|
|
|
GetVirtualMachineSwitchName(string) (string, error)
|
|
|
|
|
|
|
|
ConnectVirtualMachineNetworkAdapterToSwitch(string, string) error
|
|
|
|
|
|
|
|
CreateVirtualSwitch(string, string) (bool, error)
|
|
|
|
|
|
|
|
DeleteVirtualSwitch(string) error
|
|
|
|
|
|
|
|
CreateVirtualMachine(string, string, int64, int64, string, uint) error
|
|
|
|
|
|
|
|
DeleteVirtualMachine(string) error
|
|
|
|
|
2016-08-05 23:14:36 -04:00
|
|
|
SetVirtualMachineCpu(string, uint, bool) error
|
2015-10-30 04:23:30 -04:00
|
|
|
|
|
|
|
SetSecureBoot(string, bool) error
|
|
|
|
|
|
|
|
EnableVirtualMachineIntegrationService(string, string) error
|
|
|
|
|
|
|
|
ExportVirtualMachine(string, string) error
|
|
|
|
|
|
|
|
CompactDisks(string, string) error
|
|
|
|
|
|
|
|
CopyExportedVirtualMachine(string, string, string, string) error
|
|
|
|
|
|
|
|
RestartVirtualMachine(string) error
|
|
|
|
|
2015-12-05 06:03:33 -05:00
|
|
|
CreateDvdDrive(string, string, uint) (uint, uint, error)
|
2015-10-30 04:23:30 -04:00
|
|
|
|
2015-11-01 11:00:56 -05:00
|
|
|
MountDvdDrive(string, string, uint, uint) error
|
2015-11-07 08:42:26 -05:00
|
|
|
|
|
|
|
SetBootDvdDrive(string, uint, uint, uint) error
|
|
|
|
|
2015-11-01 11:00:56 -05:00
|
|
|
UnmountDvdDrive(string, uint, uint) error
|
2015-10-30 04:23:30 -04:00
|
|
|
|
2015-10-30 13:19:25 -04:00
|
|
|
DeleteDvdDrive(string, uint, uint) error
|
2015-10-30 04:23:30 -04:00
|
|
|
|
2015-10-30 13:19:25 -04:00
|
|
|
MountFloppyDrive(string, string) error
|
2015-11-07 08:42:26 -05:00
|
|
|
|
2015-10-30 13:19:25 -04:00
|
|
|
UnmountFloppyDrive(string) error
|
2015-06-21 07:36:07 -04:00
|
|
|
}
|