提交 c7c9dea0 编写于 作者: M Michal Privoznik

qemuDomainDiskChangeSupported: Deny changing reservations

Couple of reasons for that:

a) there's no monitor command to change path where the pr-helper
connects to, or
b) there's no monitor command to introduce a new pr-helper for a
disk that already exists.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 68773054
......@@ -2803,6 +2803,7 @@ virStorageNetHostTransportTypeToString;
virStorageNetProtocolTypeToString;
virStoragePRDefFormat;
virStoragePRDefFree;
virStoragePRDefIsEqual;
virStoragePRDefParseXML;
virStorageSourceBackingStoreClear;
virStorageSourceClear;
......
......@@ -7842,6 +7842,14 @@ qemuDomainDiskChangeSupported(virDomainDiskDefPtr disk,
CHECK_EQ(src->readonly, "readonly", true);
CHECK_EQ(src->shared, "shared", true);
if (!virStoragePRDefIsEqual(disk->src->pr,
orig_disk->src->pr)) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("cannot modify field '%s' of the disk"),
"reservations");
return false;
}
#undef CHECK_EQ
return true;
......
......@@ -2022,6 +2022,25 @@ virStoragePRDefFormat(virBufferPtr buf,
}
bool
virStoragePRDefIsEqual(virStoragePRDefPtr a,
virStoragePRDefPtr b)
{
if (!a && !b)
return true;
if (!a || !b)
return false;
if (a->enabled != b->enabled ||
a->managed != b->managed ||
STRNEQ_NULLABLE(a->path, b->path))
return false;
return true;
}
virSecurityDeviceLabelDefPtr
virStorageSourceGetSecurityLabelDef(virStorageSourcePtr src,
const char *model)
......
......@@ -395,6 +395,8 @@ void virStoragePRDefFree(virStoragePRDefPtr prd);
virStoragePRDefPtr virStoragePRDefParseXML(xmlXPathContextPtr ctxt);
void virStoragePRDefFormat(virBufferPtr buf,
virStoragePRDefPtr prd);
bool virStoragePRDefIsEqual(virStoragePRDefPtr a,
virStoragePRDefPtr b);
virSecurityDeviceLabelDefPtr
virStorageSourceGetSecurityLabelDef(virStorageSourcePtr src,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册