mirror of https://gitee.com/openkylin/libvirt.git
virsh additions for sVirt support (James Morris & Dan Walsh)
This commit is contained in:
parent
8bd1604cb7
commit
aa2c97263d
|
@ -1,6 +1,12 @@
|
|||
Tue Mar 3 09:55:13 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
virsh additions for sVirt support (James Morris & Dan Walsh)
|
||||
* src/virsh.c: Include security model / label information
|
||||
in the 'dominfo' output
|
||||
|
||||
Tue Mar 3 09:40:13 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
Core internal driver stub for sVirt support (Jams Morris & Dan Walsh)
|
||||
Core internal driver stub for sVirt support (James Morris & Dan Walsh)
|
||||
* Makefile.maint: Add virSecurityReportError as a msggen
|
||||
function
|
||||
* docs/schemas/capability.rng: Add <secmodel> element
|
||||
|
|
25
src/virsh.c
25
src/virsh.c
|
@ -1539,6 +1539,8 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd)
|
|||
{
|
||||
virDomainInfo info;
|
||||
virDomainPtr dom;
|
||||
virSecurityModel secmodel;
|
||||
virSecurityLabel seclabel;
|
||||
int ret = TRUE, autostart;
|
||||
unsigned int id;
|
||||
char *str, uuid[VIR_UUID_STRING_BUFLEN];
|
||||
|
@ -1597,6 +1599,29 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd)
|
|||
autostart ? _("enable") : _("disable") );
|
||||
}
|
||||
|
||||
/* Security model and label information */
|
||||
memset(&secmodel, 0, sizeof secmodel);
|
||||
if (virNodeGetSecurityModel(ctl->conn, &secmodel) == -1) {
|
||||
virDomainFree(dom);
|
||||
return FALSE;
|
||||
} else {
|
||||
/* Only print something if a security model is active */
|
||||
if (secmodel.model[0] != '\0') {
|
||||
vshPrint(ctl, "%-15s %s\n", _("Security model:"), secmodel.model);
|
||||
vshPrint(ctl, "%-15s %s\n", _("Security DOI:"), secmodel.doi);
|
||||
|
||||
/* Security labels are only valid for active domains */
|
||||
memset(&seclabel, 0, sizeof seclabel);
|
||||
if (virDomainGetSecurityLabel(dom, &seclabel) == -1) {
|
||||
virDomainFree(dom);
|
||||
return FALSE;
|
||||
} else {
|
||||
if (seclabel.label[0] != '\0')
|
||||
vshPrint(ctl, "%-15s %s (%s)\n", _("Security label:"),
|
||||
seclabel.label, seclabel.enforcing ? "enforcing" : "permissive");
|
||||
}
|
||||
}
|
||||
}
|
||||
virDomainFree(dom);
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue