Index: src/libvirt.c =================================================================== RCS file: /data/cvs/libvirt/src/libvirt.c,v retrieving revision 1.214 diff -u -r1.214 libvirt.c --- src/libvirt.c 12 Jun 2009 13:20:13 -0000 1.214 +++ src/libvirt.c 18 Jun 2009 02:51:23 -0000 @@ -4412,8 +4412,9 @@ if (conn->driver->domainGetSecurityLabel) return conn->driver->domainGetSecurityLabel(domain, seclabel); + /* the operation is not supported */ virLibConnWarning(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); - return -1; + return -2; } /** @@ -4442,8 +4443,9 @@ if (conn->driver->nodeGetSecurityModel) return conn->driver->nodeGetSecurityModel(conn, secmodel); + /* the operation is not supported */ virLibConnWarning(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); - return -1; + return -2; } /** Index: src/virsh.c =================================================================== RCS file: /data/cvs/libvirt/src/virsh.c,v retrieving revision 1.210 diff -u -r1.210 virsh.c --- src/virsh.c 3 Jun 2009 12:13:52 -0000 1.210 +++ src/virsh.c 18 Jun 2009 02:51:25 -0000 @@ -1582,7 +1582,7 @@ virDomainPtr dom; virSecurityModel secmodel; virSecurityLabel seclabel; - int ret = TRUE, autostart; + int ret = TRUE, ret_code, autostart; unsigned int id; char *str, uuid[VIR_UUID_STRING_BUFLEN]; @@ -1642,9 +1642,13 @@ /* Security model and label information */ memset(&secmodel, 0, sizeof secmodel); - if (virNodeGetSecurityModel(ctl->conn, &secmodel) == -1) { + ret_code = virNodeGetSecurityModel(ctl->conn, &secmodel); + if (ret_code == -1) { + /* operation failure */ virDomainFree(dom); return FALSE; + } else if (ret_code == -2) { + /* operation is not supported. noop */ } else { /* Only print something if a security model is active */ if (secmodel.model[0] != '\0') { @@ -1653,9 +1657,13 @@ /* Security labels are only valid for active domains */ memset(&seclabel, 0, sizeof seclabel); - if (virDomainGetSecurityLabel(dom, &seclabel) == -1) { + ret_code = virDomainGetSecurityLabel(dom, &seclabel); + if (ret == -1) { + /* operation failure */ virDomainFree(dom); return FALSE; + } else if (ret == -2) { + /* operation is not supported. noop */ } else { if (seclabel.label[0] != '\0') vshPrint(ctl, "%-15s %s (%s)\n", _("Security label:"),