1

今天我正在尝试使用 smartos 创建一个虚拟机。

我构建了这个配置文件(称为router.json):

{
"alias": "router",
"hostname": "router",
"brand": "joyent",
"max_physical_memory": 256,
"image_uuid": "088b97b0-e1a1-11e5-b895-9baa2086eb33",
"quota": 10,
"nics": [
    {
        "nic_tag": "admin",
        "ip": "dhcp",
        "allow_ip_spoofing": "1",
        "primary": "1"
    },
    {
        "nic_tag": "stub0",
        "ip": "10.0.0.1",
        "netmask": "255.255.255.0",
        "allow_ip_spoofing": "1",
        "gateway": "10.0.0.1"
    }
]

运行此命令:

# vmadm validate create -f router.json
VALID 'create' payload for joyent brand VMs.

但是当我尝试创建虚拟机时仍然出现错误:

# vmadm create -f router.json
provisioning dataset 088b97b0-e1a1-11e5-b895-9baa2086eb33 with brand joyent is not supported

有人有想法吗?非常感谢。

4

1 回答 1

2

您在上面的 JSON 有效负载上缺少一个右大括号“}”,我认为这只是一个复制/粘贴错误。

修复 JSON 后,我得到以下信息:

[root@smartos ~]# vmadm validate create -f router.json
{
  "bad_values": [
    "image_uuid"
  ],
  "bad_properties": [],
  "missing_properties": []
}

你已经导入那个图像了吗?

[root@smartos ~]# imgadm import 088b97b0-e1a1-11e5-b895-9baa2086eb33

导入后我得到:

[root@smartos ~]# vmadm validate create -f router.json
VALID 'create' payload for joyent brand VMs.
[root@smartos ~]# vmadm create -f router.json
Invalid nic tag "stub0"

当然,我还没有etherstub NIC设置。

[root@smartos ~]# nictagadm add -l stub0

然后我可以使用您的有效负载创建实例:

[root@smartos ~]# vmadm create -f router.json
Successfully created VM 53c2648c-d963-62b6-a9dd-e0b9809355d0

如果您仍然有问题,您可以提供您正在使用的版本吗?

[root@smartos ~]# uname -a
SunOS smartos 5.11 joyent_20170413T062226Z i86pc i386 i86pc
于 2017-04-27T17:49:36.973 回答