2014-05-01 03:35:21 +00:00
|
|
|
Index: xen-4.4.0-testing/tools/libxl/xl.c
|
|
|
|
===================================================================
|
|
|
|
--- xen-4.4.0-testing.orig/tools/libxl/xl.c
|
|
|
|
+++ xen-4.4.0-testing/tools/libxl/xl.c
|
2014-06-12 05:11:30 +00:00
|
|
|
@@ -282,6 +282,32 @@ static void xl_ctx_free(void)
|
2014-05-01 03:35:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+/*
|
|
|
|
+ Return 0 if domain is managed by libvirt
|
|
|
|
+*/
|
2014-06-12 05:11:30 +00:00
|
|
|
+static int xl_lookup_libvirt_managed_domain(int argc, char **argv)
|
2014-05-01 03:35:21 +00:00
|
|
|
+{
|
2014-06-12 05:11:30 +00:00
|
|
|
+ uint32_t domid;
|
|
|
|
+ uint8_t *t_data;
|
|
|
|
+ char *domname;
|
|
|
|
+ int i, rc, t_len;
|
2014-05-01 03:35:21 +00:00
|
|
|
+
|
2014-06-12 05:11:30 +00:00
|
|
|
+ for (i=0; i<argc; ++i) {
|
|
|
|
+ rc = libxl_domain_qualifier_to_domid(ctx, argv[i], &domid);
|
|
|
|
+ if (!rc) {
|
|
|
|
+ domname = libxl_domid_to_name(ctx, domid);
|
|
|
|
+ if (domname != NULL) {
|
|
|
|
+ rc = libxl_userdata_retrieve(ctx, domid, "libvirt-xml", &t_data, &t_len);
|
|
|
|
+ if (!rc && t_len)
|
|
|
|
+ return 0;
|
|
|
|
+ break;
|
2014-05-01 03:35:21 +00:00
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return 1;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
int opt = 0;
|
2014-06-12 05:11:30 +00:00
|
|
|
@@ -345,6 +371,18 @@ int main(int argc, char **argv)
|
2014-05-01 03:35:21 +00:00
|
|
|
goto xit;
|
|
|
|
}
|
|
|
|
if (cspec->modifies && !dryrun_only) {
|
|
|
|
+ if (!force_execution) {
|
2014-06-12 05:11:30 +00:00
|
|
|
+ if (!xl_lookup_libvirt_managed_domain(argc, argv)) {
|
2014-05-01 03:35:21 +00:00
|
|
|
+ fprintf(stderr,
|
|
|
|
+"Warning: This domain is managed by libvirt. Using xl commands to modify this\n"
|
|
|
|
+"domain will result in errors when virsh or virt-manager is used.\n"
|
|
|
|
+"Please use only virsh or virt-manager to manage this domain.\n\n"
|
|
|
|
+"(This check can be overridden with the -f option.)\n"
|
|
|
|
+ );
|
|
|
|
+ ret = 1;
|
|
|
|
+ goto xit;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
for (int i = 0; i < sizeof(locks)/sizeof(locks[0]); i++) {
|
|
|
|
if (!access(locks[i], F_OK) && !force_execution) {
|
|
|
|
fprintf(stderr,
|