mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 01:18:00 +03:00
startupPolicty: Minor cleanups
This patch does some cleanups to my previous startupPolicy patchset.
This commit is contained in:
parent
d84b36263c
commit
457d46ca8c
@ -497,6 +497,8 @@ static int remoteRelayDomainEventDiskChange(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
mem_error:
|
mem_error:
|
||||||
|
VIR_FREE(oldSrcPath_p);
|
||||||
|
VIR_FREE(newSrcPath_p);
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -2726,7 +2726,7 @@ virDomainDiskDefParseXML(virCapsPtr caps,
|
|||||||
if (startupPolicy) {
|
if (startupPolicy) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if ((i = virDomainStartupPolicyTypeFromString(startupPolicy)) < 0) {
|
if ((i = virDomainStartupPolicyTypeFromString(startupPolicy)) <= 0) {
|
||||||
virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("unknown startupPolicy value '%s'"),
|
_("unknown startupPolicy value '%s'"),
|
||||||
startupPolicy);
|
startupPolicy);
|
||||||
|
@ -1602,9 +1602,8 @@ qemuDomainCheckDiskPresence(struct qemud_driver *driver,
|
|||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
int i;
|
int i;
|
||||||
int accessRet;
|
|
||||||
virDomainDiskDefPtr disk;
|
virDomainDiskDefPtr disk;
|
||||||
char uuid[VIR_UUID_STRING_BUFLEN] ATTRIBUTE_UNUSED;
|
char uuid[VIR_UUID_STRING_BUFLEN];
|
||||||
virDomainEventPtr event = NULL;
|
virDomainEventPtr event = NULL;
|
||||||
|
|
||||||
virUUIDFormat(vm->def->uuid, uuid);
|
virUUIDFormat(vm->def->uuid, uuid);
|
||||||
@ -1615,11 +1614,10 @@ qemuDomainCheckDiskPresence(struct qemud_driver *driver,
|
|||||||
if (!disk->startupPolicy || !disk->src)
|
if (!disk->startupPolicy || !disk->src)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((accessRet = virFileAccessibleAs(disk->src, F_OK,
|
if (virFileAccessibleAs(disk->src, F_OK,
|
||||||
driver->user,
|
driver->user,
|
||||||
driver->group)) >= 0) {
|
driver->group) >= 0) {
|
||||||
/* disk accessible or virFileAccessibleAs()
|
/* disk accessible */
|
||||||
* terminated with signal*/
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1628,7 +1626,7 @@ qemuDomainCheckDiskPresence(struct qemud_driver *driver,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_STARTUP_POLICY_MANDATORY:
|
case VIR_DOMAIN_STARTUP_POLICY_MANDATORY:
|
||||||
virReportSystemError(-accessRet,
|
virReportSystemError(errno,
|
||||||
_("cannot access file '%s'"),
|
_("cannot access file '%s'"),
|
||||||
disk->src);
|
disk->src);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -1636,7 +1634,7 @@ qemuDomainCheckDiskPresence(struct qemud_driver *driver,
|
|||||||
|
|
||||||
case VIR_DOMAIN_STARTUP_POLICY_REQUISITE:
|
case VIR_DOMAIN_STARTUP_POLICY_REQUISITE:
|
||||||
if (!start_with_state) {
|
if (!start_with_state) {
|
||||||
virReportSystemError(-accessRet,
|
virReportSystemError(errno,
|
||||||
_("cannot access file '%s'"),
|
_("cannot access file '%s'"),
|
||||||
disk->src);
|
disk->src);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -1649,8 +1647,8 @@ qemuDomainCheckDiskPresence(struct qemud_driver *driver,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
VIR_DEBUG("Droping disk '%s' on domain '%s' (UUID '%s') "
|
VIR_DEBUG("Dropping disk '%s' on domain '%s' (UUID '%s') "
|
||||||
"due to not accessible source '%s'",
|
"due to inaccessible source '%s'",
|
||||||
disk->dst, vm->def->name, uuid, disk->src);
|
disk->dst, vm->def->name, uuid, disk->src);
|
||||||
|
|
||||||
event = virDomainEventDiskChangeNewFromObj(vm, disk->src, NULL, disk->info.alias,
|
event = virDomainEventDiskChangeNewFromObj(vm, disk->src, NULL, disk->info.alias,
|
||||||
|
Loading…
Reference in New Issue
Block a user