git.annexia.org
/
libguestfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
inspection: Return root devices sorted.
[libguestfs.git]
/
src
/
virt.c
diff --git
a/src/virt.c
b/src/virt.c
index
cd48888
..
cc11c68
100644
(file)
--- a/
src/virt.c
+++ b/
src/virt.c
@@
-82,6
+82,7
@@
guestfs__add_domain (guestfs_h *g, const char *domain_name,
const char *libvirturi;
int readonly;
int live;
const char *libvirturi;
int readonly;
int live;
+ int allowuuid;
const char *iface;
struct guestfs___add_libvirt_dom_argv optargs2 = { .bitmask = 0 };
const char *iface;
struct guestfs___add_libvirt_dom_argv optargs2 = { .bitmask = 0 };
@@
-93,6
+94,8
@@
guestfs__add_domain (guestfs_h *g, const char *domain_name,
? optargs->iface : NULL;
live = optargs->bitmask & GUESTFS_ADD_DOMAIN_LIVE_BITMASK
? optargs->live : 0;
? optargs->iface : NULL;
live = optargs->bitmask & GUESTFS_ADD_DOMAIN_LIVE_BITMASK
? optargs->live : 0;
+ allowuuid = optargs->bitmask & GUESTFS_ADD_DOMAIN_ALLOWUUID_BITMASK
+ ? optargs->allowuuid : 0;
if (live && readonly) {
error (g, _("you cannot set both live and readonly flags"));
if (live && readonly) {
error (g, _("you cannot set both live and readonly flags"));
@@
-114,7
+117,14
@@
guestfs__add_domain (guestfs_h *g, const char *domain_name,
*/
virConnSetErrorFunc (conn, NULL, ignore_errors);
*/
virConnSetErrorFunc (conn, NULL, ignore_errors);
- dom = virDomainLookupByName (conn, domain_name);
+ /* Try UUID first. */
+ if (allowuuid)
+ dom = virDomainLookupByUUIDString (conn, domain_name);
+
+ /* Try ordinary domain name. */
+ if (!dom)
+ dom = virDomainLookupByName (conn, domain_name);
+
if (!dom) {
err = virGetLastError ();
error (g, _("no libvirt domain called '%s': %s"),
if (!dom) {
err = virGetLastError ();
error (g, _("no libvirt domain called '%s': %s"),
@@
-382,10
+392,10
@@
guestfs___add_libvirt_dom (guestfs_h *g, virDomainPtr dom,
/* Checkpoint the command line around the operation so that either
* all disks are added or none are added.
*/
/* Checkpoint the command line around the operation so that either
* all disks are added or none are added.
*/
-
cmdline_pos = guestfs___checkpoint_cmdline
(g);
+
struct drive **cp = guestfs___checkpoint_drives
(g);
r = guestfs___for_each_disk (g, dom, add_disk, &optargs2);
if (r == -1)
r = guestfs___for_each_disk (g, dom, add_disk, &optargs2);
if (r == -1)
- guestfs___rollback_
cmdline (g, cmdline_pos
);
+ guestfs___rollback_
drives (g, cp
);
return r;
}
return r;
}