File: inject_virtio_win.mli

package info (click to toggle)
guestfs-tools 1.52.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 69,236 kB
  • sloc: ansic: 15,698; ml: 15,621; sh: 7,396; xml: 5,478; makefile: 3,601; perl: 1,535; lex: 135; yacc: 128; python: 80
file content (95 lines) | stat: -rw-r--r-- 3,781 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
(* virt-v2v
 * Copyright (C) 2009-2023 Red Hat Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *)

(** Values and functions for installing Windows virtio drivers. *)

type t (** Handle *)

type block_type = Virtio_blk | Virtio_SCSI | IDE
and net_type = Virtio_net | E1000 | RTL8139
and machine_type = I440FX | Q35 | Virt

type virtio_win_installed = {
  block_driver : block_type;
  net_driver : net_type;
  virtio_rng : bool;
  virtio_balloon : bool;
  isa_pvpanic : bool;
  virtio_socket : bool;
  machine : machine_type;
  virtio_1_0 : bool;
}
(** After calling {!install_drivers}, this describes what virtio-win
    drivers we were able to install (and hence, what the guest requires).
    eg. if [virtio_rng] is true then we installed the virtio RNG
    device, otherwise we didn't. *)

val from_path : Guestfs.guestfs -> string -> string -> t
(** Create a new virtio-win handle.  The parameters are [g root path].

    The [path] should point to either the virtio-win ISO
    (eg. F</usr/share/virtio-win/virtio-win.iso>) or the unpacked
    directory (eg. F</usr/share/virtio-win>).

    The libosinfo database is ignored if you use this method. *)

val from_libosinfo : Guestfs.guestfs -> string -> t
(** Create a new virtio-win handle.  The parameters are [g root].

    The libosinfo database will be used as the source for drivers.
    The virtio-win ISO or unpacked directory is ignored if you use
    this method. *)

val from_environment : Guestfs.guestfs -> string -> string -> t
(** Using the [VIRTIO_WIN] environment variable (if present), set up
    the injection handle.

    The parameters are: [g root datadir].  The [datadir] is the path
    from ./configure (eg. {!Config.datadir}).

    This should only be used by [virt-v2v] and is considered a legacy method. *)

val get_block_driver_priority : t -> string list
val set_block_driver_priority : t -> string list -> unit
(** Get or set the current block driver priority list.  This is
    a list of virtio-win block driver names (eg. ["viostor"]) that
    we search until we come to the first [name ^ ".sys"] that
    we find, and that is the block driver which gets installed.

    This module contains a default priority list which should
    be suitable for most use cases. *)

val inject_virtio_win_drivers : t -> Registry.t -> virtio_win_installed
(** [inject_virtio_win_drivers t reg]
    installs virtio drivers from the driver directory or driver
    ISO into the guest driver directory and updates the registry
    so that the [viostor.sys] driver gets loaded by Windows at boot.

    [reg] is the system hive which is open for writes when this
    function is called.

    This returns a {!virtio_win_installed} struct reflecting what devices
    are now required by the guest, either virtio devices if we managed to
    install those, or legacy devices if we didn't. *)

val inject_qemu_ga : t -> bool
(** Inject MSIs (ideally just one) with QEMU Guest Agent into a Windows
    guest.  A firstboot script is also injected which should install
    the MSI(s).

    Returns [true] iff we were able to inject qemu-ga. *)