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

Workaround for OS-7666: vminfod times out while starting with thousands of snapshots #971

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/img/lib/imgadm.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* CDDL HEADER END
*
* Copyright 2020 Joyent, Inc.
* Copyright 2021 ASS-Einrichtungssysteme GmbH
*
* * *
* The main imgadm functionality. The CLI is a light wrapper around this tool.
Expand Down Expand Up @@ -273,7 +274,7 @@ function getZfsDataset(name, properties, callback) {
var dataset;

function getDataset(next) {
var cmd = format('/usr/sbin/zfs list -H -p -o %s %s',
var cmd = format('/usr/sbin/zfs list -d 3 -H -p -o %s %s',
properties.join(','), name);
exec(cmd, {maxBuffer: 10485760}, function (err, stdout, stderr) {
if (err) {
Expand Down Expand Up @@ -307,7 +308,7 @@ function getZfsDataset(name, properties, callback) {
return;
}
dataset.children = {};
var cmd = format('/usr/sbin/zfs list -t all -pHr -o name %s', name);
var cmd = format('/usr/sbin/zfs list -d 3 -t all -pHr -o name %s', name);
exec(cmd, {maxBuffer: 10485760}, function (err, stdout, stderr) {
if (err) {
next(new errors.InternalError({
Expand Down Expand Up @@ -338,7 +339,7 @@ function getZfsDataset(name, properties, callback) {
next();
return;
}
var cmd = '/usr/sbin/zfs list -t filesystem,volume -o origin,name -pH';
var cmd = '/usr/sbin/zfs list -d 3 -t filesystem,volume -o origin,name -pH';
exec(cmd, {maxBuffer: 10485760}, function (err, stdout, stderr) {
if (err) {
next(new errors.InternalError({
Expand Down Expand Up @@ -851,7 +852,7 @@ IMGADM.prototype._loadImages = function _loadImages(callback) {
* is fine with false positives.
*/
execPlus({
command: '/usr/sbin/zfs list -t filesystem,volume,snapshot -pH '
command: '/usr/sbin/zfs list -d 3 -t filesystem,volume,snapshot -pH '
+ '-o name,origin,mountpoint,imgadm:ignore',
log: self.log,
errMsg: 'could not load images',
Expand Down
3 changes: 2 additions & 1 deletion src/img/sbin/recover-vm-from-failed-imgadm-create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#
# Copyright (c) 2018, Joyent, Inc.
# Copyright 2021 ASS-Einrichtungssysteme GmbH
#

#
Expand Down Expand Up @@ -97,7 +98,7 @@ vmInfo="$(vmadm get "$RECOVER_VM")"

# Sanity check that the VM is in that state.
rollbackSnap="zones/$RECOVER_VM@imgadm-create-pre-prepare"
zfs list -Ho name "$rollbackSnap" >/dev/null \
zfs list -d 3 -Ho name "$rollbackSnap" >/dev/null \
|| fatal "vm $RECOVER_VM is not in the expected failed state: cannot find $rollbackSnap snapshot"

vmBrand=$(echo "$vmInfo" | json brand)
Expand Down
5 changes: 3 additions & 2 deletions src/piadm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#
# Copyright 2021 Joyent, Inc.
# Copyright 2021 ASS-Einrichtungssysteme GmbH
#

# shellcheck disable=1091
Expand Down Expand Up @@ -685,7 +686,7 @@ ispoolenabled() {
currbootfs=$(zpool list -Ho bootfs "$pool")
if [[ $currbootfs == "${pool}/boot" ]]; then
# We're bootable (at least bootable enough)
zfs list -H "$currbootfs" > /dev/null 2>&1 && return 0
zfs list -d 3 -H "$currbootfs" > /dev/null 2>&1 && return 0
# else drop out to not-bootable, but this shouldn't happen.
vecho ".... odd, ${pool}/boot is pool's bootfs," \
"but isn't a filesystem"
Expand Down Expand Up @@ -1082,7 +1083,7 @@ enablepool() {
# For now, proceed clobber-style.
fi

if ! zfs list -H "$bootfs" > /dev/null 2>&1; then
if ! zfs list -d 3 -H "$bootfs" > /dev/null 2>&1; then
# Create a new bootfs and set it.
# NOTE: Encryption should be turned off for this dataset.
zfs create -o encryption=off "$bootfs" || \
Expand Down
3 changes: 2 additions & 1 deletion src/smartdc/lib/smartos_prompt_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#
# Copyright 2020 Joyent, Inc.
# Copyright 2021 ASS-Einrichtungssysteme GmbH
#

# XXX - TODO
Expand Down Expand Up @@ -879,7 +880,7 @@ create_dump()
#
setup_datasets()
{
datasets=$(zfs list -H -o name | xargs)
datasets=$(zfs list -d 3 -H -o name | xargs)

if ! echo $datasets | grep dump > /dev/null; then
printf "%-56s" "Making dump zvol... "
Expand Down
3 changes: 2 additions & 1 deletion src/sysinfo
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash
#
# Copyright 2020 Joyent, Inc.
# Copyright 2021 ASS-Einrichtungssysteme GmbH
#
# Output some info representing the system. Default: JSON
#
Expand Down Expand Up @@ -143,7 +144,7 @@ function get_nonglobal_info()
QUOTA=$(/usr/sbin/mdata-get sdc:quota)
if [[ $? != 0 ]]; then
QUOTA="unknown"
if [[ $(/usr/sbin/zfs list -H | wc -l | tr -d ' ') != 0 ]]; then
if [[ $(/usr/sbin/zfs list -d 3 -H | wc -l | tr -d ' ') != 0 ]]; then
ROOTQUOTA=$(($(/usr/sbin/zfs get -pHo value quota / | tr -d 'GMT') / (1024 * 1024 * 1024)))
if [[ $? == 0 ]]; then
QUOTA="${ROOTQUOTA}"
Expand Down
3 changes: 2 additions & 1 deletion src/vm/node_modules/VM.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/vm/tests/test-delegate.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright 2015 Joyent, Inc. All rights reserved.
// Copyright 2021 ASS-Einrichtungssysteme GmbH

var async = require('/usr/node/node_modules/async');
var cp = require('child_process');
Expand Down Expand Up @@ -61,7 +62,7 @@ test('check delegated', function(t) {
return;
}

cp.exec('zlogin ' + vmobj.uuid + ' zfs list | grep zones/' + vmobj.uuid + '/data',
cp.exec('zlogin ' + vmobj.uuid + ' zfs list -d 3 | grep zones/' + vmobj.uuid + '/data',
function (error, stdout, stderr) {
if (error) {
t.ok(false, 'VM does not appear to have dataset: ' + error.message);
Expand Down