Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement VSS support #10

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions BuildScripts/build-toolspkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ def buildBundlePkg(moduleName, moduleFriendlyName, payloadPath, postInstallScrip
moduleShutdownTool = "ShutdownTool"
moduleShutdownToolTiger = moduleShutdownTool + "Tiger"
moduleShutdownToolFriendly = "Hyper-V Shutdown Daemon"
moduleSnapshotTool = "SnapshotTool"
moduleSnapshotToolTiger = moduleSnapshotTool + "Tiger"
moduleSnapshotToolFriendly = "Hyper-V Snapshot Daemon"
moduleTimeSyncTool = "TimeSyncTool"
moduleTimeSyncToolTiger = moduleTimeSyncTool + "Tiger"
moduleTimeSyncToolFriendly = "Hyper-V Time Synchronization Daemon"
Expand Down Expand Up @@ -248,6 +251,18 @@ def buildBundlePkg(moduleName, moduleFriendlyName, payloadPath, postInstallScrip
gProjDir + "/Tools/Daemons/hvshutdownd/fish.goldfish64.hvshutdownd.plist")
shutdownTigerPkg, shutdownTigerPkgId = buildBundlePkg(moduleShutdownToolTiger, moduleShutdownToolFriendly,
shutdownTigerPath, gProjDir + "/Tools/Daemons/hvshutdownd/postinstall")

# Build hvsnapshotd package.
snapshotPath = createDaemonPayloadLayout(moduleSnapshotTool, gBuildDir + "/hvsnapshotd", gBuildDir + "/hvsnapshotd-universal",
gProjDir + "/Tools/Daemons/hvsnapshotd/fish.goldfish64.hvsnapshotd.plist")
snapshotPkg, snapshotPkgId = buildFlatPkg(moduleSnapshotTool, snapshotPath, gProjDir + "/Tools/Daemons/hvsnapshotd")

# Build hvsnapshotd package for Tiger.
if Path(gBuildDir + "/hvsnapshotd-tiger").is_file():
snapshotTigerPath = createDaemonTigerPayloadLayout(moduleSnapshotToolTiger, gBuildDir + "/hvsnapshotd-tiger",
gProjDir + "/Tools/Daemons/hvsnapshotd/fish.goldfish64.hvsnapshotd.plist")
snapshotTigerPkg, snapshotTigerPkgId = buildBundlePkg(moduleSnapshotToolTiger, moduleSnapshotToolFriendly,
snapshotTigerPath, gProjDir + "/Tools/Daemons/hvsnapshotd/postinstall")

# Build hvtimesyncd package.
timeSyncPath = createDaemonPayloadLayout(moduleTimeSyncTool, gBuildDir + "/hvtimesyncd", gBuildDir + "/hvtimesyncd-universal",
Expand Down Expand Up @@ -284,6 +299,9 @@ def buildBundlePkg(moduleName, moduleFriendlyName, payloadPath, postInstallScrip
shutil.copyfile(shutdownPkg, mpkgPackagesPath + "/" + os.path.basename(shutdownPkg))
if shutdownTigerPkg is not None:
shutil.copytree(shutdownTigerPkg, mpkgPackagesPath + "/" + os.path.basename(shutdownTigerPkg), dirs_exist_ok=True)
shutil.copyfile(snapshotPkg, mpkgPackagesPath + "/" + os.path.basename(snapshotPkg))
if snapshotTigerPkg is not None:
shutil.copytree(snapshotTigerPkg, mpkgPackagesPath + "/" + os.path.basename(snapshotTigerPkg), dirs_exist_ok=True)
shutil.copyfile(timeSyncPkg, mpkgPackagesPath + "/" + os.path.basename(timeSyncPkg))
if timeSyncTigerPkg is not None:
shutil.copytree(timeSyncTigerPkg, mpkgPackagesPath + "/" + os.path.basename(timeSyncTigerPkg), dirs_exist_ok=True)
Expand Down Expand Up @@ -321,6 +339,10 @@ def buildBundlePkg(moduleName, moduleFriendlyName, payloadPath, postInstallScrip
if shutdownTigerPkg is not None:
ET.SubElement(distChoices, "line", { "choice": moduleShutdownToolTiger })

ET.SubElement(distChoices, "line", { "choice": moduleSnapshotTool })
if snapshotTigerPkg is not None:
ET.SubElement(distChoices, "line", { "choice": moduleSnapshotToolTiger })

ET.SubElement(distChoices, "line", { "choice": moduleTimeSyncTool })
if timeSyncTigerPkg is not None:
ET.SubElement(distChoices, "line", { "choice": moduleTimeSyncToolTiger })
Expand Down Expand Up @@ -362,6 +384,24 @@ def buildBundlePkg(moduleName, moduleFriendlyName, payloadPath, postInstallScrip
})
ET.SubElement(distChoiceShutdownTiger, "pkg-ref", { "id" : shutdownTigerPkgId })

distChoiceSnapshot = ET.SubElement(distInstallerGuiScript, "choice", {
"id" : moduleSnapshotTool,
"title" : moduleSnapshotTool + "_title",
"description" : moduleSnapshotTool + "_description",
"start_selected" : "!checkIfTiger()",
"visible" : "!checkIfTiger()",
})
ET.SubElement(distChoiceSnapshot, "pkg-ref", { "id" : snapshotPkgId })
if snapshotTigerPkg is not None:
distChoiceSnapshotTiger = ET.SubElement(distInstallerGuiScript, "choice", {
"id" : moduleSnapshotToolTiger,
"title" : moduleSnapshotToolTiger + "_title",
"description" : moduleSnapshotToolTiger + "_description",
"start_selected" : "checkIfTiger()",
"visible" : "checkIfTiger()",
})
ET.SubElement(distChoiceSnapshotTiger, "pkg-ref", { "id" : snapshotTigerPkgId })

distChoiceTimeSync = ET.SubElement(distInstallerGuiScript, "choice", {
"id" : moduleTimeSyncTool,
"title" : moduleTimeSyncTool + "_title",
Expand Down Expand Up @@ -405,6 +445,18 @@ def buildBundlePkg(moduleName, moduleFriendlyName, payloadPath, postInstallScrip
"installKBytes" : str(round(getDirectorySize(shutdownTigerPath) / 1000))
}).text = "file:./Contents/Packages/" + os.path.basename(shutdownTigerPkg)

ET.SubElement(distInstallerGuiScript, "pkg-ref", {
"id" : snapshotPkgId,
"auth" : "root",
"installKBytes" : str(round(getDirectorySize(snapshotPath) / 1000))
}).text = "file:./Contents/Packages/" + os.path.basename(snapshotPkg)
if snapshotTigerPkg is not None:
ET.SubElement(distInstallerGuiScript, "pkg-ref", {
"id" : snapshotTigerPkgId,
"auth" : "root",
"installKBytes" : str(round(getDirectorySize(snapshotTigerPath) / 1000))
}).text = "file:./Contents/Packages/" + os.path.basename(snapshotTigerPkg)

ET.SubElement(distInstallerGuiScript, "pkg-ref", {
"id" : timeSyncPkgId,
"auth" : "root",
Expand Down
10 changes: 10 additions & 0 deletions BuildScripts/package.tool
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ if [[ -f "../hvshutdownd-tiger" ]]; then
fi

cp "${PROJECT_DIR}/Tools/Daemons/hvfilecopyd/fish.goldfish64.hvfilecopyd.plist" Tools/fish.goldfish64.hvtimesyncd.plist || exit 1
cp "${PROJECT_DIR}/Tools/Daemons/hvsnapshotd/fish.goldfish64.hvsnapshotd.plist" Tools/fish.goldfish64.hvsnapshotd.plist || exit 1
if [[ -f "../hvsnapshotd-universal" ]] && [[ "../hvsnapshotd-universal" -nt "../hvsnapshotd" ]]; then
cp ../hvsnapshotd-universal Tools/hvsnapshotd || exit 1
else
cp ../hvsnapshotd Tools/hvsnapshotd || exit 1
fi
if [[ -f "../hvsnapshotd-tiger" ]]; then
cp ../hvsnapshotd-tiger Tools/ || exit 1
fi

if [[ -f "../hvtimesyncd-universal" ]] && [[ "../hvtimesyncd-universal" -nt "../hvtimesyncd" ]]; then
cp ../hvtimesyncd-universal Tools/hvtimesyncd || exit 1
else
Expand Down
2 changes: 1 addition & 1 deletion Docs/HyperV-devices.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This page describes the different services and devices exposed to a virtual mach
[Provides](https://learn.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/integration-services#hyper-v-volume-shadow-copy-requestor) Volume Shadow Copy support to guests.
* Availability: Windows Server 2008 SP2 and later
* GUID: `35fa2e29-ea23-4236-96ae-3a6ebacba440`
* Support status: Planned
* Support status: Handled by HyperVSnapshot

### Data Exchange
[Provides](https://learn.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/integration-services#hyper-v-data-exchange-service-kvp) a mechanism to exchange basic metadata between the guest and the host via a key/value pair system.
Expand Down
10 changes: 10 additions & 0 deletions Docs/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ Provides software shutdown through Virtual Machine Connection and PowerShell. Re
| -hvshutmsgdbg | Enables debug printing of message data in DEBUG builds
| -hvshutoff | Disables this module

## Snapshot (HyperVSnapshot)
Provides support for consistent backup support and production checkpoints. Requires the `hvsnapshotd` userspace daemon to be running.

| Boot argument | Description |
|----------------|-------------|
| -hvsnapdbg | Enables debug printing in DEBUG builds
| -hvsnapuserdbg | Enables debug printing of user client data in DEBUG builds
| -hvsnapmsgdbg | Enables debug printing of message data in DEBUG builds
| -hvsnapoff | Disables this module

## Storage (HyperVStorage)
Provides SCSI storage support.

Expand Down
Loading