提交 5a4f7836 编写于 作者: C Chunyan Liu 提交者: Daniel P. Berrange

rename qemu*NetConfigRestore/Replace to virHostdevNetConfigRestore/Replace

上级 996af573
...@@ -299,8 +299,8 @@ cleanup: ...@@ -299,8 +299,8 @@ cleanup:
static int static int
qemuDomainHostdevPciSysfsPath(virDomainHostdevDefPtr hostdev, virHostdevPciSysfsPath(virDomainHostdevDefPtr hostdev,
char **sysfs_path) char **sysfs_path)
{ {
virPCIDeviceAddress config_address; virPCIDeviceAddress config_address;
...@@ -314,12 +314,12 @@ qemuDomainHostdevPciSysfsPath(virDomainHostdevDefPtr hostdev, ...@@ -314,12 +314,12 @@ qemuDomainHostdevPciSysfsPath(virDomainHostdevDefPtr hostdev,
static int static int
qemuDomainHostdevIsVirtualFunction(virDomainHostdevDefPtr hostdev) virHostdevIsVirtualFunction(virDomainHostdevDefPtr hostdev)
{ {
char *sysfs_path = NULL; char *sysfs_path = NULL;
int ret = -1; int ret = -1;
if (qemuDomainHostdevPciSysfsPath(hostdev, &sysfs_path) < 0) if (virHostdevPciSysfsPath(hostdev, &sysfs_path) < 0)
return ret; return ret;
ret = virPCIIsVirtualFunction(sysfs_path); ret = virPCIIsVirtualFunction(sysfs_path);
...@@ -331,13 +331,13 @@ qemuDomainHostdevIsVirtualFunction(virDomainHostdevDefPtr hostdev) ...@@ -331,13 +331,13 @@ qemuDomainHostdevIsVirtualFunction(virDomainHostdevDefPtr hostdev)
static int static int
qemuDomainHostdevNetDevice(virDomainHostdevDefPtr hostdev, char **linkdev, virHostdevNetDevice(virDomainHostdevDefPtr hostdev, char **linkdev,
int *vf) int *vf)
{ {
int ret = -1; int ret = -1;
char *sysfs_path = NULL; char *sysfs_path = NULL;
if (qemuDomainHostdevPciSysfsPath(hostdev, &sysfs_path) < 0) if (virHostdevPciSysfsPath(hostdev, &sysfs_path) < 0)
return ret; return ret;
if (virPCIIsVirtualFunction(sysfs_path) == 1) { if (virPCIIsVirtualFunction(sysfs_path) == 1) {
...@@ -360,11 +360,11 @@ cleanup: ...@@ -360,11 +360,11 @@ cleanup:
static int static int
qemuDomainHostdevNetConfigVirtPortProfile(const char *linkdev, int vf, virHostdevNetConfigVirtPortProfile(const char *linkdev, int vf,
virNetDevVPortProfilePtr virtPort, virNetDevVPortProfilePtr virtPort,
const virMacAddr *macaddr, const virMacAddr *macaddr,
const unsigned char *uuid, const unsigned char *uuid,
bool associate) bool associate)
{ {
int ret = -1; int ret = -1;
...@@ -400,9 +400,9 @@ qemuDomainHostdevNetConfigVirtPortProfile(const char *linkdev, int vf, ...@@ -400,9 +400,9 @@ qemuDomainHostdevNetConfigVirtPortProfile(const char *linkdev, int vf,
static int static int
qemuDomainHostdevNetConfigReplace(virDomainHostdevDefPtr hostdev, virHostdevNetConfigReplace(virDomainHostdevDefPtr hostdev,
const unsigned char *uuid, const unsigned char *uuid,
char *stateDir) char *stateDir)
{ {
char *linkdev = NULL; char *linkdev = NULL;
virNetDevVlanPtr vlan; virNetDevVlanPtr vlan;
...@@ -413,7 +413,7 @@ qemuDomainHostdevNetConfigReplace(virDomainHostdevDefPtr hostdev, ...@@ -413,7 +413,7 @@ qemuDomainHostdevNetConfigReplace(virDomainHostdevDefPtr hostdev,
bool port_profile_associate = true; bool port_profile_associate = true;
int isvf; int isvf;
isvf = qemuDomainHostdevIsVirtualFunction(hostdev); isvf = virHostdevIsVirtualFunction(hostdev);
if (isvf <= 0) { if (isvf <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Interface type hostdev is currently supported on" _("Interface type hostdev is currently supported on"
...@@ -421,7 +421,7 @@ qemuDomainHostdevNetConfigReplace(virDomainHostdevDefPtr hostdev, ...@@ -421,7 +421,7 @@ qemuDomainHostdevNetConfigReplace(virDomainHostdevDefPtr hostdev,
return ret; return ret;
} }
if (qemuDomainHostdevNetDevice(hostdev, &linkdev, &vf) < 0) if (virHostdevNetDevice(hostdev, &linkdev, &vf) < 0)
return ret; return ret;
vlan = virDomainNetGetActualVlan(hostdev->parent.data.net); vlan = virDomainNetGetActualVlan(hostdev->parent.data.net);
...@@ -435,7 +435,7 @@ qemuDomainHostdevNetConfigReplace(virDomainHostdevDefPtr hostdev, ...@@ -435,7 +435,7 @@ qemuDomainHostdevNetConfigReplace(virDomainHostdevDefPtr hostdev,
virNetDevVPortTypeToString(virtPort->virtPortType)); virNetDevVPortTypeToString(virtPort->virtPortType));
goto cleanup; goto cleanup;
} }
ret = qemuDomainHostdevNetConfigVirtPortProfile(linkdev, vf, ret = virHostdevNetConfigVirtPortProfile(linkdev, vf,
virtPort, &hostdev->parent.data.net->mac, uuid, virtPort, &hostdev->parent.data.net->mac, uuid,
port_profile_associate); port_profile_associate);
} else { } else {
...@@ -475,9 +475,9 @@ cleanup: ...@@ -475,9 +475,9 @@ cleanup:
* case, try to find in the old state dir. * case, try to find in the old state dir.
*/ */
static int static int
qemuDomainHostdevNetConfigRestore(virDomainHostdevDefPtr hostdev, virHostdevNetConfigRestore(virDomainHostdevDefPtr hostdev,
char *stateDir, char *stateDir,
char *oldStateDir) char *oldStateDir)
{ {
char *linkdev = NULL; char *linkdev = NULL;
virNetDevVPortProfilePtr virtPort; virNetDevVPortProfilePtr virtPort;
...@@ -495,7 +495,7 @@ qemuDomainHostdevNetConfigRestore(virDomainHostdevDefPtr hostdev, ...@@ -495,7 +495,7 @@ qemuDomainHostdevNetConfigRestore(virDomainHostdevDefPtr hostdev,
!hostdev->parent.data.net) !hostdev->parent.data.net)
return 0; return 0;
isvf = qemuDomainHostdevIsVirtualFunction(hostdev); isvf = virHostdevIsVirtualFunction(hostdev);
if (isvf <= 0) { if (isvf <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Interface type hostdev is currently supported on" _("Interface type hostdev is currently supported on"
...@@ -503,15 +503,16 @@ qemuDomainHostdevNetConfigRestore(virDomainHostdevDefPtr hostdev, ...@@ -503,15 +503,16 @@ qemuDomainHostdevNetConfigRestore(virDomainHostdevDefPtr hostdev,
return ret; return ret;
} }
if (qemuDomainHostdevNetDevice(hostdev, &linkdev, &vf) < 0) if (virHostdevNetDevice(hostdev, &linkdev, &vf) < 0)
return ret; return ret;
virtPort = virDomainNetGetActualVirtPortProfile( virtPort = virDomainNetGetActualVirtPortProfile(
hostdev->parent.data.net); hostdev->parent.data.net);
if (virtPort) { if (virtPort) {
ret = qemuDomainHostdevNetConfigVirtPortProfile(linkdev, vf, virtPort, ret = virHostdevNetConfigVirtPortProfile(linkdev, vf, virtPort,
&hostdev->parent.data.net->mac, NULL, &hostdev->parent.data.net->mac,
port_profile_associate); NULL,
port_profile_associate);
} else { } else {
ret = virNetDevRestoreNetConfig(linkdev, vf, stateDir); ret = virNetDevRestoreNetConfig(linkdev, vf, stateDir);
if (ret < 0 && oldStateDir != NULL) if (ret < 0 && oldStateDir != NULL)
...@@ -748,8 +749,8 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr, ...@@ -748,8 +749,8 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
continue; continue;
if (hostdev->parent.type == VIR_DOMAIN_DEVICE_NET && if (hostdev->parent.type == VIR_DOMAIN_DEVICE_NET &&
hostdev->parent.data.net) { hostdev->parent.data.net) {
if (qemuDomainHostdevNetConfigReplace(hostdev, uuid, if (virHostdevNetConfigReplace(hostdev, uuid,
hostdev_mgr->stateDir) < 0) { hostdev_mgr->stateDir) < 0) {
goto resetvfnetconfig; goto resetvfnetconfig;
} }
} }
...@@ -833,8 +834,7 @@ inactivedevs: ...@@ -833,8 +834,7 @@ inactivedevs:
resetvfnetconfig: resetvfnetconfig:
for (i = 0; for (i = 0;
last_processed_hostdev_vf != -1 && i < last_processed_hostdev_vf; i++) last_processed_hostdev_vf != -1 && i < last_processed_hostdev_vf; i++)
qemuDomainHostdevNetConfigRestore(hostdevs[i], hostdev_mgr->stateDir, virHostdevNetConfigRestore(hostdevs[i], hostdev_mgr->stateDir, NULL);
NULL);
reattachdevs: reattachdevs:
for (i = 0; i < virPCIDeviceListCount(pcidevs); i++) { for (i = 0; i < virPCIDeviceListCount(pcidevs); i++) {
...@@ -1343,8 +1343,8 @@ qemuDomainReAttachHostdevDevices(virQEMUDriverPtr driver, ...@@ -1343,8 +1343,8 @@ qemuDomainReAttachHostdevDevices(virQEMUDriverPtr driver,
* reset and reattach device * reset and reattach device
*/ */
for (i = 0; i < nhostdevs; i++) for (i = 0; i < nhostdevs; i++)
qemuDomainHostdevNetConfigRestore(hostdevs[i], hostdev_mgr->stateDir, virHostdevNetConfigRestore(hostdevs[i], hostdev_mgr->stateDir,
oldStateDir); oldStateDir);
for (i = 0; i < virPCIDeviceListCount(pcidevs); i++) { for (i = 0; i < virPCIDeviceListCount(pcidevs); i++) {
virPCIDevicePtr dev = virPCIDeviceListGet(pcidevs, i); virPCIDevicePtr dev = virPCIDeviceListGet(pcidevs, i);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册