mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
xenapi: Convert to virMacAddr
This commit is contained in:
parent
9d1938896c
commit
c7d5cdb15b
@ -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,
|
|||||||
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,28 +541,21 @@ 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];
|
goto error_cleanup;
|
||||||
virMacAddrFormat(def->nets[i]->mac, macStr);
|
virMacAddrFormat(&def->nets[i]->mac, mac);
|
||||||
if (!(mac = strdup(macStr))) {
|
|
||||||
VIR_FREE(bridge);
|
if (createVifNetwork(conn, *vm, device_number,
|
||||||
goto error_cleanup;
|
def->nets[i]->data.bridge.brname,
|
||||||
}
|
mac) < 0) {
|
||||||
|
VIR_FREE(mac);
|
||||||
|
goto error_cleanup;
|
||||||
}
|
}
|
||||||
if (mac != NULL && bridge != NULL) {
|
device_number++;
|
||||||
if (createVifNetwork(conn, *vm, device_number, bridge,
|
|
||||||
mac) < 0) {
|
|
||||||
VIR_FREE(bridge);
|
|
||||||
goto error_cleanup;
|
|
||||||
}
|
|
||||||
VIR_FREE(bridge);
|
|
||||||
device_number++;
|
|
||||||
}
|
|
||||||
VIR_FREE(bridge);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user