X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=inspector%2Fvirt-inspector.c;h=d016b2ddd5ba08b21c3e11dfe027c59128a34707;hb=9e7c6a548353bde925c16434711bcc6208038d83;hp=a3c0a04a304a24355f4e714b671eaa817910eba2;hpb=c5cb65f0aac3298e634b183f73fda6644a158018;p=libguestfs.git diff --git a/inspector/virt-inspector.c b/inspector/virt-inspector.c index a3c0a04..d016b2d 100644 --- a/inspector/virt-inspector.c +++ b/inspector/virt-inspector.c @@ -1,5 +1,5 @@ /* virt-inspector - * Copyright (C) 2010 Red Hat Inc. + * Copyright (C) 2010-2011 Red Hat Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -38,6 +39,7 @@ guestfs_h *g; int read_only = 1; +int live = 0; int verbose = 0; int keys_from_stdin = 0; int echo_keys = 0; @@ -83,7 +85,7 @@ usage (int status) " --keys-from-stdin Read passphrases from stdin\n" " -v|--verbose Verbose messages\n" " -V|--version Display version and exit\n" - " -x Echo each command before executing it\n" + " -x Trace libguestfs API calls\n" "For more information, see the manpage %s(1).\n"), program_name, program_name, program_name, program_name); @@ -118,11 +120,9 @@ main (int argc, char *argv[]) }; struct drv *drvs = NULL; struct drv *drv; - char *p, *file = NULL; const char *format = NULL; int c; int option_index; - int next_prepared_drive = 1; g = guestfs_create (); if (g == NULL) { @@ -228,6 +228,7 @@ main (int argc, char *argv[]) */ assert (read_only == 1); assert (inspector == 1); + assert (live == 0); /* Must be no extra arguments on the command line. */ if (optind != argc) @@ -333,7 +334,7 @@ static void output_root (xmlTextWriterPtr xo, char *root) { char *str; - int i; + int i, r; char buf[32]; char canonical_root[strlen (root) + 1]; @@ -372,6 +373,13 @@ output_root (xmlTextWriterPtr xo, char *root) xmlTextWriterWriteElement (xo, BAD_CAST "product_name", BAD_CAST str)); free (str); + str = guestfs_inspect_get_product_variant (g, root); + if (!str) exit (EXIT_FAILURE); + if (STRNEQ (str, "unknown")) + XMLERROR (-1, + xmlTextWriterWriteElement (xo, BAD_CAST "product_variant", BAD_CAST str)); + free (str); + i = guestfs_inspect_get_major_version (g, root); snprintf (buf, sizeof buf, "%d", i); XMLERROR (-1, @@ -408,6 +416,43 @@ output_root (xmlTextWriterPtr xo, char *root) BAD_CAST str)); free (str); ); + DISABLE_GUESTFS_ERRORS_FOR ( + str = guestfs_inspect_get_windows_current_control_set (g, root); + if (str) + XMLERROR (-1, + xmlTextWriterWriteElement (xo, BAD_CAST "windows_current_control_set", + BAD_CAST str)); + free (str); + ); + + str = guestfs_inspect_get_format (g, root); + if (!str) exit (EXIT_FAILURE); + if (STRNEQ (str, "unknown")) + XMLERROR (-1, + xmlTextWriterWriteElement (xo, BAD_CAST "format", + BAD_CAST str)); + free (str); + + r = guestfs_inspect_is_live (g, root); + if (r > 0) { + XMLERROR (-1, + xmlTextWriterStartElement (xo, BAD_CAST "live")); + XMLERROR (-1, xmlTextWriterEndElement (xo)); + } + + r = guestfs_inspect_is_netinst (g, root); + if (r > 0) { + XMLERROR (-1, + xmlTextWriterStartElement (xo, BAD_CAST "netinst")); + XMLERROR (-1, xmlTextWriterEndElement (xo)); + } + + r = guestfs_inspect_is_multipart (g, root); + if (r > 0) { + XMLERROR (-1, + xmlTextWriterStartElement (xo, BAD_CAST "multipart")); + XMLERROR (-1, xmlTextWriterEndElement (xo)); + } output_mountpoints (xo, root); @@ -632,7 +677,7 @@ canonicalize (char *dev) (dev[5] == 'h' || dev[5] == 'v') && dev[6] == 'd' && c_isalpha (dev[7]) && - c_isdigit (dev[8])) + (c_isdigit (dev[8]) || dev[8] == '\0')) dev[5] = 's'; }