return 0;
}
+
+static int
+chDomainAddNet(virCHDriver *driver,
+ virCHMonitor *mon,
+ virDomainObj *vm,
+ virDomainNetDef *net)
+{
+ chAssignDeviceNetAlias(vm->def, net);
+
+ if (chProcessAddNetworkDevice(driver, mon, vm->def, net, NULL, NULL) < 0) {
+ return -1;
+ }
+
+ virDomainNetInsert(vm->def, net);
+
+ return 0;
+}
+
+
static int
chDomainAttachDeviceLive(virCHDriver *driver,
virDomainObj *vm,
break;
case VIR_DOMAIN_DEVICE_NET:
- if (chProcessAddNetworkDevice(driver, mon, vm->def, dev->data.net,
- NULL, NULL) < 0) {
+ if (chDomainAddNet(driver, mon, vm, dev->data.net) < 0) {
break;
}
- virDomainNetInsert(vm->def, dev->data.net);
alias = dev->data.net->info.alias;
dev->data.net = NULL;
ret = 0;
return -1;
}
- chAssignDeviceNetAlias(vmdef, net);
if (virCHMonitorBuildNetJson(net, &netJSONPayload) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Failed to build net json"));