TritonDataCenter / smartos-live

For more information, please see http://smartos.org/ For any questions that aren't answered there, please join the SmartOS discussion list: https://smartos.topicbox.com/groups/smartos-discuss
1.57k stars 246 forks source link

vmadm create does not work anymore with zonename #805

Open jeroenvanderweele opened 6 years ago

jeroenvanderweele commented 6 years ago

When I do vmadm create -f server100.json with the json below using 20170511T001921Z it works fine, when I use the latest 20180927T004151Z I get the following error:

Uncaught AssertionError: uuid (uuid) is required FROM _toss (/usr/node/0.10/node_modules/assert-plus.js:22:11) Function.out.(anonymous function) [as uuid] (/usr/node/0.10/node_modules/assert-plus.js:122:17) zonecfg (/usr/vm/node_modules/zonecfg.js:79:12) createZone (/usr/vm/node_modules/VM.js:8036:5) vasync.waterfall.obj.uuid (/usr/vm/node_modules/VM.js:9824:17) Object._onImmediate (/usr/vm/node_modules/vasync/lib/vasync.js:601:23) processImmediate [as _immediateCallback] (timers.js:330:15) Abort (core dumped)

I tracked it down to the zonename/zonepath, if I remove this from the json file it works ok, so something has changed with the zonename logic.

server100.json

{ "alias": "server100", "zonename": "server100", "zonepath": "server100", "hostname": "server100.demo.com", "brand": "joyent", "max_physical_memory": 4096, "image_uuid": "23b267fc-ad02-11e7-94da-53e3d3884fe0", "autoboot": true, "quota": 25000, "resolvers": ["8.8.8.8", "8.8.4.4"], "nics": [ { "interface": "net0", "nic_tag": "admin", "ip": "10.10.10.100", "netmask": "255.255.255.0", "gateway": "10.10.10.1" } ] }

sjorge commented 6 years ago

Is there a particular reason you ware setting zonename and zonepath?

I think zonename can be set but it is discouraged...

       zonename:

           This property indicates the zonename of a VM. The zonename is a private
           property and not intended to be used directly. For OS VMs you can set
           this property with the create payload, but such use is discouraged.

           type: string
           vmtype: ANY
           listable: yes
           create: yes (OS VMs only)
           update: no
           default: value of uuid

zonepath is not even marked as listable but not as usable for creation/update, it might work if you remove that. In anycase the value takes a full path to a zone so it should be an absolute path like /zones/.

       zonepath:

           This property will show up in JSON representing a VM. It describes the
           path in the filesystem where you will find the VMs zone dataset. For OS
           VMs all VM data will be under this path, for HVM VMs this is where
           you´ll find things such as the logs and sockets for a VM.

           type: string (path)
           vmtype: ANY
           listable: no
           create: no (automatic)
           update: no

I think it will probably still work if your drop the zonepath property from the json. However vmadm should probably throw an error if zonepath is specified.

jeroenvanderweele commented 6 years ago

Is there a particular reason you ware setting zonename and zonepath?

Yes, I used it for years and it is nice if the onderlying zfs names has the same name/path as the servername, when I do ls /zones I get server1 server2 etc instead of the uuid, also scripting is easier.

But I understand someting is changed recently and it is not supported anymore, and you are correct if I drop zonename/zonepath it works. I will try the suggestion of the full path, else I can create vm without zonepath and rename later manual. thanks !

sjorge commented 6 years ago

I think if you just provide 'zonename' it should work, IIRC zonepath is '/zones/' so it might still do what you want.