提交 c7d5cdb1 编写于 作者: J Jiri Denemark

xenapi: Convert to virMacAddr

上级 9d193889
...@@ -1512,7 +1512,8 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) ...@@ -1512,7 +1512,8 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
} }
xen_vif_get_record(session, &vif_rec, vif); xen_vif_get_record(session, &vif_rec, vif);
if (vif_rec != NULL) { if (vif_rec != NULL) {
if (virMacAddrParse((const char *)vif_rec->mac,defPtr->nets[i]->mac) < 0) if (virMacAddrParse((const char *)vif_rec->mac,
&defPtr->nets[i]->mac) < 0)
xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR, xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
_("Unable to parse given mac address")); _("Unable to parse given mac address"));
xen_vif_record_free(vif_rec); xen_vif_record_free(vif_rec);
......
...@@ -453,7 +453,6 @@ createVMRecordFromXml (virConnectPtr conn, virDomainDefPtr def, ...@@ -453,7 +453,6 @@ createVMRecordFromXml (virConnectPtr conn, virDomainDefPtr def,
char uuidStr[VIR_UUID_STRING_BUFLEN]; char uuidStr[VIR_UUID_STRING_BUFLEN];
xen_string_string_map *strings = NULL; xen_string_string_map *strings = NULL;
int device_number = 0; int device_number = 0;
char *bridge = NULL, *mac = NULL;
int i; int i;
*record = xen_vm_record_alloc(); *record = xen_vm_record_alloc();
...@@ -542,29 +541,22 @@ createVMRecordFromXml (virConnectPtr conn, virDomainDefPtr def, ...@@ -542,29 +541,22 @@ createVMRecordFromXml (virConnectPtr conn, virDomainDefPtr def,
} }
for (i = 0; i < def->nnets; i++) { for (i = 0; i < def->nnets; i++) {
if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_BRIDGE) { if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_BRIDGE &&
if (def->nets[i]->data.bridge.brname) def->nets[i]->data.bridge.brname) {
if (!(bridge = strdup(def->nets[i]->data.bridge.brname))) char *mac;
goto error_cleanup;
if (def->nets[i]->mac) { if (VIR_ALLOC_N(mac, VIR_MAC_STRING_BUFLEN) < 0)
char macStr[VIR_MAC_STRING_BUFLEN];
virMacAddrFormat(def->nets[i]->mac, macStr);
if (!(mac = strdup(macStr))) {
VIR_FREE(bridge);
goto error_cleanup; goto error_cleanup;
} virMacAddrFormat(&def->nets[i]->mac, mac);
}
if (mac != NULL && bridge != NULL) { if (createVifNetwork(conn, *vm, device_number,
if (createVifNetwork(conn, *vm, device_number, bridge, def->nets[i]->data.bridge.brname,
mac) < 0) { mac) < 0) {
VIR_FREE(bridge); VIR_FREE(mac);
goto error_cleanup; goto error_cleanup;
} }
VIR_FREE(bridge);
device_number++; device_number++;
} }
VIR_FREE(bridge);
}
} }
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册