Skip to content

Commit

Permalink
OS-7343 bhyve image creation blocked by tightening of quota
Browse files Browse the repository at this point in the history
Reviewed by: Mike Gerdts <mike.gerdts@joyent.com>
Reviewed by: Orlando Vazquez <orlando@joyent.com>
Approved by: Mike Gerdts <mike.gerdts@joyent.com>
  • Loading branch information
dyep49 committed Nov 30, 2018
1 parent a8f151d commit 2255127
Show file tree
Hide file tree
Showing 2 changed files with 352 additions and 4 deletions.
40 changes: 40 additions & 0 deletions src/img/lib/imgadm.js
Original file line number Diff line number Diff line change
Expand Up @@ -3572,6 +3572,37 @@ IMGADM.prototype.createImage = function createImage(options, callback) {
next();
}
},
function removeBhyveQuota(next) {
if (vmInfo.brand !== 'bhyve') {
next();
return;
}

getZfsDataset(vmInfo.zfs_filesystem, ['quota'],
function onDataset(err, ds) {
if (err) {
next(err);
return;
}

zfs.set(vmInfo.zfs_filesystem, {quota: 'none'},
function quotaSet(e) {
if (e) {
next(e);
return;
}

if (ds.quota === '0') {
ds.quota = 'none';
}

toCleanup.bhyveQuota = ds.quota;
next();
}
);
}
);
},
function autoprepSnapshotDatasets(next) {
if (!prepareScript) {
next();
Expand Down Expand Up @@ -4061,6 +4092,15 @@ IMGADM.prototype.createImage = function createImage(options, callback) {
},
next);
},
function cleanupBhyveQuota(next) {
if (!toCleanup.bhyveQuota) {
next();
return;
}

zfs.set(vmInfo.zfs_filesystem, {quota: toCleanup.bhyveQuota},
next);
},
function cleanupAutoprepStartVm(next) {
if (!toCleanup.autoprepStartVm) {
next();
Expand Down

0 comments on commit 2255127

Please sign in to comment.