1. 18 11月, 2010 2 次提交
    • E
      maint: avoid remaining sprintf uses · e8aba782
      Eric Blake 提交于
      * cfg.mk (sc_prohibit_sprintf): New rule.
      (sc_prohibit_asprintf): Avoid false positives.
      * docs/hacking.html.in (Printf-style functions): Document the
      policy.
      * HACKING: Regenerate.
      * .x-sc_prohibit_sprintf: New exemptions.
      * Makefile.am (syntax_check_exceptions): Ship new file.
      * src/vbox/vbox_tmpl.c (vboxStartMachine, vboxAttachUSB): Use
      virAsprintf instead.
      * src/uml/uml_driver.c (umlOpenMonitor): Use snprintf instead.
      * tools/virsh.c (cmdDetachInterface): Likewise.
      * src/security/security_selinux.c (SELinuxGenSecurityLabel):
      Likewise.
      * src/openvz/openvz_driver.c (openvzDomainDefineCmd): Likewise,
      and ensure large enough buffer.
      e8aba782
    • E
      maint: improve i18n on non-Linux · 981d2cda
      Eric Blake 提交于
      Per the gettext developer:
      http://lists.gnu.org/archive/html/bug-gnu-utils/2010-10/msg00019.html
      http://lists.gnu.org/archive/html/bug-gnu-utils/2010-10/msg00021.html
      
      gettext() doesn't work correctly on all platforms unless you have
      called setlocale().  Furthermore, gnulib's gettext.h has provisions
      for setting up a default locale, which is the preferred method for
      libraries to use gettext without having to call textdomain() and
      override the main program's default domain (virInitialize already
      calls bindtextdomain(), but this is insufficient without the
      setlocale() added in this patch; and a redundant bindtextdomain()
      in this patch doesn't hurt, but serves as a good example for other
      packages that need to bind a second translation domain).
      
      This patch is needed to silence a new gnulib 'make syntax-check'
      rule in the next patch.
      
      * daemon/libvirtd.c (main): Setup locale and gettext.
      * src/lxc/lxc_controller.c (main): Likewise.
      * src/security/virt-aa-helper.c (main): Likewise.
      * src/storage/parthelper.c (main): Likewise.
      * tools/virsh.c (main): Fix exit status.
      * src/internal.h (DEFAULT_TEXT_DOMAIN): Define, for gettext.h.
      (_): Simplify definition accordingly.
      * po/POTFILES.in: Add src/storage/parthelper.c.
      981d2cda
  2. 17 11月, 2010 3 次提交
    • E
      maint: use gnulib configmake rather than open-coding things · 0d5f54bb
      Eric Blake 提交于
      * bootstrap.conf (gnulib_modules): Add configmake.
      * daemon/Makefile.am (libvirtd_CFLAGS): Drop defines provided by
      gnulib.
      * src/Makefile.am (INCLUDES): Likewise.
      * tests/Makefile.am (INCLUDES): Likewise.
      * tools/Makefile.am (virsh_CFLAGS): Likewise.
      * daemon/libvirtd.c (qemudInitPaths, usage, main): Update
      clients.
      * src/cpu/cpu_map.c (CPUMAPFILE): Likewise.
      * src/driver.c (DEFAULT_DRIVER_DIR): Likewise.
      * src/internal.h (_): Likewise.
      * src/libvirt.c (virInitialize): Likewise.
      * src/lxc/lxc_conf.h (LXC_CONFIG_DIR, LXC_STATE_DIR, LXC_LOG_DIR):
      Likewise.
      * src/lxc/lxc_conf.c (lxcCapsInit, lxcLoadDriverConfig):
      Likewise.
      * src/network/bridge_driver.c (NETWORK_PID_DIR)
      (NETWORK_STATE_DIR, DNSMASQ_STATE_DIR, networkStartup): Likewise.
      * src/nwfilter/nwfilter_driver.c (nwfilterDriverStartup):
      Likewise.
      * src/qemu/qemu_conf.c (qemudLoadDriverConfig): Likewise.
      * src/qemu/qemu_driver.c (qemudStartup): Likewise.
      * src/remote/remote_driver.h (LIBVIRTD_PRIV_UNIX_SOCKET)
      (LIBVIRTD_PRIV_UNIX_SOCKET_RO, LIBVIRTD_CONFIGURATION_FILE)
      (LIBVIRT_PKI_DIR): Likewise.
      * src/secret/secret_driver.c (secretDriverStartup): Likewise.
      * src/security/security_apparmor.c (VIRT_AA_HELPER): Likewise.
      * src/security/virt-aa-helper.c (main): Likewise.
      * src/storage/storage_backend_disk.c (PARTHELPER): Likewise.
      * src/storage/storage_driver.c (storageDriverStartup): Likewise.
      * src/uml/uml_driver.c (TEMPDIR, umlStartup): Likewise.
      * src/util/hooks.c (LIBVIRT_HOOK_DIR): Likewise.
      * tools/virsh.c (main): Likewise.
      * docs/hooks.html.in: Likewise.
      0d5f54bb
    • S
      replace last instances of close() · 8e3051af
      Stefan Berger 提交于
      I am replacing the last instances of close() I found with VIR_CLOSE() / VIR_FORCE_CLOSE respectively.
      
      The first part patches virsh, which I missed out on previously.
      
      The 2nd patch I had left out intentionally to look at it more carefully:
      The 'closed' variable could be easily removed since it wasn't used anywhere else. The possible race condition that could result from the filedescriptor being closed and not set to -1 (and possibly let us write into 'something' totally different if the fd was allocated by another thread) seems to be prevented by the qemuMonitorLock() already placed around the code that reads from or writes to the fd. So the change of this code as shown in the patch should not have any side-effects.
      8e3051af
    • O
      virsh: add net-info command · 21f52833
      Osier Yang 提交于
      To list basic information about the network.
      
      * tools/virsh.c
      * tools/virsh.pod
      21f52833
  3. 12 11月, 2010 2 次提交
    • D
      Fix reference counting bug in virsh console · a9261567
      Daniel P. Berrange 提交于
      The event watches need to be removed before the event loop
      terminates, otherwise they cause a dangling reference to
      be held on the virStreamPtr, which in turns holds a reference
      on virConnectPtr, which in turn causes errors like
      
        "Failed to disconnect from the hypervisor"
      
      * tools/console.c: Remove watches before event loop quits
      * tools/virsh.c: Print out dangling reference count
      a9261567
    • D
      Re-write virsh console to use streams · dad4b5d4
      Daniel P. Berrange 提交于
      This re-writes the 'virsh console' command so that it uses
      the new streams API. This lets it run remotely and/or as a
      non-root user. This requires that virsh be linked against
      the simple event loop from libvirtd in daemon/event.c
      As an added bonus, it can now connect to any console device,
      not just the first one.
      
      * tools/Makefile.am: Link to event.c
      * tools/console.c, tools/console.h: Rewrite to use the
        virDomainOpenConsole() APIs with streams
      * tools/virsh.c: Support choosing the console name
        via --devname $NAME
      dad4b5d4
  4. 11 11月, 2010 1 次提交
    • E
      virsh: supply long option for -V · 51c83a2b
      Eric Blake 提交于
      * tools/virsh.c (vshParseArgv): Use NULL instead of 0 for pointer,
      and symbolic names for has_arg.  Give --version an optional arg.
      (vshUsage): Document this.
      * tools/virsh.pod: Likewise.
      51c83a2b
  5. 10 11月, 2010 2 次提交
    • L
      virsh: fix non-literal string format · ff4a31d9
      Laine Stump 提交于
      These are in the newly added -V output.
      ff4a31d9
    • S
      bye to close(), welcome to VIR_(FORCE_)CLOSE() · 60ae1c34
      Stefan Berger 提交于
      Using automated replacement with sed and editing I have now replaced all
      occurrences of close() with VIR_(FORCE_)CLOSE() except for one, of
      course. Some replacements were straight forward, others I needed to pay
      attention. I hope I payed attention in all the right places... Please
      have a look. This should have at least solved one more double-close
      error.
      60ae1c34
  6. 09 11月, 2010 2 次提交
    • J
      virsh: Add .xml suffix to tmp files used in *edit commands · fb76151c
      Jiri Denemark 提交于
      This helps editors with detecting the temporary files as XML since the
      temporary files do not contain <?xml ...?> declaration.
      
      Requested by https://bugzilla.redhat.com/show_bug.cgi?id=602277
      fb76151c
    • D
      Show compiled in options in virsh -V · 5879c15d
      Daniel Veillard 提交于
        To ease debugging this trivial patch allows to find what was compiled
      in in the local version of libvirt, this doesn't work for remote access
      but that's probably sufficient. With the patch I get on my machine:
      
      paphio:~/libvirt/tools -> ./virsh -V
      Virsh command line tool of libvirt 0.8.4
      See web site at http://libvirt.org/
      
      Compiled with support for:
       Hypervisors: Xen QEmu/KVM UML OpenVZ LXC ESX PHYP Test
       Networking: Remote Daemon Network Bridging Netcf Nwfilter
       Storage: Dir Disk Filesystem SCSI Multipath iSCSI LVM
       Miscellaneous: SELinux Secrets Debug Readline
      paphio:~/libvirt/tools ->
      
      * tools/virsh.c: add -V option
      * tools/virsh.pod: document the extension
      5879c15d
  7. 08 11月, 2010 1 次提交
  8. 06 11月, 2010 1 次提交
  9. 29 10月, 2010 1 次提交
  10. 27 10月, 2010 1 次提交
  11. 26 10月, 2010 3 次提交
    • E
      virsh: fix range of memtune command · 009035ff
      Eric Blake 提交于
      * tools/virsh.c (cmdMemtune): Use long long for memory
      sizes. Simplify allocation, and plug memory leak.
      009035ff
    • E
      virsh: improve help text where integers are expected · c1564268
      Eric Blake 提交于
      * tools/virsh.c (opts_freecell, opts_memtune, opts_vcpupin)
      (opts_setvcpus, opts_setmaxmem, opts_setmem)
      (opts_migrate_setmaxdowntime): Use VSH_OT_INT when only an integer
      is expected.
      (vshCmddefHelp, vshCmddefGetData): Allow mandatory VSH_OT_INT
      arguments.
      c1564268
    • O
      virsh: Add option 'model' for attach-interface · 1a29a14a
      Osier Yang 提交于
      * tools/virsh.c: add missing option from the CLI to allows setting
        up the NIC model type when attaching an interface
      * tools/virsh.pod: extend documentation
      * AUTHORS: add Osier Yang to the list
      1a29a14a
  12. 21 10月, 2010 2 次提交
  13. 20 10月, 2010 1 次提交
    • E
      vcpu: add virsh support · bf945ee9
      Eric Blake 提交于
      * tools/virsh.c (cmdSetvcpus): Add new flags.  Let invalid
      commands through to driver, to ease testing of hypervisor argument
      validation.
      (cmdMaxvcpus, cmdVcpucount): New commands.
      (commands): Add new commands.
      * tools/virsh.pod (setvcpus, vcpucount, maxvcpus): Document new
      behavior.
      bf945ee9
  14. 19 10月, 2010 1 次提交
  15. 16 10月, 2010 2 次提交
    • E
      virsh: new echo command · b2aedb8e
      Eric Blake 提交于
      * tools/virsh.c (cmdEcho): New command.
      (commands): Add it.
      * tools/virsh.pod (echo): Document it.
      b2aedb8e
    • E
      virsh: add support for accepting arbitrary argv · 72e884d5
      Eric Blake 提交于
      * tools/virsh.c (vshCmdOptType): Add VSH_OT_ARGV.  Delete
      unused VSH_OT_NONE.
      (vshCmddefGetData): Special case new opt flag.
      (vshCmddefHelp): Display help for argv.
      (vshCommandOptArgv): New function.
      72e884d5
  16. 13 10月, 2010 13 次提交
    • E
      virsh: update comment about parsing · 59ce32b0
      Eric Blake 提交于
      * tools/virsh.c: Update comments to match patch series.
      59ce32b0
    • E
      virsh: move code into topological order · ce828d10
      Eric Blake 提交于
      * tools/virsh.c (vshCommandParse): Float up, to avoid the need for
      a forward declaration.
      ce828d10
    • E
      virsh: simplify top-level option parsing · 5405cffc
      Eric Blake 提交于
      This makes 'virsh --conn test:///default help help' work right;
      previously, the abbreviation confused our hand-rolled option parsing.
      
      * tools/virsh.c (vshParseArgv): Use getopt_long feature, rather
      than (incorrectly) reparsing options ourselves.
      5405cffc
    • L
      virsh: add -- support · 227f5df8
      Lai Jiangshan 提交于
      "--" means no option at the following arguments.
      Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
      227f5df8
    • L
      virsh: support single quote · 57868d12
      Lai Jiangshan 提交于
      Some users may type command like this at the virsh shell:
      virsh # somecmd 'some arg'
      
      because they often use single quote in linux shell.
      Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
      57868d12
    • L
      virsh: add escaper \ for command string parsing · 52321014
      Lai Jiangshan 提交于
      add escaper \ for command string parsing, example:
      
      virsh # cd /path/which/have/a/double\"quote
      Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
      52321014
    • L
      virsh: rework command parsing · a2943243
      Lai Jiangshan 提交于
      Old virsh command parsing mashes all the args back into a string and
      miss the quotes, this patches fix it. It is also needed for introducing
      qemu-monitor-command which is very useful.
      
      This patches uses the new vshCommandParser abstraction and adds
      vshCommandArgvParse() for arguments vector, so we don't need
      to mash arguments vector into a command sting.
      
      And the usage was changed:
      old:
      virsh [options] [commands]
      
      new:
      virsh [options]... [<command_string>]
      virsh [options]... <command> [args...]
      
      So we still support commands like:
      "define D.xml; dumpxml D" was parsed as a commands-string.
      
      and support commands like:
      we will not mash them into a string, we use new argv parser for it.
      
      But we don't support the command like:
      "define D.xml; dumpxml" was parsed as a command-name, but we have no such command-name.
      Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
      a2943243
    • L
      virsh: add vshCommandParser abstraction · a93f514f
      Lai Jiangshan 提交于
      add vshCommandParser and make vshCommandParse() accept different
      parsers.
      
      the current code for parse command string is integrated as
      vshCommandStringParse().
      Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
      a93f514f
    • L
      virsh: better handling the boolean option · 4417f08d
      Lai Jiangshan 提交于
      in old code the following commands are equivalent:
           virsh # dumpxml --update-cpu=vm1
           virsh # dumpxml --update-cpu vm1
      because the old code split the option argument into 2 parts:
      --update-cpu=vm1 is split into update-cpu and vm1,
      and update-cpu is a boolean option, so the parser takes vm1 as another
      argument, very strange.
      
      after this patch applied, the first one will become illegal.
      
      To achieve this, we don't parse/check options when parsing command sting,
      but check options when parsing a command argument. And the argument is
      not split when parsing command sting.
      Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
      4417f08d
    • L
      virsh: allow zero length arguments · cdfe543f
      Lai Jiangshan 提交于
      the following command is allowed at shell, we also make it allowed at virsh shell.
      Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
      cdfe543f
    • E
      virsh: poison raw allocation routines · d9adac3e
      Eric Blake 提交于
      * tools/virsh.c (malloc, calloc, realloc, strdup): Enforce that
      within this file, we use the safe vsh wrappers instead.
      (cmdNodeListDevices, cmdSnapshotCreate, main): Fix violations of
      this policy.
      d9adac3e
    • L
      virsh: better support double quote · ad2f1b60
      Lai Jiangshan 提交于
      In origin code, double quote is only allowed at the begin or end
      "complicated argument"
      --some_opt="complicated string"  (we split this argument into 2 parts,
      option and data, the data is "complicated string").
      
      This patch makes it allow double quote at any position of
      an argument:
      complicated" argument"
      complicated" "argument
      --"some opt=complicated string"
      
      This patch is also needed for the following patches,
      the following patches will not split option argument into 2 parts,
      so we have to allow double quote at any position of an argument.
      Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
      ad2f1b60
    • N
      Adding memtune command to virsh tool · e3e2ca77
      Nikunj A. Dadhania 提交于
      The command helps to control the memory/swap parameters for the system, for
      eg. hard_limit (max memory the vm can use), soft_limit (limit during memory
      contention), swap_hard_limit(max swap the vm can use)
      e3e2ca77
  17. 16 9月, 2010 1 次提交
  18. 14 9月, 2010 1 次提交