mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
xen: Make xenDaemon*DeviceFlags errors less confusing
When a user calls to virDomain{Attach,Detach,Update}DeviceFlags() with flags == VIR_DOMAIN_DEVICE_MODIFY_LIVE on an inactive guest running on an old Xen hypervisor (such as RHEL-5) xend_internal driver reports: Xend version does not support modifying persistent config which is pretty confusing since no-one requested to modify persistent config.
This commit is contained in:
parent
2ae5086c97
commit
28160e2264
@ -3878,6 +3878,12 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml,
|
||||
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
|
||||
|
||||
if (domain->id < 0) {
|
||||
/* Cannot modify live config if domain is inactive */
|
||||
if (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) {
|
||||
virXendError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("Cannot modify live config if domain is inactive"));
|
||||
return -1;
|
||||
}
|
||||
/* If xendConfigVersion < 3 only live config can be changed */
|
||||
if (priv->xendConfigVersion < 3) {
|
||||
virXendError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
@ -3885,12 +3891,6 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml,
|
||||
"persistent config"));
|
||||
return -1;
|
||||
}
|
||||
/* Cannot modify live config if domain is inactive */
|
||||
if (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) {
|
||||
virXendError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("Cannot modify live config if domain is inactive"));
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
/* Only live config can be changed if xendConfigVersion < 3 */
|
||||
if (priv->xendConfigVersion < 3 &&
|
||||
@ -4017,6 +4017,12 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml,
|
||||
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
|
||||
|
||||
if (domain->id < 0) {
|
||||
/* Cannot modify live config if domain is inactive */
|
||||
if (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) {
|
||||
virXendError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("Cannot modify live config if domain is inactive"));
|
||||
return -1;
|
||||
}
|
||||
/* If xendConfigVersion < 3 only live config can be changed */
|
||||
if (priv->xendConfigVersion < 3) {
|
||||
virXendError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
@ -4024,12 +4030,6 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml,
|
||||
"persistent config"));
|
||||
return -1;
|
||||
}
|
||||
/* Cannot modify live config if domain is inactive */
|
||||
if (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) {
|
||||
virXendError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("Cannot modify live config if domain is inactive"));
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
/* Only live config can be changed if xendConfigVersion < 3 */
|
||||
if (priv->xendConfigVersion < 3 &&
|
||||
@ -4128,6 +4128,12 @@ xenDaemonDetachDeviceFlags(virDomainPtr domain, const char *xml,
|
||||
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
|
||||
|
||||
if (domain->id < 0) {
|
||||
/* Cannot modify live config if domain is inactive */
|
||||
if (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) {
|
||||
virXendError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("Cannot modify live config if domain is inactive"));
|
||||
return -1;
|
||||
}
|
||||
/* If xendConfigVersion < 3 only live config can be changed */
|
||||
if (priv->xendConfigVersion < 3) {
|
||||
virXendError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
@ -4135,12 +4141,6 @@ xenDaemonDetachDeviceFlags(virDomainPtr domain, const char *xml,
|
||||
"persistent config"));
|
||||
return -1;
|
||||
}
|
||||
/* Cannot modify live config if domain is inactive */
|
||||
if (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) {
|
||||
virXendError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("Cannot modify live config if domain is inactive"));
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
/* Only live config can be changed if xendConfigVersion < 3 */
|
||||
if (priv->xendConfigVersion < 3 &&
|
||||
|
Loading…
Reference in New Issue
Block a user