提交 b4e9a21c 编写于 作者: D Daniel P. Berrange 提交者: Cole Robinson

Fix virDomainDeviceInfoIsSet() to check all struct fields

The virDomainDeviceInfoIsSet API was only checking if an
address or alias was set in the struct. Thus if only a
rom bar setting / filename, boot index, or USB master
value was set, they could be accidentally dropped when
formatting XML
(cherry picked from commit 2c195fdb)

Conflicts:

	src/conf/domain_conf.c

(crobinso: some elements aren't in maint branch, drop them)
上级 8bd5c792
......@@ -1508,14 +1508,16 @@ int virDomainDeviceVirtioSerialAddressIsValid(
}
static int
static bool
virDomainDeviceInfoIsSet(virDomainDeviceInfoPtr info, unsigned int flags)
{
if (info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
return 1;
return true;
if (info->alias && !(flags & VIR_DOMAIN_XML_INACTIVE))
return 1;
return 0;
return true;
if (info->mastertype != VIR_DOMAIN_CONTROLLER_MASTER_NONE)
return true;
return false;
}
......
......@@ -138,6 +138,10 @@ struct _virDomainDeviceUSBMaster {
typedef struct _virDomainDeviceInfo virDomainDeviceInfo;
typedef virDomainDeviceInfo *virDomainDeviceInfoPtr;
struct _virDomainDeviceInfo {
/* If adding to this struct, ensure that
* virDomainDeviceInfoIsSet() is updated
* to consider the new fields
*/
char *alias;
int type;
union {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册