@MatheMatrix
2017-06-19T14:02:21.000000Z
字数 1588
阅读 217
ZStack
网络
云路由
以 vyos driver 为例,zstack 会通过 virtio serial 的方式向云路由注入下面的 bootstrap-info.json(具体参考 zstack-ctl/kvmagent 和 zstack-vyos/zvrboot 的代码)。
{
"additionalNics": [
{
"deviceName": "eth1",
"gateway": "192.168.104.1",
"ip": "192.168.104.1",
"isDefaultRoute": false,
"mac": "fa:74:e3:7e:b0:01",
"netmask": "255.255.255.0"
}
],
"managementNic": {
"deviceName": "eth0",
"gateway": "100.64.201.1",
"ip": "100.64.201.104",
"isDefaultRoute": true,
"mac": "fa:e4:1a:c1:cd:00",
"netmask": "255.255.255.0"
},
"publicKey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDcKCE3utraUks2vuek+JqQUkiJorRo8cgFFDS635Q2m4wqJKlWPe3IU4fq5eIRbFAk+K2+W4eMGZJYUnxN0Nm26+MxjkS1qOq+P6iJOTWrF7JPRsK/hPgt6zovHAoli9YHDHkeeO6MGecoMHWittddh6jFakWY9KEcbTdQPGlcjiMw0XDBjMj6iXSC4q8N62A0L8kRa0vE85sezJk+Z7dzeaAM5MioaPeNSP3ChXJZi0gjt2UJm/EfwO7CHt8Ay6RZFcRR3ldieiXtOtT5xPwGxE6pqv2PAuk/+Gk21Dibb4H7tBDqk9Lcn1RuE3XgsEE+FvTOeI8dw0tyEs68joGf root@172-20-14-15",
"sshPort": 22,
"vyosPassword": "vrouter12#"
}
继续以 vyos driver 为例,后面会调用 /echo、/init 作为初始化的 API,以及 /ping 作为心跳的 API,其 API 格式如下:
URL | 返回方式 | 调用参数(body) | 返回值 |
---|---|---|---|
/echo | 同步 | {"Host":"","callbackurl":"","taskuuid":""} | 200 {"success":true,"error":""} |
/init | 异步 | {"uuid":"557af1a07a3d4b88be1e55d0b90f6e3f","restartDnsmasqAfterNumberOfSIGUSER1":0} {"Host":"","callbackurl":"http://10.0.168.39:8080/zstack/asyncrest/callback","taskuuid":"09c4bc8c4b60496ea3b4e9ec6185e1e9"} | 200 "",异步返回:POST {"success":true,"error":""} |
/ping | 异步 | {"uuid":"557af1a07a3d4b88be1e55d0b90f6e3f"} {"Host":"","callbackurl":"http://10.0.168.39:8080/zstack/asyncrest/callback","taskuuid":"97e401115c0c4ee0b60543b147cad680"} | 200 "",异步返回:POST {"uuid":"557af1a07a3d4b88be1e55d0b90f6e3f"} |