On 20.05.2015 14:30, Daniel P. Berrange wrote: > On Mon, May 18, 2015 at 02:43:49PM +0200, Ján Tomko wrote: >> Expose the virDomainSetUserPassword API in virsh: >> virsh set-user-password dom 123456 user >> >> For root, the username can be omitted: >> virsh set-user-password dom 123456 >> --- >> tools/virsh-domain.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++ >> tools/virsh.pod | 11 ++++++++ >> 2 files changed, 87 insertions(+) > > >> +static bool >> +cmdSetUserPassword(vshControl *ctl, const vshCmd *cmd) >> +{ >> + virDomainPtr dom; >> + const char *name; >> + const char *password = NULL; >> + const char *user = NULL; >> + unsigned int flags = 0; >> + bool ret = false; >> + >> + if (vshCommandOptBool(cmd, "crypted")) >> + flags = VIR_DOMAIN_PASSWORD_CRYPTED; >> + >> + if (vshCommandOptStringReq(ctl, cmd, "user", &user) < 0) >> + return false; >> + >> + if (vshCommandOptStringReq(ctl, cmd, "password", &password) < 0) >> + return false; >> + >> + if (!user) >> + user = "root"; > > This presumes the guest is UNIX. I'd be inclined to have user > always be required, and also have user specified before the > password, as that seems slightly more common eg htpasswd > tools Agreed. ACK if you fix it. Michal -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list