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

nixos/modules/virtualization: Options to add an extra disk in virtualbox VM #60246

Merged
merged 1 commit into from Aug 2, 2020

Conversation

@dfordivam
Copy link
Contributor

@dfordivam dfordivam commented Apr 26, 2019

Motivation for this change

The current VirtualBox VM creation has a limitation/bug due to which we cannot have more than 64gb storage. This is a workaround for that, and can also be useful in other cases.
Ref: #59867

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@flokli
Copy link
Contributor

@flokli flokli commented Jun 2, 2019

@ambrop72 can you take a look at this?

};
type = types.nullOr (types.submodule {
options = {
size = mkOption {

This comment has been minimized.

@ambrop72

ambrop72 Jun 2, 2019
Contributor

I like if the option name expresses the unit when it's not obvious, so personally I'd name this option size_MiB. Otherwise when one sees configuration setting this it is necessary to consult the docs to know.

This comment has been minimized.

@flokli

flokli Jun 2, 2019
Contributor

That battle is already lost unfortunately - there's (baseImage,memory)Size (both in MiB) too, and I guess, we should stay consistent with these options.

This comment has been minimized.

@ambrop72

ambrop72 Jun 3, 2019
Contributor

That battle is already lost unfortunately - there's (baseImage,memory)Size (both in MiB) too, and I guess, we should stay consistent with these options.

Right then.

eval $(partx $dataDiskImage -o START,SECTORS --nr 1 --pairs)
mkfs.ext4 -F -L ${cfg.extraDisk.label} $dataDiskImage -E offset=$(sectorsToBytes $START) $(sectorsToKilobytes $SECTORS)K
echo "creating extra disk: data-disk.vmdk"
${pkgs.qemu}/bin/qemu-img convert -f raw -O vmdk $dataDiskImage data-disk.vmdk

This comment has been minimized.

@ambrop72

ambrop72 Jun 2, 2019
Contributor

Should this be using createrawvmdk instead like for the main disk?

This comment has been minimized.

@dfordivam

dfordivam Jun 4, 2020
Author Contributor

@ambrop72 I have done this change, and rebased the commit..

@stale
Copy link

@stale stale bot commented Jun 2, 2020

Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the
    related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse. 3. Ask on the #nixos channel on
    irc.freenode.net.
@stale stale bot added the 2.status: stale label Jun 2, 2020
@dfordivam dfordivam force-pushed the dfordivam:virtualbox-add-extra-disk branch from 1dac88d to 41e745b Jun 4, 2020
@stale stale bot removed the 2.status: stale label Jun 4, 2020
@Ericson2314
Copy link
Member

@Ericson2314 Ericson2314 commented Jul 4, 2020

I wonder if we should do extraDisks with attrOf where the label is the key.

autoResize = true;
fsType = "ext4";
};
fileSystems = { "/" = {

This comment has been minimized.

@Ericson2314

Ericson2314 Jul 4, 2020
Member

Pull the "/" = ... to the next line?

This comment has been minimized.

@dfordivam

dfordivam Jul 6, 2020
Author Contributor

Done

autoResize = true;
fsType = "ext4";
};
} // (if cfg.extraDisk == null then { } else

This comment has been minimized.

@Ericson2314

Ericson2314 Jul 4, 2020
Member

Use lib.optionalAttrs

This comment has been minimized.

@dfordivam

dfordivam Jul 6, 2020
Author Contributor

Fixed

@dfordivam dfordivam force-pushed the dfordivam:virtualbox-add-extra-disk branch from 41e745b to a78a3fa Jul 6, 2020
@dfordivam dfordivam force-pushed the dfordivam:virtualbox-add-extra-disk branch from a78a3fa to d127d85 Jul 6, 2020
@Ericson2314 Ericson2314 merged commit 3a512ab into NixOS:master Aug 2, 2020
13 checks passed
13 checks passed
Evaluation Performance Report Evaluator Performance Report
Details
grahamcofborg-eval ^.^!
Details
grahamcofborg-eval-check-meta config.nix: checkMeta = true
Details
grahamcofborg-eval-darwin nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="d127d85"; rev="d127d851736c6667efc423fa23918f2180e5a7f7"; } ./pkgs/t
Details
grahamcofborg-eval-lib-tests nix-build --arg pkgs import ./. {} ./lib/tests/release.nix
Details
grahamcofborg-eval-nixos nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="d127d85"; rev="d127d851736c6667efc423fa23918f2180e5a7f7"; } ./nixos/
Details
grahamcofborg-eval-nixos-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="d127d85"; rev="d127d851736c6667efc423fa23918f2180e5a7f7"; } ./nixos/
Details
grahamcofborg-eval-nixos-options nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="d127d85"; rev="d127d851736c6667efc423fa23918f2180e5a7f7"; } ./nixos/
Details
grahamcofborg-eval-nixpkgs-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="d127d85"; rev="d127d851736c6667efc423fa23918f2180e5a7f7"; } ./pkgs/t
Details
grahamcofborg-eval-nixpkgs-tarball nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="d127d85"; rev="d127d851736c6667efc423fa23918f2180e5a7f7"; } ./pkgs/t
Details
grahamcofborg-eval-nixpkgs-unstable-jobset nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="d127d85"; rev="d127d851736c6667efc423fa23918f2180e5a7f7"; } ./pkgs/t
Details
grahamcofborg-eval-package-list nix-env -qa --json --file .
Details
grahamcofborg-eval-package-list-no-aliases nix-env -qa --json --file . --arg config { allowAliases = false; }
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.