Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8654997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:55:27+00:00 2026-06-12T14:55:27+00:00

I am trying to write a patch for some open source software because it

  • 0

I am trying to write a patch for some open source software because it doesn’t do quite what I’d like–except I don’t know Python, at all! I expect this is very simple, but it is defeating me.

Background: The patch I am writing is for Ganeti which I am using to manage KVM virtual machine clusters, but it doesn’t support all the possible command line options of KVM and Qemu, such as USB pass-through, so I am trying to modify it to allow this.

kvm_cmd.extend() is used to add to the array of KVM CLI args that will be passed when a VM is started. If the arguments are space-separated, each argument becomes a separate string, e.g. -usb -device usb-host,hostbus=1,hostdev=14 becomes "-usb", "-device", "usb-host,hostbus=1,hostdev=14".

I am running the following command after compiling the code:

gnt-instance modify -H usb_pass="1;14"

I want this to add to the existing list of command line arguments "-usb -device usb-host,hostbus=1,hostdev=14". This is the code I have added (as well as declaring the variables elsewhere; HV_USBPASSTHROUGH is a string, but this is where the magic happens)

usb_pass = instance.hvparams[constants.HV_USBPASSTHROUGH]
if usb_pass:
    usb_pass_arr = []
    usb_pass_arr = usb_pass.split(";")
    kvm_cmd.extend(["-usb", "-device", "usb-host,hostbus=%s,hostaddr=%s" %
                    usb_pass_arr])

I am getting the following error from running the above command with the above code: Could not start instance: Error while executing backend function: not enough arguments for format string

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T14:55:29+00:00Added an answer on June 12, 2026 at 2:55 pm

    You have two `%s in "usb-host,hostbus=%s,hostaddr=%s" but provide only one argument, a list, where a tuple is expected.

    use

    "usb-host,hostbus=%s,hostaddr=%s" % tuple(usb_pass_arr)

    tuple() builtin converts an iterable to a tuple.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a multi-file patch for an open-source project, but the master
I am trying to write a script to patch our mysql database. Something like
I am trying to write a facebook app using app-engine-patch and pyFacebook. I am
Trying to write app for service technicians that will display open service calls within
I'm trying to write an ElementTree object to disk. Everything works, except that the
This is a part of an open source project called JNotify. I am trying
I'm trying to write a new emacs mode for a new template c-like language,
I'm trying to write some xml by this piece of code docs = XmlReportGenerator()
I'm trying to write some xml by this piece of code docs = XmlReportGenerator()
I'm learning python and trying to write a code to sync two directories: one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.