-
-
Notifications
You must be signed in to change notification settings - Fork 366
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
[WIP] Improve networking options for libvirtd target #922
Changes from all commits
55916cd
ece0040
84a7aa7
7145c22
7940d93
36f426d
aa69640
574ba39
deafeb4
d193ef8
c6c4351
6a6d9e3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ with lib; | |
|
||
let | ||
sz = toString config.deployment.libvirtd.baseImageSize; | ||
base_image = import ./libvirtd-image.nix { size = sz; }; | ||
base_image = import ./image.nix { size = sz; }; | ||
the_key = builtins.getEnv "NIXOPS_LIBVIRTD_PUBKEY"; | ||
ssh_image = pkgs.vmTools.runInLinuxVM ( | ||
pkgs.runCommand "libvirtd-ssh-image" | ||
|
@@ -45,11 +45,19 @@ in | |
###### interface | ||
|
||
options = { | ||
deployment.libvirtd.imageDir = mkOption { | ||
type = types.path; | ||
default = "/var/lib/libvirt/images"; | ||
deployment.libvirtd.storagePool = mkOption { | ||
type = types.str; | ||
default = "default"; | ||
description = '' | ||
The name of the storage pool where the virtual disk is to be created. | ||
''; | ||
}; | ||
|
||
deployment.libvirtd.URI = mkOption { | ||
type = types.str; | ||
default = "qemu:///system"; | ||
description = '' | ||
Directory to store VM image files. Note that it should be writable both by you and by libvirtd daemon. | ||
Connection URI. | ||
''; | ||
}; | ||
|
||
|
@@ -96,9 +104,11 @@ in | |
}; | ||
|
||
deployment.libvirtd.networks = mkOption { | ||
default = [ "default" ]; | ||
type = types.listOf types.str; | ||
description = "Names of libvirt networks to attach the VM to."; | ||
type = types.listOf (types.submodule (import ./network-options.nix { | ||
inherit lib; | ||
})); | ||
default = []; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
description = "Networks to attach the VM to."; | ||
}; | ||
|
||
deployment.libvirtd.extraDevicesXML = mkOption { | ||
|
@@ -156,6 +166,21 @@ in | |
services.openssh.extraConfig = "UseDNS no"; | ||
|
||
deployment.hasFastConnection = true; | ||
|
||
services.udev.extraRules = '' | ||
SUBSYSTEM=="virtio-ports", ATTR{name}=="org.qemu.guest_agent.0", TAG+="systemd" ENV{SYSTEMD_WANTS}="qemu-guest-agent.service" | ||
''; | ||
|
||
systemd.services.qemu-guest-agent = { | ||
description = "QEMU Guest Agent"; | ||
bindsTo = [ "dev-virtio\\x2dports-org.qemu.guest_agent.0.device" ]; | ||
after = [ "dev-virtio\\x2dports-org.qemu.guest_agent.0.device" ]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For some reason this creates a problem with my config |
||
serviceConfig = { | ||
ExecStart = "-${pkgs.kvm}/bin/qemu-ga"; | ||
Restart = "always"; | ||
RestartSec = 0; | ||
}; | ||
}; | ||
}; | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ lib } : | ||
|
||
with lib; | ||
{ | ||
options = { | ||
|
||
source = mkOption { | ||
type = types.str; | ||
default = "default"; | ||
description = '' | ||
''; | ||
}; | ||
|
||
type = mkOption { | ||
type = types.enum [ "bridge" "virtual" ]; | ||
default = "virtual"; | ||
description = '' | ||
''; | ||
}; | ||
|
||
}; | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ in | |
./gce.nix | ||
./hetzner.nix | ||
./container.nix | ||
./libvirtd.nix | ||
./libvirtd | ||
]; | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -334,7 +334,8 @@ def run_command(self, command, **kwargs): | |
# mainly operating in a chroot environment. | ||
if self.state == self.RESCUE: | ||
command = "export LANG= LC_ALL= LC_TIME=; " + command | ||
return self.ssh.run_command(command, self.get_ssh_flags(), **kwargs) | ||
|
||
return self.ssh.run_command(command, **kwargs) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See the commit message for 574ba39. Although this is quick-and-dirty WIP code, I always try to write comprehensible commit messages, so
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My bad -- I didn't pay enough attention. Great commit message! |
||
|
||
def switch_to_configuration(self, method, sync, command=None): | ||
""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When trying out this PR, I got:
This looks like this: simon3z/virt-deploy#8
And indeed for me:
Can we make this work also without the default storage pool or do we need to instruct the user to set this
default
storage pool up?