mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 19:32:19 +00:00
qemu: monitor: Ensure that qemuMonitorSetLink is called with non-null name
This commit is contained in:
parent
0e9fadd66d
commit
ee591240c2
@ -1672,11 +1672,11 @@ qemuMonitorSetLink(qemuMonitorPtr mon,
|
||||
virDomainNetInterfaceLinkState state)
|
||||
{
|
||||
int ret;
|
||||
VIR_DEBUG("mon=%p, name=%p:%s, state=%u", mon, name, name, state);
|
||||
VIR_DEBUG("mon=%p, name=%s, state=%u", mon, name, state);
|
||||
|
||||
if (!mon || !name) {
|
||||
if (!mon) {
|
||||
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||
_("monitor || name must not be NULL"));
|
||||
_("monitor must not be NULL"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -233,7 +233,8 @@ int qemuMonitorSetCapabilities(qemuMonitorPtr mon);
|
||||
|
||||
int qemuMonitorSetLink(qemuMonitorPtr mon,
|
||||
const char *name,
|
||||
virDomainNetInterfaceLinkState state);
|
||||
virDomainNetInterfaceLinkState state)
|
||||
ATTRIBUTE_NONNULL(2);
|
||||
|
||||
/* These APIs are for use by the internal Text/JSON monitor impl code only */
|
||||
char *qemuMonitorNextCommandID(qemuMonitorPtr mon);
|
||||
|
@ -2355,6 +2355,12 @@ qemuProcessSetLinkStates(virDomainObjPtr vm)
|
||||
|
||||
for (i = 0; i < def->nnets; i++) {
|
||||
if (def->nets[i]->linkstate == VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN) {
|
||||
if (!def->nets[i]->info.alias) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("missing alias for network device"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
VIR_DEBUG("Setting link state: %s", def->nets[i]->info.alias);
|
||||
|
||||
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user