Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

OS-1732 don't assume vmobj.zpool is set and use vmobj.zonepath instea…

…d when available.
  • Loading branch information...
commit 0538dd80c83657a2e4c5e1d6501fcf39b87368e2 1 parent 1663802
@joshwilsdon joshwilsdon authored
Showing with 13 additions and 3 deletions.
  1. +13 −3 src/vm/node_modules/VM.js
View
16 src/vm/node_modules/VM.js
@@ -2860,9 +2860,19 @@ function updateMetadata(vmobj, payload, callback)
var imdata = {};
var cmdata = {};
var tags = {};
- var zonepath = vmobj.zonepath = '/'
- + vmobj.zpool + '/'
- + vmobj.zonename;
+ var zonepath;
+
+ if (vmobj.hasOwnProperty('zonepath')) {
+ zonepath = vmobj.zonepath;
+ } else if (vmobj.hasOwnProperty('zpool')
+ && vmobj.hasOwnProperty('zonename')) {
+
+ zonepath = '/' + vmobj.zpool + '/' + vmobj.zonename;
+ } else {
+ callback(new Error('unable to find zonepath for '
+ + JSON.stringify(vmobj)));
+ return;
+ }
// paths are under zonepath but not zoneroot
mdata_filename = zonepath + '/config/metadata.json';
Please sign in to comment.
Something went wrong with that request. Please try again.