Index: src/libvirt.c =================================================================== RCS file: /data/cvs/libvirt/src/libvirt.c,v retrieving revision 1.42 diff -c -r1.42 libvirt.c *** src/libvirt.c 11 Aug 2006 14:40:04 -0000 1.42 --- src/libvirt.c 16 Aug 2006 15:17:43 -0000 *************** *** 240,246 **** for (i = 0;i < MAX_DRIVERS;i++) { if ((virDriverTab[i] != NULL) && (virDriverTab[i]->open != NULL)) { ! res = virDriverTab[i]->open(ret, name, 0); /* * For a default connect to Xen make sure we manage to contact * all related drivers. --- 240,246 ---- for (i = 0;i < MAX_DRIVERS;i++) { if ((virDriverTab[i] != NULL) && (virDriverTab[i]->open != NULL)) { ! res = virDriverTab[i]->open(ret, name, VIR_DRV_OPEN_QUIET); /* * For a default connect to Xen make sure we manage to contact * all related drivers. *************** *** 730,737 **** conn = domain->conn; #if PEDANTIC ! if (domain->conn->flags & VIR_CONNECT_RO) return (-1); #endif /* --- 730,739 ---- conn = domain->conn; #if PEDANTIC ! if (domain->conn->flags & VIR_CONNECT_RO) { ! virLibDomainError(domain, VIR_ERR_READ_ONLY, __FUNCTION__); return (-1); + } #endif /* *************** *** 805,812 **** conn = domain->conn; #if PEDANTIC ! if (domain->conn->flags & VIR_CONNECT_RO) return (-1); #endif /* --- 807,816 ---- conn = domain->conn; #if PEDANTIC ! if (domain->conn->flags & VIR_CONNECT_RO) { ! virLibDomainError(domain, VIR_ERR_READ_ONLY, __FUNCTION__); return (-1); + } #endif /* *************** *** 857,864 **** conn = domain->conn; #if PEDANTIC ! if (domain->conn->flags & VIR_CONNECT_RO) return (-1); #endif /* --- 861,870 ---- conn = domain->conn; #if PEDANTIC ! if (domain->conn->flags & VIR_CONNECT_RO) { ! virLibDomainError(domain, VIR_ERR_READ_ONLY, __FUNCTION__); return (-1); + } #endif /* *************** *** 1030,1037 **** conn = domain->conn; #if PEDANTIC ! if (domain->conn->flags & VIR_CONNECT_RO) return (-1); #endif /* Go though the driver registered entry points */ --- 1036,1045 ---- conn = domain->conn; #if PEDANTIC ! if (domain->conn->flags & VIR_CONNECT_RO) { ! virLibDomainError(domain, VIR_ERR_READ_ONLY, __FUNCTION__); return (-1); + } #endif /* Go though the driver registered entry points */ *************** *** 1075,1082 **** conn = domain->conn; #if PEDANTIC ! if (domain->conn->flags & VIR_CONNECT_RO) return (-1); #endif /* Go though the driver registered entry points */ --- 1083,1092 ---- conn = domain->conn; #if PEDANTIC ! if (domain->conn->flags & VIR_CONNECT_RO) { ! virLibDomainError(domain, VIR_ERR_READ_ONLY, __FUNCTION__); return (-1); + } #endif /* Go though the driver registered entry points */ *************** *** 1168,1174 **** virDomainGetUUIDString(virDomainPtr domain, char *buf) { unsigned char uuid[16]; ! if (!VIR_IS_DOMAIN(domain)) { virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__); return (-1); --- 1178,1184 ---- virDomainGetUUIDString(virDomainPtr domain, char *buf) { unsigned char uuid[16]; ! if (!VIR_IS_DOMAIN(domain)) { virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__); return (-1); *************** *** 1309,1316 **** return (-1); } conn = domain->conn; ! if (domain->conn->flags & VIR_CONNECT_RO) return (-1); /* * in that case instead of trying only though one method try all availble. --- 1319,1330 ---- return (-1); } conn = domain->conn; ! #if PEDANTIC ! if (domain->conn->flags & VIR_CONNECT_RO) { ! virLibDomainError(domain, VIR_ERR_READ_ONLY, __FUNCTION__); return (-1); + } + #endif /* * in that case instead of trying only though one method try all availble. *************** *** 1361,1368 **** return (-1); } conn = domain->conn; ! if (domain->conn->flags & VIR_CONNECT_RO) return (-1); /* * in that case instead of trying only though one method try all availble. --- 1375,1386 ---- return (-1); } conn = domain->conn; ! #if PEDANTIC ! if (domain->conn->flags & VIR_CONNECT_RO) { ! virLibDomainError(domain, VIR_ERR_READ_ONLY, __FUNCTION__); return (-1); + } + #endif /* * in that case instead of trying only though one method try all availble. *************** *** 1682,1689 **** virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__); return (-1); } ! if (domain->conn->flags & VIR_CONNECT_RO) return (-1); if (nvcpus < 1) { virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__); return (-1); --- 1700,1711 ---- virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__); return (-1); } ! #if PEDANTIC ! if (domain->conn->flags & VIR_CONNECT_RO) { ! virLibDomainError(domain, VIR_ERR_READ_ONLY, __FUNCTION__); return (-1); + } + #endif if (nvcpus < 1) { virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__); return (-1); *************** *** 1748,1755 **** virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__); return (-1); } ! if (domain->conn->flags & VIR_CONNECT_RO) return (-1); if ((vcpu > 32000) || (cpumap == NULL) || (maplen < 1)) { virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__); return (-1); --- 1770,1781 ---- virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__); return (-1); } ! #if PEDANTIC ! if (domain->conn->flags & VIR_CONNECT_RO) { ! virLibDomainError(domain, VIR_ERR_READ_ONLY, __FUNCTION__); return (-1); + } + #endif if ((vcpu > 32000) || (cpumap == NULL) || (maplen < 1)) { virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__); return (-1); Index: src/virterror.c =================================================================== RCS file: /data/cvs/libvirt/src/virterror.c,v retrieving revision 1.15 diff -c -r1.15 virterror.c *** src/virterror.c 28 Jul 2006 15:10:18 -0000 1.15 --- src/virterror.c 16 Aug 2006 15:17:43 -0000 *************** *** 533,538 **** --- 533,542 ---- else errmsg = "domain %s exists already"; break; + case VIR_ERR_READ_ONLY: + errmsg = "the hypervisor connection is readonly"; + break; + } return (errmsg); } Index: include/libvirt/virterror.h =================================================================== RCS file: /data/cvs/libvirt/include/libvirt/virterror.h,v retrieving revision 1.14 diff -c -r1.14 virterror.h *** include/libvirt/virterror.h 28 Jun 2006 18:19:13 -0000 1.14 --- include/libvirt/virterror.h 16 Aug 2006 15:17:43 -0000 *************** *** 105,111 **** VIR_ERR_DRIVER_FULL, /* too many drivers registered */ VIR_ERR_CALL_FAILED, /* not supported by the drivers */ VIR_ERR_XML_ERROR, /* an XML description is not well formed or broken */ ! VIR_ERR_DOM_EXIST /* the domain already exist */ } virErrorNumber; /** --- 105,112 ---- VIR_ERR_DRIVER_FULL, /* too many drivers registered */ VIR_ERR_CALL_FAILED, /* not supported by the drivers */ VIR_ERR_XML_ERROR, /* an XML description is not well formed or broken */ ! VIR_ERR_DOM_EXIST, /* the domain already exist */ ! VIR_ERR_READ_ONLY /* the HV connection is readonly */ } virErrorNumber; /**